From mboxrd@z Thu Jan 1 00:00:00 1970 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=-8.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 3CE9EC43467 for ; Sat, 19 Sep 2020 10:35:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9F0EB21D42 for ; Sat, 19 Sep 2020 10:35:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="EVzELTGq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9F0EB21D42 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CEF566B0037; Sat, 19 Sep 2020 06:35:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C79FC8E0001; Sat, 19 Sep 2020 06:35:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B41236B005A; Sat, 19 Sep 2020 06:35:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0019.hostedemail.com [216.40.44.19]) by kanga.kvack.org (Postfix) with ESMTP id 997B16B0037 for ; Sat, 19 Sep 2020 06:35:28 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 5C7B98249980 for ; Sat, 19 Sep 2020 10:35:28 +0000 (UTC) X-FDA: 77279454336.04.chalk44_180a24827133 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id 42AB3800C8B1 for ; Sat, 19 Sep 2020 10:35:28 +0000 (UTC) X-HE-Tag: chalk44_180a24827133 X-Filterd-Recvd-Size: 9182 Received: from mail-ot1-f65.google.com (mail-ot1-f65.google.com [209.85.210.65]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Sat, 19 Sep 2020 10:35:27 +0000 (UTC) Received: by mail-ot1-f65.google.com with SMTP id m13so3338192otl.9 for ; Sat, 19 Sep 2020 03:35:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=el+Z1rLUwIg0Lo19W7bciojCg78mYjD/sa8mCUQGhXg=; b=EVzELTGqNpOCv+xxoHTDIB+JfH6R+bJea1X1ICZfYUUSwyVqtWZK8FGT/+012CWynI JZJ90/eXttC7sXGHMV6vVDJiFkkgzC9M1+Jr+djbqhC9yIsLWNmlmHNtqfOJm783H4QN 20i+/s03YOHbsQdMI48ii5Hoj/X8m7lQJqJ4w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=el+Z1rLUwIg0Lo19W7bciojCg78mYjD/sa8mCUQGhXg=; b=gfcdKPDKAqFlBM3XN+LgXyPNGCSR5tIT44pavPqVKoo5CeJ/uLxjJLfaeta5RfFBi2 b6HDEL6hx+1qFqAS8jdkO/mqImEkiN6XQjvXjOMT14/m1MqG3LtlyojVJoPaFqwoIbNM zH2TUYyusm41Zwl7BGozSLeOL/WSn0+bXSSeBuEObzBbFkr2V7HybolHE1s5dzEuwN4y pMC7BBkh98FBoJyKOpDAJub7AFtIMifMnEt0xge9LmVRSBXD7SGK1HcfcFhp1cD9FpuF 7Xd+uJXm82rfghK2nlolEScEqfXQ2RfOJZgWVQHhtd6g/F1RKXI911Snl2J9chgUfkgw t0xw== X-Gm-Message-State: AOAM530BuPctolY6heUf3AS9taPBRruj6x6IuE0FPZxj8rN4reFJY3T8 XmktNLPW1TJGTZE1CzgWREO0tS9kBKn9/ot3yQBGYw== X-Google-Smtp-Source: ABdhPJxt+kM+c4sGqm0VngBIRvBEF3eOuAoLdZF9ShbveHjPXujfxmRvD8dORjLp/h2eldKD21rGXbvHdOMaT6H1ALo= X-Received: by 2002:a05:6830:1e56:: with SMTP id e22mr24822187otj.303.1600511726492; Sat, 19 Sep 2020 03:35:26 -0700 (PDT) MIME-Version: 1.0 References: <20200919091751.011116649@linutronix.de> In-Reply-To: <20200919091751.011116649@linutronix.de> From: Daniel Vetter Date: Sat, 19 Sep 2020 12:35:15 +0200 Message-ID: Subject: Re: [patch RFC 00/15] mm/highmem: Provide a preemptible variant of kmap_atomic & friends To: Thomas Gleixner Cc: LKML , "open list:GENERIC INCLUDE/A..." , Linus Torvalds , Paul McKenney , X86 ML , Sebastian Andrzej Siewior , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Will Deacon , Andrew Morton , Linux-MM , Russell King , Linux ARM , Chris Zankel , Max Filippov , linux-xtensa@linux-xtensa.org, Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , intel-gfx , dri-devel , Ard Biesheuvel , Herbert Xu , Vineet Gupta , arcml , Arnd Bergmann , Guo Ren , linux-csky@vger.kernel.org, Michal Simek , Thomas Bogendoerfer , linux-mips@vger.kernel.org, Nick Hu , Greentime Hu , Vincent Chen , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , linuxppc-dev , "David S. Miller" , sparclinux@vger.kernel.org Content-Type: text/plain; charset="UTF-8" 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: On Sat, Sep 19, 2020 at 11:50 AM Thomas Gleixner wrote: > > 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 I think it should be the case, but I want to double check: Will copy_*_user be allowed within a kmap_temporary section? This would allow us to ditch an absolute pile of slowpaths. -Daniel > > 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(-) -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch