Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4187127pxj; Tue, 8 Jun 2021 08:24:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuYyVuaMrG1UVrWdxi3D2X7MRwUtIfgHnqw3xYDLUuj4qFBHjBWELlaA2rEPQokLW14rka X-Received: by 2002:a17:907:948c:: with SMTP id dm12mr24316418ejc.484.1623165890075; Tue, 08 Jun 2021 08:24:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623165890; cv=none; d=google.com; s=arc-20160816; b=LdjGLpVxRFOmKBqs3P1vDQeHH4cYbDP61wtEY3ZnXib21nksrRThHXP1jZUN6rFwND CRDmNfilNuWcxNGJEHLbg/QodrNZe+7rcTFb0jXmPvWDHHNoI28OWhf3sj1p/JR0PPPF 8uEpBstjPU6+mB8ZYrHhCvUP8bK9WlZCUyfsK4TT4X1pMT1tXzp9hlv8dC64YLPHQtII jFi4T8RvMqUzcXXhHii6t9xYYYdPmi1+PZ98U3emO+pnP+g30XtX1Xq9MFHvqsZ3NH6h OGFA0Wf8O28+H5Erwz2RQ4JINzg7ebsV7C47gPGCtEKrta97VXIfzeLIBcGJ4oMpB5dD IlJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=Me1BBj6wSlmr01tOYDKRm1Y4BNiTCjG2tFj8uEl+Tb0=; b=xHLCvN3kN9HJwu5/fmyg7YowDREkp5FQL2/1esIUM8s1DUpxtb2x2IXejkA6qsZacz IV+kcXxToGbl2aRgO/8557FLrp7qwX0QUsV/fgibz/Tx4nMAvbtFvX6LWTqU9U/RVUos UGDOMdySSvz6rU41ZX5td4bn6tan6XF/dtvdzk0V8e8MG5OzV9FIPB1O70uMz9rOavj2 t7UfNzaJXQolgmVjjI4C0lbPOrasWarZIFQjJu/bVhd6Pv8SZzmjO0vj6/KjfmKhW4lL aaMoqQKH/1IU96bEUJ2qSWsZq1lLtsDaKA8pZ2FQGgGGjIwrWwsRj00X7qSPeaCsQOca PrMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i17si12798220edc.537.2021.06.08.08.24.26; Tue, 08 Jun 2021 08:24:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S231359AbhFHPXf (ORCPT + 99 others); Tue, 8 Jun 2021 11:23:35 -0400 Received: from foss.arm.com ([217.140.110.172]:33388 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231338AbhFHPXe (ORCPT ); Tue, 8 Jun 2021 11:23:34 -0400 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 0BC266D; Tue, 8 Jun 2021 08:21:41 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.5.29]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2C2983F73D; Tue, 8 Jun 2021 08:21:40 -0700 (PDT) Date: Tue, 8 Jun 2021 16:21:37 +0100 From: Mark Rutland To: Leo Yan Cc: Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 2/2] arm64: perf: Report error if PMU fails to support current CPU Message-ID: <20210608152137.GC16585@C02TD0UTHF1T.local> References: <20210608145228.36595-1-leo.yan@linaro.org> <20210608145228.36595-2-leo.yan@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210608145228.36595-2-leo.yan@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Leo, On Tue, Jun 08, 2021 at 10:52:28PM +0800, Leo Yan wrote: > When run perf command on the Arm big.LITTLE system (Juno-r2 board): > > perf record -e cycles --per-thread program > > The command executes normally without any errors; but when report the > result with "perf report", it fails to parse the symbols. This is > because the perf data file doesn't contain MMAP2 events, thus it cannot > find the correct object file for parsing symbols. > > On the big.LITTLE system, if the initialized PMU doesn't match with the > CPU the profiled task is scheduled on; for example, the initialized PMU > is on CPU0 in the LITTLE cluster, when invoke the function > perf_event_mmap_event() on CPU2 in the big cluster, the event is always > filtered out due to the CPU2 is not supported by the initialized PMU. > Finally, there have no any MMAP2 samples are generated for the > profiling. > > This patch doesn't fix for this issue, alternatively, it simply reports > an error when detect the current CPU is not supported by PMU, so can > remind the user for the abnormal situation. This behaviour is by design, and is not a kernel error, so it isn't appropriate to use pr_err() here. NAK to adding the pr_err(). I agree that the behaviour for PERF_TYPE_HARDWARE is confusing and not all that great, but as it's ABI it's not something that we can change. What really needs to happen here is for userspace to gain some awareness of big.LITTLE. For example, for the command: $ perf record -e cycles --per-thread program ... what we should do is have userspace identify the set of CPU PMUs (based on the `cpus` attribute in sysfs), and open a per-thread event on each of those, which we can then summarize together. Either that, or print a warning that the system is big.LITTLE and an event will not count on all CPUs. Thanks, Mark. > Signed-off-by: Leo Yan > --- > drivers/perf/arm_pmu.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c > index aedea060ca8b..99ddc8bf6466 100644 > --- a/drivers/perf/arm_pmu.c > +++ b/drivers/perf/arm_pmu.c > @@ -565,6 +565,9 @@ static int armpmu_filter_match(struct perf_event *event) > int ret; > > ret = cpumask_test_cpu(cpu, &armpmu->supported_cpus); > + if (!ret) > + pr_err("PMU doesn't support current CPU %d\n", cpu); > + > if (ret && armpmu->filter_match) > return armpmu->filter_match(event); > > -- > 2.25.1 >