Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1824640pxk; Sat, 19 Sep 2020 03:36:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzT1W5tBwuwkfekXXLcWB4g8awh6QqyO7KZhZ+Yor2RlMs/jUxydJ1qYtmF8XKoWFwjfWSf X-Received: by 2002:a50:fd83:: with SMTP id o3mr42262858edt.176.1600511804358; Sat, 19 Sep 2020 03:36:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600511804; cv=none; d=google.com; s=arc-20160816; b=gGd2VE9nX1VaeTGXdA/kQ8wdrT1FurLpqHBBVRawhN/na3MdT0vqIp9YqAbijLn2AS U4Mi3ZAiDUoX6YSGMM5XhBomc81QsbxFKVT4amrCcYNkzOePtG2ayAwMWBdzutH2axmY 1xFvzzLoUFyFkb+rfe0X26DMZ3CAKxI2ly8Nsg2J98fHHdmEuSDXpi7eHntTQ/zbw4kX VpibYukNV4bIHxtuhzIjmSCwfbmqtGRWZaSi+KnZ67hsHmh02/CC6J2efKWG+tlhWC2H rUweDOAlW1zTbNHZl/MWuAe7SCqkEL53rfda1M3d2HE+3wf3reXkh+5iSYCdyt2D+AHI JPaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=el+Z1rLUwIg0Lo19W7bciojCg78mYjD/sa8mCUQGhXg=; b=wfHxDWngMZcVqiZG65P3DOP6i799AxassE26HcJ0LnY+51fMbKX46EluOzqdftw3qF uFPjgJZXQOiENrRBypVsXzeP5i2i5C+Bi6JIL2Mc2isbXHiBZAqqs0Kxfz2eosTvgUdi Ki+YTGAiWwDxALsJ+Wjb8ogcbMQz92z5TrFEIrYJe+5zOyEcFKlfBrEZIYbZ+ijccgY4 YLqd++F1z1mPhG9k9h0lQiE9uzrSNUZoANSx7WyYGxvcGB6x+r0bO8AD221RxorFL3cg h6X+0+pM808M1qyUQNbmucheBqrNldHXdh3Pq3lwLiPX43tSp2GUNzxqeNeGsVE0JbVS AknQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=EVzELTGq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t12si5248196edc.310.2020.09.19.03.36.19; Sat, 19 Sep 2020 03:36:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=EVzELTGq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726170AbgISKf2 (ORCPT + 99 others); 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-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