Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2934239pxb; Tue, 13 Apr 2021 14:04:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxu8wBX3tGm7gnft5GnOFKvT3wISZMgUkQvrU4unc7/Ia/cUBV+9aucJByi8JXOUEC8MmX3 X-Received: by 2002:aa7:9e82:0:b029:24d:5cb4:235c with SMTP id p2-20020aa79e820000b029024d5cb4235cmr10930291pfq.46.1618347887519; Tue, 13 Apr 2021 14:04:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618347887; cv=none; d=google.com; s=arc-20160816; b=NSk51q3xYJ63OGEfI6eu6JpnSv3hcsuHZbWcOn3yTDg4Uxuqi9hT80Hg3vhssfETBJ IRzWYLV/g5UDCpTjqdO8Y5utEkhZcNgZ+EMsuWi4B9PY/QhBxgy7pzyZumd9S9o3aITS NYv42UXl5xb+TXhUYGs1BT9pCRsDyWG1iWDMMZCAsnXM3J5lk6NH3vjgxV+YCRd6Busr eykJiGrqgnR9uX3KfHKNaoUF0cVvxziChTTYHI3UybtoQsQUXhH8/PLhfjFHTC0KT1qL fgZxnGTuoXhSy8Na9Cwf6VQy6hMrqnZVLiFjtXFo2mua/LkwbzoJxORLouCOWQkdafo7 JfmA== 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=4mf7XVdjFYlVzcsu46/lq1ZJMjNmlJbOjyzyRkt7VCc=; b=uJ6m45BnpMDy366PFhikDhCm4F0/tHGX0TEd5KL/0m7gS4DMDjopXb5Gw5Yp4DVhBI De+7IV+BLXl54AJgsmg6e/1Rem7wUyRedHBkeWR/UnIqeWgbGWQ4Ulq2muI8iC9YhtEO g/qV0HGBn9YwFOhWpmvQhEkLBchxjmLW9I5ErgIIYqDvwATmkv0rqO3oBESyLnobQJxE dEi0fey9Bz0/3D6sUcJ/cL3wmKW8BSkDdlGVVRExsX0pUPw4H1qCUaY76hbPFRxXncPk FqcS5ttv++QmgrRnOVEiIbSS9Z1CxOTrJcj237DU13EcAkbmYGB783O/aUrG7g1dpE2P lvmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=qpfZin+e; 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 5si17755023pfp.343.2021.04.13.14.04.28; Tue, 13 Apr 2021 14:04:47 -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=qpfZin+e; 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 S229610AbhDMPZT (ORCPT + 99 others); Tue, 13 Apr 2021 11:25:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346708AbhDMPZL (ORCPT ); Tue, 13 Apr 2021 11:25:11 -0400 Received: from mail-yb1-xb34.google.com (mail-yb1-xb34.google.com [IPv6:2607:f8b0:4864:20::b34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0666CC06138F for ; Tue, 13 Apr 2021 08:24:49 -0700 (PDT) Received: by mail-yb1-xb34.google.com with SMTP id 82so18566243yby.7 for ; Tue, 13 Apr 2021 08:24: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=4mf7XVdjFYlVzcsu46/lq1ZJMjNmlJbOjyzyRkt7VCc=; b=qpfZin+exKoquYlxUINwv8WgBcOPJOThRsNfiQrdk7kIDzyy3ZQlgcACAahmx+YLcc sZq15r6Vx/VSDhH9u51blFakZ480PRmHGLvBCcgffPgxo8cRMEKy7XTuNVdsfXS+YDSJ wzWZNel0bwNlO4jMGBHqPxuOrP0vHa48/Wse4MHr7NkfIlE22Mx3XJwQgJqt47m0oYUJ nzND7JK4nymntoVwTRX1AwdudLNWbwbccaiKHwtNYlkQnqkyk+5NSYIJDeLMX0uPa5qw ajnH4FQNZHAuxWzOpOLYllUWTzbfor5Lo2+idTWaZDpgeZnvOacsBqSRjCt7YxsEldNp ds4A== 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=4mf7XVdjFYlVzcsu46/lq1ZJMjNmlJbOjyzyRkt7VCc=; b=VxuQ4Pk5lobuSFu5Ci5wR4TqYuFp8jtFzFYXhgKKL6qJVu8ETHI8B6duN5LRru7lxi +poZkiN7Xy6VVssXkFXRlIc9oF720D1rdMs/IWkfYg87OYKebkQqGh8S+lTKPNqjvhec WVBLkzQTBmd0JyH0atfAnKsKAW3EGjseu9lk5lHRTBYZzUa3H5Gw/aS6DOUbKLq86btu +RfFZpON0kyKzF8155lzxNgWQJGQdSDkCFPtC56o/P/v0QaPcpznqVJzBpwivO/97Jt8 GpjmmgRQy8Lz3EMRAi1nq7VtOZ+Mr7jaPvoI6jXMl86qFQei4j5W9CYHp3vBrRgs4SCA dHCQ== X-Gm-Message-State: AOAM531NvTtl+r/p+6fFr+qkn8yi+pj1qcgfE2yHp8SjlstM7KHrPNA5 3/00gzFv1UYWNOSB2h18HhplgpRFzVJfDriaeKDDUA== X-Received: by 2002:a25:b906:: with SMTP id x6mr43118295ybj.504.1618327488921; Tue, 13 Apr 2021 08:24:48 -0700 (PDT) MIME-Version: 1.0 References: <20210413073657.2308450-1-eric.dumazet@gmail.com> <20210413073657.2308450-2-eric.dumazet@gmail.com> <643243714.71310.1618324178021.JavaMail.zimbra@efficios.com> In-Reply-To: <643243714.71310.1618324178021.JavaMail.zimbra@efficios.com> From: Eric Dumazet Date: Tue, 13 Apr 2021 17:24:37 +0200 Message-ID: Subject: Re: [PATCH 1/3] rseq: optimize rseq_update_cpu_id() To: Mathieu Desnoyers Cc: Eric Dumazet , 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 4:29 PM Mathieu Desnoyers wrote: > > ----- On Apr 13, 2021, at 3:36 AM, Eric Dumazet eric.dumazet@gmail.com wrote: > > > From: Eric Dumazet > > > > Two put_user() in rseq_update_cpu_id() are replaced > > by a pair of unsafe_put_user() with appropriate surroundings. > > > > This removes one stac/clac pair on x86 in fast path. > > > > Signed-off-by: Eric Dumazet > > Cc: Mathieu Desnoyers > > Cc: Peter Zijlstra > > Cc: "Paul E. McKenney" > > Cc: Boqun Feng > > Cc: Arjun Roy > > Cc: Ingo Molnar > > --- > > kernel/rseq.c | 15 +++++++++++---- > > 1 file changed, 11 insertions(+), 4 deletions(-) > > > > diff --git a/kernel/rseq.c b/kernel/rseq.c > > index > > a4f86a9d6937cdfa2f13d1dcc9be863c1943d06f..d2689ccbb132c0fc8ec0924008771e5ee1ca855e > > 100644 > > --- a/kernel/rseq.c > > +++ b/kernel/rseq.c > > @@ -84,13 +84,20 @@ > > static int rseq_update_cpu_id(struct task_struct *t) > > { > > u32 cpu_id = raw_smp_processor_id(); > > + struct rseq *r = t->rseq; > > AFAIU the variable above should be a struct rseq __user *. > > Elsewhere in the file we use "rseq" rather than "r" for struct rseq __user * > variable name, it would be better to keep the naming consistent across the file > if possible. Absolutely, thanks for the feedback.