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 1EAF4C43466 for ; Sat, 19 Sep 2020 10:35:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D3BA52344C 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" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726279AbgISKf2 (ORCPT ); Sat, 19 Sep 2020 06:35:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726159AbgISKf1 (ORCPT ); Sat, 19 Sep 2020 06:35:27 -0400 Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D8E9C0613CE for ; Sat, 19 Sep 2020 03:35:27 -0700 (PDT) Received: by mail-ot1-x344.google.com with SMTP id u25so7844111otq.6 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=D1ZZFM4diDUZLcP2KpHh6+QEEyKx0l6Sn0OJ6xfA3AODPZ3878uBHLzyYhROug5Gw8 LKy7xIpZsBEadoTq69iQxoLL1R0mmsb4X1NkKJzgpbca+iZJCGYNjPP4stnBbbWMyMWx wopr/eIuuE56pRqTSCahyMaN97N9R+h39eezygzdgy+c0zTwW3Br8ZsxPRTWnD0HjESH kCOPVJB6XJ1925NS1MJrJTdl/sdocToAsOsqCH6ZLirx0D/amYCL+gbVD4qIgI75QXbn kiMgb9PRfW/m8KSFZi/zikuaFdAODgat2PNzpBcxaTq4fv9QkxXUQLBvIpwHDPed8OLZ lqCw== X-Gm-Message-State: AOAM530asI/O1gWo8bJOWOcDRtnAHvUy/xOAL+6sKqTEKwv9KOXu27wQ xp7m6Oayk6dyv69loszs7tn4Qu6qlF/hSMot5g2P7A== 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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