Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1182559rwd; Wed, 31 May 2023 10:27:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5AFq3Dbv/pH0ezhGd0bemWc8CVQ7Tu217jvRWXyrWgVJ3EFchpTXm//B3EcmU3b1IILXuq X-Received: by 2002:a17:903:230d:b0:1af:f660:1689 with SMTP id d13-20020a170903230d00b001aff6601689mr7022040plh.31.1685554027045; Wed, 31 May 2023 10:27:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685554027; cv=none; d=google.com; s=arc-20160816; b=S6vRK1bWkbx8tcPGcHHVKfdZQwB9Vq/lbfkqp/R064vXt6OstMvLdHB6NXrtdR+2hM tXeni4xw6d7BLrN6taOSnQQ5bM/6b7niuPdOF+fwoNoC4db+QIPpmgH9LFQqgKF8dqKg L6DcWGrMNYTO8dU4yB5Moc0k1EaPPsG7mqPw1rfjz4CzkG7mji2IPDFWeyqvS7Y8rfzE ZMHVG2GA3bifXRRRxLfodnoK6Oe3drQQV8UVjAH6rZ93fQ7QTlJe7eMlCxfVetl31An6 vZ4Js6r4MEDpdaJTvsuf8hM6MwtsdT4IaFkomWEj6dZVzy8xTf8Y/jBpqGfEx6FlZZAJ LkHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=jQ4u7E+2pu1MUIvR5vq40l8aNtL/U44SVHTVaiFl+ZE=; b=Q9kVVe4SNNn+N3srXAJ7N85cpjVeGmum94mRBxZkapxNY80BUqugRlDylTK9STVLLz me7OoYlJ5LcrZuZy2FtsyXIh2lvM3e6vjPq5fwKVCmnObbOOC4XUFTEBXQRJK/M7Mmzm ZdnBgrIdlhOV9nhit4kWKsPn1hTfmM2OoFFyYJWA/XtGIWQZgmMxzZYq1WeZ1MekQ2uw 5h2bSdHr7dsy5IbsNW89+ZpSOzOjQJgWZwoBbH0UrJTK/42C/iI4y06Vbur/bTLFgdY6 gYssP/Piv0uo1QJoc0d3Zq08dBaQ/cT9pyqluV5rVH4Cky1jEzbU4/bRfcHbadvhWuXk bQiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@atishpatra.org header.s=google header.b=dpkjmQJu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bf10-20020a170902b90a00b001b061dcdb78si1219665plb.92.2023.05.31.10.26.53; Wed, 31 May 2023 10:27:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@atishpatra.org header.s=google header.b=dpkjmQJu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230131AbjEaRJT (ORCPT + 99 others); Wed, 31 May 2023 13:09:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230136AbjEaRJO (ORCPT ); Wed, 31 May 2023 13:09:14 -0400 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4AFB18C for ; Wed, 31 May 2023 10:09:09 -0700 (PDT) Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2af2696fd1cso66312401fa.2 for ; Wed, 31 May 2023 10:09:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=atishpatra.org; s=google; t=1685552948; x=1688144948; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=jQ4u7E+2pu1MUIvR5vq40l8aNtL/U44SVHTVaiFl+ZE=; b=dpkjmQJu6nzfEvoWvKrVmVKQFGK9PktpjQr+7FUyc7TmLV2jDpBImI3W6D2jWa8bxQ l5hJd7cLgyNz7BZdZU1OQXZKfXRkX4bD9w1XsNtr411FOCbaa6RddJGelQbb9wilkc9y DMWXRHS43Ov4MPvOjEalEiIKCv7yNQTvhrIlI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685552948; x=1688144948; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jQ4u7E+2pu1MUIvR5vq40l8aNtL/U44SVHTVaiFl+ZE=; b=fgSwnMcBi/g511Y5RkM4gzpymFzu0e1isNLgn4IClt7XPrr698lyxsK7y8b/yPTS8B 7fRkxPIeet8vMRzCm9I1U9Oofw5vv1mNa8ciwDRi5V/r432a/YMx6kZk+bVFzqauoAAu SjeybhIoQng13FE8XqLcAXHK4ZSRZc3/lEYQ5Ib5nQwAZKygqIx5X7UEsOXG41DHwn7L oWcz0TfXVbKT4bQJIEIKA5LMsVqWhwP8yyxkD9rVtELuFPSxQOxA7OWX4TB9TAggyI8K l2h5ILWF4u3R8EMuJsdpZYSKGq/RfwEoSCksb/cM3U1jpCXRJL2QD/dMERxck5kqZvVg BrRQ== X-Gm-Message-State: AC+VfDzMoHqbepxSlIxBYyY6yJ7CSFcsCU1oyYbfPrO07FY653SaD2PL Co7j3pqvtJJaiv1nuWpR07W2VAiruHTInv5tPdG853HSyGp3jf28of3L X-Received: by 2002:a2e:8189:0:b0:2ad:ba85:9f7 with SMTP id e9-20020a2e8189000000b002adba8509f7mr3527397ljg.22.1685552947968; Wed, 31 May 2023 10:09:07 -0700 (PDT) MIME-Version: 1.0 References: <20230512085321.13259-1-alexghiti@rivosinc.com> <20230512085321.13259-9-alexghiti@rivosinc.com> <20230531-0707dc46df8078cd92711314@orel> In-Reply-To: <20230531-0707dc46df8078cd92711314@orel> From: Atish Patra Date: Wed, 31 May 2023 10:08:56 -0700 Message-ID: Subject: Re: [PATCH v2 08/10] Documentation: admin-guide: Add riscv sysctl_perf_user_access To: Andrew Jones Cc: Alexandre Ghiti , Jonathan Corbet , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Paul Walmsley , Palmer Dabbelt , Albert Ou , Anup Patel , Will Deacon , Rob Herring , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 31, 2023 at 8:07=E2=80=AFAM Andrew Jones wrote: > > On Fri, May 12, 2023 at 10:53:19AM +0200, Alexandre Ghiti wrote: > > riscv now uses this sysctl so document its usage for this architecture. > > > > Signed-off-by: Alexandre Ghiti > > --- > > Documentation/admin-guide/sysctl/kernel.rst | 24 +++++++++++++++++---- > > 1 file changed, 20 insertions(+), 4 deletions(-) > > > > diff --git a/Documentation/admin-guide/sysctl/kernel.rst b/Documentatio= n/admin-guide/sysctl/kernel.rst > > index 4b7bfea28cd7..93cd518ca94b 100644 > > --- a/Documentation/admin-guide/sysctl/kernel.rst > > +++ b/Documentation/admin-guide/sysctl/kernel.rst > > @@ -941,16 +941,32 @@ enabled, otherwise writing to this file will retu= rn ``-EBUSY``. > > The default value is 8. > > > > > > -perf_user_access (arm64 only) > > -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > +perf_user_access (arm64 and riscv only) > > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > + > > +Controls user space access for reading perf event counters. > > > > -Controls user space access for reading perf event counters. When set t= o 1, > > -user space can read performance monitor counter registers directly. > > +arm64 > > +=3D=3D=3D=3D=3D > > > > The default value is 0 (access disabled). > > +When set to 1, user space can read performance monitor counter registe= rs > > +directly. > > > > See Documentation/arm64/perf.rst for more information. > > > > +riscv > > +=3D=3D=3D=3D=3D > > + > > +When set to 0, user access is disabled. > > + > > +When set to 1, user space can read performance monitor counter registe= rs > > +directly only through perf, any direct access without perf interventio= n will > > +trigger an illegal instruction. > > + > > +The default value is 2, which enables legacy mode (user space has dire= ct > > +access to cycle, time and insret CSRs only). Note that this legacy val= ue > > +is deprecated and will be removed once all userspace applications are = fixed. > > All modes can access the time CSR so I'm not sure if it should be pointed > out here as if it's an exception. Maybe we shouldn't point it out at all > or we should point it out for all three? > Valid point. Thanks Drew. In the future, we probably want to support prctl (PR_SET_TSC/SECCOMP_MODE_STRICT) to disable even time CSR access. I don't think there is any use case for it right now. > Thanks, > drew --=20 Regards, Atish