Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2375959pxk; Sun, 20 Sep 2020 01:26:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXnJ3J2TQTevDOZO02mqSXGvRn6qcnqavBS3PoH0mgr2I8P8+eQIYW36PVoNYYnvmDrG77 X-Received: by 2002:aa7:d296:: with SMTP id w22mr47314496edq.327.1600590398671; Sun, 20 Sep 2020 01:26:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600590398; cv=none; d=google.com; s=arc-20160816; b=pSDcS7vVYJ1OiMakOLa0DTaTZVJ/kTpC8XNrrGWE4ns/WPPSkgYKbmDD2XFz/1nQvE j0YVaDSKQG11sdOl/FTSvoRDl0pc+9fAsy22x9ji4svG8MTWoywC0PF17zmMKYrULlvx EKIY5ZMz2rj22hKT8kE6wcmnzu9+1BYji8mtupjUfTz0BWy4OdScUnZOPBhsXwuOg0fG XzqfzOAd3Ct5GTTZrH4moqhD8WjuA+nAfX/OVZHYaX7UzbiWUWO/UN9y8L/WaiF/YE9s sSwMT8KbUXZW+fhZaSUyBctdOXcAlmBe5cgYiBMTj1drm1YycENwTUhIrKByr4Kp7Wdt pjAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=QW/8f02YUz9CyJxz2jJDAPCwQUNyEsIs6ErdQRH78bk=; b=ni5d7X04XNBz2wpL/wrGlSPNz7B/2gpfPC8oFB3X1kW+8oEZ3semm3EikHnfGUlI+W dL97JVGJIC1N5aVNpyRNmLSPfIyJoBHFcSh9I5bnC73Q3HIfJijU1EkAxVpO6oJYzszx VXtOspiFe/txHiIVTvcw8m1SC1icSFEzT+MtevZDKrjZ0rgYSTAoMiceQfe3sYZaxu0f bZeLlozMSIMNb2g2u0dRvCsn9tNQiEGKtVGpgRjJlgurRQh27Rnc7jDqoYXvE80EQpv3 vTYCLNGAgiPinCzZAEum5JzVsidDxJeuahucYlGDxs3rTCf7r1FLrwxewAw6LNIXh3eb lkEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=KpEMjAVs; 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 j22si7172785eds.357.2020.09.20.01.25.48; Sun, 20 Sep 2020 01:26:38 -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=KpEMjAVs; 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 S1726315AbgITIYA (ORCPT + 99 others); Sun, 20 Sep 2020 04:24:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726262AbgITIX7 (ORCPT ); Sun, 20 Sep 2020 04:23:59 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10892C0613CF for ; Sun, 20 Sep 2020 01:23:58 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id e16so9658788wrm.2 for ; Sun, 20 Sep 2020 01:23:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=QW/8f02YUz9CyJxz2jJDAPCwQUNyEsIs6ErdQRH78bk=; b=KpEMjAVsWIsf6j85U5lGiCQk94IKAbNlzJpqqh7UlpZP+uHxVyI9xbDPp+PEj35Klr Fp0pmrJPV4QcEqfbWznBKmcAQ+Q7J+2NCTy4gUD/Rd5fRLvQ3GCVnl4V8YU78MIWGtmi zOs5T/os04dSRrngCDI5iUuJvEbe2rp33EGPI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=QW/8f02YUz9CyJxz2jJDAPCwQUNyEsIs6ErdQRH78bk=; b=RoiJa5VCIF4rAzYyKHZnq8GeQqAHmMH+ajnreH2A4Ah3zEBW1uIo3IWCuUS/aW8/VS 9+DpEoIWty3x8nrTu7CkWd2SDm8Noa2vpZk3Y8IjegE9Uw/2SMw7Ka8g/QckpowMwWtF ww0SzYRofTX0BUgRQCvp2YwSd3HvPFjuvOPD7fcBsgqCY5dLq6eEanvz59f80dXIugxm yyhYZ/Vn0ulDdzGr07yCKCTWvDPZR00P1K5oqEsG9KwbOFqPOWd9o3brT2mPKzCY870L M9YJrMZkrSnKU9T2ZYR8UPng5vB5oYClUXJWdNz804xbVsag7QgGVFsQdnXArdLMNz84 8NOQ== X-Gm-Message-State: AOAM5313BRozmjHtfYm1SBhWawfj5K0/UQinP6NoifwJOvl0KyVH3wkn E/ElJX3zDF+y+f5hT4TaeKfVng== X-Received: by 2002:a5d:6886:: with SMTP id h6mr48291568wru.374.1600590237536; Sun, 20 Sep 2020 01:23:57 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id i16sm13867150wrq.73.2020.09.20.01.23.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Sep 2020 01:23:56 -0700 (PDT) Date: Sun, 20 Sep 2020 10:23:53 +0200 From: Daniel Vetter To: Thomas Gleixner Cc: Daniel Vetter , 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 Subject: Re: [patch RFC 00/15] mm/highmem: Provide a preemptible variant of kmap_atomic & friends Message-ID: <20200920082353.GG438822@phenom.ffwll.local> Mail-Followup-To: Thomas Gleixner , 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 References: <20200919091751.011116649@linutronix.de> <87pn6hc6g1.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87pn6hc6g1.fsf@nanos.tec.linutronix.de> X-Operating-System: Linux phenom 5.7.0-1-amd64 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Sep 20, 2020 at 08:23:26AM +0200, Thomas Gleixner wrote: > On Sat, Sep 19 2020 at 12:37, Daniel Vetter wrote: > > On Sat, Sep 19, 2020 at 12:35 PM Daniel Vetter wrote: > >> 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. > > > > (coffee just kicked in) copy_*_user is ofc allowed, but if you hit a > > page fault you get a short read/write. This looks like it would remove > > the need to handle these in a slowpath, since page faults can now be > > served in this new kmap_temporary sections. But this sounds too good > > to be true, so I'm wondering what I'm missing. > > In principle we could allow pagefaults, but not with the currently > proposed interface which can be called from any context. Obviously if > called from atomic context it can't handle user page faults. Yeah that's clear, but does the implemention need to disable pagefaults unconditionally? > In theory we could make a variant which does not disable pagefaults, but > that's what kmap() already provides. Currently we have a bunch of code which roughly does kmap_atomic(); copy_*_user(); kunmap_atomic(); if (short_copy_user) { kmap(); copy_*_user(remaining_stuff); kunmap(); } And the only reason is that kmap is a notch slower, hence the fastpath. If we get a kmap which is fast and allows pagefaults (only in contexts that allow pagefaults already ofc) then we can ditch a pile of kmap users. Cheers, Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch