From patchwork Tue Jan 12 17:01:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 1425321 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=sparclinux-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=ORqdfppD; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=J0FN5ZDz; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4DFcR55rjXz9sf9 for ; Wed, 13 Jan 2021 04:05:53 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391704AbhALRFl (ORCPT ); Tue, 12 Jan 2021 12:05:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392242AbhALRFb (ORCPT ); Tue, 12 Jan 2021 12:05:31 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB8E6C061794; Tue, 12 Jan 2021 09:04:50 -0800 (PST) Message-Id: <20210112170410.905976187@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1610471089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=BjHyx3TQA52ByPsCeTq6N8/6SlSmPZzIU106dD0/fYw=; b=ORqdfppD06eQ0ZtlbH7MYyPKjna93z9ENP0IyxUC4Iw+h8mTmFOQEoeWffNqPwJ05tpoTf BxSBtF0qLne6qr+iL9EF/A2QjbTRAvrPrA803FWgEdZ3cx74FSjnNeeCHqsml+N5I0eSlK Y1m+lZE8U9RRJxBqUeoPi8PANlp2ZUfN3FoMXFuwzT0271iX6iIIePHqCZ5FT4LdgqabFo boArQRMp3xXzOvXBeXDsoKUvbI8AjYR2vOvjCyJWmgTpopFj+73MUQj/VKElVv7DgMIiIu HVXrTc2BdN9e0ttqxo1T9zkDesqgXxOvpuA9ceXRlD5ek2kdBO8rK4uq5D5NEQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1610471089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=BjHyx3TQA52ByPsCeTq6N8/6SlSmPZzIU106dD0/fYw=; b=J0FN5ZDzaq16C8M0zmNKp9Th8jxUyTdPHrkY+b/W+4Hf8ZWFnW/gJMBR3JEy3Xo18wKTAQ Rcs6OW9e4Kkiz/Dw== Date: Tue, 12 Jan 2021 18:01:37 +0100 From: Thomas Gleixner To: LKML Cc: Andrew Morton , linux-mm@kvack.org, Peter Zijlstra , Andreas Larsson , "David S. Miller" , sparclinux@vger.kernel.org, Paul Cercueil , Thomas Bogendoerfer , Michael Ellerman , linuxppc-dev@lists.ozlabs.org Subject: [patch 1/4] sparc/mm/highmem: Flush cache and TLB References: <20210112170136.078559026@linutronix.de> MIME-Version: 1.0 Content-transfer-encoding: 8-bit Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org The recent conversion to the generic kmap_local infrastructure failed to assign the proper pre/post map/unmap flush operations for sparc. Sparc requires cache flush before map/unmap and tlb flush afterwards. Fixes: 3293efa97807 ("sparc/mm/highmem: Switch to generic kmap atomic") Reported-by: Andreas Larsson Signed-off-by: Thomas Gleixner Cc: "David S. Miller" Cc: sparclinux@vger.kernel.org Tested-by: Andreas Larsson --- arch/sparc/include/asm/highmem.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/arch/sparc/include/asm/highmem.h +++ b/arch/sparc/include/asm/highmem.h @@ -50,10 +50,11 @@ extern pte_t *pkmap_page_table; #define flush_cache_kmaps() flush_cache_all() -/* FIXME: Use __flush_tlb_one(vaddr) instead of flush_cache_all() -- Anton */ -#define arch_kmap_local_post_map(vaddr, pteval) flush_cache_all() -#define arch_kmap_local_post_unmap(vaddr) flush_cache_all() - +/* FIXME: Use __flush_*_one(vaddr) instead of flush_*_all() -- Anton */ +#define arch_kmap_local_pre_map(vaddr, pteval) flush_cache_all() +#define arch_kmap_local_pre_unmap(vaddr) flush_cache_all() +#define arch_kmap_local_post_map(vaddr, pteval) flush_tlb_all() +#define arch_kmap_local_post_unmap(vaddr) flush_tlb_all() #endif /* __KERNEL__ */ From patchwork Tue Jan 12 17:01:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 1425320 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=sparclinux-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=tb0Nw+JZ; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=0NjtFpZU; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4DFcR21TTJz9sjB for ; Wed, 13 Jan 2021 04:05:50 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392269AbhALRFc (ORCPT ); Tue, 12 Jan 2021 12:05:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391149AbhALRFc (ORCPT ); Tue, 12 Jan 2021 12:05:32 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5D5BC061795; Tue, 12 Jan 2021 09:04:51 -0800 (PST) Message-Id: <20210112170411.056306194@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1610471090; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=ILrs8j28FO3zCfEleUzqqCm1xJVBHSVkYVI9ahwbtj0=; b=tb0Nw+JZctFWFFRaYBghqD30vzGGQq0xZ63WD+mafLo/BbBc9IVaP8WGFGYad7u0ml8URq MM2KCJ99mn7EnO4DDfE2431luacWhtmKhXlaq0vtVViKN9hEh6EqQ6EEGU1SK7iKJAUtxF 6cJfw7YGjQG3uDHarORNdNFeFkG42Auy8GxlmR5r9OuJYWsGvaOydpAsjyjFZ59dpikzAv adffa4Gr/O9qBds6RcF/6iPj7bXa8GgnMSOwrc+bWGTmrrgvpFlNTXznqRZ9EOcVSkGNWZ Xz+9vdXq1tYzgleIhIkKw6cAVNztEHnyNgmtfDgIc3HK5dEei5vepwA9ri3nAA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1610471090; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=ILrs8j28FO3zCfEleUzqqCm1xJVBHSVkYVI9ahwbtj0=; b=0NjtFpZUXugW2G2xT1Np0nXncnyBC7n1Akw+1YIn8I0EsqwCJze0+mqAfufkzOFyuLZc+S +KihGneOryXKSwBA== Date: Tue, 12 Jan 2021 18:01:38 +0100 From: Thomas Gleixner To: LKML Cc: Andrew Morton , linux-mm@kvack.org, Peter Zijlstra , Andreas Larsson , "David S. Miller" , sparclinux@vger.kernel.org, Paul Cercueil , Thomas Bogendoerfer , Michael Ellerman , linuxppc-dev@lists.ozlabs.org Subject: [patch 2/4] mm/highmem: Prepare for overriding set_pte_at() References: <20210112170136.078559026@linutronix.de> MIME-Version: 1.0 Content-transfer-encoding: 8-bit Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org The generic kmap_local() map function uses set_pte_at(), but MIPS requires set_pte() and PowerPC wants __set_pte_at(). Provide arch_kmap_local_set_pte() and default it to set_pte_at(). Signed-off-by: Thomas Gleixner --- mm/highmem.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/mm/highmem.c +++ b/mm/highmem.c @@ -473,6 +473,11 @@ static inline void *arch_kmap_local_high } #endif +#ifndef arch_kmap_local_set_pte +#define arch_kmap_local_set_pte(mm, vaddr, ptep, ptev) \ + set_pte_at(mm, vaddr, ptep, ptev) +#endif + /* Unmap a local mapping which was obtained by kmap_high_get() */ static inline bool kmap_high_unmap_local(unsigned long vaddr) { @@ -515,7 +520,7 @@ void *__kmap_local_pfn_prot(unsigned lon vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); BUG_ON(!pte_none(*(kmap_pte - idx))); pteval = pfn_pte(pfn, prot); - set_pte_at(&init_mm, vaddr, kmap_pte - idx, pteval); + arch_kmap_local_set_pte(&init_mm, vaddr, kmap_pte - idx, pteval); arch_kmap_local_post_map(vaddr, pteval); current->kmap_ctrl.pteval[kmap_local_idx()] = pteval; preempt_enable(); From patchwork Tue Jan 12 17:01:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 1425319 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=sparclinux-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=gXKVOF3f; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=Q/AYXgDR; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4DFcR05VRtz9sf9 for ; Wed, 13 Jan 2021 04:05:48 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392305AbhALRFe (ORCPT ); Tue, 12 Jan 2021 12:05:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392288AbhALRFd (ORCPT ); Tue, 12 Jan 2021 12:05:33 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08F91C06179F; Tue, 12 Jan 2021 09:04:53 -0800 (PST) Message-Id: <20210112170411.187513575@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1610471091; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=pTk1FcH5+/wyB8HB1QRJBoXsx85zfAu4dJubIkq5SzI=; b=gXKVOF3fh+FZwnz+sbLIbpsIqGtmfmcazChwcDdjZCPkH513hGnuY50e8hxBerCj+Wozq6 WjgYTVQGcNu19gSVoPSMUUdPEFQ6UewzPdWwBUpbQGo2dR9GuoXtYO5tLQghs+5Gjdhfvn apTCXHcWAlg1m4tdfKh2Fgae4QM+vz+2vlBm4AaiqkvBvmXsD/lmVr2DpvbTvOmvz+ugxx o++jLvhtnn57Ujm52fOxGmyjUtgnJ2JI/8kE5srw5yeujHTimsvfFlCi8JDN5enGNJgu8H gUy6dDFWPVPpAWxPgD0mWAXhgQoHM2Kh/3GuZjlZ99rD4A8Fm1EkjhsFkFaArQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1610471091; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=pTk1FcH5+/wyB8HB1QRJBoXsx85zfAu4dJubIkq5SzI=; b=Q/AYXgDRbN6MB0ck3kKpvdlAZd4tF/RVCxjLqReI6YlcdY4xdER6sSEIJpfVazoon1EasT Z/sRhKeZnnCkqaCg== Date: Tue, 12 Jan 2021 18:01:39 +0100 From: Thomas Gleixner To: LKML Cc: Andrew Morton , linux-mm@kvack.org, Peter Zijlstra , Paul Cercueil , Thomas Bogendoerfer , Andreas Larsson , "David S. Miller" , sparclinux@vger.kernel.org, Michael Ellerman , linuxppc-dev@lists.ozlabs.org Subject: [patch 3/4] mips/mm/highmem: Use set_pte() for kmap_local() References: <20210112170136.078559026@linutronix.de> MIME-Version: 1.0 Content-transfer-encoding: 8-bit Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org set_pte_at() on MIPS invokes update_cache() which might recurse into kmap_local(). Use set_pte() like the original MIPS highmem implementation did. Fixes: a4c33e83bca1 ("mips/mm/highmem: Switch to generic kmap atomic") Reported-by: Paul Cercueil Reported-by: Thomas Bogendoerfer Signed-off-by: Thomas Gleixner Acked-by: Thomas Bogendoerfer --- arch/mips/include/asm/highmem.h | 1 + 1 file changed, 1 insertion(+) --- a/arch/mips/include/asm/highmem.h +++ b/arch/mips/include/asm/highmem.h @@ -51,6 +51,7 @@ extern void kmap_flush_tlb(unsigned long #define flush_cache_kmaps() BUG_ON(cpu_has_dc_aliases) +#define arch_kmap_local_set_pte(mm, vaddr, ptep, ptev) set_pte(ptep, ptev) #define arch_kmap_local_post_map(vaddr, pteval) local_flush_tlb_one(vaddr) #define arch_kmap_local_post_unmap(vaddr) local_flush_tlb_one(vaddr) From patchwork Tue Jan 12 17:01:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 1425322 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=sparclinux-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=iOrQ2yzL; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=CxIH9jkB; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4DFcR72vCYz9sjD for ; Wed, 13 Jan 2021 04:05:55 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392242AbhALRFz (ORCPT ); Tue, 12 Jan 2021 12:05:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391806AbhALRFy (ORCPT ); Tue, 12 Jan 2021 12:05:54 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55229C0617A2; Tue, 12 Jan 2021 09:04:54 -0800 (PST) Message-Id: <20210112170411.281464308@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1610471092; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=lCQcsUW6BG2TViN9PATPu0nvlehpGiocV+x+/eINNhI=; b=iOrQ2yzL7qHCBZMxPC7End9fO2OxSIYpXRwgowQ+kbHLNZtaezvOR94fNwfVroCra3r4Ew BP1Ix24/uzar89ES2eJRfzvUGDOwogScWlMzV76pJo8FD6DZNSP85cyJJUT5Z/SvHDfVxQ d76g/BhCGzVnTM+e8iRAh+j1uaqXXRNdD/M6HzdNWRAf2nn3Ax/9PBrMTnOwDKJrIpAZif inUKRshmheImrOw6IypO8IVb813XGgw6SFS/SebA5YIKRivqRd8RvMNd/pr9H2NbPUqT8r GASetIkWO4dF+yELYnO3NATQJmWYI5uCS07afeSQj/9MjvMUb41Lwa0JFXCYMg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1610471092; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=lCQcsUW6BG2TViN9PATPu0nvlehpGiocV+x+/eINNhI=; b=CxIH9jkBW11gEiftSavoeDam6PfkbYmCUt93JwwJEGwDeGCrbr+M/BpvsPEseuYsWR26v1 MLveZEz3EE/eCIDQ== Date: Tue, 12 Jan 2021 18:01:40 +0100 From: Thomas Gleixner To: LKML Cc: Andrew Morton , linux-mm@kvack.org, Peter Zijlstra , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, Andreas Larsson , "David S. Miller" , sparclinux@vger.kernel.org, Paul Cercueil , Thomas Bogendoerfer Subject: [patch 4/4] powerpc/mm/highmem: Use __set_pte_at() for kmap_local() References: <20210112170136.078559026@linutronix.de> MIME-Version: 1.0 Content-transfer-encoding: 8-bit Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org The original PowerPC highmem mapping function used __set_pte_at() to denote that the mapping is per CPU. This got lost with the conversion to the generic implementation. Override the default map function. Fixes: 47da42b27a56 ("powerpc/mm/highmem: Switch to generic kmap atomic") Signed-off-by: Thomas Gleixner Cc: Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org --- arch/powerpc/include/asm/highmem.h | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/powerpc/include/asm/highmem.h +++ b/arch/powerpc/include/asm/highmem.h @@ -58,6 +58,8 @@ extern pte_t *pkmap_page_table; #define flush_cache_kmaps() flush_cache_all() +#define arch_kmap_local_set_pte(mm, vaddr, ptep, ptev) \ + __set_pte_at(mm, vaddr, ptep, ptev, 1) #define arch_kmap_local_post_map(vaddr, pteval) \ local_flush_tlb_page(NULL, vaddr) #define arch_kmap_local_post_unmap(vaddr) \