From patchwork Fri Jun 30 08:30:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 114621 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp10204753vqr; Fri, 30 Jun 2023 01:51:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlFmXnvbWy7jlHOpRPT8YW0TcMBofPBVMEA8tL1KFiy7FY0jXgGqYLhNbOnki20b89fqasNt X-Received: by 2002:aa7:980a:0:b0:677:bb4c:c321 with SMTP id e10-20020aa7980a000000b00677bb4cc321mr2434901pfl.0.1688115105157; Fri, 30 Jun 2023 01:51:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688115105; cv=none; d=google.com; s=arc-20160816; b=g42Y6luUUnMITydb458pifRfQSwBZhxmWzgc9g4QavWr1PN0O5bozAxwT9dnO/Y64V qRnmuFeH8TOxrrmuGwwhz8P61V3SQ0nAJMl9TQj5PJ3yw3Y4JenoJB/ZIIrV5Qhd+YrH hDtQ8aZvlabR1mE57Jv/XyZJqp9IbfB6vqGNYHsYWccJowK7INyaPCvId5s794E4Loa2 7El5sno2HfEN+X1hLQq4ibMMoLojJ1cjIgJrTc5cm6T/qDeAT679aWbA4UdYolwxQWWU 5XPqAJkHDIZQaJCDL1BHLfpMrq56V1mkWki9QuUAfKegZv86UtJ//0p/2QIOGmXEuhYJ pS0A== 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=EOVYMufG9/FqBaKJMl/ssTpZw9h9Tbb5FABAwd0Y76o=; fh=hmFTrdz0WFr12osTIIcQLHDbvk92COvsNanUuMWqfoU=; b=gVHqhfgj+GdcW3GE5AipsCYSjn3D8JjnC3pZkIbKLI0d3cG8sYrJ2su6hqjOV1UDnP SVyVVuzSRliX6kVPK1/Wino9SrKbbhtOtsE+raCrw11buW/XLmgwcRXaDE1YiyvorBlu 4dvOfJwXUR7SHAfd6nTHmGlAESpqO1UCmzw+qSoIC7iCSFc7YHOsMbj3P7yGTGo1Pp4O RlYV6FjM/u/8Rxu5WvYGVg3dw+0/VAY55YlV4toAbvCkJCoG+U1+CTXp+5gtaOrnV86y o8o9kZ2x3wR0uLqveKRg8QAokHdKHTySLhfq9ZjrFSiUY6HZxgC8gGrqtdbaE4/nhFLc yQFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=EBbwFVdp; 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 z19-20020a63e113000000b0055b0e39eecdsi6073124pgh.462.2023.06.30.01.51.29; Fri, 30 Jun 2023 01:51: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=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=EBbwFVdp; 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 S232659AbjF3IkS (ORCPT + 99 others); Fri, 30 Jun 2023 04:40:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232666AbjF3Ijx (ORCPT ); Fri, 30 Jun 2023 04:39:53 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80E442100 for ; Fri, 30 Jun 2023 01:39:52 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-4fb77f21c63so2539535e87.2 for ; Fri, 30 Jun 2023 01:39:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1688114391; x=1690706391; 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=EOVYMufG9/FqBaKJMl/ssTpZw9h9Tbb5FABAwd0Y76o=; b=EBbwFVdpIP6AbRzaCcRxUMVywY4aT8TXXYQBzuXycm69Am66X12dUUj6ysptXYgNIr kGTOqS2hMSiKkr9t8z64Utml0NDzDblWb9Ih06lJFn88rRYmLS/ZPqlg6vNJLf55epe+ mfrndHAolhwfEvfAkLITFEqkTzZdBDYfiD5T/qT4GIQHOmdzObxuWC0UwwP9TFrFmFpM bOPDk4nWuDmSYim/muDHyo6QJDgHMVwWgX305aJ7W6a9SKOfVaW1r9NQOFu5pEKK5lfc w7NUfhwrRVI6RlDSQw5InTNym6I+xWKhvZhPrW4P4cphlohLHplbvosEpLUxq3VL/KAk 2BsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688114391; x=1690706391; 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=EOVYMufG9/FqBaKJMl/ssTpZw9h9Tbb5FABAwd0Y76o=; b=MJg06Cr+IB/QwSFzr9KLq6ZT1I9oR33W8DOYVHMbsrggtwwfe7zXMKHy88L/7VIltF h9fFdwfhqbv8RBCMXDQ3zX7+kxHCpf4Hg0evrbt4rKZemVMz96fiHiNR8/CerUxoDZeC 451lx8e7l9fOmNCxbhY1IvBkNf8zdnov3wcAqe9sQpg8d++WQdld9tn5s32oRR0LQ7IM N+ayeU7OXxB6cjcW3BbI3kX2YJ57kKPfDNtwlmVWhXQ/ucgtXrv7lGk0+K5r+xttQS6G qv12x3rMC+gnhAbiHVXAB4puPkB5dEHyB6hvZId8VtSEVUyUWcWALt1Z/ej9EhfhRlzL 74Bg== X-Gm-Message-State: ABy/qLauAR1XKWjXqOllk9FfHFUWcOdWk6T//K0H0NI6ZlDo1PP/PeJU eP2qB0FAraCdqwFFNxI377ddmA== X-Received: by 2002:a05:6512:31d4:b0:4f8:5f32:b1da with SMTP id j20-20020a05651231d400b004f85f32b1damr2010376lfe.24.1688114390713; Fri, 30 Jun 2023 01:39:50 -0700 (PDT) Received: from alex-rivos.ba.rivosinc.com (amontpellier-656-1-456-62.w92-145.abo.wanadoo.fr. [92.145.124.62]) by smtp.gmail.com with ESMTPSA id l6-20020adff486000000b00313fd294d6csm9704615wro.7.2023.06.30.01.39.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 01:39:50 -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 v3 08/10] Documentation: admin-guide: Add riscv sysctl_perf_user_access Date: Fri, 30 Jun 2023 10:30:11 +0200 Message-Id: <20230630083013.102334-9-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230630083013.102334-1-alexghiti@rivosinc.com> References: <20230630083013.102334-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=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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770116984437394046?= X-GMAIL-MSGID: =?utf-8?q?1770116984437394046?= riscv now uses this sysctl so document its usage for this architecture. Signed-off-by: Alexandre Ghiti --- Documentation/admin-guide/sysctl/kernel.rst | 26 +++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/Documentation/admin-guide/sysctl/kernel.rst b/Documentation/admin-guide/sysctl/kernel.rst index d85d90f5d000..c376692b372b 100644 --- a/Documentation/admin-guide/sysctl/kernel.rst +++ b/Documentation/admin-guide/sysctl/kernel.rst @@ -941,16 +941,34 @@ 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 and insret CSRs only). Note that this legacy value +is deprecated and will be removed once all userspace applications are fixed. + +Note that the time CSR is for now always accessible to all modes. pid_max =======