Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp402391pxk; Fri, 11 Sep 2020 09:57:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyq/Eb8WSohZvUbzZncsTY4WCbG3gkqxdrHbyG5qBU3Kgnq+D9S9Vbd9qdFkbBDpll5OsGT X-Received: by 2002:a17:906:2c01:: with SMTP id e1mr3027506ejh.128.1599843442760; Fri, 11 Sep 2020 09:57:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599843442; cv=none; d=google.com; s=arc-20160816; b=PxMGzWQnq5TgabXrskQgMkIiuoSOpTl7XTun9fgOxw54gpo1OaO068//+qCiI4xZLa wagkjkc9AEFD8/QxCopXAsRW23semnv+/pR77hmw2GCFGd9xRP01UWPvu/4zTUJ59NLn sNMSzfkiJgj0oqvcUALdgFkKZtpN8I2Wa6RNEwTWCvp5Mfa3aeozN6gDk0BfDa/8EdbM bSO4iFxLcic5Zh6CYfhI49Fbla/Fwovqz9UviX0r8Htd4q6HzAVn9WI2KlDeWW7cb2V1 Yd1631M7dmWJoAHbnEx/xfdS3Cfwshj0/1ofG6do2MZPFLo68vKdTQCKl8CZ7h6IEnrU D16Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ymUunqCLw2vPuQ1VbXcUDi5LPgcqHOLwtMhV+h1hP00=; b=SDJtEZO6PrnoCv2R3JvTjOlVqAx/mhQygRv14zMgYLUiHlknDvvCPP0600mk68iQF1 GAOE2if/2UrOFO6mOoHCUiaGs+uMTxYpxbJD1EMMQyIw2JXTgspL4H4jBdtZR4xHS+zg jMJz/74qBUXhHKaCEW2zxub0kqkciRQiGYlKZd9PJ6pclDKrsfjvaEG1EmCYegnUuXwG hceeVLkjlXgPCgBVatQf4ZudOEmIadN01C8/V2RYXivelzv563BLDdokYF63ek8OO1gm FT53VnTHjbqzj8pQQOyOrJeWMmLhskY4KNfNMQDttYcF8ccmKUePqueHRj8TOJXuDq4b QumQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=LzixW8IE; 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 h23si1624511ejx.721.2020.09.11.09.57.00; Fri, 11 Sep 2020 09:57:22 -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=@linux-foundation.org header.s=google header.b=LzixW8IE; 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 S1725875AbgIKQyJ (ORCPT + 99 others); Fri, 11 Sep 2020 12:54:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725832AbgIKQwi (ORCPT ); Fri, 11 Sep 2020 12:52:38 -0400 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24FC5C061573 for ; Fri, 11 Sep 2020 09:52:38 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id w1so10736758edr.3 for ; Fri, 11 Sep 2020 09:52:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ymUunqCLw2vPuQ1VbXcUDi5LPgcqHOLwtMhV+h1hP00=; b=LzixW8IE64pueJHPc4pkVfB4hu8uL7V9KR6+6qOQDiBrSui1M4vSI9xeqysgklBESL 0IQ4jxvW89dAuyt0txhLnLuupNLcl3TzUTNbKM8yk1mUHFyRH5GgOM7DPBaXlmnovHXl RwxBgeTE5qnMUevVAeinQ8lEe8Rzs7ehh51xA= 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=ymUunqCLw2vPuQ1VbXcUDi5LPgcqHOLwtMhV+h1hP00=; b=mIZR6go7yWwuAPRtew6AIv+3tNih3WJXyNfenJ3dvTf4rGZZcwGamxJIgEDOQE9EV7 Z1Szc3lgvzlF1+ZMEcY1Rj91fC40/dnpAmfEWokkMiXXhJt6BKE5l6jfwt60LYNpJ2zT 9PDCeVTuhxCRi3JCu+cZKFP0IKi9lOcMYh2z8KXoxHtj/nla72CJLM9rqyiclzY5auEG leKCP8B3PfLHc+1ccER++8GToxo7JEyDFjOAfK+DPZ1d72vS7ldNKE8tE33mJODZYBbV dTunaMWFcILJiiDSs2jAZEYPZMhKCuePUd+ZgfEHDYNfvkZEJNRbjUzyvqXZyfB6xjFj WbvA== X-Gm-Message-State: AOAM533g9G6zJFqN+yP65u7YAfji6YNs0uToyMjLB1qWUbzNNcZNK0Tj vr3Gt1KWHW2y/CwzX5zpsLmVT/YI+atbQg== X-Received: by 2002:a50:ed94:: with SMTP id h20mr3111973edr.184.1599843156568; Fri, 11 Sep 2020 09:52:36 -0700 (PDT) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com. [209.85.221.45]) by smtp.gmail.com with ESMTPSA id z21sm1928786eja.72.2020.09.11.09.52.36 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 11 Sep 2020 09:52:36 -0700 (PDT) Received: by mail-wr1-f45.google.com with SMTP id a17so12149320wrn.6 for ; Fri, 11 Sep 2020 09:52:36 -0700 (PDT) X-Received: by 2002:ac2:5594:: with SMTP id v20mr585120lfg.344.1599842749970; Fri, 11 Sep 2020 09:45:49 -0700 (PDT) MIME-Version: 1.0 References: <0dbc6ec8-45ea-0853-4856-2bc1e661a5a5@intel.com> <20200909142904.00b72921@thinkpad> <20200909192534.442f8984@thinkpad> <20200909180324.GI87483@ziepe.ca> <20200910093925.GB29166@oc3871087118.ibm.com> <20200910181319.GO87483@ziepe.ca> <0c9bcb54-914b-e582-dd6d-3861267b6c94@nvidia.com> <20200910221116.GQ87483@ziepe.ca> <20200911121955.GA10250@oc3871087118.ibm.com> In-Reply-To: <20200911121955.GA10250@oc3871087118.ibm.com> From: Linus Torvalds Date: Fri, 11 Sep 2020 09:45:33 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH v2 1/3] mm/gup: fix gup_fast with dynamic page table folding To: Alexander Gordeev Cc: Jason Gunthorpe , John Hubbard , Gerald Schaefer , Dave Hansen , LKML , linux-mm , linux-arch , Andrew Morton , Russell King , Mike Rapoport , Catalin Marinas , Will Deacon , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Jeff Dike , Richard Weinberger , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Arnd Bergmann , Andrey Ryabinin , linux-x86 , linux-arm , linux-power , linux-sparc , linux-um , linux-s390 , Vasily Gorbik , Heiko Carstens , Christian Borntraeger , Claudio Imbrenda Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 11, 2020 at 5:20 AM Alexander Gordeev wrote: > > What if the entry is still pud_present, but got remapped after > READ_ONCE(*pudp)? IOW, it is still valid, but points elsewhere? That can't happen. The GUP walk doesn't hold any locks, but it *is* done with interrupts disabled, and anybody who is modifying the page tables needs to do the TLB flush, and/or RCU-free them. The interrupt disable means that on architectures where the TLB flush involves an IPI, it will be delayed until afterwards, but it also acts as a big RCU read lock hammer. So the page tables can get modified under us, but the old pages won't be released and re-used. Linus