Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5431069ybp; Mon, 14 Oct 2019 22:37:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxNC44xGaiIJ1fyRgFTjBBOqGDQRdjvM7amyhk+6z7kocfiJ96GSP7CXVDcGsg6QnBfIgOT X-Received: by 2002:a50:c90d:: with SMTP id o13mr31607735edh.85.1571117835067; Mon, 14 Oct 2019 22:37:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571117835; cv=none; d=google.com; s=arc-20160816; b=Js+xF2gtIdvKEHHBNwXtWPfMTr9+TKU6lSCvHzi1lnNG/9yLQHlPZB+9EpI8MMgAmO pvgVE8/dV/LbMJ8MlVCCwJYTi0zXjJD+Zt/L3VELTMaJxU+2iFVsvH+rkeHZtyRUtVaK IGqJbYZyVyQI4gcOHluXf5uewP7pHdL7Ksu0PzhAMB9MStBp+IX9kFFO4W8UQrP438HL IW2+R1tw5eYdiab/yfc98dvkAqs1aRpVTm14xUc4UTi6zqDp6goYd0VRjxEKxd65VLoJ oN2mD1o4OKkw24UNDhoL4GBKqy+7FFwCsF/SxxGfXtOm6ApfcIKnUYhDajqUtXpt7Gs+ qJ/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=FbJjg8NSoazEwa/d46EiM4CDDxEnnutADGqreGQ9ZiQ=; b=YbO+pJz6ajMCEBsOutZ7F3J2CwcAdLlX7I/iLRRwPAOpQ/oodayQSpH7Yei4zTknmb 8brgvZCN/Cj0SZekxjOpatYXM/yc5/uMEb+n8YoKxRA5mhjbIqS4K+NTe4haQK30Ezix jmA3UeQYkFoKdJaEv6XhLhTnVeBt8HvBV0nP2GFROxqG6ruLuZU1CjBtitUfEIXRE7Z7 HYIGRni8VM4YbAa7DYYH6QCaIVmQXcN+iEwgU/f9uB2yBkO3uUTD7CZqbXBy2g8POoKD jv8SmFOx6Vw9WKn2ig/wwr8wNcGl7bWxP0M0TGxytXA0MprDYPDbtLGJoS5YiNbffV+G 6Hug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=pRUkZIQu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gg17si12218175ejb.294.2019.10.14.22.36.52; Mon, 14 Oct 2019 22:37:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=pRUkZIQu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727944AbfJODqy (ORCPT + 99 others); Mon, 14 Oct 2019 23:46:54 -0400 Received: from ozlabs.org ([203.11.71.1]:39561 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727092AbfJODqy (ORCPT ); Mon, 14 Oct 2019 23:46:54 -0400 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 46shDz4GQVz9sPF; Tue, 15 Oct 2019 14:46:43 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1571111212; bh=q/PUoHpaGQ1aMJQT/dQFNLxJ+BV9cLJUddGSgSiLYaM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=pRUkZIQuGKR4qqpg2naFZb9pf1kDpAldmuXM90b+cG9Xxuuz9KQmmkaXNfdQwHCKb dLk4krTPcyOj2QOqgd6em4j7kKBe0iegPbx6DIGkLvMcoolk8xlSrGVf7Dtfjh7iVm F0PNDcF3F/LfRN+VyQP2lhfylNRN6nSDJHNyTvcjrFP21TRSsTJlnkvBvCenxPY2Mv BPYd76Jv+RfChdkqucu4/wSad89kYsCJz9UnRLJ+MjCTGiy3k8mwFUAnn3vx5tEM/n 52WSRet7RK0j48h9JP8baM5Zc08KopPvcVbTtA8IU/xtq6iFyMVcTjnykDp8OcRB1h oOWDHbwR8Gojg== From: Michael Ellerman To: Linus Torvalds , Al Viro Cc: Guenter Roeck , Linux Kernel Mailing List , linux-fsdevel Subject: Re: [PATCH] Convert filldir[64]() from __put_user() to unsafe_put_user() In-Reply-To: References: <20191010195504.GI26530@ZenIV.linux.org.uk> <20191011001104.GJ26530@ZenIV.linux.org.uk> <20191013181333.GK26530@ZenIV.linux.org.uk> <20191013191050.GL26530@ZenIV.linux.org.uk> <20191013195949.GM26530@ZenIV.linux.org.uk> Date: Tue, 15 Oct 2019 14:46:41 +1100 Message-ID: <87h84avffi.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Linus Torvalds writes: > On Sun, Oct 13, 2019 at 12:59 PM Al Viro wrote: >> Re plotting: how strongly would you object against passing the range to >> user_access_end()? Powerpc folks have a very close analogue of stac/clac, >> currently buried inside their __get_user()/__put_user()/etc. - the same >> places where x86 does, including futex.h and friends. >> >> And there it's even costlier than on x86. It would obviously be nice >> to lift it at least out of unsafe_get_user()/unsafe_put_user() and >> move into user_access_begin()/user_access_end(); unfortunately, in >> one subarchitecture they really want it the range on the user_access_end() >> side as well. > > Hmm. I'm ok with that. > > Do they want the actual range, or would it prefer some kind of opaque > cookie that user_access_begin() returns (where 0 would mean "failure" > of course)? The code does want the actual range, or at least the range rounded to a segment boundary (256MB). But it can get that already from a value it stashes in current->thread, it was just more natural to pass the addr/size with the way the code is currently structured. It seems to generate slightly better code to pass addr/size vs loading it from current->thread, but it's probably in the noise vs everything else that's going on. So a cookie would work fine, we could return the encoded addr/size in the cookie and that might generate better code than loading it back from current->thread. Equally we could just use the value in current->thread and not have any cookie at all. cheers