[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] xen/pvcalls-back: fix permanently masked event channel


  • To: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Thu, 19 Jan 2023 21:11:15 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DbBOmXvNw+1mMey8yI7cqMPgGwSu1jVp5Matm0hB6G8=; b=h9R0FmybgXbi3PKWmXMGqcQt43eGIneli4HU98cB7M2pxIU9DJoza/WZ8eQbqXIgbHyqXYYk1fN6WfZ20gGZY/jxayr4B99I7BWZ0RktzX+/8mAjOoGpFgmOVa9150Tek7Rfu3TNuD3cG8u2eD7BI1vHrHSSrSSHXQcdQLfAX+Ojy0FAms1Bq9ScMPJC9LkVK5qZn/N2XurM2Es0VNctFvb2YBZDG7twLLe90rGWEysWynG82fsAQHqlviyyUbFZF0wOrBTrTPd7gL52NWvsVaiLv1VFkSaDjD4OY6ZEM5mSrY97IMrOB+cf4czR5IlFNMT2QLzx9SIwJ6IuLtFKNg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DPwiALO0aLJqlCIP8N8/9hakoTWz6+zxEqXUSM6erj6IRmS85XoF++u/0ceeogY3tCp8zrimDNBpNL2N9IzGiX1XmiPxXu1bNTYgDImahmEQ0D1vb9gGYQsnvjulV0u8Rnu9LkPMO2EFjQ4HIzNoMRosjY3xeruIfkzfWK4aGB6NRkKG28Il0WQWKVKt/egxVapi2aa88mb2U0pVg5STSHxCucAX00Eg6eSj4PaLE329BUTFgdBDi0c/79evTMCufUHPXYP3eP8sYmgJDVsDP6GE5+SRwyVyVBJWFulpJYK+Y8tcwa+UyfHvkFBVCt0M3DjQUfLvLazQcAAdFsZbzg==
  • Cc: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>, Oleksii Moisieiev <Oleksii_Moisieiev@xxxxxxxx>
  • Delivery-date: Thu, 19 Jan 2023 21:12:09 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHZLEqQuRGgM2P0bEiSEaENUdLo/Q==
  • Thread-topic: [PATCH] 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 <volodymyr_babchuk@xxxxxxxx>
Reported-by: Oleksii Moisieiev <oleksii_moisieiev@xxxxxxxx>
---
 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



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.