Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp814407iog; Wed, 15 Jun 2022 12:59:55 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sqO7wYedoNJl3opvkxeriRXCLklRdUgIdhZ1eG1A7cAOfjQez+TiJCPJCTIwVdR5ew87Ld X-Received: by 2002:a17:902:db0f:b0:166:42b5:c819 with SMTP id m15-20020a170902db0f00b0016642b5c819mr1001688plx.96.1655323195023; Wed, 15 Jun 2022 12:59:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655323195; cv=none; d=google.com; s=arc-20160816; b=FxtLwF6+1yrfE2BJ4ccKjXhtbdHb9S0i/Hv4R4t8ERUVWhOruwCHZIRmxnjKiJm9Vy XWQzn+AdqV62kveZXNa8L4ja1U8tzDRDU/5kkNkNvmCcry5ekNYZ0GWh/XxGoy6XC7ux gvBAnJJ58GPkVugeyhCDWOmWMEasxcorl6tY3qp5Eopo31SKT70MqVnVOazr2coCwzqW z7LTgeCf3sBCmJHAgf+xCNt6/iOgTKr6oCcdpOW2z833ZLL07MF3RAKHifbKCRg4NvNL ghwOibTQ96Ux+6CMapQbtxJjxSE1bal/8GR0gcMMjOqIi8lCYq4xkxlYv+rRxxnFdt6t DkVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=shHKUoayK96CPigRfp44IPrAHccpMKlltUH9EmGpMeU=; b=Cc3GiknkzKTnPj6a8yFi7R1K8UYMB2BVdQPJrghhX0LT1xJx9CWrXR0GeJ1+0wnKz8 qTOqzXqBFTJjDg3p+0TAMZeFVNpI56NWypdr3y0qN3SX39j+9GGWgXiF+kN8V+0hV6/K hxPZk4KtVdwWVddGKj4I3PVLqkx4sdNgiSKIbRTl2Xs+FI+BotZhaQX8Iihw87nLJHk/ MwNl65auvedbsan8dbK73oIvlbKmGATuo4Aewpb5c2PMVKDoZmfe2awxctTmbpOJg+0b M/ZsKNA84K3TQz2OmvusD4Kw9twuVo8ZZFdfmh+675JRnLcnGRa2kkrxuIxQymp7jmXA f/Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nkWj9Lfd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k13-20020aa788cd000000b0050ebd76abccsi132867pff.2.2022.06.15.12.59.42; Wed, 15 Jun 2022 12:59:55 -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=@kernel.org header.s=k20201202 header.b=nkWj9Lfd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350303AbiFOTqv (ORCPT + 99 others); Wed, 15 Jun 2022 15:46:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244636AbiFOTqt (ORCPT ); Wed, 15 Jun 2022 15:46:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEE8F54BE9; Wed, 15 Jun 2022 12:46:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5461C60C32; Wed, 15 Jun 2022 19:46:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4532C341C0; Wed, 15 Jun 2022 19:46:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655322407; bh=nOopfbmMyE0zFSTGtfblVa/zt6IbMPT2M5vyvVqxC5U=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=nkWj9LfdIx6JvO6oHl690f+EQlTF17ydQgfzXPAWXAo0DSHZlOK+Kqs+8WYA8mq3f 7gX46Xr0YGAUjYyWIlFcQgWnSb/u4L7BVMrAFUYOd/I1oZpO65eoRM6I5FR71JY4vl XPySLRD+shq5NFDfeyTP2stBiEv3h2ESeq9l24LsRZYu0zewefobGoeMPNNkvYP2wo hKcZ82b5JaYW10RdqEbMSgrMkvh1wiWn1EeOd5v+862g2qgAQ8xXtDcg7s1AYFX+84 TIFLlC5tbvCuWUznULVZNfpwS6KCfSHKnZHipgPT8T3rmtmZhSsXDm7/iOynAzpXJU ATUES8wzHzJoA== Received: by mail-vk1-f174.google.com with SMTP id c11so4647773vkn.5; Wed, 15 Jun 2022 12:46:47 -0700 (PDT) X-Gm-Message-State: AJIora8os1VPqroVHgUKnySi3/wRxJ6EAkUqbQ6EbB+u2nLNTOUaPBsL nM1RbqHRKoi8FtThKVXsX2pL4Z8TnpuJdkNrGQ== X-Received: by 2002:a1f:a1c6:0:b0:35e:3f6a:b8b8 with SMTP id k189-20020a1fa1c6000000b0035e3f6ab8b8mr898915vke.26.1655322406702; Wed, 15 Jun 2022 12:46:46 -0700 (PDT) MIME-Version: 1.0 References: <30d95df2-c3b-b3e3-d65e-c6be0355fb1@maine.edu> In-Reply-To: <30d95df2-c3b-b3e3-d65e-c6be0355fb1@maine.edu> From: Rob Herring Date: Wed, 15 Jun 2022 13:46:35 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [perf] why is /proc/sys/kernel/perf_user_access ARM64 only? To: Vince Weaver Cc: "linux-kernel@vger.kernel.org" , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Catalin Marinas , linux-perf-users , Will Deacon , Mark Rutland Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 Wed, Jun 15, 2022 at 11:57 AM Vince Weaver wrote: > > > Just wasted a lot of time tracking down why rdpmc() event reading wasn't > working on an ARM64 machine. > > It turns out ARM64 has added a custom > "/proc/sys/kernel/perf_user_access" > to control rdpmc access, but only on ARM64. > e2012600810c9ded81f6f63a8d04781be3c300ad > > Why is this ARM64-only? Why isn't this generic perf infrastructure? Adding it on x86 would break users at least if default off. > How is this different from the existing > /sys/bus/event_source/devices/cpu/rdpmc > tooling? big.LITTLE We need a single point of control. Otherwise, there's dealing with mismatched state of multiple PMUs. > Also, when user events are disabled, why is the ARMv8 PMU not disabling > the cap_user_rdpmc bit in the perf mmap() page? Humm, maybe that should be changed. The current behavior of cap_user_rdpmc is static for the event and set means user access may be enabled at some point. Several factors can still prevent userspace from getting an event index. A counter couldn't be allocated or perf_user_access is disabled. Should the event open fail if perf_user_access is disabled? Current operation is it isn't considered and perf_user_access can change while the event is opened. > rdpmc was trouble before, but now it's an even bigger > architecture-dependent mess just trying to figure out if the feature is > enabled or not. The thing is that x86 started with access being wide open and has since been trying to lock things down without breaking userspace. It still has questionable uses enabled which complicates the implementation. For arm, we're starting with access being an explicit request on open and only for task bound events. If there's a real need for other scenarios, then we can revisit that. Rob