A dead lock may happen before this patch:
rptun thread (usrsock_rpmsg_recvfrom_handler):
Gets all tx payload but waiting net_lock in psock_recvfrom
net driver thread (higher priority):
Receives a packet, holding net_lock, calling usrsock_rpmsg_send_event
But no tx buffer left, so rpmsg_send blocks, and won't release net_lock
In short:
Rptun: Hold all `tx_payload_buffer` -> want `net_lock`
Driver: Hold `net_lock` -> want `tx_payload_buffer`
This patch use net_lock to combine get_tx_payload and recvfrom together,
then:
- If it's waiting net_lock, tx payload will not be held, other threads
may get tx buffer and do their work.
- If net_lock is got, it won't be disturbed before finish receiving,
then tx payload won't have chance to be blocked before releasing.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
Note:
tcp_poll_eventhandler have logic after poll_notify, if we teardown poll
inside poll callback without clearing revents, use-after-free will
happen.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
The circbuf part is implemented by the fb driver, and goldfish needs to
delete the part related to circbuf and adapt to the interface of the fb
driver.
Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
refact vsync queue to support multi fb poll and overlay poll.
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
Signed-off-by: rongyichang <rongyichang@xiaomi.com>
Summary
The following compilation error occurs after configuring CONFIG_DEBUG_OPTLEVEL="-O3"
CC: ping.c video/video.c: In function 'video_ioctl':
video/video.c:2347:22: error: 'control.size' may be used uninitialized [-Werror=maybe-uninitialized]
2347 | control->size,
| ^~
video/video.c:2273:28: note: 'control' declared here
2273 | struct v4l2_ext_control control;
| ^~~~~~~
Signed-off-by: wangming9 <wangming9@xiaomi.com>
Add usb_fs driver so that userspace can directly transfer USB packets
through the EP node. ADB, Fastboot, MTP will use usb_fs, these class
driver only need to provide the descriptors and register the usb_fs device.
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
The RPMB partition cannot be accessed via standard block layer, but by a set of specific commands: WRITE, READ, GET_WRITE_COUNTER, and PROGRAM_KEY. Such a partition provides authenticated and replay protected access, hence suitable as a secure storage.
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
In sensor_rpmsg_ioctl, when rpmsg_get_tx_payload_buffer is block,
The rptun thread will continue to process rx_buffers from other cores,
So the proxy may be released in sensor_unadv_handler, then if using
the proxy, It causes a crash.
backtrace:
0 0x06007c2e in is_rpmsg_ept_ready (ept=0x5a5a5a5a) at nuttx/include/openamp/rpmsg.h:172
1 0x06013354 in rpmsg_send_nocopy (len=<optimized out>,
data=<optimized out>, ept=<optimized out>) at nuttx/include/openamp/rpmsg.h:521
2 rpmsg_send_nocopy (ept=0x5a5a5a5a, data=data@entry=0x201facf0,
len=len@entry=40) at nuttx/include/openamp/rpmsg.h:512
3 0x06013b34 in sensor_rpmsg_ioctl (dev=dev@entry=0x201b7388,
cmd=538701816, cmd@entry=2690, arg=0, len=len@entry=0,
wait=<error reading variable: dwarf2_find_location_expression:
Corrupted DWARF expression.>) at ../../../drivers/sensors/sensor_rpmsg.c:395
4 0x06013cce in sensor_rpmsg_alloc_proxy (dev=dev@entry=0x201b7388,
ept=ept@entry=0x202073d0, msg=msg@entry=0x201684f0) at ../../../drivers/sensors/sensor_rpmsg.c:498
5 0x06013d12 in sensor_rpmsg_adv_handler (ept=0x202073d0,
data=0x201684f0, len=49, src=<optimized out>, priv=0x202073c8) at ../../../drivers/sensors/sensor_rpmsg.c:905
6 0x0600d45e in sensor_rpmsg_ept_cb (ept=<optimized out>,
data=<optimized out>, len=<optimized out>, src=<optimized out>,
priv=0x202073c8) at ../../../drivers/sensors/sensor_rpmsg.c:1168
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
vfork use waitpid hang father process,
but waitpid release child processs information by default.
So when user call wait, it return errno 10.
Signed-off-by: yangyalei <yangyalei@xiaomi.com>
When the machine is cold started, the psram area where the syslog
buffer is located contains some random values, so it will cause
loss of valid log.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
When the system starts up, the hw count may not start counting from 0,
which can cause the processing time of the first oneshot handler to be
too long. Therefore, the current tick value should be set based on the
hw count during initialization.
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
The class device only handles descriptor information specific to the class,
and shared descriptor information is passed through parameters and
handled by the composite driver.
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
Whevenever the bit rate is going to be set, it's necessary to first
set the master clock if the underlying device supports it. If it
fails, just return the error code.