* [PATCH] Bluetooth: hci_vhci: Report write readiness with queued input
@ 2026-11-12 8:26 raoxu
2026-11-12 13:35 ` bluez.test.bot
0 siblings, 1 reply; 2+ messages in thread
From: raoxu @ 2026-11-12 8:26 UTC (permalink / raw)
To: marcel; +Cc: luiz.dentz, linux-bluetooth, linux-kernel, raoxu
From: Xu Rao <raoxu@uniontech.com>
vhci_poll() returns only EPOLLIN and EPOLLRDNORM when readq is nonempty,
dropping the write readiness bits it reports when the queue is empty.
However, vhci_write() does not wait for readq to drain: incoming frames
are handled independently by vhci_get_user().
As a result, userspace polling only for write readiness can time out or
remain asleep while input is queued, even though it could submit a
frame. Applications that drain input before waiting to write avoid this
case.
Always include EPOLLOUT and EPOLLWRNORM in the readiness mask, and add
EPOLLIN and EPOLLRDNORM when readq contains data. Keep the existing wait
queue registration and empty-queue behavior unchanged.
Signed-off-by: Xu Rao <raoxu@uniontech.com>
---
drivers/bluetooth/hci_vhci.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
index 771ad9893c44..0b427c65ce59 100644
--- a/drivers/bluetooth/hci_vhci.c
+++ b/drivers/bluetooth/hci_vhci.c
@@ -636,13 +636,14 @@ static ssize_t vhci_write(struct kiocb *iocb, struct iov_iter *from)
static __poll_t vhci_poll(struct file *file, poll_table *wait)
{
struct vhci_data *data = file->private_data;
+ __poll_t mask = EPOLLOUT | EPOLLWRNORM;
poll_wait(file, &data->read_wait, wait);
if (!skb_queue_empty(&data->readq))
- return EPOLLIN | EPOLLRDNORM;
+ mask |= EPOLLIN | EPOLLRDNORM;
- return EPOLLOUT | EPOLLWRNORM;
+ return mask;
}
static void vhci_open_timeout(struct work_struct *work)
--
2.50.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-12 13:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12 8:26 [PATCH] Bluetooth: hci_vhci: Report write readiness with queued input raoxu
2026-11-12 13:35 ` bluez.test.bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox