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 4579EC433EF for ; Tue, 15 Feb 2022 16:03:32 +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=5VvpDRgD0RTBFtoq6Jd+fjRb3DeHOj8RuuniaQkWCqo=; b=MQXg4GHxqfCbk2 mFN4NvRsOkZTUpMLsfuAQHIaW2snKgDNYGAjZA59G1WsRiwR1UK05RLRZoqSgrKSWKCMUZazdEsrS i+eLHRvEcq1LT4Ab+X7M2nSTbNb7nGeKXVpQCtkEs0a5O2lZ6HCwRS7YyVLxGOIbPVoUkyKryoyrt CeuMCE6H38E1VJfZ2USGkfxvxBNwexCHGVupQF9VI/MLEimb3hT3eEHnVLTYyS/zrSJXmb78UBCyu lP2+IpjjH0aDw76ZdK88zAcXVxsZV02Y8auYx1pYYb06mykWV4Tc8BN9h78NLZwsYNQU+Al1rqNxV +exWtn6eJjaCr9vA/GxA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nK0HF-003Wu4-Na; Tue, 15 Feb 2022 16:02:06 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJztZ-003LJs-Cp for linux-arm-kernel@lists.infradead.org; Tue, 15 Feb 2022 15:37:39 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E2F956172A; Tue, 15 Feb 2022 15:37:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1349EC340EB; Tue, 15 Feb 2022 15:37:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644939455; bh=BsBNZ9apjGJSc2g0ZwEBxAVFFQEqTe0vH5kNc5TqqNU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Z6Iki+WPdLb9gpmywemitTCbjFKLwFXyTTkar9otLYCKmkVVJPLCuaNDalikiu+v1 TFg7/MiGeNkMeC5C+RikqLWr791Vcf3KgyznU/cTJXJwn4KkTeYH5QXgrrDOtIAhzR HXFUOcqXeTgSTD2IXcbWEAHEL3htsLHJhtz/sS63033m1wmPOY/h6HTiaccbMIJUMt 3alZOADJ+zQEo5A/yY2sNEVbLpudzmSGh3At7PAJF7bpC5s4Inb1TFrMCDOxMrFBqZ U+gGuiE1GqpSi3wnrtEQO//Mqi29tuq6Bz6N4JtqUeb0zS2jeX1gvVisnLyw0ihv+N oDOxIMDwcMJGA== Date: Tue, 15 Feb 2022 15:37:27 +0000 From: Will Deacon To: Valentin Schneider Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rt-users@vger.kernel.org, Sebastian Andrzej Siewior , Catalin Marinas , Ingo Molnar , Peter Zijlstra , Thomas Gleixner , Steven Rostedt , Daniel Bristot de Oliveira , "Paul E. McKenney" , Frederic Weisbecker , Josh Triplett , Mathieu Desnoyers , Davidlohr Bueso , Lai Jiangshan , Joel Fernandes , Anshuman Khandual , Vincenzo Frascino , Steven Price , Ard Biesheuvel , Boqun Feng , Mike Galbraith Subject: Re: [PATCH v4] arm64: mm: Make arch_faults_on_old_pte() check for migratability Message-ID: <20220215153726.GA7944@willie-the-truck> References: <20220127192437.1192957-1-valentin.schneider@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220127192437.1192957-1-valentin.schneider@arm.com> 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-20220215_073737_561941_4624D83E X-CRM114-Status: GOOD ( 23.04 ) 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 Thu, Jan 27, 2022 at 07:24:37PM +0000, Valentin Schneider wrote: > arch_faults_on_old_pte() relies on the calling context being > non-preemptible. CONFIG_PREEMPT_RT turns the PTE lock into a sleepable > spinlock, which doesn't disable preemption once acquired, triggering the > warning in arch_faults_on_old_pte(). > > It does however disable migration, ensuring the task remains on the same > CPU during the entirety of the critical section, making the read of > cpu_has_hw_af() safe and stable. > > Make arch_faults_on_old_pte() check cant_migrate() instead of preemptible(). > > Suggested-by: Sebastian Andrzej Siewior > Signed-off-by: Valentin Schneider > Link: https://lore.kernel.org/r/20210811201354.1976839-5-valentin.schneider@arm.com > --- > v3 -> v4: Dropped migratable(), reuse cant_migrate() (Sebastian) > --- > arch/arm64/include/asm/pgtable.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h > index c4ba047a82d2..3caf6346ea95 100644 > --- a/arch/arm64/include/asm/pgtable.h > +++ b/arch/arm64/include/asm/pgtable.h > @@ -1001,7 +1001,8 @@ static inline void update_mmu_cache(struct vm_area_struct *vma, > */ > static inline bool arch_faults_on_old_pte(void) > { > - WARN_ON(preemptible()); > + /* The register read below requires a stable CPU to make any sense */ > + cant_migrate(); FWIW: There's a patch in the multi-generational LRU series that drops this WARN_ON() entirely. I'm not sure if/when that lot will land, but just wanted to let you know. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel