From patchwork Wed Dec 20 22:58:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Harris X-Patchwork-Id: 13500742 Received: from mailout1.w2.samsung.com (mailout1.w2.samsung.com [211.189.100.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 67EF150264; Wed, 20 Dec 2023 23:05:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="FyZ+W7Y/" Received: from uscas1p2.samsung.com (unknown [182.198.245.207]) by mailout1.w2.samsung.com (KnoxPortal) with ESMTP id 20231220225813usoutp01a69809fd1697b5b3d6bf63c8bdf8d1a8~irFXKeojt1790817908usoutp01k; Wed, 20 Dec 2023 22:58:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w2.samsung.com 20231220225813usoutp01a69809fd1697b5b3d6bf63c8bdf8d1a8~irFXKeojt1790817908usoutp01k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1703113093; bh=vHjHVuNeMvsYn/jGlYOwAfeBkkG04z0tW8qpz0yXs/Q=; h=From:To:Subject:Date:References:From; b=FyZ+W7Y/VhbLPiZsAXd51gGWEz9YXuY2oZIV21iTyB70lF4BxrP+5ZJExlU64bUGW KH+gx0+9RicXHf+azd8lZ9GDYU6FWSy9BX14XHNvTFM1umu+YPFEZ4XfCie6llGLO1 Rvjm06yzpIHjQvxELv35qHnZufkE4ljP9Qdmq4tE= Received: from ussmges1new.samsung.com (u109.gpu85.samsung.co.kr [203.254.195.109]) by uscas1p2.samsung.com (KnoxPortal) with ESMTP id 20231220225813uscas1p20ef1e841a3f4350729c33fac0b286679~irFXB_21L2500725007uscas1p2-; Wed, 20 Dec 2023 22:58:13 +0000 (GMT) Received: from uscas1p2.samsung.com ( [182.198.245.207]) by ussmges1new.samsung.com (USCPEMTA) with SMTP id 5A.12.09678.58173856; Wed, 20 Dec 2023 17:58:13 -0500 (EST) Received: from ussmgxs1new.samsung.com (u89.gpu85.samsung.co.kr [203.254.195.89]) by uscas1p1.samsung.com (KnoxPortal) with ESMTP id 20231220225813uscas1p15c950a58c7de44d32199a63a13f1bb31~irFWtWa1u0648706487uscas1p1Y; Wed, 20 Dec 2023 22:58:13 +0000 (GMT) X-AuditID: cbfec36d-acdff700000025ce-ea-658371852dd0 Received: from SSI-EX2.ssi.samsung.com ( [105.128.3.67]) by ussmgxs1new.samsung.com (USCPEXMTA) with SMTP id 17.DE.09930.48173856; Wed, 20 Dec 2023 17:58:12 -0500 (EST) Received: from SSI-EX2.ssi.samsung.com (105.128.2.227) by SSI-EX2.ssi.samsung.com (105.128.2.227) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.1.2375.24; Wed, 20 Dec 2023 14:58:12 -0800 Received: from SSI-EX2.ssi.samsung.com ([105.128.2.227]) by SSI-EX2.ssi.samsung.com ([105.128.2.227]) with mapi id 15.01.2375.024; Wed, 20 Dec 2023 14:58:12 -0800 From: Jim Harris To: Bjorn Helgaas , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Leon Romanovsky , "Jason Gunthorpe" , Alex Williamson Subject: [PATCH 0/2] pci/iov: avoid device_lock() when reading sriov_numvfs Thread-Topic: [PATCH 0/2] pci/iov: avoid device_lock() when reading sriov_numvfs Thread-Index: AQHaM5gBfWDt8KjT2UOEaPDLPlceog== Date: Wed, 20 Dec 2023 22:58:12 +0000 Message-ID: <170311143880.2826.17853753430536108145.stgit@bgt-140510-bm01.eng.stellus.in> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-ID: Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CFilter-Loop: Reflected X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprJKsWRmVeSWpSXmKPExsWy7djX87qthc2pBncnCFt8+9/DZrGkKcPi yr89jBabNjxhsbi8aw6bxdl5x9kc2DwWbCr16G1+x+bxft9VNo/Pm+QCWKK4bFJSczLLUov0 7RK4MuY+bGIq2MRdsfXaU+YGxh7uLkZODgkBE4kpHbsYuxi5OIQEVjJKdL+dzALhtDJJ3On4 xgpTterlInaIxBpGiV+T5zNBOJ8YJbbOmQ/VsoxRoulZMxtIC5uApsSvK2uYQGwRgTlMEjMu eHYxcnAIC3hLHOiugggHSRycf5oVwtaT+NXykwWkhEVAVeLsznqQMK9ApMTFS4fYQWxGATGJ 76cgJjILiEvcejKfCeI4QYlFs/cwQ9hiEv92PWSDsBUl7n9/yQ4ykhnomvW79CFMO4m++VIQ UxQlpnQ/ZIfYJChxcuYTFohOSYmDK26APSUhMJdD4s22rVCrXCRezj/GDmFLS1y9PhVqbbbE yvUdTCDzJQQKJBqOBEGErSUW/lkPdTGfxN9fjxghSnglOtqEJjAqzULyyyyEO2ch3DkLyZ2z kNy5gJF1FaN4aXFxbnpqsWFearlecWJucWleul5yfu4mRmDqOf3vcO4Oxh23PuodYmTiYDzE KMHBrCTCu7ezKVWINyWxsiq1KD++qDQntfgQozQHi5I4r6HtyWQhgfTEktTs1NSC1CKYLBMH p1QD09RVEy1Fyo8wrOAqCdOfx9nhWbnt0mRWxq0K02/JRMu0yDm7SllvvTt7ywWJH+lMzJNU srad/f6VhyGVJSnX5MyKgxEypSuOvbqse8DtZuNaNd/nX2UZnk7kYZFf2uO75kgl68Pcl0v+ 5Ss2Ll0XovaGQ+J/0UqOv7rBRTef/kh6vUivNMFE2ueg1CrJBNsgufvO3N1lmkJhm72XX1Ur PKt7IbNj//+m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mVrNG6uob7e/u/+U9uWpmfeUDKf1ZJ65m ygoIZtUEB+nqql8vFD1wZGmDfeo9JZbijERDLeai4kQAe1AuXycDAAA= X-CMS-MailID: 20231220225813uscas1p15c950a58c7de44d32199a63a13f1bb31 CMS-TYPE: 301P X-CMS-RootMailID: 20231220225813uscas1p15c950a58c7de44d32199a63a13f1bb31 References: If SR-IOV enabled device is held by vfio, and device is removed, vfio will hold device lock and notify userspace of the removal. If userspace reads sriov_numvfs sysfs entry, that thread will be blocked since sriov_numvfs_show() also tries to acquire the device lock. If that same thread is responsible for releasing the device to vfio, it results in a deadlock. One patch was proposed to add a separate mutex, specifically for struct pci_sriov, to synchronize access to sriov_numvfs in the sysfs paths (replacing use of the device_lock()). Leon instead suggested just reverting the commit 35ff867b765 which introduced device_lock() in the store path. This also led to a small fix around ordering on the kobject_uevent() when sriov_numvfs is updated. Ref: https://lore.kernel.org/linux-pci/ZXJI5+f8bUelVXqu@ubuntu/ --- Jim Harris (2): Revert "PCI/IOV: Serialize sysfs sriov_numvfs reads vs writes" pci/iov: fix kobject_uevent() ordering in sriov_enable() drivers/pci/iov.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) --