From patchwork Wed Nov 18 19:48:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 11915847 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_NONE autolearn=ham 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 EFD54C5519F for ; Wed, 18 Nov 2020 20:58:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2243D2075B for ; Wed, 18 Nov 2020 20:58:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="TJRKGnvp"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ybiGAa/B" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2243D2075B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0D0C76B0036; Wed, 18 Nov 2020 15:58:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 05AC66B005C; Wed, 18 Nov 2020 15:58:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E634B6B005D; Wed, 18 Nov 2020 15:58:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0035.hostedemail.com [216.40.44.35]) by kanga.kvack.org (Postfix) with ESMTP id B796A6B0036 for ; Wed, 18 Nov 2020 15:58:34 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 5D0331EE6 for ; Wed, 18 Nov 2020 20:58:34 +0000 (UTC) X-FDA: 77498752548.13.smash62_6203e1f2733d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin13.hostedemail.com (Postfix) with ESMTP id 3967A18140B69 for ; Wed, 18 Nov 2020 20:58:34 +0000 (UTC) X-HE-Tag: smash62_6203e1f2733d X-Filterd-Recvd-Size: 7436 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Wed, 18 Nov 2020 20:58:33 +0000 (UTC) Message-Id: <20201118194838.753436396@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1605733111; 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=0069BgO4zunZ3BCjdQm1WHTDs++SOImFblflaj//gkw=; b=TJRKGnvplKgd6QcumiiUu9p4bIhWKnGhSBpOEvBNwv6IK7UoCTR9JjruR8MKTzVfEnWokz dgyJfqaLS2oWCxqVU0xc5amAXQNcLSDYRdR32Z1OWllWjgHOqah0sVTWlG+ar2KgqqcyEQ 6YygJeSSkT/GqAKKzn4CfYviux/CSACm9jOsQ8L+k+fo7omgj1+dpeF+sRccDCBz+XkJLw gA6OjnfbYepJeTyrCrbWhJIIG4cTyJnhte18zOLGKk5iRO+VVrfY6VDU4w94wZN70g1ulu ZUE9VreELU9M6+hwihFVhZJ2OVoYYwLSg3p8apwj2bv24Artqqp5wf8jJuXquA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1605733111; 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=0069BgO4zunZ3BCjdQm1WHTDs++SOImFblflaj//gkw=; b=ybiGAa/BXJpeqCiRjSCJrFO+k32vi+9Bfxy2iNTt/0ERftQSvvXRaysX/WuZi5ysY+YoID 30gVLTux2uC7vzBA== Date: Wed, 18 Nov 2020 20:48:38 +0100 From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Linus Torvalds , Christoph Hellwig , Matthew Wilcox , Daniel Vetter , Andrew Morton , linux-mm@kvack.org, Linus Torvalds , Peter Zijlstra , Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira Subject: [patch V4 0/8] mm/highmem: Preemptible variant of kmap_atomic & friends MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This is the outstanding set of patches for the preemptible kmap_*() implementation. The previous version is here: https://lore.kernel.org/r/20201103092712.714480842@linutronix.de The following changes come with it: - Better debugging for kmap* by enforcing the temporary mappings even for lowmem pages when the architecture allows it. - Support for enforced mappings on X86 for both 32 and 64 bit. As KMAP_LOCAL is already independent from HIGHMEM this needs only the extra fixmap space on 64bit and no further code changes. - Removing the RT dependency from migrate_disable/enable(). This patch still needs some help from the scheduler folks vs. the comment in preempt.h. - Switching from per CPU storage of the kmap index to a per task storage by 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_local*() 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_local(). Changes vs. V3: - Rebased on top of the merged consolidation patches and on top of the latest version of migrate disable support. - New debug features (enforced mappings) - Dropped the conversion patches as they need review from the respective subsystems and better go through the relevant trees for 5.12 The series is based on git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core/mm with git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core merged in. It is also available from git: git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git highmem Thanks, tglx --- Documentation/driver-api/io-mapping.rst | 74 +++++++++++-------- arch/x86/Kconfig | 1 arch/x86/include/asm/fixmap.h | 12 ++- arch/x86/include/asm/pgtable_64_types.h | 6 + arch/x86/kernel/crash_dump_32.c | 48 ++---------- include/asm-generic/kmap_size.h | 2 include/linux/highmem-internal.h | 58 +++++++++++++++ include/linux/highmem.h | 43 +++++++---- include/linux/io-mapping.h | 30 +++++++ include/linux/kernel.h | 21 +++-- include/linux/preempt.h | 38 ---------- include/linux/sched.h | 11 ++ kernel/entry/common.c | 2 kernel/fork.c | 1 kernel/sched/core.c | 63 ++++++++++++++-- kernel/sched/sched.h | 4 - lib/Kconfig.debug | 22 +++++ lib/smp_processor_id.c | 2 mm/highmem.c | 121 ++++++++++++++++++++++++++++---- 19 files changed, 400 insertions(+), 159 deletions(-)