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 8D63BC54E5D for ; Wed, 13 Mar 2024 00:33:13 +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=sHmocSw4A5WigOCRNpWVxr8bYnLmFRf6N2qr7NeiOr8=; b=DCzH0q01JHLUyL ktAoQITkT+dgbtrgvZJmqnxwjs8UXcLIWFSD1MzWgQqIZg68XQAuv/iMu+77xSMV06Dm7znnGFaqA cP+EbTZwq2xhCAnGWoW2zpqJGYZxM1YWIiA7Iw929/817f+rhmq51gkMphqRLYKxJ7VbkuJU9Jwff KcIGUQ6iyk88yvfPwSCDthnxTLqXyu5PI4vCefHmaNgOMSfyLDr9zptmQ0oITAPpStp3WmrxIR5ga vUcW7I5FrVgfZhlTSY2DG3P2igAytcDe+IkTlzSr9qZnlnfJWD94GDHlwWlSntbkgz6sxvG+5Czkz hP4uf/MVFN6sB9zXw22w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkCYC-000000088Iz-3yUh; Wed, 13 Mar 2024 00:32:57 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkCY9-000000088IE-3ZiI for linux-arm-kernel@lists.infradead.org; Wed, 13 Mar 2024 00:32:55 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id A965BCE172D; Wed, 13 Mar 2024 00:32:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C1FFC433F1; Wed, 13 Mar 2024 00:32:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710289970; bh=kYD2EpLgbT4sPCWd/jlC/Lu5P5Sa6jt2PmeMn6R10fI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=K1nFluVLxRu/u5a/qGTLoH5nSjbx2dz43KNXq480rVe6fo4AnMhZLRY2rrC7moBkh eM8TEawAxTq85gYZ3LSakhqBM1htUlT7ndZfPKzN+Jc01S1n26191w79G9xlNtpPfU h0shHYo+wXzMGO9a1kT+t/qn0lndJ03yuDmk0P8wW4rAc5Jjf8HgjnZ+fP8sAf/pxc 7tSln8gbmdkWVQMuuKNn1A2XI7hGHI8aSsxnyTbWV4NeLUbceyyVfgCbgIP0+umhdR nyi2nUdmG0hxmz7EbUinnCzGpb5w8uHqoUKn7shlTpf9RCNQdxybicI/KTMFg/CTNW IrowB/k6isRvw== Date: Wed, 13 Mar 2024 00:32:44 +0000 From: Will Deacon To: "Russell King (Oracle)" Cc: Stefan Wiehler , 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: <20240313003244.GA29568@willie-the-truck> References: <20240307160951.3607374-1-stefan.wiehler@nokia.com> <66fdce3a-c7f6-4ef4-ab56-7c9ece0b00e2@nokia.com> <20240312221440.GA29419@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240312_173254_269863_94D447FC X-CRM114-Status: GOOD ( 28.59 ) 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 Tue, Mar 12, 2024 at 10:39:30PM +0000, Russell King (Oracle) wrote: > On Tue, Mar 12, 2024 at 10:14:40PM +0000, Will Deacon wrote: > > On Sat, Mar 09, 2024 at 09:57:04AM +0000, Russell King (Oracle) wrote: > > > On Sat, Mar 09, 2024 at 08:45:35AM +0100, Stefan Wiehler wrote: > > > > 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... > > > > Thanks for adding me in. > > > > Using arch_spin_lock() really feels like a bodge to me. This code isn't > > run only on the hot-unplug path, but rather this is part of switch_mm() > > and we really should be able to have lockdep work properly there for > > the usual case. > > > > Now, do we actually need to worry about the ASID when switching to the > > init_mm? I'd have thought that would be confined to global (kernel) > > mappings, so I wonder whether we could avoid this slow path code > > altogether like we do on arm64 in __switch_mm(). But I must confess that > > I don't recall the details of the pre-LPAE MMU configuration... > > As the init_mm shouldn't have any userspace mappings, isn't the ASID > entirely redundant? Couldn't check_and_switch_context() just simply > do the vmalloc seq check, set the reserved ASID, and then head to > switch_mm_fastpath to call the mm switch code? Right, that's what I was thinking too, but I have some distant memories of the module space causing potential issues in some configurations. Does that ring a bell with you? Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel