Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp935331pxp; Wed, 16 Mar 2022 21:52:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxDBOQ3jqRG11h1g3nfd2Wx8Ra+/Lg6dYZBk6IrIJ8Q6+gctirN0Ja+UtEOWbWQIO18Q6I X-Received: by 2002:a63:7b49:0:b0:37f:ed43:4fc4 with SMTP id k9-20020a637b49000000b0037fed434fc4mr2230950pgn.387.1647492755381; Wed, 16 Mar 2022 21:52:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1647492755; cv=pass; d=google.com; s=arc-20160816; b=SASVveoduKORa+aFYFV5nTtee/f2GDuEwXElmhyFfrQ9GM3C9lIvj2hdTieyJQp8i2 YoVWHHX8FAc+iDoI5yDMmqjNBFNXq18K6IfCYRFFc/OpEZIHrXQEKggSV5gSewOeoba6 XzNpBUznZcmOxaSDq+SLdyuuwPw2PLghsFWkCDModZnlUxhuQhuvGuteGrM7JHhrfi77 shWKBn+9Y6+TuDF85A77+LiUuD2Ufoocp2LELyMLQjJmI79UWRzSliEXQ7Bk9XNCFlIo /loiHMY34XTWjFut0inpbNso/fcJF59B25W94RV4/Aif9alk7keR5cjkZW+EJcBTrmnx nLgA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=qP9FQrc22gZLoGJNWx4okDUdifZNCMBLp+pcdy2OTLI=; b=hXG24rG6KOvu6dqxVlL68OI/L7R3I5VvsHkFIhfH7k/QIiYjV8mpesX/7nnqBHRvsG 8yL/3YkZz7BeQXX9kxc5NJB4rxTa5Lp22pPWreUMcRzN8Rvb4TCz/8R8+7uy6ChSmy5I vuQb/JymwMCAKl03XNxNUIqzxDoEqI2zvXcLUG7hWH9pWUORZjzx1oqXvj+o19AFjGel eQrMb8odLghPmVLx5j+uBpKX8A+SVlhj5guzKHMgQEOr6BViyE5d/bJhLBP/3HEdBim3 DaDVmDTIJHieQm87ZfHarAP1N4EYWYhrBCYU9Pz+6bQsgGMZZD+XIhIYt1Scly/IIwBu mVxw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=lKk80P0t; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id a19-20020a17090a8c1300b001bf3fe66278si1362327pjo.183.2022.03.16.21.52.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 21:52:35 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=lKk80P0t; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 659BE76669; Wed, 16 Mar 2022 21:11:09 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354681AbiCPLS2 (ORCPT + 99 others); Wed, 16 Mar 2022 07:18:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352041AbiCPLS1 (ORCPT ); Wed, 16 Mar 2022 07:18:27 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2065.outbound.protection.outlook.com [40.107.237.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF660654B0 for ; Wed, 16 Mar 2022 04:17:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gxTIK4GAhXi5QFzwuFPSe/A1h2p1z6OvooVFRahRaRfyvhrH8yvlbpeE/8E8upb/YuUn8LfADCXF9BBYlCORku7VbG4dFdQVZJacu4m6ZF3FJ1+p5nGRJtTvZgOKd5Y8dc+9sj07E3rUF2kUpHv+gSsndCnDefDV93E+te1OZgxEbQ6nCUXPjR7LdWrM36BBRhCc9EIPncBIJJhryjzciCICYarjylU1TQOgmpB3iW093wINQXq67lZMBdh4SfC4X2BI4RQhpREueTwEO69ggz8aDT4tLuEgtL5J35fRP+5Ffd97yVa6Sw19iAFIL3p/0xWoQ6nIdQtd3LDG2AQPOQ== 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=qP9FQrc22gZLoGJNWx4okDUdifZNCMBLp+pcdy2OTLI=; b=huYHwFtJuv8pIRFPDLqAbh3wMAFY+syf7Mz/wAsH77V8r1uefAya4M45/lsjRCOZ4WbNXEKhFVIcZYH8hRMbLIp9J15dHFpHQbhOLIQJv4bKofxmLdFw5kaUFGIXkxE1K11dvm+BH7b0javYoRXDpuu61osy/45ZNak1xk1nMbGEWBJFXwFoWGm4IIDfEZ0Pvr2xIA0etJwQV11w7lbfjMJiAgtY3l86xTSnJgyDisxxdEXgXLX1O8Jr8e//0MMvfzlbSg01/Ba2nWLBjU1jZE5rY0wWqC/Mj0Izbhy4jFVj6RbYpESocczIRdqL9HRSoQE3CPTY/4BGAJNH4KPIXw== 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=qP9FQrc22gZLoGJNWx4okDUdifZNCMBLp+pcdy2OTLI=; b=lKk80P0t9G/+XNk6zC3K0aiSeQaqdvJ0JHyQHW9NZkX78d9TYc+q1KlxxSEmEXITCN859UJv+53+Vi1GnnSi4SG42W2yhVTF9VCWYyDFPKkawnN0IroZb0o29YhuqeH1B9p6ccJUSC2IIQCKBYPw23dRJExW7kE13N7QnnzA7+I= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from DM6PR12MB3051.namprd12.prod.outlook.com (2603:10b6:5:119::29) by DM5PR12MB2584.namprd12.prod.outlook.com (2603:10b6:4:b0::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.25; Wed, 16 Mar 2022 11:17:10 +0000 Received: from DM6PR12MB3051.namprd12.prod.outlook.com ([fe80::7166:2b70:c084:359f]) by DM6PR12MB3051.namprd12.prod.outlook.com ([fe80::7166:2b70:c084:359f%4]) with mapi id 15.20.5061.029; Wed, 16 Mar 2022 11:17:10 +0000 Message-ID: Date: Wed, 16 Mar 2022 16:46:56 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Subject: Re: [PATCH v6 10/12] perf tools: Improve IBS error handling Content-Language: en-US To: Stephane Eranian Cc: peterz@infradead.org, kim.phillips@amd.com, acme@redhat.com, jolsa@redhat.com, songliubraving@fb.com, linux-kernel@vger.kernel.org, Ravi Bangoria References: <20220208211637.2221872-1-eranian@google.com> <20220208211637.2221872-11-eranian@google.com> From: Ravi Bangoria In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: BMXPR01CA0077.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:54::17) To DM6PR12MB3051.namprd12.prod.outlook.com (2603:10b6:5:119::29) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bac0bf4e-7721-495e-6d3f-08da073e8380 X-MS-TrafficTypeDiagnostic: DM5PR12MB2584:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rTcZKUbuyi89+uSedUGR4p4oEv2XHS0v1PBwTDvVhueyDs8F5+PN8QoV3ZkjCmxUnI5kjlV5r6nCPGpRmn7kxcCGUCQkkGzi9sqV3vcqT8Ow+9qVjr4dYTSbhw1LlsFFi4ogRGlblPpSngwSQsdUbwJFOEPVF+0aKwaAWZqls/H/YH2csK9Q8e75z9sQbsZ7YOb6GwQB6cmg5JbzSmSjFx86e1+e3D4RkQMrBY/JTqTb6eULYqpzvaFPceHjInsLPtsfAAmFhcZzq0HX715dicpHnGKoNk2MfLnlmD+FvN7C7SmuSI8SiHY9Xh6z2bHA3X6Mb4xLB0ieKPC2dyAqBUSyC4iYs64MNnJm3J2dWAukmiHYAuhEkI0i39jh8qyI9/4MkbMQTxvcSfgh2h1K4aqnP60ytPx1f0lFWuE6bPOdK1vG60a3DD8kchp5N33eaNLhmvJ8RSo/au2hsXFP9cXzGtDfG73Hg86VzjcHqy59Iv36Mb2Fqu3tchOzr2xr9p0iqWhhaaQwGDACt9EVkpkvexOmSWMKhCOVwDSiB2kt0men9Sl84BpqZbi+Cgnxm9ntobMNKR+9FXnTAlJs3Ss0OC80pVzRwGzo06PHpqhD7THHFrMhHoqWg/leiXihlLQ6WGXmJTX5qG63UmgHQrndDMUE9rCm4nFIFSxLFdzS/IXST4ROAPPG56G28N4kkFQ4F+y37PsIaEn2XxVIjsJXWMT7XWFodUHl3I/TagSHpJEv+AKoaip9a9tFqleT X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB3051.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(2616005)(8676002)(316002)(26005)(83380400001)(186003)(4326008)(6916009)(6512007)(38100700002)(86362001)(6486002)(6666004)(44832011)(5660300002)(53546011)(31686004)(66946007)(6506007)(66476007)(66556008)(508600001)(2906002)(8936002)(31696002)(36756003)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?NGhVWUpSWTBPSGdGcW9idHBQRHc3VkN3TzAyTExocmZneXEzSHlaakowQVQ3?= =?utf-8?B?TE1VRjR6SVdHZytPMDlablpzTEpUOXZJWWVKY0EyaXhHQzJVVHVpUm9MNU1C?= =?utf-8?B?S3V2WjNDZE03d1VCSHhQdjg0Ym1zczRod1V5aVdMaXgwWE9OZmpXNXNvbVZN?= =?utf-8?B?Vmk1VklBUXhMQ3JuNnhySkpLMFp2cUJKYk9ZSGlJZU9ObkhKVkVmU3IyWU90?= =?utf-8?B?dzRjRlFKcXpOUllJRlo1UnovL2N6VG5zaWZ0OGYxNlVEUzl0L2ZYaE9ON09S?= =?utf-8?B?aFVpYTZwcEk3VmRTd2k4anpCSTFCSFRBcWRhaGwxdjg5eWNlM0RPZEtVdlYw?= =?utf-8?B?V21mYUc4Q0VQOU1zeTQ0Lzl4azlPYmt2NzRmVVNPZjJUajlnNkgwQ3Zk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JUNG9oOVJ4?= =?utf-8?B?ZDZ6R0ZvM3dWM1ljbXVLVUltdWE2MStLeDBKSENIRGhJVEhpZmZhU01jNVl1?= =?utf-8?B?WEYyVmJDM1Zza1FzaUlsWHc4dlF0c3pGc3JYb3JzMTBzOW15SW1aNnFWTVNK?= =?utf-8?B?MFNkWVdLTGxqTVdOWEo4c3Z1SFFydStYZE1xS0ZMdzVqU3ZjOFNRVHlwYzl2?= =?utf-8?B?QWZ6dTNtSUNGY1FEa1pjbVRzTUZ5ak9qcFlmT3NtdmovY0tveDlYTTNCQWxL?= =?utf-8?B?Wko4SEU4SWFCbjBXeTFpMjhWQ0I5SGo1Z2dhQ282eTFXUkhkVHI0Y3hndGd4?= =?utf-8?B?ZHR0cnpOc0hMb3REby8ybzVwSTdwVERzNy9BZHZlUldHUXU2NE1nbHdiZlJC?= =?utf-8?B?REtiS2dDQk9KZUJLSlJ1dGUyMkprUVdqMnF2YzlubmlQQjlhdkp2blAwRCtI?= =?utf-8?B?WkdMRG5CNy9lNHgvWHNya2FFMVVkbmh0aU5nb0l4WTcwN0swUEFZQlVJWHMx?= =?utf-8?B?YkZTK05QZkZNM0JVdWJEQk9LOUFDQzljdC9TdVRHRUtpb1dPNktQbUdDN1Qz?= =?utf-8?B?RkhRbGoycFJ5K2s1TVdMTVAxZW9obkRWRDgwclBwb2w4MERhbHovLzFPdDJI?= =?utf-8?Q?FNyARCtQgvNvpPBIR9AlmDNSzbSpVS7X?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: bac0bf4e-7721-495e-6d3f-08da073e8380 X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3051.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Mar 2022 11:17:10.5694 (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: RkFq+d8bn1yN5BF1it5v9z7ux14O61ggo51CVgV4bLAf35iXr5onlhtu/hnfCVO4rhNsQFJ93TehMCPbYr1Tnw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB2584 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no 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 16-Mar-22 4:37 PM, Ravi Bangoria wrote: > Stephane, > > On 16-Mar-22 5:33 AM, Stephane Eranian wrote: >> On Tue, Mar 15, 2022 at 12:46 AM Ravi Bangoria wrote: >>> >>> Stephane, >>> >>> On 09-Feb-22 2:46 AM, Stephane Eranian wrote: >>>> From: Kim Phillips >>>> >>>> improve the error message returned on failed perf_event_open() on AMD when >>>> using IBS. >>>> >>>> Output of executing 'perf record -e ibs_op// true' BEFORE this patch: >>>> >>>> The sys_perf_event_open() syscall returned with 22 (Invalid argument)for event (ibs_op//u). >>>> /bin/dmesg | grep -i perf may provide additional information. >>>> >>>> Output after: >>>> >>>> AMD IBS cannot exclude kernel events. Try running at a higher privilege level. >>>> >>>> Output of executing 'sudo perf record -e ibs_op// true' BEFORE this patch: >>>> >>>> Error: >>>> The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (ibs_op//). >>>> /bin/dmesg | grep -i perf may provide additional information. >>>> >>>> Output after: >>>> >>>> Error: >>>> AMD IBS may only be available in system-wide/per-cpu mode. Try using -a, or -C and workload affinity >>> >>> This patch seems to be causing regression to perf python test. >>> >>> Without this patch: >>> >>> $ sudo ./perf test -vvv 19 >>> 19: 'import perf' in python : >>> --- start --- >>> test child forked, pid 145391 >>> python usage test: "echo "import sys ; sys.path.append('python'); import perf" | '/usr/bin/python2' " >>> test child finished with 0 >>> ---- end ---- >>> 'import perf' in python: Ok >>> >>> With this patch: >>> >>> $ sudo ./perf test -vvv 19 >>> 19: 'import perf' in python : >>> --- start --- >>> test child forked, pid 144415 >>> python usage test: "echo "import sys ; sys.path.append('python'); import perf" | '/usr/bin/python2' " >>> Traceback (most recent call last): >>> File "", line 1, in >>> ImportError: python/perf.so: undefined symbol: perf_env__cpuid >>> test child finished with -1 >>> ---- end ---- >>> 'import perf' in python: FAILED! >>> >> >> The fix I sent you is just to prevent a potential SEGFAULT in >> is_amd_ibs(). I bet the test fails some perf_event_open() >> and ends up in strerror function and from there I don't see how the >> patch could impact the test, given you'd segfault >> otherwise. >> >> I tried on my side and with or without this patch this test fails. I >> think this looks like an unrelated issue. > > That's strange. IIUC, python/perf.so needs to know about util/evsel.c I meant util/env.c not util/evsel.c > which can be done by adding an entry in util/python-ext-sources. > > In any case, do we really need this patch now? For both the example given > in description, I see no difference with or without patch: > > Without patch: > > $ sudo ./perf record -e ibs_op// true > Error: > Invalid event (ibs_op//) in per-thread mode, enable system wide with '-a'. > > $ ./perf record -e ibs_op// true > Error: > Invalid event (ibs_op//u) in per-thread mode, enable system wide with '-a'. > > Same o/p with the patch as well. > > Thanks, > Ravi