Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp3130989pxb; Tue, 13 Apr 2021 20:16:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdTB29k4IuxHw1gMHWKW6ERsrQcJsimI/GBgrO6cTgE2eSDq+6jTrUlW8W2D4vczryMCmk X-Received: by 2002:a17:90a:88e:: with SMTP id v14mr1077852pjc.107.1618370192854; Tue, 13 Apr 2021 20:16:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618370192; cv=none; d=google.com; s=arc-20160816; b=wu1iIGqNfnmO+VGtFcTcNBGE5Ei4dmmd6ReJdDMGfa91J8eRuGrlpDs8ou79gEHkYk FFMyBfVHn/p8x68EjoJiXZfVYe7TsZZXypDytNgqtemh+IojKr/eKF2kEmGev4gdVrqK BhZ472OSgnZ2cHTPZW+GHqQ8jj/mZv+kTXh6+JQM7fP86eW6fx/vx5BJsRO1PQFy3H8j 1cqOSjY51+0YV8Yf2IWw6INDltB+xbGVbVAu/GhgLDse3AViuOuZkP1y48g+7eft6ntM bo0c3jWCsrfdYLYUAc8Qd4Xf6gXUwE5NI3w3XiYcf3ZSsgiPJFvCxYd+/BGC+WmoRvd0 Uk/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=sIb8IwNOZepXabt6WVaLaJtN2aj5BmW49uF20/Ejxbo=; b=tf9t4zAIcQMeQzcGHdr9UHFl5xx2j1aqDt6MUirA7DmpsfQ9uevUvw+Ogz9Cp/5AaZ trLnD77KdvosLiH81lzEYVtjOIBv8PqtnQ3gptqyiiI1FaWvAfAS5QO2JiK+sOeCD3b4 kAuGM0oI7sDuhtdn/XPOpZMYuBOABVsn2naGD0HbafBx8h1CpZUtGZJ3IW03s8tAIFGy D1yLDq5VVaqjUmlSns1zlfPYztu6sbA6UXc7CMc+1Tmp0KPQe8hwK8k3rNABpYERp0JZ uqHxvFydxecvf7NQ+thj8+NizRIC1E4XcA0Nx6qjMLXRVuwHwFsBQaA+TuRHHYRExOuF aHnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=by5WlLVc; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o67si17665877pgo.70.2021.04.13.20.16.19; Tue, 13 Apr 2021 20:16:32 -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=@google.com header.s=20161025 header.b=by5WlLVc; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346999AbhDMRCO (ORCPT + 99 others); Tue, 13 Apr 2021 13:02:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229924AbhDMRCK (ORCPT ); Tue, 13 Apr 2021 13:02:10 -0400 Received: from mail-yb1-xb31.google.com (mail-yb1-xb31.google.com [IPv6:2607:f8b0:4864:20::b31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5AECC061574 for ; Tue, 13 Apr 2021 10:01:49 -0700 (PDT) Received: by mail-yb1-xb31.google.com with SMTP id z1so18903377ybf.6 for ; Tue, 13 Apr 2021 10:01:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sIb8IwNOZepXabt6WVaLaJtN2aj5BmW49uF20/Ejxbo=; b=by5WlLVcOZORyGd/g5wQBfbbtWans0+3l+XmttHOX0fMxtej5hmYT2PFzP13MggXRN 1dM6PpsrVbmxpQ6pZvZSjffKn1i4kMjfr//SMb4N0zVt47WwmA5AyfYFrng8hV9f7tP8 q5t+rn44wBrXyS5QZWaPuCulpeBrR8mg/wLiwfBWd39Ayj+mFW7st9Sy+qaIHeVtoK8Q LWALjVvcg/gSc2vJ7w9mK/LsGrFR1dnt4EcRtXD2bq7PqFXPhctWmvX/CN4mYeU6S05I my2IlhsiYJIlm0P+aHm6W9HWKUCk03GXoBrAq0q8/B0nfFnQRMEJfkiaJm61fNwNz+eQ 68sA== 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=sIb8IwNOZepXabt6WVaLaJtN2aj5BmW49uF20/Ejxbo=; b=nxET2UKhf5R8BLqt7iYEALJEWO+2GHsmrPHXYvrEojqa7SZB0VD2nvScrBB3ul4Nz9 8k15X20bSFriuwHyN2Ok+s8LuK56idSGJ3gxfW/u01HIsY2mHMuX3shFHHeem2al0qV+ U2UMrLrJua7Pb1umLJrq7naLikpOlRY1WPtP39tp0lTpd2J7uEcuXxOcQP/4TRxj9D/l 96iprvwnFjPGNY0+M3353X31hv9XAIy4G2u+B9qn3TJio5n/VHJpZ9HEFxhVhvbbS6ki v2X626U1e/MEIoKCun/sJG/FR7iSDWakXAj70RgcOUhT0r4PDAnWzEu6m3wIgRQuV77/ zE0A== X-Gm-Message-State: AOAM533IAdbX5BLIxpvGIWgJ40EXxKVho/v1nz+fR5f2PyrjLJQetAcn S2gE4aGJmcLQmavJYHl4l04XilGCOGpMdAF3xH3TFg== X-Received: by 2002:a25:cf08:: with SMTP id f8mr10283550ybg.132.1618333308825; Tue, 13 Apr 2021 10:01:48 -0700 (PDT) MIME-Version: 1.0 References: <20210413162240.3131033-1-eric.dumazet@gmail.com> <20210413162240.3131033-4-eric.dumazet@gmail.com> <567941475.72456.1618332885342.JavaMail.zimbra@efficios.com> In-Reply-To: From: Eric Dumazet Date: Tue, 13 Apr 2021 19:01:37 +0200 Message-ID: Subject: Re: [PATCH v2 3/3] rseq: optimise rseq_get_rseq_cs() and clear_rseq_cs() To: Mathieu Desnoyers Cc: Eric Dumazet , David Laight , Ingo Molnar , Peter Zijlstra , paulmck , Boqun Feng , Arjun Roy , linux-kernel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 13, 2021 at 6:57 PM Eric Dumazet wrote: > > On Tue, Apr 13, 2021 at 6:54 PM Mathieu Desnoyers > wrote: > > > > ----- On Apr 13, 2021, at 12:22 PM, Eric Dumazet eric.dumazet@gmail.com wrote: > > > > > From: Eric Dumazet > > > > > > Commit ec9c82e03a74 ("rseq: uapi: Declare rseq_cs field as union, > > > update includes") added regressions for our servers. > > > > > > Using copy_from_user() and clear_user() for 64bit values > > > is suboptimal. > > > > > > We can use faster put_user() and get_user(). > > > > > > 32bit arches can be changed to use the ptr32 field, > > > since the padding field must always be zero. > > > > > > v2: added ideas from Peter and Mathieu about making this > > > generic, since my initial patch was only dealing with > > > 64bit arches. > > > > Ah, now I remember the reason why reading and clearing the entire 64-bit > > is important: it's because we don't want to allow user-space processes to > > use this change in behavior to figure out whether they are running on a > > 32-bit or in a 32-bit compat mode on a 64-bit kernel. > > > > So although I'm fine with making 64-bit kernels faster, we'll want to keep > > updating the entire 64-bit ptr field on 32-bit kernels as well. > > > > Thanks, > > > > So... back to V1 then ? Or add more stuff as in : #ifdef CONFIG_64BIT + return put_user(0UL, &t->rseq->rseq_cs.ptr64); +#else + return put_user(0UL, &t->rseq->rseq_cs.ptr.ptr32) | put_user(0UL, &t->rseq->rseq_cs.ptr.padding); +#endif