From patchwork Tue Dec 3 20:36:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13892937 Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2067.outbound.protection.outlook.com [40.107.241.67]) (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 D29A5207A01 for ; Tue, 3 Dec 2024 20:37:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.241.67 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733258243; cv=fail; b=sjied8NJvfws+kDzSf1G341E1HGTs0HHpyVLcUrscMCY1012y6S90gcuhmBbIn/MY7rVgVEeZZuRwMC1r+qROcPb4bkMkaoni7bfYvO84v2Q1asxCOGcwUjpakeZoN6tlSjyFUyGMTe8c4/V3BelLbqVsc+Vl+zA3orwVGIJON8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733258243; c=relaxed/simple; bh=VIyuF+APlHGxVbHCKBU3zVADRJEOLBTDV24SeUflb/0=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=UU45/iFa27adqEgdu5CYQgv+fHaqzT12WNMNq5FHyYHFbprOgQXnPVGYjk/uQrTPCxM9dUKxXInAGpgcepMrgejq7X2A/hP3QD0u37ziTUc1fBzEIf3qfSfgle+hw++KMk2xcK0zm2sx7AImxF/IWhj1xpoFuduQ3dM71g79/gY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=ZCo3Q+0L; arc=fail smtp.client-ip=40.107.241.67 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="ZCo3Q+0L" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=i3UXpdFTU1xYRecO11m2hg1MU6yaU2iU0pCVmDMm2R+B/j7ozCJFwvhkxhWuZsovFYm9DRJNr9VriEQKFeV+DHM++8ssNmuPpO7LsIaYq+NmC/hf8QtAHEw5sdiRVKqYNCb4H5mvFH6yN1aCbRDXyLhJnV3uQAhcByiiZXHnNzk8rxFDy+k/ZhnMKvJ+E8TnN1uR83RMn0VfMk3P11A81SqHoTVfdNG3Pk4Qn6jhYSWudqCB053lriNO2bbeeuk76B+4nZvR0ze921TAGmfQWYobUM9i+rEPuPPCVWUHgxHcdUsO7rMth/iA/rU8OWZHYH7XZCiFF+tKqz2OP8XMJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=DaAaAgIktJ7JroizMUpVdHODPOvPbmLVhjbqsqOxQ/U=; b=lBjvb3WJ4AZZ86HD97kiyO+l5Gfnv2JyqtBdq3oHXAkMU+lfddzEp1zbSJTUcvMYpLC4QvWQm094ukIr9d6HWtLMo7oBTHO6U3Fsj4GI0Gzy2YoswofhB3GHvmrMnGLzBga+E/m+bL3CazHure992mrKTiv2Zx9iqKAMJjfRgzRKPca7LV9EPSVuh4xBjmaR9HhsTcTJ8rdjEkDnEP6SgGClhh+OeGSkDLDsw6PBtN4+tSJJTjbsfCk4EsFvN1KSnQDephX1wCf0BFHcFoHQfuiCA4Vv2QakMGR20HLeTnm08xy8lN4oOTlZaT9rogL+bb1ImeC5l3LFVTnqvXUToQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DaAaAgIktJ7JroizMUpVdHODPOvPbmLVhjbqsqOxQ/U=; b=ZCo3Q+0Lf3J7temjzT7CXBkqkzY8gkyaDc46L6tgp1Ew4SmDYHplmK4s4uYmzs2Tk7PDumoo5fH+Pa2ifM3Xid4TZcBkAqq20updqAeLJWdZrtz5Mrwr+MvZWcGXUWJWw2Y6F9wE/SPzSmdtUKP9AS4FyegWSPWzJR101GNAGpYaOGbtQkyXsGPifnCbWWS8IgEEUqRnwTdeKkoH95VIlVcuGw8veAiM20mdSqVLT+/6jRB/tLsXMUlIvmm40Lt8+xKmXROZ3uOT0e4DhOVewJUMsAOFTpe4bIh/ZIV+6nmMdulcz9K1qAyzkMGdPk88xoxixE9fTq3uEHnjm2Ey7Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by AM0PR04MB7108.eurprd04.prod.outlook.com (2603:10a6:208:19e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.17; Tue, 3 Dec 2024 20:37:13 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%5]) with mapi id 15.20.8207.017; Tue, 3 Dec 2024 20:37:13 +0000 From: Frank Li Date: Tue, 03 Dec 2024 15:36:50 -0500 Subject: [PATCH v9 1/6] platform-msi: Add msi_remove_device_irq_domain() in platform_device_msi_free_irqs_all() Message-Id: <20241203-ep-msi-v9-1-a60dbc3f15dd@nxp.com> References: <20241203-ep-msi-v9-0-a60dbc3f15dd@nxp.com> In-Reply-To: <20241203-ep-msi-v9-0-a60dbc3f15dd@nxp.com> To: Manivannan Sadhasivam , =?utf-8?q?Krzy?= =?utf-8?q?sztof_Wilczy=C5=84ski?= , Kishon Vijay Abraham I , Bjorn Helgaas , Arnd Bergmann , Greg Kroah-Hartman , "Rafael J. Wysocki" , Thomas Gleixner , Anup Patel Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, imx@lists.linux.dev, Niklas Cassel , dlemoal@kernel.org, maz@kernel.org, jdmason@kudzu.us, Frank Li , stable@kernel.org X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1733258225; l=2997; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=VIyuF+APlHGxVbHCKBU3zVADRJEOLBTDV24SeUflb/0=; b=vHiTlC48JtEMcLt88Yc8rsnJo0HGUpGffqsnWTfzD4aEejA2hkapZO77HOE1rYIF2bbCBH/wE QMpM7qCby1CBv3d4DXMbjq2MaxKf8fFVVCF5l3kfnjS8VnqizmMfUrX X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR05CA0013.namprd05.prod.outlook.com (2603:10b6:a03:c0::26) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AM0PR04MB7108:EE_ X-MS-Office365-Filtering-Correlation-Id: 1e0828e7-ff92-4701-733d-08dd13da44e9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|7416014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?kraLOM056rsbDhLXzsNu/dhbDxtnt99?= =?utf-8?q?Drzy7H15vqkum3+hMmfZtRiwO8QAiHN2ZBW80RwvEizqczwaSH1wT08T5JKPusF9x?= =?utf-8?q?hDZM6thKcPsY3eUjKV5OBEFR5tAuRdDy8RuLpyo6mzQgTXQr98A3YtwrO8WckeWcJ?= =?utf-8?q?ryl6iJg0ejynRa9I45ubuP31KKhEHoXzuPBYepWdqMVCiMCXXMn2EcTm4mcIjGGNF?= =?utf-8?q?XmDdRnNv1hAm3uEnMSojReiFeLX01uHPsM/oBEl4G/Ae1c9MzlhPqHfsjbI93YUi2?= =?utf-8?q?94wCeqyYbg4aip0ospwtAmF3En3UQGi92OoKk/HXAx3YNDlBnLB21I/9z8mRq44pW?= =?utf-8?q?Yron3Ze1xCelx7C8xt92I2uU2f7+GhvZ+dc6uCH1Bi9vnUGfEZmVJ5j+kS4mSDC5Q?= =?utf-8?q?VFhey8TwSARiIrlXMofpSg0eqE7+NIudX9qaAIIjcisUrygygJWTYVJRmc9X15JGd?= =?utf-8?q?bAMuPFlRY9h9/HGq1qyn018ioYfhZQykWP66R9fVmVz/QsnDa4q9VBkKWddi6qPin?= =?utf-8?q?kHCYUGiItEHieKOprzUITOqLg84ZXN4kg+zeJzWFTfjP3e1FflqyuTO2TPv6WR+8A?= =?utf-8?q?lZX247zfEWN/YoL8K6wwnuIS8DYkwNlDJn4rwVOtb1rcIJfnrVR6oiQLxd4om8Mbg?= =?utf-8?q?ZRen/8ybTcLCd0Zt/hR2f+qZyfsKwD1EhZnPg5KFU6BRwMkPSz1QxYnoAV5pCfFlD?= =?utf-8?q?+xNDiHt0vPR+r0fZe43PQZf0ih4tOkmIpMcRf73c++IQRZfntr46+wO2e1Xs60WyJ?= =?utf-8?q?SOVq1cuAofCKJf1zrun1BiaGyePujUm77KA31QT0L0USgm5DMDE7Zi1voln+LPNhx?= =?utf-8?q?dbKnvrq+K7OlC/0GLeBtN+Eo+L3VpbI8vL59bky1D1VRk0uYRNewl2F11k2jKv77q?= =?utf-8?q?tuNGTKsAzTh4cXh5oo8qvmY+zGY3xrRI3n6vKU/IX4y+7cA/KCPzDCOPFdBRBCgcz?= =?utf-8?q?II7Sl8kKgUB3xBszB45j9peI/Ss1lFnMmkLTa6qS+fMCndbMeW066CJPJoD6Ms+QB?= =?utf-8?q?aSBBbiKAWS4eYZzqXeIGGVj6hDtIlupXChP96IV4XYXV/wGvfiZebYSGJpq2j/xSf?= =?utf-8?q?E+fD4aNEykcVifXwFEq3IGvNUv0TZdzsGGLHrJwaa4xbUtSdU8Mx9aXjygn1v/M5o?= =?utf-8?q?3m3mbrE5C+SvRVYH5dRGteglwVhC+aSFpJWdCL+AwxjEAbIcLh+eENGtul5CTzToZ?= =?utf-8?q?z5hu41vU169VRVsyoBUH03PvkdIzQ3kbHDQqYAfE0FNG6D9/1V2Z1mDW8Q0w0jglh?= =?utf-8?q?s3xsW/a/8GMYclpceNFxJrZdBnP0fh6/MZp6mQ45IxW//lroDS4iGXvGcLBmqmqHn?= =?utf-8?q?Lrajri+BQhsn/ZNMjMGYPvnfeu6BNOkU7w=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(52116014)(7416014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?69luTsMFdyzBB2hevprZCXELhQOV?= =?utf-8?q?D9z0Ux3sq9wIUj6FIebr/nXqbtiEt8QcMQiMZqeqkLxuACTpCh1mYqgqXDzpbj+0F?= =?utf-8?q?KW7qO+61NRg/2uIiABrUvVt61NCKR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IGR0nsVzmT8cBYpqA/8z0v77Nt?= =?utf-8?q?Jbw+pA8WgZp2VgOcRn97mExbeFGthZblyP9tPVZ88vWDNbOJsO03F6OS5h1013Pur?= =?utf-8?q?ZOsWWgTp2aH+U8g787lvPQ/kYHbeGk8Rcwx3DkeMY/3XkPv1/LnjG2uyc3MBgiw9D?= =?utf-8?q?sXn+sdMxiDhi4pRDsNMIl4TJI6cqyk5VT3j4sMIWTIOG2Sr4F7M6LODOaHWAl68Rb?= =?utf-8?q?2nhq57iv8HxVd5yLckkTMLvINp+H0UvVpGNSoyxmmzpm632XGVfgge9o6xti/UCRy?= =?utf-8?q?Pn9UWSCnqf9PN7F4P5/Z/U5pSUMiaDUrAVbzSsOyEYzFx8bZEXFp1QT3KdUxN3dzf?= =?utf-8?q?+EfWjXB1z23PmnET/NppXWDCF1ShkVDuCNkQvNyFK0c8Ia+ZDW5Nm+fDAonPkIz32?= =?utf-8?q?wkT4wGENbMwCVcym4Qg1zX4pvaXXwqDgZwjD4J87v4Xlo//RkZ8VW/V0RJmlGIPFQ?= =?utf-8?q?rhQkMD48CftOLcEt3wKoi1mtnMVtGkMOW2DnuvczRF1IZJ6WL//lkQZc=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e0828e7-ff92-4701-733d-08dd13da44e9 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2024 20:37:13.7356 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 18JjsRs7Qv6R05+A7pPzsaKl12fGRL6C8Aw6ZSL1H8NKPJRFjsfRA6W+FCpspZrDAuNwvguxPic6Z43UlZaJRg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB7108 The follow steps trigger kernel dump warning and platform_device_msi_init_and_alloc_irqs() return false. 1: platform_device_msi_init_and_alloc_irqs(); 2: platform_device_msi_free_irqs_all(); 3: platform_device_msi_init_and_alloc_irqs(); [ 76.713677] WARNING: CPU: 3 PID: 134 at kernel/irq/msi.c:1028 msi_create_device_irq_domain+0x1bc/0x22c [ 76.723010] Modules linked in: [ 76.726082] CPU: 3 UID: 0 PID: 134 Comm: kworker/3:1H Not tainted 6.13.0-rc1-00015-gd60b98003b43-dirty #57 [ 76.735741] Hardware name: NXP i.MX95 19X19 board (DT) [ 76.740883] Workqueue: kpcitest pci_epf_test_cmd_handler [ 76.746212] pstate: a0400009 (NzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 76.753172] pc : msi_create_device_irq_domain+0x1bc/0x22c [ 76.758586] lr : msi_create_device_irq_domain+0x104/0x22c [ 76.763988] sp : ffff800083f43be0 [ 76.767313] x29: ffff800083f43be0 x28: 0000000000000000 x27: ffff8000827a7000 [ 76.774466] x26: ffff00008085f400 x25: ffff00008000b180 x24: ffff000080fc6410 [ 76.781624] x23: ffff000085704cc0 x22: ffff8000811c8828 x21: ffff000085704cc0 [ 76.788774] x20: ffff000082814000 x19: 0000000000000000 x18: ffffffffffffffff [ 76.795933] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 [ 76.803083] x14: 0000000000000000 x13: 0000000f00000000 x12: 0000000000000000 [ 76.810233] x11: 0000000000000000 x10: 000000000000002d x9 : ffff800083f43ba0 [ 76.817383] x8 : 00000000ffffffff x7 : 0000000000000019 x6 : ffff0000857e443a [ 76.824533] x5 : 0000000000000000 x4 : ffffffffffffffff x3 : ffff000085704ce8 [ 76.831683] x2 : ffff000080835640 x1 : 0000000000000213 x0 : ffff0000877189c0 [ 76.838840] Call trace: [ 76.841287] msi_create_device_irq_domain+0x1bc/0x22c (P) [ 76.846701] msi_create_device_irq_domain+0x104/0x22c (L) [ 76.852118] platform_device_msi_init_and_alloc_irqs+0x6c/0xb8 Do below two things in platform_device_msi_init_and_alloc_irqs(). - msi_create_device_irq_domain() - msi_domain_alloc_irqs_range() But only call msi_domain_free_irqs_all() in platform_device_msi_free_irqs_all(), which missed call msi_remove_device_irq_domain(). This cause above kernel dump when call platform_device_msi_init_and_alloc_irqs() again. Fixes: c88f9110bfbc ("platform-msi: Prepare for real per device domains") Cc: stable@kernel.org Signed-off-by: Frank Li --- drivers/base/platform-msi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/base/platform-msi.c b/drivers/base/platform-msi.c index 4401cc31e4736..e7615daf5f539 100644 --- a/drivers/base/platform-msi.c +++ b/drivers/base/platform-msi.c @@ -98,5 +98,6 @@ EXPORT_SYMBOL_GPL(platform_device_msi_init_and_alloc_irqs); void platform_device_msi_free_irqs_all(struct device *dev) { msi_domain_free_irqs_all(dev, MSI_DEFAULT_DOMAIN); + msi_remove_device_irq_domain(dev, MSI_DEFAULT_DOMAIN); } EXPORT_SYMBOL_GPL(platform_device_msi_free_irqs_all);