Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp2187581rwp; Fri, 14 Jul 2023 02:05:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlGwjU1CGOkuePPp6Mt9UU30YPddaIOXFsEUjwI3Gou2BpmINW0mKCC5VDXz3mBWSVAMa+fg X-Received: by 2002:a05:6e02:152b:b0:348:6aa8:590f with SMTP id i11-20020a056e02152b00b003486aa8590fmr944343ilu.23.1689325545484; Fri, 14 Jul 2023 02:05:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689325545; cv=none; d=google.com; s=arc-20160816; b=WEK0kA4JX5cqA+z9dWkJHYlKc9CBmQfrZfLx28m4jtCT/9DAqJV4aPxjlA2ep8AIKa TerkQflJxAsLltlJQyqK8uoAopkrQm8XltegAYD1UuC4juD2e3nyHZ6qTh7TtFE0GKgm 2WNmPlNNUMCSwpj6fXKMPCY7l6M4PAWWEAI2g2JqEcDouBGancahikHNqJSJ8K20kWsl dm+v8J6tNoOUvC3wwhgWEB13pj26LZQtql+qk1sRQ7+KMI1BVJzeW1XM0y8Poo8WHWc/ qgdYrJ++IfbqvtyeTpkTkIGQuHh5gdVXzNfXGr0GdsLFD+ie/fC7R76hsoiXcubZqROG i7rw== 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=UVJFUGPgUiZjejGogHmLzYwwKGbHbhdGEjYSUHSjBfo=; fh=y2M5v1gYeu0HYmN0hofCIqVy6M5fV8gJXE/fccYEzwc=; b=hFz0Yv7/RHh3Hz3E2uWo9WTwQG4Z/ugf9l8MNXdwQ4842WU519zmu+kIsceRHYNYPo RQWkK5hFLlE/AMSiZ/6O65eL5Hh+ZITpFXkmpjqJq0x0XpKZfeK3+2E669MwgDPvMPSM njKO+OKH9r7+R9q9X6s3ObRKY5I/ueYHlQqoYtVr4ISk0vGhfOUFCG0fkl+HXq2a3Q60 +Vw7WuPGgKo5DsNGQps/S6ICM21Sz0ouu420k6LcV0brsSRMZX8uKeIQfLQlWlwmjXBu rxQZadFp+p7HidXJdl7HVBbCGh5COpyRXaC9r4RgAPeJhwarltRuoC5eJysO0n7tB6pZ 7j1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@atishpatra.org header.s=google header.b=pYAcX4FP; 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 a9-20020a17090a740900b00263fbeed5d9si921331pjg.57.2023.07.14.02.05.33; Fri, 14 Jul 2023 02:05:45 -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=pYAcX4FP; 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 S235651AbjGNIvU (ORCPT + 99 others); Fri, 14 Jul 2023 04:51:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235622AbjGNIvP (ORCPT ); Fri, 14 Jul 2023 04:51:15 -0400 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EFF826BC for ; Fri, 14 Jul 2023 01:51:13 -0700 (PDT) Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2b6fbf0c0e2so24884191fa.2 for ; Fri, 14 Jul 2023 01:51:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=atishpatra.org; s=google; t=1689324671; x=1691916671; 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=UVJFUGPgUiZjejGogHmLzYwwKGbHbhdGEjYSUHSjBfo=; b=pYAcX4FPQitZnsDIm6cTcKdm1Ztraq4W2bv6eu94SIYUTBpXculUzJiLK05nDzIZQY X+ajUMzJ4+s3GZVMczZKydx+tBqLXWPIIcNeeaSKxDbOIpV+juiQrp9N9A7oMFbOy0ej Bev1FExTBu9b0hpfG/pxEJkztwcOKTfi7ojBA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689324671; x=1691916671; 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=UVJFUGPgUiZjejGogHmLzYwwKGbHbhdGEjYSUHSjBfo=; b=ME2mZ3YWBkcZoJn145ag6TIorBmqvjYYzyr7g1POwRy1MOZ+K+4OaGCUJRiF3JVLrf Fk+p6TBatF7Uq9E9Gsnm+DgZOfnKSPEs3LgaHajEXFNvVysZr2q/XzBqYn/kTnRnHgDd JNt1LcZHMTume8Xao8XYORrohWQJGYef5WSBg29a6ZV7iBswndgOqzdkAKKPT1lKk4Ry x+kyI8YyZ+XhyfYJU5bj1ZzLEFrrvE8sFjupQ+tOGIKzE79h+8rCtEonb+BZa7MIK2XV RQu49HGOoFvqqOeQJEaYTZQAFQX/jobVN874QW/Mhgo10gfsXikK+Fq8ZhHNG9NQQ0di qJLQ== X-Gm-Message-State: ABy/qLbRBoXyHIU3pZ0N2fc7wv86YoPIAL30NAEpYZrgUruY039Ohinh eqnhUOLEqmy53Q5ajhuEBkhBzvDJUYusCUnmdkTa X-Received: by 2002:a2e:8611:0:b0:2b6:ee1c:216a with SMTP id a17-20020a2e8611000000b002b6ee1c216amr3436379lji.34.1689324671023; Fri, 14 Jul 2023 01:51:11 -0700 (PDT) MIME-Version: 1.0 References: <20230703124647.215952-1-alexghiti@rivosinc.com> <20230703124647.215952-9-alexghiti@rivosinc.com> In-Reply-To: <20230703124647.215952-9-alexghiti@rivosinc.com> From: Atish Patra Date: Fri, 14 Jul 2023 01:50:59 -0700 Message-ID: Subject: Re: [PATCH v4 08/10] Documentation: admin-guide: Add riscv sysctl_perf_user_access To: Alexandre Ghiti Cc: 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 , Andrew Jones , 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_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 Mon, Jul 3, 2023 at 5:54=E2=80=AFAM 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 | 27 ++++++++++++++++++--- > 1 file changed, 23 insertions(+), 4 deletions(-) > > diff --git a/Documentation/admin-guide/sysctl/kernel.rst b/Documentation/= admin-guide/sysctl/kernel.rst > index d85d90f5d000..19b627883313 100644 > --- a/Documentation/admin-guide/sysctl/kernel.rst > +++ b/Documentation/admin-guide/sysctl/kernel.rst > @@ -941,16 +941,35 @@ enabled, otherwise writing to this file will return= ``-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 to = 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 registers > +directly. > + For ARM64, 1 also enables reading performance counters via perf interface o= nly. I don't think there is any way to access the counters directly in ARM64. > See Documentation/arm64/perf.rst for more information. > > +riscv > +=3D=3D=3D=3D=3D > + > +When set to 0, user space access is disabled. > + > +The default value is 1, user space can read performance monitor counter > +registers through perf, any direct access without perf intervention will= trigger > +an illegal instruction. > + > +When set to 2, which enables legacy mode (user space has direct access t= o cycle > +and insret CSRs only). Note that this legacy value is deprecated and wil= l be > +removed once all user space applications are fixed. > + > +Note that the time CSR is always directly accessible to all modes. > > pid_max > =3D=3D=3D=3D=3D=3D=3D > -- > 2.39.2 > --=20 Regards, Atish