Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1373014pxb; Fri, 21 Jan 2022 16:52:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJwDaRZZyA7qj5J+g47V0iZiP9weSlXr7+TbEBJKFpn7ZxIbg+QJicl65RVym0YXlMrd6Jcd X-Received: by 2002:a63:2a0d:: with SMTP id q13mr4596331pgq.601.1642812740211; Fri, 21 Jan 2022 16:52:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642812740; cv=none; d=google.com; s=arc-20160816; b=IB69E87ZWN0b3lGhH7te2COKWDd9Zo+BH+iIor3URpxMZN/IBrQXqInaDsQDU6BQDl ODgAnttsTWarGQYFcwWScfDGzLviusQDC9v+YeBCkssS0dv5icvN7dxqrBBzltdQFv50 wXvvhqgwboRmK+NzycEc+YbSok6D9oV0K/cftm9OvaFr78oFbm2T2f45WYYILtOvkkki sk0YSqdoZKWUyMQFpN6WtmteRKdf3BmaRJNuTj0hgbtDKr7NvU1zUA7LffYydG8ln/Bx hW3120ddVqHOQyM0oCT31YZWhN4zWOKChzk1jIqD2GPv5ph3ZIhBwZY0cJVj1zHudmqK mEkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=Pbstx6vO38CkF348MC7jEhVDnB3Fbx/jLFC81aOOPcI=; b=LzjIRqjiep/YhYf9MoElHGHxbKyQAnkDcF4+ekpeGa+5Z/BR0+JjhlxM/KrF2oSAwG TzHB7RMB0cgC/IGoQzKGZl+OQqFt8MSzI5n2mDEbYX7DEYRgO8B1ZzRwkLEjT+PDV0G9 ejalYX5omuOqCIMQqWgSEp+M/903GVhGh1HdZEoy5teXKZHA+s1skvZb/MWk3H7tte/w J2xMp4E7wjiD7Q6FJIyR1LNz7Hu8THVRBClJsqSVshseUs7TVyuv3d4DnO9lrlbAhgET qbzmbDRuK32Fttwpf0FsqMtjjAl+yG90FscJ34D0ZjMpCMspDj0kcbws+drX3g1F6TXh kDnw== 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 25si7991167pgv.580.2022.01.21.16.52.08; Fri, 21 Jan 2022 16:52:20 -0800 (PST) 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 S1380056AbiAULZV (ORCPT + 99 others); Fri, 21 Jan 2022 06:25:21 -0500 Received: from foss.arm.com ([217.140.110.172]:48958 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235434AbiAULZV (ORCPT ); Fri, 21 Jan 2022 06:25:21 -0500 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 420D21FB; Fri, 21 Jan 2022 03:25:20 -0800 (PST) Received: from [10.57.39.197] (unknown [10.57.39.197]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E3E543F73D; Fri, 21 Jan 2022 03:25:17 -0800 (PST) Subject: Re: [PATCH] perf script: Fix printing 'phys_addr' failure issue To: Wei Li , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim Cc: Peter Zijlstra , Ingo Molnar , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, guohanjun@huawei.com, jinyao5@huawei.com References: <20220121065954.2121900-1-liwei391@huawei.com> From: German Gomez Message-ID: <1c38c70b-d165-acf9-1c98-eeb234fbbe99@arm.com> Date: Fri, 21 Jan 2022 11:24:57 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20220121065954.2121900-1-liwei391@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Wei, This looks good to me. As a followup we could also fix the 'weight' field, which was introduced recently. On 21/01/2022 06:59, Wei Li wrote: > From: Yao Jin > > Perf script was failed to print the phys_addr for SPE profiling. > One 'dummy' event is added by SPE profiling but it doesn't have PHYS_ADDR > attribute set, perf script then exits with error. > > Now referring to 'addr', use evsel__do_check_stype() to check the type. > > Before: > > # perf record -e arm_spe_0/branch_filter=0,ts_enable=1,pa_enable=1,load_filter=1,jitter=0,\ > store_filter=0,min_latency=0,event_filter=2/ -p 4064384 -- sleep 3 > # perf script -F pid,tid,addr,phys_addr > Samples for 'dummy:u' event do not have PHYS_ADDR attribute set. Cannot print 'phys_addr' field. > > After: > > # perf record -e arm_spe_0/branch_filter=0,ts_enable=1,pa_enable=1,load_filter=1,jitter=0,\ > store_filter=0,min_latency=0,event_filter=2/ -p 4064384 -- sleep 3 > # perf script -F pid,tid,addr,phys_addr > 4064384/4064384 ffff802f921be0d0 2f921be0d0 > 4064384/4064384 ffff802f921be0d0 2f921be0d0 > > Signed-off-by: Yao Jin > Signed-off-by: Wei Li Reviewed-by: German Gomez Also it looks like the SPE samples are also missing the PHYS_ADDR flag. I think we'll need to fix the consistency of the flags. Many thanks, German > --- > tools/perf/builtin-script.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c > index ecd4f99a6c14..abae8184e171 100644 > --- a/tools/perf/builtin-script.c > +++ b/tools/perf/builtin-script.c > @@ -515,7 +515,7 @@ static int evsel__check_attr(struct evsel *evsel, struct perf_session *session) > return -EINVAL; > > if (PRINT_FIELD(PHYS_ADDR) && > - evsel__check_stype(evsel, PERF_SAMPLE_PHYS_ADDR, "PHYS_ADDR", PERF_OUTPUT_PHYS_ADDR)) > + evsel__do_check_stype(evsel, PERF_SAMPLE_PHYS_ADDR, "PHYS_ADDR", PERF_OUTPUT_PHYS_ADDR, allow_user_set)) > return -EINVAL; > > if (PRINT_FIELD(DATA_PAGE_SIZE) &&