Skip to content

Commit c70b774

Browse files
lorcjgross1
authored andcommitted
xen/pvcalls-back: fix permanently masked event channel
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 <[email protected]> Reported-by: Oleksii Moisieiev <[email protected]> Reviewed-by: Juergen Gross <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Juergen Gross <[email protected]>
1 parent 3e8cd71 commit c70b774

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/xen/pvcalls-back.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ static bool pvcalls_conn_back_write(struct sock_mapping *map)
173173
RING_IDX cons, prod, size, array_size;
174174
int ret;
175175

176+
atomic_set(&map->write, 0);
177+
176178
cons = intf->out_cons;
177179
prod = intf->out_prod;
178180
/* read the indexes before dealing with the data */
@@ -197,7 +199,6 @@ static bool pvcalls_conn_back_write(struct sock_mapping *map)
197199
iov_iter_kvec(&msg.msg_iter, ITER_SOURCE, vec, 2, size);
198200
}
199201

200-
atomic_set(&map->write, 0);
201202
ret = inet_sendmsg(map->sock, &msg, size);
202203
if (ret == -EAGAIN) {
203204
atomic_inc(&map->write);

0 commit comments

Comments
 (0)