From patchwork Tue Nov 3 20:36:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 317006 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0188C2D0A3 for ; Tue, 3 Nov 2020 21:18:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A4F18206DC for ; Tue, 3 Nov 2020 21:18:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604438323; bh=OL+qO1rHfIQb/juRRsCMJBnD/zn9AUei3CNLxgY3ciY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=KSlwxGAyM9Ao158gcRnl5VI9wf6IvAJLZSKx49WeVSrtYL+1y73aCuWt3xOQRs/Xz cmVZ1JVib3lUklopWE3WRoFnMABnjkoeR8yhzznf7tGd8QyaRSjDwuoPJni33F1vXV ZAqMaRH0CTd7C0y0bKXhmdEV4fCl1aKhcNyOltG8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388440AbgKCVJN (ORCPT ); Tue, 3 Nov 2020 16:09:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:49110 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388436AbgKCVJM (ORCPT ); Tue, 3 Nov 2020 16:09:12 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 045FE205ED; Tue, 3 Nov 2020 21:09:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437751; bh=OL+qO1rHfIQb/juRRsCMJBnD/zn9AUei3CNLxgY3ciY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OCSP/QLaLqFm0cvAEaUPjSGtsl8NV4WxOSw0awdHQPdXn/0918zf0nX2m8ta4ZVWr lZkYFIGxxiRjCaQkyTlx7rYz9Yn+zHfqYsJ2zZYR/hTivOSXmcVvh1Ai5wCO+1np+h L+WcmiPDv2XEsG1quvfvk4S3tXR5xckj1Ktkw6So= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Michael Ellerman , Sasha Levin Subject: [PATCH 4.14 018/125] powerpc: select ARCH_WANT_IRQS_OFF_ACTIVATE_MM Date: Tue, 3 Nov 2020 21:36:35 +0100 Message-Id: <20201103203159.377192547@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203156.372184213@linuxfoundation.org> References: <20201103203156.372184213@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Nicholas Piggin [ Upstream commit 66acd46080bd9e5ad2be4b0eb1d498d5145d058e ] powerpc uses IPIs in some situations to switch a kernel thread away from a lazy tlb mm, which is subject to the TLB flushing race described in the changelog introducing ARCH_WANT_IRQS_OFF_ACTIVATE_MM. Signed-off-by: Nicholas Piggin Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20200914045219.3736466-3-npiggin@gmail.com Signed-off-by: Sasha Levin --- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/mmu_context.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 679e1e3c16953..7cc91d7f893cf 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -154,6 +154,7 @@ config PPC select ARCH_USE_BUILTIN_BSWAP select ARCH_USE_CMPXCHG_LOCKREF if PPC64 select ARCH_WANT_IPC_PARSE_VERSION + select ARCH_WANT_IRQS_OFF_ACTIVATE_MM select ARCH_WEAK_RELEASE_ACQUIRE select BINFMT_ELF select BUILDTIME_EXTABLE_SORT diff --git a/arch/powerpc/include/asm/mmu_context.h b/arch/powerpc/include/asm/mmu_context.h index 6f67ff5a52672..5f9ad4f4b9c0f 100644 --- a/arch/powerpc/include/asm/mmu_context.h +++ b/arch/powerpc/include/asm/mmu_context.h @@ -101,7 +101,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, */ static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next) { - switch_mm(prev, next, current); + switch_mm_irqs_off(prev, next, current); } /* We don't currently use enter_lazy_tlb() for anything */