Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1460034pxk; Thu, 10 Sep 2020 16:23:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxX/eONv/A9MmtE+HCNKCCvclI8yPR+2+RtEqml/hopJQA1Vcu7QdSfc2JNPXHPelbJnXVp X-Received: by 2002:a17:907:2141:: with SMTP id rk1mr11228454ejb.256.1599780194115; Thu, 10 Sep 2020 16:23:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599780194; cv=none; d=google.com; s=arc-20160816; b=SpYboHK9iQObG9GBQTFvBWSq8wIldKrtntIGE8ZU8nVs1MWO4SePrTrKYbPGSvGLCM kFrnF7L47CDT6Fymk/QyW5frfwaWe4Lfhpw95sGyZoYhFmeHxeIVZsiVx0xIP1/zPW9O iBpG6VBHUStV38Sywl/wc5MiWlE+clgL4mX6B5+01igBikmtR2fdTW2tnye5n8PX2pQ0 c55nNh7D3sl6Wt9F8Lzb+pmyqx0nd4r+pcDQhYVpv/Rlt9MsVKgh27JS1fy1M/0fSWG+ EuCfihesEcTIHX63iUBmDMrPIRGIp6mRIlE4A4Yeu7NsP7tJPQlqWtcIvjL97OVKcCZW 9NBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=fIHL0Rq33O5ozDdBNb92cfl0GBqGdNKvR/YdlpxGcAc=; b=kABzWEKRk5sm9XdlbNA1nC0x1bAyA3+jV4VS50TyR2c9MLnqRLUYAfebkxjRrdzglI BLGBWY1vX1vaYfHEqwJny63xjKjrqoxIribf4gdKGzn1p6yLPVM2xhP262uEx4RCcSwm O31qGJhn+vHDoWWk1XUNvpR2XJEwUFqYN292uGPJMHrdI1Trcvq60JX83Oakg0lazOQZ 2HmSNwoFf2iHUNlw5diCfoWd35yX6PKGR+z83pSVrE63bSTPO6KfuyuNAxDrEcOQixQH 6QbO3ABUOU/sP/SUNieywHW1P0PHS99hmkTJYD3HerqJY1I9EIPE0j/UR1OHRolWgqGc OCqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=ek3aEVh6; 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 q4si67668ejd.380.2020.09.10.16.22.50; Thu, 10 Sep 2020 16:23:14 -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=@ziepe.ca header.s=google header.b=ek3aEVh6; 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 S1725601AbgIJXVS (ORCPT + 99 others); Thu, 10 Sep 2020 19:21:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725468AbgIJXVL (ORCPT ); Thu, 10 Sep 2020 19:21:11 -0400 Received: from mail-qv1-xf43.google.com (mail-qv1-xf43.google.com [IPv6:2607:f8b0:4864:20::f43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BFBEC0613ED for ; Thu, 10 Sep 2020 16:21:09 -0700 (PDT) Received: by mail-qv1-xf43.google.com with SMTP id h1so4235017qvo.9 for ; Thu, 10 Sep 2020 16:21:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=fIHL0Rq33O5ozDdBNb92cfl0GBqGdNKvR/YdlpxGcAc=; b=ek3aEVh6EDZv0MY4CyKrIOtcGg9hcQrcK0LNTKZQKq5D36Q4OOful56d1fLsdvbySj gIxGsvrf3KCS0cBe2Cddj6sjM6xxgr+gzrdl7qNDkNuApsUa7CiM5w7gHpJiiyXmHOM7 z0Fmkdon1hMn3l1idV0bhKgpCa6PUJSq4CW7y6g23Ml8DO+r/mDIQI9+zVDERUCtr5L5 WJuVfXkINtgWDQegahH+XHGH+cQJScV2EOHwfsx92Xl2/qRCRlsZDeCmHgB5ogwUgrhe yUNj2pRXsNm4WiFcUh2LoLVRUAZ5EBB0j8EQP9F4uwiM1oP8TqSobCs8onyBplaZNq9X j4og== 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:references :mime-version:content-disposition:in-reply-to; bh=fIHL0Rq33O5ozDdBNb92cfl0GBqGdNKvR/YdlpxGcAc=; b=HdVwV2B1ih6+0iLDsmABwJ35kUVwi1RvpZjEcA9eRbd4B+LaQyu8QOMaaDRp76X2fP qwng+SUvvpG0oJutucPIKplMF6MMOCNqC780IwkRsCwOrDBb0b+Y8SNqTls+donyMZrk AU04F1bgFyfcyBWJODVp8O4dFi0wFryCcd5xvcoXqDXfnt2gPH3fsUUlcgBIp6UEuY42 m7HTzfVk/nYqLYLv6l5+a6MUCuF2Q1m2GnChTDYiKYxQ00njYfMcVUJV37V1cewRlBlX T7bX+K6uog9WkO8crKW7mofxJNYwCsM3SB/V1iwtqa8zgVuGla6J5f+g1wAz8FDvNgjl P5vQ== X-Gm-Message-State: AOAM530+mds89eYpDW1YE5f/0VCQmi9uXDhyzTMktPfB5MqxjLYaD/hr NYL6YNBC/QjFb1Hj1Eb157IpwQ== X-Received: by 2002:a05:6214:954:: with SMTP id dn20mr10867015qvb.122.1599780068776; Thu, 10 Sep 2020 16:21:08 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-48-30.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.48.30]) by smtp.gmail.com with ESMTPSA id m36sm289969qtd.10.2020.09.10.16.21.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Sep 2020 16:21:07 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kGVsI-004SPL-RD; Thu, 10 Sep 2020 20:21:06 -0300 Date: Thu, 10 Sep 2020 20:21:06 -0300 From: Jason Gunthorpe To: Gerald Schaefer Cc: Alexander Gordeev , Dave Hansen , John Hubbard , LKML , linux-mm , linux-arch , Andrew Morton , Linus Torvalds , 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 Subject: Re: [RFC PATCH v2 1/3] mm/gup: fix gup_fast with dynamic page table folding Message-ID: <20200910232106.GR87483@ziepe.ca> References: <20200907180058.64880-1-gerald.schaefer@linux.ibm.com> <20200907180058.64880-2-gerald.schaefer@linux.ibm.com> <0dbc6ec8-45ea-0853-4856-2bc1e661a5a5@intel.com> <20200909142904.00b72921@thinkpad> <20200909192534.442f8984@thinkpad> <20200909180324.GI87483@ziepe.ca> <20200910093925.GB29166@oc3871087118.ibm.com> <20200910130233.GK87483@ziepe.ca> <20200910195749.795232d1@thinkpad> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200910195749.795232d1@thinkpad> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 10, 2020 at 07:57:49PM +0200, Gerald Schaefer wrote: > On Thu, 10 Sep 2020 10:02:33 -0300 > Jason Gunthorpe wrote: > > > On Thu, Sep 10, 2020 at 11:39:25AM +0200, Alexander Gordeev wrote: > > > > > As Gerald mentioned, it is very difficult to explain in a clear way. > > > Hopefully, one could make sense ot of it. > > > > I would say the page table API requires this invariant: > > > > pud = pud_offset(p4d, addr); > > do { > > WARN_ON(pud != pud_offset(p4d, addr); > > next = pud_addr_end(addr, end); > > } while (pud++, addr = next, addr != end); > > > > ie pud++ is supposed to be a shortcut for > > pud_offset(p4d, next) > > > > Hmm, IIUC, all architectures with static folding will simply return > the passed-in p4d pointer for pud_offset(p4d, addr), for 3-level > pagetables. It is probably moot now, but since other arch's don't crash they also return pud_addr_end() == end so the loop only does one iteration. ie pud == pud_offset(p4d, addr) for all iterations as the pud++ never happens. Which is what this addr_end patch does for s390.. Jason