Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp880025rwd; Thu, 15 Jun 2023 03:28:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ435lUTbxtOC0K48fDczM69aCFoJc6TtFXrsfOKy5IdkeGCPqsXg3xEfj518RKsJmj8QjbV X-Received: by 2002:a17:90a:4e49:b0:25b:ec4c:4886 with SMTP id t9-20020a17090a4e4900b0025bec4c4886mr3279389pjl.2.1686824880193; Thu, 15 Jun 2023 03:28:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686824880; cv=none; d=google.com; s=arc-20160816; b=Q6HrqMojGqPeoanxic2/VMrBRtRpcjTPy9THlX9qdtbkveMnG+9PhhDDYSmuFIinBA jurf3J+QUg/GCaa0yUOutovfsrQO6guorqrIu4ICixzcBos6MHs1DEfRPzktL4r7/eib Dt15C5OFMriTTImaC1Z1ei5Pi4uBnCBA4XkZIN0OAw3F/fMbo2gCZfP8gY5+xTwNb8vz sA+z8QMqZlQE+jQqoKMAygDdlpTAzK4TPcwqsxTI/T4cpySzlhbDe4GHhv/osWxTK+2r iJV+72/nUeUg6i+Ib4kmaP8tv5HO9gWhXCGJzRAk98pYYgMXXk6QpzbQ2uKtyEONlzvN mKMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=sPBZuZZCRdglpvIlGR1bqYw7aS6VuNLLvyn2HOQfgNE=; b=gICw0xy9mA/UofxU4isB0+XKCf4LNVULo4vgLmheDLHTESaVaMLfhqSsWiVGPprYsa ifwMsKXVO+EC3QHStcL+6a4DF5YLQDl0tVNgpagoHiKsSsNnPJCleK777OVo9A/eS2Ul mAf80vrcvk1q3SxifEaP92OPgwVeQMXAHK5HWi6a5ZZoQUD8poMCwBrjuUcC8o/2zoS0 FIemhu9CZzSJ+lcHUZy30jVz6ZdkPK1UXK1o6rvZd9HeE0hEW9rVEuB8N6xJajZO3ZNT ZYMMIPsv9xq5ZwU+jZa1HpUyQJEbLMAI/5tFfKZ3byRumJ/0Mi+cs7kFG4es5/R7MHX1 bEqQ== ARC-Authentication-Results: i=1; mx.google.com; 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 h20-20020a17090ac39400b002565804077bsi6780262pjt.32.2023.06.15.03.27.48; Thu, 15 Jun 2023 03:28:00 -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; 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 S240885AbjFOKAT (ORCPT + 99 others); Thu, 15 Jun 2023 06:00:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237827AbjFOKAQ (ORCPT ); Thu, 15 Jun 2023 06:00:16 -0400 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::222]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DDCC1A3; Thu, 15 Jun 2023 03:00:14 -0700 (PDT) X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr X-GND-Sasl: alex@ghiti.fr Received: by mail.gandi.net (Postfix) with ESMTPSA id CBCA64000B; Thu, 15 Jun 2023 10:00:01 +0000 (UTC) Message-ID: <653f51b6-9f6e-12f1-9165-541922bed7a9@ghiti.fr> Date: Thu, 15 Jun 2023 12:00:01 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v2 08/10] Documentation: admin-guide: Add riscv sysctl_perf_user_access Content-Language: en-US To: Andrew Jones , 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 , Atish Patra , 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 References: <20230512085321.13259-1-alexghiti@rivosinc.com> <20230512085321.13259-9-alexghiti@rivosinc.com> <20230531-0707dc46df8078cd92711314@orel> From: Alexandre Ghiti In-Reply-To: <20230531-0707dc46df8078cd92711314@orel> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 31/05/2023 17:07, 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/Documentation/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 return ``-EBUSY``. >> The default value is 8. >> >> >> -perf_user_access (arm64 only) >> -================================= >> +perf_user_access (arm64 and riscv only) >> +======================================= >> + >> +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 >> +===== >> >> The default value is 0 (access disabled). >> +When set to 1, user space can read performance monitor counter registers >> +directly. >> >> See Documentation/arm64/perf.rst for more information. >> >> +riscv >> +===== >> + >> +When set to 0, user access is disabled. >> + >> +When set to 1, user space can read performance monitor counter registers >> +directly only through perf, any direct access without perf intervention will >> +trigger an illegal instruction. >> + >> +The default value is 2, which enables legacy mode (user space has direct >> +access to cycle, time and insret CSRs only). Note that this legacy value >> +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? Ok I removed the reference to the time CSR for the legacy mode and instead added a note stating that this CSR is always accessible whatever the mode. Thanks! > > Thanks, > drew