Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp416584rdh; Wed, 14 Feb 2024 00:09:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV/VGVhb9ma1xTdqQIOOZckupSA/vdzEmcTH0FZKvkioNdcmty3DKYdomNB1MfhyN8bbxGTbs8eoEQm0/c5I8hHXgXx/eVwTG4rqhyxlg== X-Google-Smtp-Source: AGHT+IHzfwDVOPGR0m1d7N4fOzHsPfvMX9f/vB0DuB5h0J1wdZ8a32n0lUXdmRUorY/A07ah+0os X-Received: by 2002:a05:6870:84c2:b0:21a:216d:3a6a with SMTP id l2-20020a05687084c200b0021a216d3a6amr1971577oak.52.1707898191299; Wed, 14 Feb 2024 00:09:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707898191; cv=pass; d=google.com; s=arc-20160816; b=T1fOEnBMPFWKTDCo0bGlvFImy3cyr2x74mr/ng1oPJUSyP4HnzmCwXuUV/mIpS8ScC zD94Ow0uNW+nkVPd09fhNDqPUVY5yNAA24BvjF7aNgqQUnrvxxgrOsqJ/AjbypiB+pzr GOHYZxT9wQp0R9GmuYQJUJ9eDTyb5X5QN5y0dLs2r0LMZbTmX06jqv9Raf7nN3yUoGZb WWvpimW5+GL9Y9CeC/eocCdDkLjFACnFOz07cGbLE7OoBLTzAVXRi2EstgBzJmg/hrdt 5kfPpZ9uTiLmCi+iypaRAcZYhO9p6kAfk9yfFVOnWbiyhNND5hMpvoacQV7NqB7LS0jN j+NQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:date:message-id:dkim-signature; bh=2v0hlwpBVJIDoWo3D4rG6ozciu8MtAw5fKJ6M/0ZGtA=; fh=sbcQBOIJeBlQ9VRxqvwqXwZquiYHYpvmM8Ve4aV0eEg=; b=zauP87POr9U/doINfVAE+FqpcaRwkYgx1kj8qrfGfthcc1W0Rpqfk0j39WNDs4WwuG Spg/+jujz6QFYofv2EDsXTBC1oaulgBBSHQDPQP1LB8nA5sVRpa2xRlBN0Bz5vEPJLfy f1kmoHWoOQAGDsI8b4g92ZtX8F74WOQAnX8vrIT8txmh3EH+kCd0UKl1GVkuzMAahSyq IAJUVOMkA0b/h+SPkODUTCyG1fqRFZt1UafmJAYkCALdbDf2y7MlgOON2DpyncOm4fsA ZD/hYLDYepas72FFnArr27ipVqXi+LNdVaxhDvp32gjYmjhoz3ywBnt5EZG9/711NlN8 F5+g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=KLVjjEBM; arc=pass (i=1 dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.vnet.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-64753-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64753-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com X-Forwarded-Encrypted: i=2; AJvYcCXXIz/EEyBCIYtdrOV9+CN2B/muyDxbW8M7z8TPxe2I1VIVbm86NvJgBDnrUSQKk/2y381yKeWp9J1IA+a7VWiNnw0hGJgXTcA/oUDSeQ== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id bn14-20020a056a02030e00b005ce172ef504si1949308pgb.36.2024.02.14.00.09.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 00:09:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-64753-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=KLVjjEBM; arc=pass (i=1 dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.vnet.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-64753-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64753-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 87C8DB22B7A for ; Wed, 14 Feb 2024 05:34:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B137311193; Wed, 14 Feb 2024 05:34:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="KLVjjEBM" Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 ED92F11183 for ; Wed, 14 Feb 2024 05:34:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707888885; cv=none; b=dIzffCt6RGmwI29n4vf8etc85BzTmKwbQp+7zzW14yTkh0XFQ5aSurkyM65MYVOizcXrxgyBe8wVTZfXD9XM3BpLWNALgTf3PRCNwVfMSjXeiudDO2avH7G0ADE+oh/k4Xww10JXGtMgPaJtJ4pGMDKQ3kWpQZV7Bj2StXf4cVw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707888885; c=relaxed/simple; bh=0vn/2xZjRpP2RruobzMCkoDCEodYNaVfuaYzWJk1pGI=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=j8+YUSSi5RXhrvMDiB2eus598EDi/ZOJdzWHTIINODnTalI/wNm4vAtjnBCpbIsuY3lLbb2HwaEbXOE5CR3ulAn7Eorep1dwQXdC0SatbiulXEvN5tkpekfpS1S7DZy744Fb7Lc//T70Je3JYGRFk25Xoiw2AsdPF7cJ9XevXqQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.vnet.ibm.com; spf=none smtp.mailfrom=linux.vnet.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=KLVjjEBM; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.vnet.ibm.com Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41E4vlrQ031412; Wed, 14 Feb 2024 05:34:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pp1; bh=2v0hlwpBVJIDoWo3D4rG6ozciu8MtAw5fKJ6M/0ZGtA=; b=KLVjjEBMoqqxjWiQsGgV9Gs0dYzXQXlHvsRIJMWuXJVEwit72eowV8sL1Yg5SAeioXNg HBvpY/VJf+ipoSUMz03mLOTr7CmzRHHq0Bsub64Tr4ECyheIsvw5eAXLl3gEEq7LO46S xeGGbIJx7Eow8aG17toiZl8MrrAIBUKvhvGslflr1XQQLb+Wt6+nAsCSzOyi9FCL0c/x +RzztIOrMvoPiAENdkYLgX5PZrc2o1NPBLNwa+cQoEEHkejWVbAi6Yji9t9WcB6k2KQo LCmPEoXmc6jjspObIlvg6jyfa4t0blrUa+jitoCxBUplmqE8tJ05hbpEltao0dubhSk1 Ow== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w8pxmgw5c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 14 Feb 2024 05:34:13 +0000 Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41E4w2EM032629; Wed, 14 Feb 2024 05:34:12 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w8pxmgw51-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 14 Feb 2024 05:34:12 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41E2NvJ0004339; Wed, 14 Feb 2024 05:34:11 GMT Received: from smtprelay03.wdc07v.mail.ibm.com ([172.16.1.70]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3w6kv0c6e8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 14 Feb 2024 05:34:11 +0000 Received: from smtpav01.dal12v.mail.ibm.com (smtpav01.dal12v.mail.ibm.com [10.241.53.100]) by smtprelay03.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41E5Y8OF26280472 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Feb 2024 05:34:10 GMT Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2A15158058; Wed, 14 Feb 2024 05:34:08 +0000 (GMT) Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6A4855806B; Wed, 14 Feb 2024 05:34:02 +0000 (GMT) Received: from [9.43.87.202] (unknown [9.43.87.202]) by smtpav01.dal12v.mail.ibm.com (Postfix) with ESMTP; Wed, 14 Feb 2024 05:34:02 +0000 (GMT) Message-ID: <4f5e638d-30a2-4207-b515-d07c20b0fb47@linux.vnet.ibm.com> Date: Wed, 14 Feb 2024 11:04:00 +0530 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] powerpc/iommu: Fix the missing iommu_group_put() during platform domain attach Content-Language: en-GB To: Jason Gunthorpe , Shivaprasad G Bhat Cc: iommu@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu, aneesh.kumar@kernel.org, naveen.n.rao@linux.ibm.com, jroedel@suse.de, tpearson@raptorengineering.com, aik@amd.com, bgray@linux.ibm.com, gregkh@linuxfoundation.org, gbatra@linux.vnet.ibm.com, vaibhav@linux.ibm.com References: <170784021983.6249.10039296655906636112.stgit@linux.ibm.com> <20240213172128.GM765010@ziepe.ca> From: Venkat Rao Bagalkote In-Reply-To: <20240213172128.GM765010@ziepe.ca> Content-Type: text/plain; charset=UTF-8; format=flowed X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: VEN0Ab5lxghBOi28HwoCQawyJkmQ3Lg6 X-Proofpoint-GUID: uUo8j74xaYSgknAAVs_YIypAe1HaCi1W Content-Transfer-Encoding: 7bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-13_16,2024-02-12_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 bulkscore=0 clxscore=1011 mlxlogscore=468 phishscore=0 mlxscore=0 adultscore=0 impostorscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402140041 Thanks for the patch. Applied this patch and verified and issue is fixed. This issue way originally reported in the below mail. https://marc.info/?l=linux-kernel&m=170737160630106&w=2 Tested-by: Venkat Rao Bagalkote On 13/02/24 10:51 pm, Jason Gunthorpe wrote: > On Tue, Feb 13, 2024 at 10:05:22AM -0600, Shivaprasad G Bhat wrote: >> The function spapr_tce_platform_iommu_attach_dev() is missing to call >> iommu_group_put() when the domain is already set. This refcount leak >> shows up with BUG_ON() during DLPAR remove operation as, >> >> KernelBug: Kernel bug in state 'None': kernel BUG at arch/powerpc/platforms/pseries/iommu.c:100! >> Oops: Exception in kernel mode, sig: 5 [#1] >> LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=8192 NUMA pSeries >> >> Hardware name: IBM,9080-HEX POWER10 (raw) 0x800200 0xf000006 of:IBM,FW1060.00 (NH1060_016) hv:phyp pSeries >> NIP: c0000000000ff4d4 LR: c0000000000ff4cc CTR: 0000000000000000 >> REGS: c0000013aed5f840 TRAP: 0700 Tainted: G I (6.8.0-rc3-autotest-g99bd3cb0d12e) >> MSR: 8000000000029033 CR: 44002402 XER: 20040000 >> CFAR: c000000000a0d170 IRQMASK: 0 >> GPR00: c0000000000ff4cc c0000013aed5fae0 c000000001512700 c0000013aa362138 >> GPR04: 0000000000000000 0000000000000000 0000000000000000 0000000119c8afd0 >> GPR08: 0000000000000000 c000001284442b00 0000000000000001 0000000000001003 >> GPR12: 0000000300000000 c0000018ffff2f00 0000000000000000 0000000000000000 >> GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 >> GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 >> GPR24: c0000013aed5fc40 0000000000000002 0000000000000000 c000000002757d90 >> GPR28: c0000000000ff440 c000000002757cb8 c00000183799c1a0 c0000013aa362b00 >> NIP [c0000000000ff4d4] iommu_reconfig_notifier+0x94/0x200 >> LR [c0000000000ff4cc] iommu_reconfig_notifier+0x8c/0x200 >> Call Trace: >> [c0000013aed5fae0] [c0000000000ff4cc] iommu_reconfig_notifier+0x8c/0x200 (unreliable) >> [c0000013aed5fb10] [c0000000001a27b0] notifier_call_chain+0xb8/0x19c >> [c0000013aed5fb70] [c0000000001a2a78] blocking_notifier_call_chain+0x64/0x98 >> [c0000013aed5fbb0] [c000000000c4a898] of_reconfig_notify+0x44/0xdc >> [c0000013aed5fc20] [c000000000c4add4] of_detach_node+0x78/0xb0 >> [c0000013aed5fc70] [c0000000000f96a8] ofdt_write.part.0+0x86c/0xbb8 >> [c0000013aed5fce0] [c00000000069b4bc] proc_reg_write+0xf4/0x150 >> [c0000013aed5fd10] [c0000000005bfeb4] vfs_write+0xf8/0x488 >> [c0000013aed5fdc0] [c0000000005c0570] ksys_write+0x84/0x140 >> [c0000013aed5fe10] [c000000000033358] system_call_exception+0x138/0x330 >> [c0000013aed5fe50] [c00000000000d05c] system_call_vectored_common+0x15c/0x2ec >> --- interrupt: 3000 at 0x20000433acb4 >> >> ---[ end trace 0000000000000000 ]--- >> >> The patch adds the missing iommu_group_put() call. >> >> Fixes: a8ca9fc9134c ("powerpc/iommu: Do not do platform domain attach atctions after probe") >> Signed-off-by: Shivaprasad G Bhat >> --- >> arch/powerpc/kernel/iommu.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) > Doh, that is a weird splat for this but thanks for finding it > > Reviewed-by: Jason Gunthorpe > > Jason >