Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp544564rdh; Wed, 14 Feb 2024 04:56:13 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUedcHg2xJAvcxqz/ItWGhVLESsZYbRK4g29ksQitXw33KKyOXwbcFSWkj3Beg2Llg1izpKtWbyL/7RdjkdUiuak68lYHBm/KIRQxPZSg== X-Google-Smtp-Source: AGHT+IFXjJsrIfHOYvUQEM3jtiYGC+zJpFU02tAQdHHsx3aTJm8lROQVSwa4dsxiPS2N16tMMMnQ X-Received: by 2002:a92:d68f:0:b0:364:2359:7616 with SMTP id p15-20020a92d68f000000b0036423597616mr3254825iln.6.1707915373632; Wed, 14 Feb 2024 04:56:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707915373; cv=pass; d=google.com; s=arc-20160816; b=PrHd8TrLQI5EaV7syp4Q5+jvjbOpN5EvEqhk9+UZnFoIs7bCL1N3TneEiuiHGrwHY7 KfTMBVVsIwGeE7pH1Wpf5rK0vdkfRvRLICtim/Lr4wx8ZVnCDlCLPNn2/0iN3YpErTsO +OnHqvOo0EAo1euVEREobd59fEfVuCtj0aNzcqSEuKjEHakZ5XfSai/MQpLfL7IteuL8 fGJD2v4EtivEG8kc7DN+rjQP80c4oS20BwA3Xg1DdSk5UlcxzJEhRkMUZQ2PB5rXuAzq RF4NbZeRkLoqZ34kM4zF43oKqkbllwoJ6hAzEOkab+d813fXf89R/wmCa/kkiyL+2W5I dXFQ== 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 :message-id:date:references:in-reply-to:subject:cc:to:from :dkim-signature; bh=2yGYnjksCOnTrmVt4RdgHftQySQabm4BEhRKLQZMYvw=; fh=BGXKOwgD1O1V0I04cb0zh2Ptqkpg3AVnEFXq+0Cq32w=; b=CzFBaBu3s+Tb7blSqp8At7OZZ1xf5wPbG0cYrDA054uP87bIbwtXPATr7/baqEBfWd 4GIP/32ZQDpqN2HEJaoLIAwcVwwJA1kUWR2Rp/fdWrlJmXWbfccgUlGPX0sAoNz4pKKg A5xZj3o2cBJ1AtMFC4e+mNQv4Ule5TN3ZTDWBHJT5Hz8QSm+VImGokjvuJopMHnpTSuo FFa9XC9Z39gFgOEgqTT3+f+GitgAG4iKd8AO4ym7XvDyj7B5C1J7C6sbC9wDJA/PL9Dv ko2DXOSI1N8bI9gF0VAYEOBMIQJJ/e4HgoeIWwitVpVCnfgtKk9HfS0oBlbvEzDIVTlG iq1g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=XE2pPkt3; arc=pass (i=1 spf=pass spfdomain=ellerman.id.au dkim=pass dkdomain=ellerman.id.au); spf=pass (google.com: domain of linux-kernel+bounces-65227-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65227-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCUox2WIY9UwHiz7Zvdx4frGEFmDi+u5S3Eu6mUzM2LivNirqXRJqXzmdGPYpqv7LJxNT1YjmAZ45LNEZYUjhCGoqzUUV+Z6zV+yDt4ecw== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p23-20020a639517000000b005dc529b708asi3728358pgd.743.2024.02.14.04.56.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 04:56:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65227-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=XE2pPkt3; arc=pass (i=1 spf=pass spfdomain=ellerman.id.au dkim=pass dkdomain=ellerman.id.au); spf=pass (google.com: domain of linux-kernel+bounces-65227-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65227-linux.lists.archive=gmail.com@vger.kernel.org" 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 7CD0D289E6B for ; Wed, 14 Feb 2024 12:55:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E8CC5535D6; Wed, 14 Feb 2024 12:53:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b="XE2pPkt3" Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (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 C413C53393 for ; Wed, 14 Feb 2024 12:53:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=150.107.74.76 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707915211; cv=none; b=aQZ1rR/gjKnIS5jx3oxLw7GPqwuWh/Ty/a5/thBs22LLur+age4SDleYpxyVvK0VlReeplNnszIJqzBI/UukvCQC/TyPM9Zmx2iLHNQ+T5jNAPQ2f7xpeHBFqULVVs8YQtJ0VEmCou/ioI7npM7oIKDfi+sN8ipbUJbo08DXZ1E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707915211; c=relaxed/simple; bh=7qQl3oUH908Qo+DjPhPwTveHPALrcW4P/GCBSzvUYvg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=dGcXM71uILybjAxuk1RZehlyNKA6XzuGwxFE2T7GIrnVfO4iC/fp1oucB5HFUypCMgwW9hKPCEkmg2XwriwGVIHVsZzSG6+AB/PwvNcknVZzW3v93qeq44gMtEpcMpaZ14PZDMb53giuQYEUmfwZ9cliiWPiptRK47HEPYOMTWQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au; spf=pass smtp.mailfrom=ellerman.id.au; dkim=pass (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b=XE2pPkt3; arc=none smtp.client-ip=150.107.74.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ellerman.id.au DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1707915205; bh=2yGYnjksCOnTrmVt4RdgHftQySQabm4BEhRKLQZMYvw=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=XE2pPkt3SjW8DtGmMvWJGhlsNBiE4/O11nAWaHS4X4tOUavECaHl3WodQ6RZ02WrI almV87Vjd3dekGxaIEk1nq2vrEFBC2fwJlTQC/NPMmv0sAH/9z39AzF6g5JkxVx15l 4FN5phMtb9ZgcugZSS2XWi1jNOejnfyLXMLHdYCK63VX6KVnD6nU9JaU6EscAzSUN7 Ys+WtcnU4s1YvhKkoHxFUey4JGkmQX3rrPk7lI9QULOLTewhWjgb2c3Cc2zl/lb8UM PsMeR4O6sjG9HMH7rLAzoW0HSRxfrXXLAbJi30sBWqLW1D9qwqc4uVEgsFAZ4R7U3q LXiQPCup57nYg== Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4TZdR636lbz4wcp; Wed, 14 Feb 2024 23:53:22 +1100 (AEDT) From: Michael Ellerman To: Venkat Rao Bagalkote , Jason Gunthorpe , Shivaprasad G Bhat Cc: iommu@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, 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 Subject: Re: [PATCH] powerpc/iommu: Fix the missing iommu_group_put() during platform domain attach In-Reply-To: <4f5e638d-30a2-4207-b515-d07c20b0fb47@linux.vnet.ibm.com> References: <170784021983.6249.10039296655906636112.stgit@linux.ibm.com> <20240213172128.GM765010@ziepe.ca> <4f5e638d-30a2-4207-b515-d07c20b0fb47@linux.vnet.ibm.com> Date: Wed, 14 Feb 2024 23:53:20 +1100 Message-ID: <87le7n6wcf.fsf@mail.lhotse> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Venkat Rao Bagalkote writes: > 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 Please use lore for links, in this case: https://lore.kernel.org/all/274e0d2b-b5cc-475e-94e6-8427e88e271d@linux.vnet.ibm.com/ cheers > 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 >>