Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1414326pxk; Thu, 10 Sep 2020 14:57:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxs24tTH8XdCT1DgiOp2XQNIggsg/JNzHPHmybagtc0rf8VcD27gmXeP1Euxcah5qRyH7Nv X-Received: by 2002:a17:906:2f0c:: with SMTP id v12mr10825972eji.484.1599775075078; Thu, 10 Sep 2020 14:57:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599775075; cv=none; d=google.com; s=arc-20160816; b=PWB5ywKEOTPj40x8SfeO1AP9ptVur6P+W/X73XvlL2U+goe+YFVOb92U9P/HMPfAMp 6tm/AsyknFs1dNxg6VsG5kCTx41yHFFQHBN6MOBvAaqnT/P5BbzmLzkvbDE/I+5frhla 9MXwM+c8vb9s0wDpPaiHy/OtL5dYXKvT8zAzolUHivEpL1NkVwUj8dNEMK1P5J3I/VVd 2PC2WgrK3fFMApoV3/3Txw6H4vO+q8Nb4A8FgqR//MWR3f70aOCMFh98RZNfRuIdh8pP N1vxiJ08nqwk78qtVX66UPmBJMynwPSG8sx4s2l6ZAh0LaNfoCiDjMJslDLMeb7RGjIx 5/LA== 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=ZMHVjl3+9TgVg2XMpsqEGzDzTL85oyvjl7Ly6KJECZs=; b=Y4vieN3pc3b3FbNFz8p5z/FDoTdoHfdFz6+hhCWA2LFwEbdEJ4w3OmOwEzGEqojwPi oB0+R5zG9zmoDBM3C5bXSVRW7clx4QqQHynV+r/OX9u+8NPIYKfPEitAzQjU7eg7mFri 3KBnLq4/1zBSJnzW67Z9r0/w8m2WlHpK4FWGlM21QVUmKfMLuuKZTrjpBmBkqS2TI8aZ SVtQfRnZHzz44l6Q0BbZPvt3Reh+PP4nnM7pZ7dcdWsOEcDbeN7UXbhj/9ushdp5N3vz xwo64eqSiMSGIXwMg2sXPFBC3ILoZusaGbq9TNRdh5wLGusz5o0+/R/0/8/rCzfflNt7 TRwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=f2+BlMuU; 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 lu21si4373983ejb.482.2020.09.10.14.57.32; Thu, 10 Sep 2020 14:57:55 -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=f2+BlMuU; 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 S1728180AbgIJVm2 (ORCPT + 99 others); Thu, 10 Sep 2020 17:42:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729908AbgIJNDE (ORCPT ); Thu, 10 Sep 2020 09:03:04 -0400 Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EC59C06179B for ; Thu, 10 Sep 2020 06:02:38 -0700 (PDT) Received: by mail-qk1-x741.google.com with SMTP id d20so5922269qka.5 for ; Thu, 10 Sep 2020 06:02:38 -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=ZMHVjl3+9TgVg2XMpsqEGzDzTL85oyvjl7Ly6KJECZs=; b=f2+BlMuUGxSPKYE1QP62oEt/bC0dGgrFO/pevuVdYEPal0FxZbbtojVdbZbQ6sqmoz jaJs9e7Yg3oQ36AJtmPt+bWSweDM603M+W0NfngEfLnlu8waQhxBgX6HgQdgQkAOsQvN Imc2Ip25I3geF80IGGT4DFhCwFFWUwFOfv4oqMhYXEEoXV/3te0bj60yPFJV8SXZ1nIN 1cOGfWeoU7Qerilj2IP4cT0hDPg8C8eGeDjj8ADKqV0CudBo5FDoF28Zeb24SsNY1XCA ye3tKdEeX5uSb4xgr1Zl54/2+vf6Hqdh4TzuL59fwFBW+mdrXHCpM+fh1UX1VSvqoYEC Wv+g== 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=ZMHVjl3+9TgVg2XMpsqEGzDzTL85oyvjl7Ly6KJECZs=; b=biYOQN+w6LtIPsW/ZsDJ12IYfA+gyd3JQJzBHBUZ2mzrZ9TYiVQmS8v4ogW9OxSZvK EAePhIzPVeRNTzOVXWkVCgu/ScclPKIGNmCal7GgnceecJumiPqnGuDoL5oRloKpk22o HAPt/oqcpbf1hf/FSnp5e2wO7I7mJxr5u/9kgtl8R43SyRcoUp+j+LMpSb8GPoDK9mvk RIO7CzKzKcficGajy7zIqWwoOgcUOnfj6er7wja03XoqJbbTl5IpJ9u+tSm2k73Cf+YR 5bgArME1xhrm/aed7+pgfvFqjmFwYmxAjF7NKrvtoPuUIjiksftgbBxBwnG07MpQ9EyR J+Vw== X-Gm-Message-State: AOAM531M7/KuCM28CGPGU/uhYy2EwLvb8axGlWqih59A61Tlg4SZ28vC ryeZr8lw7JkaliJxy6uu0ccREA== X-Received: by 2002:a05:620a:410:: with SMTP id 16mr7289645qkp.133.1599742955509; Thu, 10 Sep 2020 06:02:35 -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 i1sm6457907qkd.58.2020.09.10.06.02.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Sep 2020 06:02:34 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kGMDh-004Ksi-Dp; Thu, 10 Sep 2020 10:02:33 -0300 Date: Thu, 10 Sep 2020 10:02:33 -0300 From: Jason Gunthorpe To: Alexander Gordeev Cc: Gerald Schaefer , 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: <20200910130233.GK87483@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200910093925.GB29166@oc3871087118.ibm.com> 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 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) While S390 does not follow this. Fixing addr_end brings it into alignment by preventing pud++ from happening. The only currently known side effect is that gup_fast crashes, but it sure is an unexpected thing. This suggests another fix, which is to say that pud++ is undefined and pud_offset() must always be called, but I think that would cause worse codegen on all other archs. Jason