Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1363854pxb; Fri, 21 Jan 2022 16:35:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJxTVsql1mFp882UE7KtzLABrbtsagVpZXgMaEPVwXX+cupZJtTtOr0a90PK8x8e3GjmNDPS X-Received: by 2002:a63:e008:: with SMTP id e8mr4553082pgh.506.1642811714763; Fri, 21 Jan 2022 16:35:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642811714; cv=none; d=google.com; s=arc-20160816; b=zLN6vYH5JUs2vYpUfqqvACfnhaW3QCkDMKhyhweeosbgiZ7iqXIDjq/WXU7q/rlrRC rw1Sv8itBm49qoWPGnW21b9GGurG7NolQQ/qneJjFJMiOapHNW25Hm/Cl+1RL3MteO9N A1asWy0g2cQYT+Bne93Vg4+E0SsJYmR3MUHyzgR3iT3caCywnC+Tg9iCUeLJ2AblU2aQ aDRmcseTTdWeJcW9/F0NzHFOfMlJohPsM5wYxajeAQpTUXxTRzi8h14ID1XaV+kHwf6c uNcBhJlg2NI1swiHz1UAi0rZdiEhZ1VKl1CQwO+ybPCI94tEeoZGWFz2iIG3ZW8cOZQO 8HFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=eCs3eS8xLTdt7/gH87GNn89SkvGdahSKXP0f1UkV/CU=; b=d899X0t4jAfgvvJhew5h5xvc9CavLrrNoaUDDKFiRL8eBzvWjRhxeBveP0FTMs+M/p b9C+k+fdcsNt27JSq8eiBDMrv63B0C3XNwmvzYH2dF4UUQPMTOdllAe8vDoitoPe6dUN GMv9mvwXufpcIZ20dbkvttKuqWLaDmp/NCxA1KQQxmwUC6xb96tx7p5nQwHN2UMJGMzq wRUjrruthdQSlanjEEpU+MNqVjh+8oMoGQau/fYOqsyajSE+GeDwmSgPjh1y1uWPrWTP zjuclotQXrb5d8faNryGl3Vhq0f9aEAe0OH0BXcxFgqzJBWMbWdf8AvXEbd1TyosZXPu /iPw== 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 145si7523836pga.75.2022.01.21.16.35.03; Fri, 21 Jan 2022 16:35:14 -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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378795AbiAUGzD (ORCPT + 99 others); Fri, 21 Jan 2022 01:55:03 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]:35854 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378777AbiAUGzB (ORCPT ); Fri, 21 Jan 2022 01:55:01 -0500 Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Jg98j2gp3zccgv; Fri, 21 Jan 2022 14:54:13 +0800 (CST) Received: from localhost.localdomain (10.175.103.91) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Fri, 21 Jan 2022 14:54:58 +0800 From: Wei Li To: Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim CC: Peter Zijlstra , Ingo Molnar , , , , Subject: [PATCH] perf script: Fix printing 'phys_addr' failure issue Date: Fri, 21 Jan 2022 14:59:54 +0800 Message-ID: <20220121065954.2121900-1-liwei391@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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) && -- 2.25.1