Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1944130rwi; Tue, 11 Oct 2022 02:38:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6zK0A92sKWXcSc/+4Puo39y8VFH/WjvNV117i54Ha84Amrb5xRY/5AJdCoHXxSk6A1GUz0 X-Received: by 2002:a05:6a00:1956:b0:557:7f97:3ff3 with SMTP id s22-20020a056a00195600b005577f973ff3mr24452836pfk.77.1665481125849; Tue, 11 Oct 2022 02:38:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665481125; cv=none; d=google.com; s=arc-20160816; b=Qg1OTo18iZp6ij+b+1/ouvtGZS8/t061PNVlKtGscE75WPhnDiQ9s4D3esaQlWWnTt +oe2bw+BWaD0wasm3BeaJYs3MyUIc07s/rpkIElj+fR4fZa4vV9dL+mwXN0woxNcVub5 5DcZI7tFzAeOPA86nH+UP1wbYbRMJHgk3ceHhtfTO1k3GnS8pguPlwGyml4XkwPoj2Ok soRf+opn83tUBP7blqBcm9ihCnMzJBMN/WmwMwxTlobbSbeJ3m1OtBqR11C8DiOMYaQU g86uwmzZGWQX5XaX+BxxfLk2NCTZNvCiYlTZSx7jtOK2xT9oMUphCxxY9hIX0/1AvOTu Uwdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=IAMWuzz54aThnzro2dtbTM2YKHmcnEwDgSWr/xDQMd8=; b=KWdVBO9rpoDyHuxfHgEItmc1EpumczzZcu51uKElQseaHvuOzTHrFCrLh3ZU6X6/1U 0vnQ0Fv6ZlCg24zETWvieJZHkb/juWRKPYYGM6yTDTdQFp/bobfSMXGN1mL8bPQbfnRV 6U2XwGI0HQi1JrkCuVyE+fHsQ3x1zshVToJyFTLW4B20+CFu1WV8PZ3y8XK8ii1ApNy/ zGD5qeD1ko0W68Y1UB6AVEnc22j3OxMy6UM6zgKtRjzaaNOteCPrEcXUBxQLtaHkkPPl 0/TAgJ/1fKbxL6mPhGWzmE7sFfIgb/rT85638uDsfxaZgGbN8S0fFjic/5MEdjhoUN0/ v6qQ== 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 c20-20020a6566d4000000b00434e8ee92a5si17539215pgw.119.2022.10.11.02.38.34; Tue, 11 Oct 2022 02:38: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; 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 S229544AbiJKJ1W (ORCPT + 99 others); Tue, 11 Oct 2022 05:27:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229495AbiJKJ1U (ORCPT ); Tue, 11 Oct 2022 05:27:20 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 95AAE8A7C8; Tue, 11 Oct 2022 02:27:18 -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 8B3AD1042; Tue, 11 Oct 2022 02:27:24 -0700 (PDT) Received: from [10.163.35.30] (unknown [10.163.35.30]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0FDC93F766; Tue, 11 Oct 2022 02:27:14 -0700 (PDT) Message-ID: <237ded55-5284-e30e-60e4-67db7799eedc@arm.com> Date: Tue, 11 Oct 2022 14:57:28 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH V3 7/7] arm64/perf: Enable branch stack sampling Content-Language: en-US To: Suzuki K Poulose , James Clark Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, peterz@infradead.org, acme@kernel.org, mark.rutland@arm.com, will@kernel.org, catalin.marinas@arm.com References: <20220929075857.158358-1-anshuman.khandual@arm.com> <20220929075857.158358-8-anshuman.khandual@arm.com> <0adcc3f7-bf60-516f-c8d7-4250d1f901cb@arm.com> <6805165c-8aaf-086f-f5a6-181876cd7975@arm.com> From: Anshuman Khandual In-Reply-To: <6805165c-8aaf-086f-f5a6-181876cd7975@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE 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 10/10/22 21:18, Suzuki K Poulose wrote: > On 10/10/2022 14:55, James Clark wrote: >> >> >> On 29/09/2022 08:58, Anshuman Khandual wrote: >>> Now that all the required pieces are already in place, just enable the perf >>> branch stack sampling support on arm64 platform, by removing the gate which >>> blocks it in armpmu_event_init(). >>> >>> Cc: Mark Rutland >>> Cc: Will Deacon >>> Cc: Catalin Marinas >>> Cc: linux-kernel@vger.kernel.org >>> Cc: linux-arm-kernel@lists.infradead.org >>> Signed-off-by: Anshuman Khandual >>> --- >>>   drivers/perf/arm_pmu.c | 32 +++++++++++++++++++++++++++++--- >>>   1 file changed, 29 insertions(+), 3 deletions(-) >>> >>> diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c >>> index 93b36933124f..2a9b988b53c2 100644 >>> --- a/drivers/perf/arm_pmu.c >>> +++ b/drivers/perf/arm_pmu.c >>> @@ -537,9 +537,35 @@ static int armpmu_event_init(struct perf_event *event) >>>           !cpumask_test_cpu(event->cpu, &armpmu->supported_cpus)) >>>           return -ENOENT; >>>   -    /* does not support taken branch sampling */ >>> -    if (has_branch_stack(event)) >>> -        return -EOPNOTSUPP; >>> +    if (has_branch_stack(event)) { >>> +        /* >>> +         * BRBE support is absent. Select CONFIG_ARM_BRBE_PMU >>> +         * in the config, before branch stack sampling events >>> +         * can be requested. >>> +         */ >>> +        if (!IS_ENABLED(CONFIG_ARM_BRBE_PMU)) { >>> +            pr_warn_once("BRBE is disabled, select CONFIG_ARM_BRBE_PMU\n"); >>> +            return -EOPNOTSUPP; >>> +        } >>> + >>> +        if (event->attr.branch_sample_type & PERF_SAMPLE_BRANCH_KERNEL) { >>> +            if (!perfmon_capable()) { >> >> I'm still getting different behaviour compared to x86 when using >> perf_event_paranoid because of this perfmon_capable() call here. > > Given the generic events framework already checks this for any > privileged branch samples (i.e., for both KERNEL and HV), the > individual drivers must not add additional restrictions. Okay, will drop perfmon_capable() check here along with the warning. > >> >>> +                pr_warn_once("does not have permission for kernel branch filter\n"); >> >> Also I was under the impression that this should be more like a >> KERN_INFO loglevel rather than a KERN_WARNING. It's more like expected >> behavior rather than unexpected behavior and as far as I know anyone who >> sees something in dmesg might think something has gone wrong and try to >> follow it up. It is quite a useful message but I remember getting a >> review like this before and it made sense to me. > > +1 Sure, will change remaining pr_warn_once() prints as pr_info() instead.