From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 719DBC54798 for ; Sat, 9 Mar 2024 09:57:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ct94y0CQBT3pUgClYOjLRFsnDB1iEsnRd0D579G8oKY=; b=Ufpmg/LlISs0k4 S1fvJdGUW2FMzPbpyB+T25dlsyd+H4/G4bHg7PbwgiFZu8pWauIxczZm1aGSh2CdadC3vEReqhprh wA6xTWa36CEFdp1NmntC0tOe3NDZNxC+m3zedoXGeWJgLJ3sNcUGpRzNbfHjqCT1NaonkUxD5qkxB ShGW9/MgK4PriiO6Yg+i07l3UtXLZYc7ruEEbFjD6VvtjVzvTMP9605taMATq02jWiVSGPuVRoigN HzMCOQVKcK1fTcMJFoEwtmn0gBkNea6NJa5B7QLNrJ4MqKklFFQJZCsRVfbuzBZeRYwKUyo7eErZO dWHnkkDGAVViU3qQ+DtQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ritSL-0000000D2fo-0mtY; Sat, 09 Mar 2024 09:57:29 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1ritSH-0000000D2f1-44Jl for linux-arm-kernel@lists.infradead.org; Sat, 09 Mar 2024 09:57:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ssepVLzl5NKMIkC/PseMyPpZmZ3pHbZYAJxnB3I/oWA=; b=cqpEppfxsrFkAyaR43ERaanrhE i2+Q8haXzU+0LKmPKF6ZLU/G8InKTOlGgDmamP9KKJ3q8c56Zw3iMLahKznCii6yCRKX2C8/C2oK/ VQzyUDZ0se9zgG1YHqPZJlj0qFVTWkwwma26tK8b64tyjVoL5WfkeGwneg4zfpehcqbmMt7c/u29f AhQCbYFLypCEvQa2zdmM/KHL4iLTYrQiXK0VqVCcuEIZH0/SaXnY6VQnXvGH4VmDoJOYGDNN0t6l+ /NnE7Juk7NgP4tzwArfKwhVCgD0wOTzIw9k6WG02F7MuN2FX+CAZSTxIhlQ/wAR8xFTSBvjAC43OL MRFBau2A==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:51170) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ritS0-0003cn-2j; Sat, 09 Mar 2024 09:57:08 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1ritRw-0000fu-Mi; Sat, 09 Mar 2024 09:57:04 +0000 Date: Sat, 9 Mar 2024 09:57:04 +0000 From: "Russell King (Oracle)" To: Stefan Wiehler , Will Deacon Cc: Joel Fernandes , "Paul E. McKenney" , Josh Triplett , Boqun Feng , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang , linux-arm-kernel@lists.infradead.org, rcu@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm: smp: Avoid false positive CPU hotplug Lockdep-RCU splat Message-ID: References: <20240307160951.3607374-1-stefan.wiehler@nokia.com> <66fdce3a-c7f6-4ef4-ab56-7c9ece0b00e2@nokia.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <66fdce3a-c7f6-4ef4-ab56-7c9ece0b00e2@nokia.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240309_015726_318512_B03BBE66 X-CRM114-Status: GOOD ( 20.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sat, Mar 09, 2024 at 08:45:35AM +0100, Stefan Wiehler wrote: > > I agree with the problem but disagree with the patch because it feels like a > > terrible workaround. > > > > Can we just use arch_spin_lock() for the cpu_asid_lock? This might require > > acquiring the raw_lock within the raw_spinlock_t, but there is precedent: > > > > arch/powerpc/kvm/book3s_hv_rm_mmu.c:245: > > arch_spin_lock(&kvm->mmu_lock.rlock.raw_lock); > > > > IMO, lockdep tracking of this lock is not necessary or possible considering the > > hotplug situation. > > > > Or is there a reason you need lockdep working for the cpu_asid_lock? > > I was not aware of this possibility to bypass lockdep tracing, but this seems > to work and indeed looks like less of a workaround: > > diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c > index 4204ffa2d104..4fc2c559f1b6 100644 > --- a/arch/arm/mm/context.c > +++ b/arch/arm/mm/context.c > @@ -254,7 +254,8 @@ void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk) > && atomic64_xchg(&per_cpu(active_asids, cpu), asid)) > goto switch_mm_fastpath; > > - raw_spin_lock_irqsave(&cpu_asid_lock, flags); > + local_irq_save(flags); > + arch_spin_lock(&cpu_asid_lock.raw_lock); > /* Check that our ASID belongs to the current generation. */ > asid = atomic64_read(&mm->context.id); > if ((asid ^ atomic64_read(&asid_generation)) >> ASID_BITS) { > @@ -269,7 +270,8 @@ void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk) > > atomic64_set(&per_cpu(active_asids, cpu), asid); > cpumask_set_cpu(cpu, mm_cpumask(mm)); > - raw_spin_unlock_irqrestore(&cpu_asid_lock, flags); > + arch_spin_unlock(&cpu_asid_lock.raw_lock); > + local_irq_restore(flags); > > switch_mm_fastpath: > cpu_switch_mm(mm->pgd, mm); > > @Russell, what do you think? I think this is Will Deacon's code, so we ought to hear from Will... -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel