From patchwork Fri May 12 08:53:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 93010 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp4952229vqo; Fri, 12 May 2023 02:04:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7y/4icdGIzmN+b4CLa/n/6bBsn98lu61M0X7jlXKDsVrB4LMzdnzFTrxp0jh8pOKu14yZu X-Received: by 2002:a17:902:ce8b:b0:1ab:d2c:a1a6 with SMTP id f11-20020a170902ce8b00b001ab0d2ca1a6mr27401183plg.69.1683882278856; Fri, 12 May 2023 02:04:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683882278; cv=none; d=google.com; s=arc-20160816; b=HbS5UuB1Y50FL9+jTkyF/m95iT1eZtL8rlsgBhrODf1zk6zIWomOT4IXQmXNuvG8Kw M8EoBiqgzLj2Igl/beynLN4GorS1RQACX5YhjN9saLWluKsFVdnsuEp4QVUHux404qWK NSjoukRc6P8eGBWtutHwXFREPx5i/qfftogmoCMF6dUDYKCpLsNFwJyM157foPNSZy9m 00WiiIO+pYNcp77gZvbiO3EfEUqJPLOfjiqwTWXCsJHHRLRUywFWvXiUeoPAi9KcV02j Pc5Rqgqn0XXHBS4UPmQQKzPnwQs53g12pi4seW6+67RX/28lqR2eKRkpePgYky5oElnJ zCmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lnd8gr51X8/5uF+3rCtJjAEchITyuqH0kTrDbBmZ9i8=; b=fiUq09upIH6Lqeb0TH66JReOnHDI2PCrE4IHz11fpctkXiB7PwblZpxroMJTZuy0DJ MRe/47cSwQRGXUNRdvXpEaz3pNCXrImCq0sCVKJRxUkLIT0ymNdhF3GbcttXx5rVYN3Z 0MMFMbq5SnNjwXA9KrmvmyAPgsLFq2XMTqGR4x4hOVAz6YLFgNZFRMQOR2y0P24QfqwV xRlIXwOGa5vCWZrvmsDp+JnXiRZVLQqqh9nj+V5+Evb/0lZFu3t26wc367XdpYgd8D5f Izl4zE+xROxKZd9sMCLsQ5Q2B7BXn2nrBZ8QraOFRKX58bGM3wTq88H3pa3LSFKVQ1Za Gb3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=BP88QC1b; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 19-20020a170902c21300b001ab0bc1e621si8549859pll.12.2023.05.12.02.04.22; Fri, 12 May 2023 02:04:38 -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=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=BP88QC1b; 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 S240303AbjELJCH (ORCPT + 99 others); Fri, 12 May 2023 05:02:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240286AbjELJCF (ORCPT ); Fri, 12 May 2023 05:02:05 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57B70D879 for ; Fri, 12 May 2023 02:02:04 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3f42c865534so40718045e9.2 for ; Fri, 12 May 2023 02:02:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1683882123; x=1686474123; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lnd8gr51X8/5uF+3rCtJjAEchITyuqH0kTrDbBmZ9i8=; b=BP88QC1bhM6e6lKhDv4DvB5IhPrAhRpa7/EMuvDfBK9ilVoXmFBPXJUv7eBZFXmzeA pnY3MuFsQG/Vi8of/R7SxCeVy84BBl6Kp1magUzy5obpB8MTplmqFtJ+UgoUCcKHR6m9 UwYczpC1Cx+cXBzZGpkRFIRi/arSoVntIWcSkPr8Uz7fI8PTIaU1AmU3/fMWlJvtE84G vEGkUYx4uqolizKdU/vvmYS0xRNcR9bjpIc8poxfmhpbguk7A2Gc9CwCubqWiDgmeF5g 3turrONwbQmgL4fwYhBq0v/Kxt48W0IjtCm8J04PJG0yCm4qXFEa4nSI1/4IOKe8BxDM dsHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683882123; x=1686474123; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lnd8gr51X8/5uF+3rCtJjAEchITyuqH0kTrDbBmZ9i8=; b=i5W7ENkbDwYdB6F0ZM1tJxEBgbqNhS4SiviqKst39lFEL/ysb5x2JYiL+OqBAUIcuL K849BjmUfNlKHwixa1Cu5Lo8eAIQsWoNGXEOF8usJerVNqvq0VMPo9faK/7sb/grR06I GFl+m/KbKFwRDGuY8ZGc4qSm33Rbw+u057yPepQPm4L4Wq+nI6Nks5t1KdcFh7YTUa6W 9q2zESEQPByGvmaYfFFWf2jf1GiZrMoEAr9DdGJ2ajkGCykgjGy51J8r1xGLfdZNari4 Okyf2iIzltKVoY1O8UQPzibFUksevoOFDpsQx5PlRNMTWR9szU4FFE96gupY08443mHe 65PA== X-Gm-Message-State: AC+VfDyTt4+7q2AjyQUPW7CqQA8pw1IiAAQHHnp+mnbzQEwWyheiN2jQ iJlvxGtJMfdWT1jW6UhrWkMrhA== X-Received: by 2002:a05:600c:228e:b0:3f4:2174:b28a with SMTP id 14-20020a05600c228e00b003f42174b28amr15724552wmf.15.1683882122838; Fri, 12 May 2023 02:02:02 -0700 (PDT) Received: from alex-rivos.home (amontpellier-656-1-456-62.w92-145.abo.wanadoo.fr. [92.145.124.62]) by smtp.gmail.com with ESMTPSA id f26-20020a7bcd1a000000b003f423f5b659sm15364363wmj.10.2023.05.12.02.02.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 May 2023 02:02:02 -0700 (PDT) From: Alexandre Ghiti To: 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 , 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 Cc: Alexandre Ghiti Subject: [PATCH v2 08/10] Documentation: admin-guide: Add riscv sysctl_perf_user_access Date: Fri, 12 May 2023 10:53:19 +0200 Message-Id: <20230512085321.13259-9-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230512085321.13259-1-alexghiti@rivosinc.com> References: <20230512085321.13259-1-alexghiti@rivosinc.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765678544399781155?= X-GMAIL-MSGID: =?utf-8?q?1765678544399781155?= 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. pid_max =======