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=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 04AADC4346D for ; Sun, 20 Sep 2020 08:24:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BD38820897 for ; Sun, 20 Sep 2020 08:24:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="KpEMjAVs" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726332AbgITIYA (ORCPT ); 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-Google-Smtp-Source: ABdhPJxNYcqTcvbH9VqF1Sc6UfalSbf2k2pQjIV2s6WyfB9ecjNuyH5YNGsmVXrxzF1y/be4tY28HQ== 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Date: Sun, 20 Sep 2020 08:23:53 +0000 Subject: Re: [patch RFC 00/15] mm/highmem: Provide a preemptible variant of kmap_atomic & friends Message-Id: <20200920082353.GG438822@phenom.ffwll.local> List-Id: References: <20200919091751.011116649@linutronix.de> <87pn6hc6g1.fsf@nanos.tec.linutronix.de> In-Reply-To: <87pn6hc6g1.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Thomas Gleixner Cc: Juri Lelli , Peter Zijlstra , Sebastian Andrzej Siewior , dri-devel , linux-mips@vger.kernel.org, Ben Segall , Max Filippov , Guo Ren , sparclinux@vger.kernel.org, Vincent Chen , Will Deacon , Ard Biesheuvel , "open list:GENERIC INCLUDE/A..." , Vincent Guittot , Herbert Xu , Michael Ellerman , X86 ML , Russell King , linux-csky@vger.kernel.org, David Airlie , Mel Gorman , arcml , linux-xtensa@linux-xtensa.org, Paul McKenney , intel-gfx , linuxppc-dev , Steven Rostedt , Linus Torvalds , Rodrigo Vivi , Dietmar Eggemann , Linux ARM , Chris Zankel , Michal Simek , Thomas Bogendoerfer , Nick Hu , Linux-MM , Vineet Gupta , LKML , Arnd Bergmann , Paul Mackerras , Andrew Morton , Daniel Bristot de Oliveira , "David S. Miller" , Greentime Hu 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 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=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 8AAA4C43465 for ; Sun, 20 Sep 2020 08:25:58 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B0C3520809 for ; Sun, 20 Sep 2020 08:25:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="KpEMjAVs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B0C3520809 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BvLHk6xtZzDqk8 for ; Sun, 20 Sep 2020 18:25:54 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=ffwll.ch (client-ip=2a00:1450:4864:20::444; helo=mail-wr1-x444.google.com; envelope-from=daniel@ffwll.ch; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=ffwll.ch header.i=@ffwll.ch header.a=rsa-sha256 header.s=google header.b=KpEMjAVs; dkim-atps=neutral Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4BvLFb4jrnzDqsx for ; Sun, 20 Sep 2020 18:24:01 +1000 (AEST) Received: by mail-wr1-x444.google.com with SMTP id m6so9663124wrn.0 for ; Sun, 20 Sep 2020 01:24:01 -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=JnVM4fIQEQOCuPebGEZEw2uEkRBwJVYMhSynFPUP4toA6wlTl6wyKmmu1FBBbWQnpk BmD3J9EXUYJxWST4BaKKanwUAMp93CyZpRbbi2Xdb3sg7g2JnoJ1AJU9dH2zr3gpLRZu olC0KBlT32DOuQ1tGZMMclLQrjeINn1xZ6PTg7C6fBQlLa4yTThJ4Rp8NEn7qWNKd05G 8pkhfV9WbdHT5vnxtzWNCNSTCop5MPFLpR8eauzAT7JOsVAKeqQ7G3SwO+LxC+Z7ZGgp DKCz+nfVqpKJCQHfo7GNC86a7pkHhWbSVpPzqHmZYQfu8kguhcDwsFYNwBTbG2fsVAn1 e92Q== X-Gm-Message-State: AOAM532NGnXrL8kZ4Fpi1lRvQDRmyClBxwQAMK9bR1n+UuR+MmeZXlUH nARR8B0ZvIPcB/bQNxRYMxnnYA== X-Google-Smtp-Source: ABdhPJxNYcqTcvbH9VqF1Sc6UfalSbf2k2pQjIV2s6WyfB9ecjNuyH5YNGsmVXrxzF1y/be4tY28HQ== 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 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 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juri Lelli , Peter Zijlstra , Sebastian Andrzej Siewior , Joonas Lahtinen , dri-devel , linux-mips@vger.kernel.org, Ben Segall , Max Filippov , Guo Ren , sparclinux@vger.kernel.org, Vincent Chen , Will Deacon , Ard Biesheuvel , "open list:GENERIC INCLUDE/A..." , Vincent Guittot , Herbert Xu , X86 ML , Russell King , linux-csky@vger.kernel.org, David Airlie , Mel Gorman , arcml , linux-xtensa@linux-xtensa.org, Paul McKenney , intel-gfx , linuxppc-dev , Steven Rostedt , Linus Torvalds , Jani Nikula , Rodrigo Vivi , Dietmar Eggemann , Linux ARM , Chris Zankel , Michal Simek , Thomas Bogendoerfer , Nick Hu , Linux-MM , Vineet Gupta , LKML , Arnd Bergmann , Daniel Vetter , Paul Mackerras , Andrew Morton , Daniel Bristot de Oliveira , "David S. Miller" , Greentime Hu Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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 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=-5.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 9A70BC4346A for ; Sun, 20 Sep 2020 08:24:07 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8BFA520897 for ; Sun, 20 Sep 2020 08:24:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="raTNdm5a"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="KpEMjAVs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8BFA520897 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-snps-arc-bounces+linux-snps-arc=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=kwQC8mrozSAjo569PJzX2nm09hoG7uCNkpdKLvorro8=; b=raTNdm5axEIHYPrfl2G/VACwC x7yEuXJ8XuUmqmt6FHAiytUm9dKQSIYDq+OgPBq0DkoeXzkFKOA1mYhaWOwZVz7Da+4EZP6A/P34N aNJ6w0SD5Oz7CMAcIY49KuvMoQNLZlkYGSWOXhy1L2gnzrQKZwMJpEFLoyvi3studBX/ND2ND3Z0W jSVN9WoQmWAeo6QaQmziKiaiCl/uLc0I+qjaXrMRh+SoSK1lLD6RslVlXk8T5lsTYlM6rY1p2eBKX MLR1RSYWYR71VRzi0VJmA+6SEI75rhwrhTCyiInuHnoVQqCr8Xc74pcJMiUP7UaPjdg1bMG4BofwZ l8j++dFyw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kJudh-0001zR-Fl; Sun, 20 Sep 2020 08:24:05 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kJudd-0001xs-U3 for linux-snps-arc@lists.infradead.org; Sun, 20 Sep 2020 08:24:03 +0000 Received: by mail-wr1-x442.google.com with SMTP id g4so9636419wrs.5 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=T3k5jISw/yKtUkWEHNBcJU4RhDv+M9lNJKnF393+OeXTQlbE+DmquQKc+htAjeRBlw 6iXexXxk49wfu+tEP1dEz6WSeSMviZmMaX8vRdzPvwLPjz/dt3K9rZx4uR84aHRY/3Pp fRryTR52BA/8E+Qd7uiiwA5L79SPN++fX9Sx5w4C1pToxPVI92NWZZZcEVna+e9ZXRyv JOC4qzCamWtZOTGPnWx02t45uy3z7B3UkyS0i9uXrCSlYBiCIMvwNBjpCTWXvQ2XNrWJ +GTRaSJQ0j7seBlzoZEjIJPu2YwEpy2dHFYLTKzE3/jY0O8q+s2aslQ4NyLon1AulZGt Kh3w== X-Gm-Message-State: AOAM533JILLSUzrf7drj8oesw6DJFRVCacHaY8WT21lpSI4Cby+vN23Z cleu606fc6r6ZI2OwGlRGyl0Bw== X-Google-Smtp-Source: ABdhPJxNYcqTcvbH9VqF1Sc6UfalSbf2k2pQjIV2s6WyfB9ecjNuyH5YNGsmVXrxzF1y/be4tY28HQ== 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 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-Disposition: inline In-Reply-To: <87pn6hc6g1.fsf@nanos.tec.linutronix.de> X-Operating-System: Linux phenom 5.7.0-1-amd64 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200920_042401_992567_C418857D X-CRM114-Status: GOOD ( 23.40 ) X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juri Lelli , Peter Zijlstra , Benjamin Herrenschmidt , Sebastian Andrzej Siewior , Joonas Lahtinen , dri-devel , linux-mips@vger.kernel.org, Ben Segall , Max Filippov , Guo Ren , sparclinux@vger.kernel.org, Vincent Chen , Will Deacon , Ard Biesheuvel , "open list:GENERIC INCLUDE/A..." , Vincent Guittot , Herbert Xu , Michael Ellerman , X86 ML , Russell King , linux-csky@vger.kernel.org, David Airlie , Mel Gorman , arcml , linux-xtensa@linux-xtensa.org, Paul McKenney , intel-gfx , linuxppc-dev , Steven Rostedt , Linus Torvalds , Jani Nikula , Rodrigo Vivi , Dietmar Eggemann , Linux ARM , Chris Zankel , Michal Simek , Thomas Bogendoerfer , Nick Hu , Linux-MM , Vineet Gupta , LKML , Arnd Bergmann , Daniel Vetter , Paul Mackerras , Andrew Morton , Daniel Bristot de Oliveira , "David S. Miller" , Greentime Hu Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+linux-snps-arc=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc 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=-5.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 B6E85C43465 for ; Sun, 20 Sep 2020 08:26:15 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1B1EE2084C for ; Sun, 20 Sep 2020 08:26:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="WT2ZBdCL"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="KpEMjAVs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1B1EE2084C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=yENsg3ESB0ILGKpeYFyWUOkYpwKDUbPkA6IQP4KcV4Y=; b=WT2ZBdCLrJI5ev1zhQJNjbxYn AYzfMGYw/BFZMOrhsX8qGjoalanykf1Gll8G/EGE12LH/+JVOSIzYLIYLz/TKQWUmRY8lJzm6m3U3 NHIVVHVfaJP5esqKXBQ/48AmcCnYKA7zL5th5HNKDC1GAyEkFNZB1IWIeoWUBqc4p/NXHQJ7nCxDO 3yqSxsMkVTLsJLvlze0Y713c88pie4dAwjCTkCe0vfiXOADyC4aL9pwYEHssHBBVWhimfi2jR3L7Y j6uO3ADOcyr0PKTzOgZ31UFDZlx7J0uJBhmMFUxfJGTsXi9OSYzfIS4Kh8WTMlULrpABk92bO2EXw U3H3YNH9g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kJudi-0001zZ-8n; Sun, 20 Sep 2020 08:24:06 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kJude-0001xq-0U for linux-arm-kernel@lists.infradead.org; Sun, 20 Sep 2020 08:24:04 +0000 Received: by mail-wr1-x442.google.com with SMTP id z4so9640326wrr.4 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=U2o4fxVCIRebJWG7SeubNaarMbM3A3OoxP9KjVlR4KMa/lw5koadzC555bIiL42GJS OHaYgZkAyDBYQ5dco20x8n4Ws+6diMLWhM2PtoScUJaZKF615lH394nLwoX+X6skcNzG A4Xpg/ZYbvYW+mxJ/ppvVY7zDfyRbGDhkW1lujH1E/vosghG3UxdneLbd0vaMNRrLjqA IO/n59FbkKXCNjeASVe6WMUx8SkqHVz3fO3unWFYjM71wx3mBmp4um+xIxi06bk16l47 Nfd1mv1ZJpo2qbB7O6lPq+OaUQ4tdpUvwtY13fN9EBhhRPvGdOI2oTBKfKJBHt6K8EyH AUeA== X-Gm-Message-State: AOAM530E6g5bNwbVDEwbWZMsJPDOuHUzxn5yApw1u3Jcli1nfNFIP4bh hxopoDY0GOmGXuYtV6ppg/NvAQ== X-Google-Smtp-Source: ABdhPJxNYcqTcvbH9VqF1Sc6UfalSbf2k2pQjIV2s6WyfB9ecjNuyH5YNGsmVXrxzF1y/be4tY28HQ== 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 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-Disposition: inline In-Reply-To: <87pn6hc6g1.fsf@nanos.tec.linutronix.de> X-Operating-System: Linux phenom 5.7.0-1-amd64 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200920_042402_088415_CF7F42E3 X-CRM114-Status: GOOD ( 24.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juri Lelli , Peter Zijlstra , Benjamin Herrenschmidt , Sebastian Andrzej Siewior , Joonas Lahtinen , dri-devel , linux-mips@vger.kernel.org, Ben Segall , Max Filippov , Guo Ren , sparclinux@vger.kernel.org, Vincent Chen , Will Deacon , Ard Biesheuvel , "open list:GENERIC INCLUDE/A..." , Vincent Guittot , Herbert Xu , Michael Ellerman , X86 ML , Russell King , linux-csky@vger.kernel.org, David Airlie , Mel Gorman , arcml , linux-xtensa@linux-xtensa.org, Paul McKenney , intel-gfx , linuxppc-dev , Steven Rostedt , Linus Torvalds , Jani Nikula , Rodrigo Vivi , Dietmar Eggemann , Linux ARM , Chris Zankel , Michal Simek , Thomas Bogendoerfer , Nick Hu , Linux-MM , Vineet Gupta , LKML , Arnd Bergmann , Daniel Vetter , Paul Mackerras , Andrew Morton , Daniel Bristot de Oliveira , "David S. Miller" , Greentime Hu Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 338F9C43466 for ; Sun, 20 Sep 2020 08:24:05 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D16D820EDD for ; Sun, 20 Sep 2020 08:24:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="KpEMjAVs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D16D820EDD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 05C976E0EE; Sun, 20 Sep 2020 08:24:00 +0000 (UTC) Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id 189526E0EE for ; Sun, 20 Sep 2020 08:23:59 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id x14so9623942wrl.12 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=Pu9jvk1NUqYDtq4+5EfX/SJfPj+ifQwGJwsgbvVXNPyfE6Rwm6g4PLKVqUwZoek7/y hCnYuIYt6u4tF4atTwsUdCOgqn7PbSGJrUJD2GiUDUZPcH7FtT3KJoXo83jfSa2KHHgf Zt9tvs0UP6niq7qfXD3aDo5F7Hsm6Bj5q6uMnwoOOI6SlqCUVtEHX8zSiyQgdwWZYBWB PDdDMIDK6jxZlYy15FAYZbp4mavwCIW9XbOdvRDmh1z187HqWpaqUCCxpk0hEl9tXG9U rPuRX2dMHeQnnSCl6O/aWaVuY12DZuoN7OkZtXHL0z+Yt2R2doXus+1STV5fD7ApiQM9 xr6w== X-Gm-Message-State: AOAM533JGO4Y3WTNHn2JCtiBFMZ0AihFtekiWAZnVDULj3QHlqAClAjq qU1G6+owOOYZ+ddvUj+ps7zTAA== X-Google-Smtp-Source: ABdhPJxNYcqTcvbH9VqF1Sc6UfalSbf2k2pQjIV2s6WyfB9ecjNuyH5YNGsmVXrxzF1y/be4tY28HQ== 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 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-Disposition: inline In-Reply-To: <87pn6hc6g1.fsf@nanos.tec.linutronix.de> X-Operating-System: Linux phenom 5.7.0-1-amd64 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juri Lelli , Peter Zijlstra , Sebastian Andrzej Siewior , dri-devel , linux-mips@vger.kernel.org, Ben Segall , Max Filippov , Guo Ren , sparclinux@vger.kernel.org, Vincent Chen , Will Deacon , Ard Biesheuvel , "open list:GENERIC INCLUDE/A..." , Vincent Guittot , Herbert Xu , Michael Ellerman , X86 ML , Russell King , linux-csky@vger.kernel.org, David Airlie , Mel Gorman , arcml , linux-xtensa@linux-xtensa.org, Paul McKenney , intel-gfx , linuxppc-dev , Steven Rostedt , Linus Torvalds , Rodrigo Vivi , Dietmar Eggemann , Linux ARM , Chris Zankel , Michal Simek , Thomas Bogendoerfer , Nick Hu , Linux-MM , Vineet Gupta , LKML , Arnd Bergmann , Paul Mackerras , Andrew Morton , Daniel Bristot de Oliveira , "David S. Miller" , Greentime Hu Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel 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=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 BFFC9C4346B for ; Sun, 20 Sep 2020 08:24:02 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C076320897 for ; Sun, 20 Sep 2020 08:24:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="KpEMjAVs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C076320897 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D61E46E0D7; Sun, 20 Sep 2020 08:24:00 +0000 (UTC) Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id E5C396E0D7 for ; Sun, 20 Sep 2020 08:23:58 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id s12so9627761wrw.11 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=VZKi9ZuCRP1BzeWxsbRyJAlvi4JpfQyctCcS4bawSlYh2JqtEOqlS49fZfM6mPPsFr BT+LBbvyL+aRMq9KHnVTlK9btZ21RHPIOXmSzMz2Sx9S0FVnklIv3pUNY8UEm+u9CEoh +d1KlDvQweAHOvSt9qT+Sru1RUQHXBbdRd3pyMeReur0CZJtUiuDiI+2ySz8xpsiBXBl sZNSbffTclUdT6BpBAED6KygScR3QpynGsAZk7kNc2oIxbdD5e0huSvyNhdo/D9ILqGM r08kUlfImzpDIBuQKrCtARjGqimZkb7yWuG5I4HHIedNdRrDGLZhctBeGa7ZHe/Dwtoo CB/A== X-Gm-Message-State: AOAM530sPA7p09dVhXicLlJRhTaSy4+aTcIVPDJYG2EhKCoQLJpqajX5 bnaR3JWR4YNoQbkiG93VE0RCKA== X-Google-Smtp-Source: ABdhPJxNYcqTcvbH9VqF1Sc6UfalSbf2k2pQjIV2s6WyfB9ecjNuyH5YNGsmVXrxzF1y/be4tY28HQ== 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 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-Disposition: inline In-Reply-To: <87pn6hc6g1.fsf@nanos.tec.linutronix.de> X-Operating-System: Linux phenom 5.7.0-1-amd64 Subject: Re: [Intel-gfx] [patch RFC 00/15] mm/highmem: Provide a preemptible variant of kmap_atomic & friends X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juri Lelli , Peter Zijlstra , Benjamin Herrenschmidt , Sebastian Andrzej Siewior , dri-devel , linux-mips@vger.kernel.org, Ben Segall , Max Filippov , Guo Ren , sparclinux@vger.kernel.org, Vincent Chen , Will Deacon , Ard Biesheuvel , "open list:GENERIC INCLUDE/A..." , Herbert Xu , Michael Ellerman , X86 ML , Russell King , linux-csky@vger.kernel.org, David Airlie , Mel Gorman , arcml , linux-xtensa@linux-xtensa.org, Paul McKenney , intel-gfx , linuxppc-dev , Steven Rostedt , Linus Torvalds , Dietmar Eggemann , Linux ARM , Chris Zankel , Michal Simek , Thomas Bogendoerfer , Nick Hu , Linux-MM , Vineet Gupta , LKML , Arnd Bergmann , Paul Mackerras , Andrew Morton , Daniel Bristot de Oliveira , "David S. Miller" , Greentime Hu Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx