From patchwork Sat Sep 19 09:17:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 11786907 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DEFFC746 for ; Sat, 19 Sep 2020 09:52:19 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AADDF21582 for ; Sat, 19 Sep 2020 09:52:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rLFxOHjn"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ul0AzmKX"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="KbJ6GiNR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AADDF21582 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Subject:To:From:Date:Message-Id: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=VH7vun0/EJe3tivt2PHLbz8APc6vicjbcZQtcyEllfw=; b=rLFxOHjngc5u+WS8YFa7tWvx0V XFmyQ4eqRu0ciAl/dgrDup1so2jsryJRPtjf6041ggawMHNdzo5vqOSPG69LnVLnI0w8wWFl/1oWm mgb22EeYO0G0lrK6NFAjQIRj2tBoYQmzuvD+3V/mvWnUycCFZoDelLIi1eHpmQ87kOKO0bHGaVh6r iyN8onZDzm/sVV6HSRzTwd41KVFpfTReZaaYHpmFyybuNtwWoLgLugR808H8sklKKvsbdhCUwOgzx Zdh6F1PtQWmSlT7sCxlzQWDzOl8S/EZiin0y/t50EXOicnnTPreasfxsBk0Fk9V0X0xte79tq7AsW +sn13p9w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kJZVY-0003K3-5I; Sat, 19 Sep 2020 09:50:16 +0000 Received: from galois.linutronix.de ([193.142.43.55]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kJZVL-0003Ax-H3; Sat, 19 Sep 2020 09:50:04 +0000 Message-Id: <20200919091751.011116649@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1600509000; 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; bh=wXMSkZdDTGr2cnZMoKDSJw7MNirhJVzX4vOCHJbvoN0=; b=ul0AzmKXYj0qCi93y+r/rwwgxSXPin2sTe3PYhi7zjaY3NKa41EvWRmaZkAKju2f4qLfIs i1aVPwNRkUKTlsYfZfyyB/zi5KZf7ZY7OD58PCvZV59UcRuCOhEQsNPck5r1VuTJtHi72C +LNe+RY18cKtN3h7SPt+666fUzU5ch+DkMG/6qPFHiUag3Vd24Fa5TJBueGpK9wLzW3bo0 IscYJhM/dQECgU1ilCEI7V6IMnuxdAonST0geBGtFlUWgd5xXJJx546wfo5abrk+4cO8Sx euhWyLJDvleHSJCh+QF6n/GwOhvNr9+hHKu+6tM3Z9VRQSgIOxJikgFGusnWsg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1600509000; 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; bh=wXMSkZdDTGr2cnZMoKDSJw7MNirhJVzX4vOCHJbvoN0=; b=KbJ6GiNRGpCyvVdElEw4H+4LtrSHxOXy5YeKjcqGSrhkBp5nKWiHepRirVJ50oI9WjzN2D 1DCAFhaD9E835KBw== Date: Sat, 19 Sep 2020 11:17:51 +0200 From: Thomas Gleixner To: LKML Subject: [patch RFC 00/15] mm/highmem: Provide a preemptible variant of kmap_atomic & friends MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200919_055003_785957_F831A945 X-CRM114-Status: GOOD ( 14.21 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [193.142.43.55 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juri Lelli , Peter Zijlstra , Benjamin Herrenschmidt , Sebastian Andrzej Siewior , Joonas Lahtinen , dri-devel , Ben Segall , Max Filippov , Guo Ren , sparclinux@vger.kernel.org, Vincent Chen , Will Deacon , Ard Biesheuvel , linux-arch@vger.kernel.org, Vincent Guittot , Herbert Xu , Michael Ellerman , x86@kernel.org, Russell King , linux-csky@vger.kernel.org, David Airlie , Mel Gorman , linux-snps-arc@lists.infradead.org, linux-xtensa@linux-xtensa.org, Paul McKenney , intel-gfx , linuxppc-dev@lists.ozlabs.org, Steven Rostedt , Linus Torvalds , Jani Nikula , Rodrigo Vivi , Dietmar Eggemann , Linux ARM , Chris Zankel , Michal Simek , Thomas Bogendoerfer , Nick Hu , Linux-MM , Vineet Gupta , linux-mips@vger.kernel.org, Arnd Bergmann , Daniel Vetter , Paul Mackerras , Andrew Morton , Daniel Bristot de Oliveira , "David S. Miller" , Greentime Hu Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org First of all, sorry for the horribly big Cc list! Following up to the discussion in: https://lore.kernel.org/r/20200914204209.256266093@linutronix.de this provides a preemptible variant of kmap_atomic & related interfaces. This is achieved by: - Consolidating all kmap atomic implementations in generic code - Switching from per CPU storage of the kmap index to a per task storage - Adding a pteval array to the per task storage which contains the ptevals of the currently active temporary kmaps - Adding context switch code which checks whether the outgoing or the incoming task has active temporary kmaps. If so, the outgoing task's kmaps are removed and the incoming task's kmaps are restored. - Adding new interfaces k[un]map_temporary*() which are not disabling preemption and can be called from any context (except NMI). Contrary to kmap() which provides preemptible and "persistant" mappings, these interfaces are meant to replace the temporary mappings provided by kmap_atomic*() today. This allows to get rid of conditional mapping choices and allows to have preemptible short term mappings on 64bit which are today enforced to be non-preemptible due to the highmem constraints. It clearly puts overhead on the highmem users, but highmem is slow anyway. This is not a wholesale conversion which makes kmap_atomic magically preemptible because there might be usage sites which rely on the implicit preempt disable. So this needs to be done on a case by case basis and the call sites converted to kmap_temporary. Note, that this is only lightly tested on X86 and completely untested on all other architectures. The lot is also available from git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git highmem Thanks, tglx --- a/arch/arm/mm/highmem.c | 121 --------------------- a/arch/microblaze/mm/highmem.c | 78 ------------- a/arch/nds32/mm/highmem.c | 48 -------- a/arch/powerpc/mm/highmem.c | 67 ----------- a/arch/sparc/mm/highmem.c | 115 -------------------- arch/arc/Kconfig | 1 arch/arc/include/asm/highmem.h | 8 + arch/arc/mm/highmem.c | 44 ------- arch/arm/Kconfig | 1 arch/arm/include/asm/highmem.h | 30 +++-- arch/arm/mm/Makefile | 1 arch/csky/Kconfig | 1 arch/csky/include/asm/highmem.h | 4 arch/csky/mm/highmem.c | 75 ------------- arch/microblaze/Kconfig | 1 arch/microblaze/include/asm/highmem.h | 6 - arch/microblaze/mm/Makefile | 1 arch/microblaze/mm/init.c | 6 - arch/mips/Kconfig | 1 arch/mips/include/asm/highmem.h | 4 arch/mips/mm/highmem.c | 77 ------------- arch/mips/mm/init.c | 3 arch/nds32/Kconfig.cpu | 1 arch/nds32/include/asm/highmem.h | 21 ++- arch/nds32/mm/Makefile | 1 arch/powerpc/Kconfig | 1 arch/powerpc/include/asm/highmem.h | 6 - arch/powerpc/mm/Makefile | 1 arch/powerpc/mm/mem.c | 7 - arch/sparc/Kconfig | 1 arch/sparc/include/asm/highmem.h | 7 - arch/sparc/mm/Makefile | 3 arch/sparc/mm/srmmu.c | 2 arch/x86/include/asm/fixmap.h | 1 arch/x86/include/asm/highmem.h | 12 +- arch/x86/include/asm/iomap.h | 29 +++-- arch/x86/mm/highmem_32.c | 59 ---------- arch/x86/mm/init_32.c | 15 -- arch/x86/mm/iomap_32.c | 57 ---------- arch/xtensa/Kconfig | 1 arch/xtensa/include/asm/highmem.h | 9 + arch/xtensa/mm/highmem.c | 44 ------- b/arch/x86/Kconfig | 3 include/linux/highmem.h | 141 +++++++++++++++--------- include/linux/io-mapping.h | 2 include/linux/sched.h | 9 + kernel/sched/core.c | 10 + mm/Kconfig | 3 mm/highmem.c | 192 ++++++++++++++++++++++++++++++++-- 49 files changed, 422 insertions(+), 909 deletions(-)