From patchwork Thu Jan 19 21:11:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Babchuk X-Patchwork-Id: 13108763 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 683E3C46467 for ; Thu, 19 Jan 2023 21:12:18 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.481334.746139 (Exim 4.92) (envelope-from ) id 1pIcCF-0002CY-4a; Thu, 19 Jan 2023 21:11:43 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 481334.746139; Thu, 19 Jan 2023 21:11:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pIcCF-0002CR-1n; Thu, 19 Jan 2023 21:11:43 +0000 Received: by outflank-mailman (input) for mailman id 481334; Thu, 19 Jan 2023 21:11:41 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pIcCD-0002CL-Aq for xen-devel@lists.xenproject.org; Thu, 19 Jan 2023 21:11:41 +0000 Received: from mx0b-0039f301.pphosted.com (mx0b-0039f301.pphosted.com [148.163.137.242]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id dc25aff0-983d-11ed-b8d1-410ff93cb8f0; Thu, 19 Jan 2023 22:11:38 +0100 (CET) Received: from pps.filterd (m0174681.ppops.net [127.0.0.1]) by mx0b-0039f301.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30JGOmUN025449; Thu, 19 Jan 2023 21:11:26 GMT Received: from eur01-he1-obe.outbound.protection.outlook.com (mail-he1eur01lp2058.outbound.protection.outlook.com [104.47.0.58]) by mx0b-0039f301.pphosted.com (PPS) with ESMTPS id 3n74cd1vhb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 19 Jan 2023 21:11:26 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com (2603:10a6:803:31::18) by AS8PR03MB6840.eurprd03.prod.outlook.com (2603:10a6:20b:298::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.25; Thu, 19 Jan 2023 21:11:21 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::8b3:273:e51b:1023]) by VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::8b3:273:e51b:1023%7]) with mapi id 15.20.5986.023; Thu, 19 Jan 2023 21:11:15 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: dc25aff0-983d-11ed-b8d1-410ff93cb8f0 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== 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-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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=epam.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DbBOmXvNw+1mMey8yI7cqMPgGwSu1jVp5Matm0hB6G8=; b=U+xn9cDcV/H6CMh+xM1668lUTXtAy3r1SwiAlN8BECmiuwihJblNdEjDV8RQUH/2rwiYtLJqMyFw8Chk7hkBkiIWB8hIxIS7KuVDR0ExR6B/KCoTj3k/SGQ1gew3u/nG6ZLfKmNGUSUdWmdJzG7y7gZiCy+B0VU2VrQITncqbZqFfl7QXCq7CodYCKr9OwEmNfgdjX3Tz25X98lmNijn9JtHiIqicZHp9ogKRv7LjbUufBOeyf4R1rmHDu5Giox0OpKzYfA6bAgT75fxB52j4jttjswK9EK3rKm85ANqQJaBZsTgoHvuVIyN310Mz1Iyz82/Dd1taBO78HiL/cr33w== From: Volodymyr Babchuk To: Boris Ostrovsky , Juergen Gross , Stefano Stabellini CC: Volodymyr Babchuk , "xen-devel@lists.xenproject.org" , "linux-kernel@vger.kernel.org" , Oleksii Moisieiev Subject: [PATCH] xen/pvcalls-back: fix permanently masked event channel Thread-Topic: [PATCH] xen/pvcalls-back: fix permanently masked event channel Thread-Index: AQHZLEqQuRGgM2P0bEiSEaENUdLo/Q== Date: Thu, 19 Jan 2023 21:11:15 +0000 Message-ID: <20230119211037.1234931-1-volodymyr_babchuk@epam.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.38.1 x-ms-publictraffictype: Email x-ms-traffictypediagnostic: VI1PR03MB3710:EE_|AS8PR03MB6840:EE_ x-ms-office365-filtering-correlation-id: b08107ef-535e-4bf7-0817-08dafa61b36c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: h3iGwIPyAsL6v8b4J8MaNg4OGRAEfnMh9DgOy2fZEu/eHqxmViygsV42/qQt6GTzzVA29K+MelotLTYfCjv+ZT5jqS7BkL3qbE4m+tZyDq9lqDuzw5aQh5aGBR3Jq2ZzQC62GH3Zy0dhAqMiKH9ci5UJEGvSZtifEpts7MPElH6hYtvoHcwV4cPA2/7Xxd2s1Tv3AYDa8eu0fXdX1zir3XcXiS9IA6wbaTG8HXSmztMB36XewnW6EDAn7dicKdonpyF2afqD8kZnEsbIvqruPC/YlmFGGgiTy9wfUzeP3VdDdoQUgk+PReYaJLGs9BjDYIeLfH3YWRv+NrRqlZswZgnyK9IkEUtW7vZbwpBVwggtK5lp08TckxGkWKEwTkAxxFDN4CaYgirg5KHsJK49Atuvap4+QNe1XoD3FhzeQuhXXlKlyVh1R+QHWA+3LH7dV5kC1jv4TSNO4E1xb6j3c4MpLDk3g48+F+alp6TbtSrLUbTIi4iY1Gobfx8rwonDJumnfYsMfPE3Mp89mKJOMCaAUCbojielZPtk2d3UrN/kwJQIm11fHjjUxUH58kk/TLe1KlnuAmXiGniaOBZPBnS8jAq1Eo6Fw3kn+ciojK1wAX4sc0+qE1tba4XRwQSl3gU3UfLR+7k8Ts51S9RlH5KvInassdz4NNq3ALnmAC5hQoVlS8Dqcse3z0tKz6bRxTF3zcjB+PDyaUXQ382Arw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB3710.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(346002)(396003)(366004)(376002)(136003)(451199015)(107886003)(86362001)(6506007)(55236004)(36756003)(6486002)(478600001)(71200400001)(8936002)(122000001)(316002)(5660300002)(66476007)(4326008)(66446008)(66556008)(91956017)(38100700002)(76116006)(8676002)(64756008)(6512007)(41300700001)(66946007)(26005)(186003)(38070700005)(2616005)(83380400001)(54906003)(110136005)(2906002)(1076003)(66899015);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?VQ7n0jlfBEMBPaKLUzK0wK5?= =?iso-8859-1?q?x7aDqgHSegP/Oc0YEb/hEGSEiFysf6hDZTRnNO/8aYVey81i38+85fGNf6FC?= =?iso-8859-1?q?004w3HNiMvXQ8lgaemsk4kIy4a1x5UahqSN/g+hUhO/AcupuvSnyMLtGUnDH?= =?iso-8859-1?q?wyglVhSUMt20v+3LhogWyk3ykNcJR4umZhW07pJDHb7rBco68ZexPuBPMtuU?= =?iso-8859-1?q?25RcdpX02fT9N4x4iFH2QjrPRjAUkboOn3u62B4ZlFGNHAlMtQdXxJ26e3Du?= =?iso-8859-1?q?Gjw38sl1ScYrBbNNJ3xCm1EMzCRLQD3uSBh238QnUcrWOVg115wm9vUKtbp1?= =?iso-8859-1?q?dD3MOp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kIq5klETcayRvhV1V8t6+s/yCczcFZHEaX3p?= =?iso-8859-1?q?wKnYUFSCNTSwN3W3eQIYx6qUPWqKgOPZJ8FwbjSovCHjv8Nz5ou6l3LaC2yP?= =?iso-8859-1?q?waBY4KgSseSdxDrhg6E61uZRxWJQhycMArokVIJO900+/tUL7+b2Q50/dWYD?= =?iso-8859-1?q?IpRMpCiHV546F8L2gMLzUVW/op5fKuI1zA0uqEt8wJzmmLqJF+4EniBrEIDY?= =?iso-8859-1?q?csJ/DpT7UkEkesmjF8GqlL7tOTcilraCLQMOm2SQMJyGYfKdMM9Jx7znD+kX?= =?iso-8859-1?q?x5L+plnJwvEAsG38dl0x5l23OSmX7Czb10EalBN8k7AFSQedmCrTLm8Q3o65?= =?iso-8859-1?q?FTXaO/xXxdF4lpi/dF8C+Y8cLjtJLaRlA53x+9y3iXZSYe6kIxT0k+6Gwa8p?= =?iso-8859-1?q?K2OzZsMGKlEUweMuF4Oc4W7tbsGl5fde4RhlzPA=3D=3D?= MIME-Version: 1.0 X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB3710.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b08107ef-535e-4bf7-0817-08dafa61b36c X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Jan 2023 21:11:15.5007 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b41b72d0-4e9f-4c26-8a69-f949f367c91d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: NhCyDbiqHrNSxhseMNkqf4+1vs2rBVnWdBq84rVqsOOAYFJl7k5jyc8fKqxfNkl3fyYSMRtnPm5z1c2rdS40j6+ouB0m8pTkWdCkO6fazvU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB6840 X-Proofpoint-ORIG-GUID: ouClumBOzvn6CkxX3bejVPFm-vDk31IT X-Proofpoint-GUID: ouClumBOzvn6CkxX3bejVPFm-vDk31IT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-19_14,2023-01-19_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 clxscore=1011 mlxlogscore=999 impostorscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 adultscore=0 malwarescore=0 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301190177 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 Reported-by: Oleksii Moisieiev Reviewed-by: Juergen Gross --- 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);