Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5B3DC433F5 for ; Wed, 1 Dec 2021 15:30:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350978AbhLAPdq (ORCPT ); Wed, 1 Dec 2021 10:33:46 -0500 Received: from mail-dm6nam11on2069.outbound.protection.outlook.com ([40.107.223.69]:15873 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230118AbhLAPdo (ORCPT ); Wed, 1 Dec 2021 10:33:44 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aLOnE22rHRLG7x+RhWf2h1n5ylm36/YZB40KoGTobB6+J0722dwNH1eey9HwbkTnO60E2WA59LPuoX6qFJQBV0IfRfeKOwltBvOmdsoBxFDARVb5gyKGMZf6WYAVXKdkPgSbFWksLKTEuPiD7Zn6gQrrIU9CN1GtP9FODtHSM/tWzRsv1QCiO+pHIi1cxoe4AY0LWxKyUrPIsm3LataPQIADEINzM1YI8EklPErIFcQbMZJiEtgJgY8TzpBw1EXtXHrIyP8ZCaZi7eMPLS57gxpiEot91qEBDw+T0GSS6sxUJ5HS5SrpxV+dUuKH3FqNtqES4SGxB4J6nfKXcTR7BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NpQLekvxwLuNkNcuwq2fxFIMBTFST5v2RGxVtAx/a0o=; b=VcBVCQ2KZtmSeZcoNbg5aHctcElfqMme2YL9NPE2ol8rrEfI/KgWgH2YFynisqul0Y7L7utjbDKTsZW41hwgbrp8QY7j4rujLqzMFTzTKV08+hHqpVQo0Yif1XApjpDhvFNlM2sMe7opRGe69lDlX1KgEl3Csa/Wl+ONlRj/4MOphtwxVqIvR9QjHGHEsVjgO5VJY+Ls8sgw9oGxXBrOHl6ctsivDzXshyICt7p4uhF70zm0iDHbBk05YfjFgrgoyrzawB3iPMvMtIUi7lNk+kyJYWZSfBjnFCMsn1EZeo9T9Nhnz0ZrmrLH47TAMM8K5YkNB/CKXa3pL9IVRdpFJg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NpQLekvxwLuNkNcuwq2fxFIMBTFST5v2RGxVtAx/a0o=; b=AoTEo7XLPxOufrzGcjsm2rY3hw3rJ4TimRa3L3SRLxeTv21+BzKZ0JQNQwjcI+QZ2674Tkz2McNFZVchP3iVxuMLLk+F5n97mtqete0KvsmpP+M62MBFPn60ChqFBJI2gQYv1CpssY3N3n+V90Kmm6vF7Hyk+C7SK3iIMDkdJoA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from BN8PR12MB3505.namprd12.prod.outlook.com (2603:10b6:408:69::17) by BN8PR12MB3460.namprd12.prod.outlook.com (2603:10b6:408:48::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.24; Wed, 1 Dec 2021 15:30:19 +0000 Received: from BN8PR12MB3505.namprd12.prod.outlook.com ([fe80::704c:60ed:36f:4e4c]) by BN8PR12MB3505.namprd12.prod.outlook.com ([fe80::704c:60ed:36f:4e4c%7]) with mapi id 15.20.4734.027; Wed, 1 Dec 2021 15:30:19 +0000 Message-ID: <25f7b261-3f2a-942d-8d3f-d501d9dc9612@amd.com> Date: Wed, 1 Dec 2021 09:30:14 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.1 Subject: Re: [PATCH v3 11/13] perf tools: improve IBS error handling Content-Language: en-US To: Stephane Eranian , linux-kernel@vger.kernel.org Cc: peterz@infradead.org, acme@redhat.com, jolsa@redhat.com, songliubraving@fb.com, mpe@ellerman.id.au, maddy@linux.ibm.com References: <20211201010217.886919-1-eranian@google.com> <20211201010217.886919-12-eranian@google.com> From: Kim Phillips In-Reply-To: <20211201010217.886919-12-eranian@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: BL0PR0102CA0056.prod.exchangelabs.com (2603:10b6:208:25::33) To BN8PR12MB3505.namprd12.prod.outlook.com (2603:10b6:408:69::17) MIME-Version: 1.0 Received: from [10.236.30.70] (165.204.77.1) by BL0PR0102CA0056.prod.exchangelabs.com (2603:10b6:208:25::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.22 via Frontend Transport; Wed, 1 Dec 2021 15:30:17 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4fea0011-6ec1-406d-e056-08d9b4df7a8d X-MS-TrafficTypeDiagnostic: BN8PR12MB3460: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1923; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kJvmE4QoL+/NPMPj86rZyUG53j54+OkI8e1iL1dEoz2LWEEcA1E/cE3uYCrL+C7aSuuzj3eslMk/bGgQJIs8IsoP0RzoSsIk31fa9CTaluI4mk0/6rmdydyFcbNO1fMNu72uyxyq+9x6LGe0cqIH1oRoAuXEZeeT3WRvL58+kUgkh5k1llCdZKWl8q9w1aOOrLOR7eAEsjGekfAyfFGicn67ADkFwpi383G+b+ehZJzRHxmU+BejnjNoAOEcDwb6alrWK+aXav4GfCeZ2W5u0jhR+Hxwkv6zbwbNDjdn661RLOswZQbs5MU8slb97FowWXmONm8oVJ8gVXaPv4aOL7JDSkzxf/a/EtsdAgztU4Eplk//TEl8iTWsyCWNC4ehMq25QEVEdFHTfZR0bna/nVo8GlkGYTjIrCjiwbP7+CEo81jE7KBaJhCmpayJXDGePBelNeD0ZjdiMT/2ySbBulTz9BHZ518Y6HXkBRnvYYbemHHWH1Euc8H/AgPmqckqxfsKjbD++ZTVXLW/73mxYYf4+WvUuCuI6JA90ZArwVuL96oGslgaZRn1JAdf/Vvc9gBYOOM2Q2D/iqda8Gl0Qz3MUseI3mswsUDzD3pa+1nNRGimLxV4DC1+BKggMRk9p/oddfTOV10ArUz1SM6m0IE5/EDY83sdxjHG2rrRnw/AD55vNQ6dklSbI56lgc8La3ervUZM1wHUkJfZjLC7Yw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR12MB3505.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(26005)(186003)(66476007)(66556008)(66946007)(6666004)(38100700002)(31686004)(508600001)(2616005)(5660300002)(53546011)(6486002)(956004)(16576012)(86362001)(8936002)(44832011)(4326008)(8676002)(31696002)(316002)(83380400001)(2906002)(36756003)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?NkcxaGJYVlM3SlBSdGFHUnptb3ZmY0w5bHVHem1sVk56OUlSRlAzN3NWam9s?= =?utf-8?B?cHRxVUh3ckVWb0hlUEdNcElSSmpKUk9WcHNEMnd4YjVnRnVNaW5jTnVRaW9t?= =?utf-8?B?SWtPUDhISVdiTklNMldSd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1IrOEpkRDBEaUE4NTdOY0Q5?= =?utf-8?B?TVRqWWNOd3o1VFEzRHBCQkdlNzFSRGx2dHhzdWxoak1Rbk5CQUVzOFk2U1Ri?= =?utf-8?B?T2l3Y3pyaWVmcmhLYzc0YTBiYVN1a0doeDdEM0RxbHpPTmpCZEc0Q3JpR05G?= =?utf-8?B?bnJMcjVHZzVVREh4NEZ3U0lJTVpqVFhJa3N3QUtXV2FFN0g4dWdXMFUrbWEw?= =?utf-8?B?WG9WMFRrWGVvRkFrK0VUOWUvRk84dHY0RDNYRHBPYjUxOUVRV25CcWt2aU1E?= =?utf-8?Q?pdFa/yMQ9pGIwRB+HGIwn3Y=3D?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4fea0011-6ec1-406d-e056-08d9b4df7a8d X-MS-Exchange-CrossTenant-AuthSource: BN8PR12MB3505.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2021 15:30:19.1412 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: fOKaJ+NyLk6d/8VAWl6Oavrce8odoRC3XJZt8AyMiNv7z/simSKMevusQFg3bHDoDMQMyp9Wpmyiode0LnBJsQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3460 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Stephane, This v3 looks like it's the same as in the v1 of the series, which got nacked by acme. Please use the newer patches provided. Instructions to do so haven't changed since then. Thanks, Kim On 11/30/21 7:02 PM, Stephane Eranian wrote: > From: Kim Phillips > > This patch improves the error message returned on failed perf_event_open() on > AMD when using IBS. > > Signed-off-by: Kim Phillips > --- > tools/perf/util/evsel.c | 42 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 42 insertions(+) > > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c > index ac0127be0459..39e9063c0a80 100644 > --- a/tools/perf/util/evsel.c > +++ b/tools/perf/util/evsel.c > @@ -2852,12 +2852,52 @@ static bool find_process(const char *name) > return ret ? false : true; > } > > +static bool is_amd; > + > +static char *fgrep(FILE *inf, const char *str) > +{ > + char line[256]; > + int slen = strlen(str); > + > + while (!feof(inf)) { > + if (!fgets(line, 256, inf)) > + break; > + if (strncmp(line, str, slen)) > + continue; > + > + return strdup(line); > + } > + > + return NULL; > +} > + > +static void detect_amd(void) > +{ > + FILE *inf = fopen("/proc/cpuinfo", "r"); > + char *res; > + > + if (!inf) > + return; > + > + res = fgrep(inf, "vendor_id"); > + > + if (res) { > + char *s = strchr(res, ':'); > + > + is_amd = s && !strcmp(s, ": AuthenticAMD\n"); > + free(res); > + } > + fclose(inf); > +} > + > int evsel__open_strerror(struct evsel *evsel, struct target *target, > int err, char *msg, size_t size) > { > char sbuf[STRERR_BUFSIZE]; > int printed = 0, enforced = 0; > > + detect_amd(); > + > switch (err) { > case EPERM: > case EACCES: > @@ -2950,6 +2990,8 @@ int evsel__open_strerror(struct evsel *evsel, struct target *target, > return scnprintf(msg, size, "wrong clockid (%d).", clockid); > if (perf_missing_features.aux_output) > return scnprintf(msg, size, "The 'aux_output' feature is not supported, update the kernel."); > + if (is_amd && (evsel->core.attr.precise_ip || !strncmp(evsel->pmu_name, "ibs", 3)) && (evsel->core.attr.exclude_kernel)) > + return scnprintf(msg, size, "AMD IBS can't exclude kernel events. Try running at a higher privilege level."); > break; > case ENODATA: > return scnprintf(msg, size, "Cannot collect data source with the load latency event alone. " >