From patchwork Thu May 5 16:32:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 12839780 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 CDA40C433FE for ; Thu, 5 May 2022 16:34:00 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DQbNAVGjQFERamDc6EPVvKtyQlpgK269PVNOpNQMnGg=; b=PWTWaY4wyHmaHr gzH8UkCjsZiyi3EIf8lnC1Qq6SWdaMrzcp5JBs25Ar3KiIyrcMGu1d+QKkOLcOEjrDTWTy93aeQom mS+gIyxPYZOfU2Z9oxyIa5UnZYg+dCjwgYU9kSrXwUxa8Kq5NngjDF6ycUe5c2Tjt3/ZaEqjxdmUx E03Vjl3uF4fQ39r4Lvz1p3dhnVxTSG4voKpsgLnLaZmD06miT9cQw9ykQrpKgEh/0u3K4ZbqigmK+ 1wvvP0odbltsBBtvSeIDxCir/j3XOagc9gbAQTxb7GZcNu2FVK9pjsibdi2DGofM4DK6zD7W7ZCkj oHVLmRxWgnC9e4RxQ3rw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmePV-00GsRo-K6; Thu, 05 May 2022 16:33:01 +0000 Received: from galois.linutronix.de ([2a0a:51c0:0:12e:550::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmeOs-00Gs91-4f for linux-arm-kernel@lists.infradead.org; Thu, 05 May 2022 16:32:25 +0000 From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1651768334; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LKm9AqbXcXRNKE2mxGijV7TPIG3gvdmtoC0y/ykq+0g=; b=eoU1GdPieDsNfZLaqVV4ics+xIMfGrnmT94xmAgYAhUrcvVmLPkgq12DfgR+5eYUvyW7yS 2yfdfVEPpqQ1ibpjY9H4TnETO9PsnuHSxzn3JnV9sUz5eyJT4L53r9ZfMx+BhbLTUPQ/jJ 8wu9s3PTIwESnkXV2WBkwpPFdPQHzTO1MVjsS14bDa3vOuUIcAQRQ++DjdhTFK325CvFL8 xR7i4ThhL4vSPy6IeuBtEMmc1BGb3Ll2eP5PPV5O+/qcK++TrOkQNt/Jh8JR9x4kpAsBCS t44ZAl0rXkvD0jHi8xifkVkKHLEIvx1Q58wCmSYuoKylNWwCT+NAjDE7JfnMwg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1651768334; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LKm9AqbXcXRNKE2mxGijV7TPIG3gvdmtoC0y/ykq+0g=; b=lj6so2GEhXyvry3v++TaUJnebl76rudhXO9HGhB/NmTEIswfkZ1mg000RHKfzkr0POsU31 uLRZqOG810ecEMDQ== To: linux-arm-kernel@lists.infradead.org Cc: Catalin Marinas , Will Deacon , Thomas Gleixner , Valentin Schneider , Valentin Schneider , Sebastian Andrzej Siewior Subject: [PATCH 3/3] arm64: mm: Make arch_faults_on_old_pte() check for migratability Date: Thu, 5 May 2022 18:32:07 +0200 Message-Id: <20220505163207.85751-4-bigeasy@linutronix.de> In-Reply-To: <20220505163207.85751-1-bigeasy@linutronix.de> References: <20220505163207.85751-1-bigeasy@linutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220505_093222_368627_4E08F7AF X-CRM114-Status: UNSURE ( 9.29 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Valentin Schneider 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(). Cc: Valentin Schneider Suggested-by: Sebastian Andrzej Siewior Signed-off-by: Valentin Schneider Link: https://lore.kernel.org/r/20220127192437.1192957-1-valentin.schneider@arm.com Acked-by: Catalin Marinas --- 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 8ebf1cec5d901..5a53558578ab3 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -1018,7 +1018,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(); return !cpu_has_hw_af(); }