Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1279659iog; Thu, 30 Jun 2022 22:27:42 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sWfq8xo9zj4DIXp3P9Ph9+R1pCb8PhInKpmUWgVqIaY8N7PbKBkAYRKZVG6XqiR+U/YjVV X-Received: by 2002:a17:906:b150:b0:711:c6a5:c5c1 with SMTP id bt16-20020a170906b15000b00711c6a5c5c1mr12544221ejb.177.1656653262512; Thu, 30 Jun 2022 22:27:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656653262; cv=none; d=google.com; s=arc-20160816; b=ci9PPUTuWLPiPfQMEELoUQQei6rpLEvlwRdAGLJZ5G4PbXMDy0HVKOjRlrGtNe2/aj YtX/voLGS+Xx6lLPENiG59QtDIP6OkIdqRoLZ/buZ/bKNG2Mqs86Zh1QJQ9ohoSLcfU8 rDNhf/ezu+O/3XJOsxTwFRjrqFA1LqxOamvuo97Ir0iM1R/hO5YWuiIRn9Cn/tTWx65y JS5cU25S5dBf4ic/s1uIGayrChknvsTp7BNLGof3Z/OC8Bdg1Mly8Zh+5rXyh8Cdoq1K MfYFI7Syn753aoFxbrEwqXjFsV/X4JBdaPhH5920pTj6WgDZZ2gybQQ5OfNEGYmQFzYa 5sjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:subject:from:cc:to :content-language:user-agent:mime-version:date:message-id; bh=B1TFPQU6stBanVHFAw2fEeELCwQI5Q5rX8HCsT2NHHw=; b=0Wzfk6l1q0E+5jduElS8vvEs7vFXSov5+AM2FeuU5qph2GqQPWzuVQB7qnig/YJXw4 8AaQ2HQ1z5Tv3nHacJV1g8gUyIlp/3GrJtGNbKjfUG24969L/+41OXzVbVQ3GvVybdPh 2lxMv4h68eWjgTn76Qibk/204Mk9q1sMJOMGqbRfqmAsIvTMjX88eOjFoVZFCsiLv3ey uEJQGyLm9S0no1fw40a7nMNVXzRrnQv0wTxGKGVXFCLbFlKWwU5tLfBwIyyjF1/rA+K6 lfBEZpjqyTv1odGZFTPgfh8pq0zclzuHnY0JDXPwIIA9vKvKnaQTMHDuGxOGja0GvQ9B 7OpQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hz3-20020a1709072ce300b00718cd33f793si28061061ejc.158.2022.06.30.22.27.15; Thu, 30 Jun 2022 22:27:42 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233418AbiGAFHq (ORCPT + 99 others); Fri, 1 Jul 2022 01:07:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232223AbiGAFHo (ORCPT ); Fri, 1 Jul 2022 01:07:44 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 36A4061D4D for ; Thu, 30 Jun 2022 22:07:43 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0AE7F1042; Thu, 30 Jun 2022 22:07:43 -0700 (PDT) Received: from [10.162.43.6] (unknown [10.162.43.6]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E03393F5A1; Thu, 30 Jun 2022 22:07:40 -0700 (PDT) Message-ID: <9be223fb-5803-b676-902a-28e1c168cd8a@arm.com> Date: Fri, 1 Jul 2022 10:37:37 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Content-Language: en-US To: "linux-kernel@vger.kernel.org" Cc: Ingo Molnar , Peter Zijlstra , Arnaldo Carvalho de Melo , Mark Rutland From: Anshuman Khandual Subject: Regarding perfmon_capable() Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,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 Hello, In perf event subsystem and related platform drivers registering a PMU, should perfmon_capable() be used directly ? OR just wondering if instead perf_allow_[cpu|kernel|tracepoint]() helpers should be used which also checks for 'sysctl_perf_event_paranoid' ? Should not both capabilities and 'sysctl_perf_event_paranoid' decide whether kernel/cpu/tracepoint events will be captured for unprivileged users. arch/parisc/kernel/perf.c: if (!perfmon_capable()) arch/powerpc/perf/imc-pmu.c: if (!perfmon_capable()) arch/powerpc/perf/imc-pmu.c: if (!perfmon_capable()) drivers/gpu/drm/i915/i915_perf.c: i915_perf_stream_paranoid && !perfmon_capable()) { drivers/gpu/drm/i915/i915_perf.c: if (oa_freq_hz > i915_oa_max_sample_rate && !perfmon_capable()) { drivers/gpu/drm/i915/i915_perf.c: if (i915_perf_stream_paranoid && !perfmon_capable()) { drivers/gpu/drm/i915/i915_perf.c: if (i915_perf_stream_paranoid && !perfmon_capable()) { drivers/media/rc/bpf-lirc.c: if (perfmon_capable()) drivers/perf/arm_spe_pmu.c: if (IS_ENABLED(CONFIG_PID_IN_CONTEXTIDR) && perfmon_capable()) drivers/perf/arm_spe_pmu.c: if (!perfmon_capable() && Although BPF might use perfmon_capabale() alone, because it was never dependent on 'sysctl_perf_event_paranoid' ? - Anshuman