You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "xiaoxiang781216 (via GitHub)" <gi...@apache.org> on 2023/01/27 20:20:18 UTC
[GitHub] [nuttx] xiaoxiang781216 opened a new pull request, #8317: net_lock: fix deadlock issue when running iperf tx test on usrsock
xiaoxiang781216 opened a new pull request, #8317:
URL: https://github.com/apache/nuttx/pull/8317
## Summary
Issue Description:
deadlock happens when runnging iperf TCP tx on usrsock with the following commands:
device command: iperf2 -c <PC IP address> -u -i 1 -p 1122 -t 10 PC command: iperf -s -u -i 1 -p 1122
iperf's thread holds net_lock before call usrsock_setup_request_callback and waits for conn->resp.sem by calling
nxsem_wait_uninterruptible(&conn->resp.sem), while conn->resp.sem can only be signaled in usrsock_response, who is waiting for net_lock in tptun's thread.
Solution:
call net_lockedwait_uninterruptible to make sure net_lock can be released when conn->resp.sem is not available.
Here's the backtrace:
```
up_block_task
nuttx/arch/arm/src/common/arm_blocktask.c:151
nxsem_wait
nuttx/sched/semaphore/sem_wait.c:185 (discriminator 2) nxsem_wait_uninterruptible
nuttx/sched/semaphore/sem_wait.c:223 (discriminator 1) usrsock_setup_request_callback
nuttx/net/usrsock/usrsock_conn.c:228
usrsock_setup_data_request_callback
nuttx/net/usrsock/usrsock_conn.c:257
usrsock_getsockopt
nuttx/net/usrsock/usrsock_getsockopt.c:202
psock_getsockopt
nuttx/net/socket/getsockopt.c:448
getsockopt
nuttx/net/socket/getsockopt.c:515
getsock_tcp_windowsize
external/iperf2/iperf2/src/tcp_window_size.c:165
reporter_reportsettings
external/iperf2/iperf2/src/ReportDefault.c:384
reporter_print
external/iperf2/iperf2/src/Reporter.c:1402
reporter_process_report
external/iperf2/iperf2/src/Reporter.c:860
reporter_process_report
external/iperf2/iperf2/src/Reporter.c:828
reporter_spawn
external/iperf2/iperf2/src/Reporter.c:720
thread_run_wrapper
external/iperf2/iperf2/compat/Thread.c:270
pthread_startup
nuttx/libs/libc/pthread/pthread_create.c:59 (discriminator 2) pthread_start
nuttx/sched/pthread/pthread_create.c:182 (discriminator 4)
```
```
up_block_task
nuttx/arch/arm/src/common/arm_blocktask.c:151
nxsem_wait
nuttx/sched/semaphore/sem_wait.c:185 (discriminator 2) sem_wait
nuttx/sched/semaphore/sem_wait.c:271
nxmutex_lock
nuttx/include/nuttx/mutex.h:165
nxrmutex_lock
nuttx/include/nuttx/mutex.h:369
usrsock_handle_req_response
nuttx/net/usrsock/usrsock_devif.c:466
usrsockdev_write
nuttx/drivers/usrsock/usrsock_dev.c:304
file_write
nuttx/fs/vfs/fs_write.c:90
usrsock_rpmsg_default_handler
apps/netutils/usrsock_rpmsg/usrsock_rpmsg_client.c:137 rpmsg_virtio_rx_callback
nuttx/openamp/open-amp/lib/rpmsg/rpmsg_virtio.c:371 virtqueue_notification
nuttx/openamp/open-amp/lib/virtio/virtqueue.c:706
rproc_virtio_notified
nuttx/openamp/open-amp/lib/remoteproc/remoteproc_virtio.c:337 (discriminator 2) remoteproc_get_notification
nuttx/openamp/open-amp/lib/remoteproc/remoteproc.c:999 rptun_worker
nuttx/drivers/rptun/rptun.c:333
rptun_thread
nuttx/drivers/rptun/rptun.c:364 (discriminator 1)
nxtask_start
nuttx/sched/task/task_start.c:144
```
## Impact
usrsock
## Testing
Xiaomi AI Speaker
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] xiaoxiang781216 commented on pull request #8317: net_lock: fix deadlock issue when running iperf tx test on usrsock
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on PR #8317:
URL: https://github.com/apache/nuttx/pull/8317#issuecomment-1407264182
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #8317: net_lock: fix deadlock issue when running iperf tx test on usrsock
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #8317:
URL: https://github.com/apache/nuttx/pull/8317#discussion_r1089424033
##########
net/usrsock/usrsock_devif.c:
##########
@@ -665,6 +665,10 @@ int usrsock_do_request(FAR struct usrsock_conn_s *conn,
net_sem_wait_uninterruptible(&req->acksem);
--req->nbusy; /* net_lock held. */
}
+ else
+ {
+ nerr("error, usrsock request failed with %d\n", ret);
Review Comment:
Change to `error:` not `Error:` like other places in the same file.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] acassis commented on a diff in pull request #8317: net_lock: fix deadlock issue when running iperf tx test on usrsock
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on code in PR #8317:
URL: https://github.com/apache/nuttx/pull/8317#discussion_r1089418410
##########
net/usrsock/usrsock_devif.c:
##########
@@ -665,6 +665,10 @@ int usrsock_do_request(FAR struct usrsock_conn_s *conn,
net_sem_wait_uninterruptible(&req->acksem);
--req->nbusy; /* net_lock held. */
}
+ else
+ {
+ nerr("error, usrsock request failed with %d\n", ret);
Review Comment:
```suggestion
nerr("Error: usrsock request failed with %d\n", ret);
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] masayuki2009 merged pull request #8317: net_lock: fix deadlock issue when running iperf tx test on usrsock
Posted by "masayuki2009 (via GitHub)" <gi...@apache.org>.
masayuki2009 merged PR #8317:
URL: https://github.com/apache/nuttx/pull/8317
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] masayuki2009 commented on pull request #8317: net_lock: fix deadlock issue when running iperf tx test on usrsock
Posted by "masayuki2009 (via GitHub)" <gi...@apache.org>.
masayuki2009 commented on PR #8317:
URL: https://github.com/apache/nuttx/pull/8317#issuecomment-1407205176
@xiaoxiang781216
Please squash the first two commits into one commit.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org