* [PATCH] xen/pvcalls-back: fix permanently masked event channel
@ 2023-01-19 21:11 Volodymyr Babchuk
2023-01-20 7:24 ` Juergen Gross
2023-02-13 8:19 ` Juergen Gross
0 siblings, 2 replies; 3+ messages in thread
From: Volodymyr Babchuk @ 2023-01-19 21:11 UTC (permalink / raw)
To: Boris Ostrovsky, Juergen Gross, Stefano Stabellini
Cc: Volodymyr Babchuk, xen-devel, linux-kernel, Oleksii Moisieiev
There is a sequence of events that can lead to a permanently masked
event channel, because xen_irq_lateeoi() is newer called. This happens
when a backend receives spurious write event from a frontend. In this
case pvcalls_conn_back_write() returns early and it does not clears the
map->write counter. As map->write > 0, pvcalls_back_ioworker() returns
without calling xen_irq_lateeoi(). This leaves the event channel in
masked state, a backend does not receive any new events from a
frontend and the whole communication stops.
Move atomic_set(&map->write, 0) to the very beginning of
pvcalls_conn_back_write() to fix this issue.
Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Reported-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
---
drivers/xen/pvcalls-back.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c
index a7d293fa8d14..60f5cd70d770 100644
--- a/drivers/xen/pvcalls-back.c
+++ b/drivers/xen/pvcalls-back.c
@@ -173,6 +173,8 @@ static bool pvcalls_conn_back_write(struct sock_mapping *map)
RING_IDX cons, prod, size, array_size;
int ret;
+ atomic_set(&map->write, 0);
+
cons = intf->out_cons;
prod = intf->out_prod;
/* read the indexes before dealing with the data */
@@ -197,7 +199,6 @@ static bool pvcalls_conn_back_write(struct sock_mapping *map)
iov_iter_kvec(&msg.msg_iter, READ, vec, 2, size);
}
- atomic_set(&map->write, 0);
ret = inet_sendmsg(map->sock, &msg, size);
if (ret == -EAGAIN) {
atomic_inc(&map->write);
--
2.38.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xen/pvcalls-back: fix permanently masked event channel
2023-01-19 21:11 [PATCH] xen/pvcalls-back: fix permanently masked event channel Volodymyr Babchuk
@ 2023-01-20 7:24 ` Juergen Gross
2023-02-13 8:19 ` Juergen Gross
1 sibling, 0 replies; 3+ messages in thread
From: Juergen Gross @ 2023-01-20 7:24 UTC (permalink / raw)
To: Volodymyr Babchuk, Boris Ostrovsky, Stefano Stabellini
Cc: xen-devel, linux-kernel, Oleksii Moisieiev
[-- Attachment #1.1.1: Type: text/plain, Size: 903 bytes --]
On 19.01.23 22:11, Volodymyr Babchuk wrote:
> There is a sequence of events that can lead to a permanently masked
> event channel, because xen_irq_lateeoi() is newer called. This happens
> when a backend receives spurious write event from a frontend. In this
> case pvcalls_conn_back_write() returns early and it does not clears the
> map->write counter. As map->write > 0, pvcalls_back_ioworker() returns
> without calling xen_irq_lateeoi(). This leaves the event channel in
> masked state, a backend does not receive any new events from a
> frontend and the whole communication stops.
>
> Move atomic_set(&map->write, 0) to the very beginning of
> pvcalls_conn_back_write() to fix this issue.
>
> Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
> Reported-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Juergen
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3149 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xen/pvcalls-back: fix permanently masked event channel
2023-01-19 21:11 [PATCH] xen/pvcalls-back: fix permanently masked event channel Volodymyr Babchuk
2023-01-20 7:24 ` Juergen Gross
@ 2023-02-13 8:19 ` Juergen Gross
1 sibling, 0 replies; 3+ messages in thread
From: Juergen Gross @ 2023-02-13 8:19 UTC (permalink / raw)
To: Volodymyr Babchuk, Boris Ostrovsky, Stefano Stabellini
Cc: xen-devel, linux-kernel, Oleksii Moisieiev
[-- Attachment #1.1.1: Type: text/plain, Size: 895 bytes --]
On 19.01.23 22:11, Volodymyr Babchuk wrote:
> There is a sequence of events that can lead to a permanently masked
> event channel, because xen_irq_lateeoi() is newer called. This happens
> when a backend receives spurious write event from a frontend. In this
> case pvcalls_conn_back_write() returns early and it does not clears the
> map->write counter. As map->write > 0, pvcalls_back_ioworker() returns
> without calling xen_irq_lateeoi(). This leaves the event channel in
> masked state, a backend does not receive any new events from a
> frontend and the whole communication stops.
>
> Move atomic_set(&map->write, 0) to the very beginning of
> pvcalls_conn_back_write() to fix this issue.
>
> Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
> Reported-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Pushed to: xen/tip.git for-linus-6.3
Juergen
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3149 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-02-13 8:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-19 21:11 [PATCH] xen/pvcalls-back: fix permanently masked event channel Volodymyr Babchuk
2023-01-20 7:24 ` Juergen Gross
2023-02-13 8:19 ` Juergen Gross
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).