From patchwork Thu Jul 27 14:14:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 127012 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp1175814vqo; Thu, 27 Jul 2023 08:21:44 -0700 (PDT) X-Google-Smtp-Source: APBJJlELIL8YKmfkWY3DahE6QJ1TG+NGogGT2+xmQtPCw6aW9BwuWxaAYujJlLwa59htGzMKLVU9 X-Received: by 2002:a05:6a20:938b:b0:13b:78aa:3f2b with SMTP id x11-20020a056a20938b00b0013b78aa3f2bmr5034072pzh.27.1690471304556; Thu, 27 Jul 2023 08:21:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690471304; cv=none; d=google.com; s=arc-20160816; b=kPyPr9+OePBfN2c+n0OAfQQ0YC1nEvgAH5fnE6HyKpfQaVMnoR6Tf6GhoFFqiYWAGI gGuq+IciDq1hRHKh2NeHQqkfGNdLkHdcmJl0WujR/07FfV9EjNgRurElfIsIj9S5cl3J iVqomkXnoVzWoxuMudN0KxbUdScHnM7st0G4WhL/eQKOLdNBE3yuri7kuBZc7NVdUxP6 7GO8dEFHdxAFLqdI/0nLud4aQv8DmO3sPAmYycSzmWVM7LyJ8+EWJQemF716XyQKIQhE SJwWaucchEqBknd2hnJYgNvzqjZGw1mMTXeB9Pdf4vvQWLG2vBuixz9jAvLglzpcZTGT Cplg== 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=91jtKpAX8BKXnlM2DqECzDjrTgIUONnRJGEpBfq59o4=; fh=nNJyTk/ugcKLLr+prU1/fE/iglwY5VvSzzFBFZJUGQI=; b=A0Q94Dyv4sbD7lpqdgtcoBsutrLLi8OjuoYikLQ2j2EYwY9TLvjyqtbKMetXyHcScs b79H1BBO9C8I8lEACb8XxGDWb7wSYWMexvNX54tWdB4mZJn1s3qmhzJQaazY7r79m2gi Ub7p17rATe2/hLev2qCoEpGi1co7B4ljHff19DwbOszontz0pSBwLfCW+asEDIa8LNFp 2eB5p8ESMJcVc1j/vxX/taWIC2oY7YcsOEU9xBqAShSso+iTzbl09vt0FZszSVKOyb/L MgpgnHM2MmLL4SOFduuAPlAwtJl2l4Deg0FW/YJnwdThhg/I5ODma51gHRf0tTCpE5jD LAtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=USVtlzZp; 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 e64-20020a636943000000b005572b13d228si1373532pgc.277.2023.07.27.08.21.31; Thu, 27 Jul 2023 08:21:44 -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=USVtlzZp; 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 S233699AbjG0O1U (ORCPT + 99 others); Thu, 27 Jul 2023 10:27:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231927AbjG0O1S (ORCPT ); Thu, 27 Jul 2023 10:27:18 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BFC6273C for ; Thu, 27 Jul 2023 07:27:17 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-31783d02093so537108f8f.0 for ; Thu, 27 Jul 2023 07:27:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1690468036; x=1691072836; 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=91jtKpAX8BKXnlM2DqECzDjrTgIUONnRJGEpBfq59o4=; b=USVtlzZpNwlYrsQ/yWuVvPJRGGc68ABNqkAYawYirkXn7ZDuug3OTHFZiUyezO7zda zGcr8wBTIGK2jIwXcydY8wz70yiXl/2gtFoFFqUROTaVNxkcaF1qwUTPGaWD14w2PTvO BIrYBbC3g+PleFK3ZHxJLfZE8n3mzvSPjUlpZH2pJJVLlQi7uMxJnDxJVgTExpOhiLwQ rN3BDxQ5jQZ1Y5LNxPkC6gTGFIkfNsL5zGj8utGStZ1gc6WWAqb/23rigAebUbt5YvbA ERiLCKS0iev3LQVaq9aa+s9Wx3HIeZ42CARfGbLjAl9BUCw3E0mlK6NA1DSEBd+uhTbm nZHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690468036; x=1691072836; 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=91jtKpAX8BKXnlM2DqECzDjrTgIUONnRJGEpBfq59o4=; b=ZbNVHVRvHEuI2K9idR6d1X3KmTBJQQecOBUkzumc8QZFgIKtRT49db3fKkmNxnm/og fsPlzU4bukIvo7q0tgli0bYL4jfxYPpwKnkRSk2QGoVU4jD8bt8NNk9puw/+pOzJPajI 1et+szFh8KLnjsCBcFDWwIIn/veLzGjaKIEYdKLU+2tMATPODaL5J6Faq/uT3ZLgTyXW ExixuJHAYKT3eGXXbc1GDzcdYp0Jw9AEBMOahhL5sSxMfpbB/Gm2595KBx3xDL6OecwM kDnSp+NOoradkYPt66umkxKGmKXWvQGVwjMciKPSiEOhUfrIjHOYFJzO5rqvWsRhJJWQ oPgw== X-Gm-Message-State: ABy/qLbNjctFdWc4G3rvZnK1Gx/sgNd6wQvNPt07oCkrsEUgnuKHrMyw WYM4Dmafq/xYANBsygSpkIm7zQ== X-Received: by 2002:a5d:428a:0:b0:317:5cfb:714e with SMTP id k10-20020a5d428a000000b003175cfb714emr2129750wrq.55.1690468035860; Thu, 27 Jul 2023 07:27:15 -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 y18-20020a5d6212000000b003143c6e09ccsm2266885wru.16.2023.07.27.07.26.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 07:27:15 -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 , =?utf-8?q?R=C3=A9mi_Denis-Courmont?= , 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 v4 08/10] Documentation: admin-guide: Add riscv sysctl_perf_user_access Date: Thu, 27 Jul 2023 16:14:26 +0200 Message-Id: <20230727141428.962286-9-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230727141428.962286-1-alexghiti@rivosinc.com> References: <20230727141428.962286-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: INBOX X-GMAIL-THRID: 1772587638619810144 X-GMAIL-MSGID: 1772587638619810144 riscv now uses this sysctl so document its usage for this architecture. Signed-off-by: Alexandre Ghiti Reviewed-by: Andrew Jones --- 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 3800fab1619b..8019103aac10 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) -================================= +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/arch/arm64/perf.rst for more information. +riscv +===== + +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 to cycle +and insret CSRs only). Note that this legacy value is deprecated and will be +removed once all user space applications are fixed. + +Note that the time CSR is always directly accessible to all modes. pid_max =======