Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp3929934ioa; Tue, 26 Apr 2022 12:40:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8/o9MMQ9+g739GaZodhP7WnZbBwNRVViyeHo6BCpkBRBuzk4LvITibRWvt160HfGu1zjc X-Received: by 2002:a17:907:2ce4:b0:6ef:f141:406d with SMTP id hz4-20020a1709072ce400b006eff141406dmr22174283ejc.214.1651002002451; Tue, 26 Apr 2022 12:40:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1651002002; cv=pass; d=google.com; s=arc-20160816; b=02KECRtwfRYbU5WN3NB8NdLjVM6QD3IGPpf1RSQ8JJOQrGl+R2Xf9HluxTMs/8v3hn 678pJAfBe13GzqVTaT5DAmf00qFXzLkqsVtcEG+LeC394bN0vy8oFdzrgFRtqscFRu1y A/3YfP406FWQ3ZRPfGb94tFrI0/x/bUNYtrh+6NLQoKEjryiXNN/GyltblPPpxaSP1XI RHYffooA864f71y3B7WoMJvYFtBVLO4PcZD2OulDEd/IDfWI8mAAp+cOlRVWNytoheqc UpufsM3t/aKshrY8+6G/7miEEj6UCKdTo5mHTi7TV8xyFeIEUJd1QTKCAPBhuLBn5O0W IGjQ== 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=h3d6U8hLC8JBh4W/SMG/72osSR8J+9mWFjLs02HrwPk=; b=Tqc89fF9XW23khK0bNH0WpOcRAheIZmI9uPxzjNDrFKqXbwBQWRY+TVfFptH78zqmn VDQSLneyHPLruElWJG635aWKBOlmME77tZXtA07hbwBcWyJ3XoSshbPLQPEsFh69Rlnj q+Dp+kkWToQbqoqAUCUnyeYMbqyuekjYCykTo+neY3Ysg6tAaxEATDOd7Ip9NFiD+KGZ faiDDgpf8cft0Qo5DZMXYYlrcDWouMfXn4u2UpQd109Xbc/MIzXPPE6YjjPY9VvmLdCB Q9PPAmBx/NZuDydrG1LFdhTJJYTF5YukaekeMB+ldZn3FD5Cz1UVW1lduCfoGkoR3/yt 9jZg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Fe9xPRNq; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g18-20020a17090669d200b006e80297a928si16307393ejs.469.2022.04.26.12.39.37; Tue, 26 Apr 2022 12:40:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Fe9xPRNq; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349603AbiDZLqs (ORCPT + 99 others); Tue, 26 Apr 2022 07:46:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349604AbiDZLqq (ORCPT ); Tue, 26 Apr 2022 07:46:46 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2053.outbound.protection.outlook.com [40.107.220.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99B913C490; Tue, 26 Apr 2022 04:43:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P66AuvajrujR/MQotw+1ymhZv3x8JRuDFimdJ4G47AdgyRlFSu2HyxE0C3NY0/ZoA3pbmIDrijgUYTjQWtan8L0QHisjk5Gtkx/KLWJTPrXdauEghLwhpsVH1AAyeKPTI+gmmulJMcb7gcv4rqZ9UEWcaQ/XELHJ9xEkaODTNweDFwdBfkbropu1y7cEKOz6kqSjJCfFeDZrkrIvcJvLIYHjsaGKguEDIquHtfn0gr0Icxm32j4eJtVb+VqX2hRTm0SlnZgSqeVLHgOa7NooiZLJ2q9yKoHnBPpK0Qc4IlmatjIdLojVNEC7H1VMZZqh75VUcfQGMgMuBhC31AEDvQ== 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=h3d6U8hLC8JBh4W/SMG/72osSR8J+9mWFjLs02HrwPk=; b=XjFFy1ifsUKAM3PS+ojFHboMFTQ+H2+evJbiVkUzjlHuFQWxjUqGTFklZpfpa9RvCpjqDUWy7oidhP20XbRrwQCnK3MLXtBuUe9qeYdckBIApAsY6DtAUYlNoitYq7tlPaMv7IZAS/adrfTga2jhmjAfjXOohU1jJUvRG4KnnmMLfnCu8TpMDM/bavo6yamSglZNT3+gzUDqeAJvZqfND5+LdEOPC6Nmonxi2zb5AAyKyrgHkiBifZAnczrWsv3X4ZFnjjtEN5reS2xkLpfpAK2gFnMn7idrsE8FCKRmA7TsVztVr5vSlBvQ8eLubFjPs6xBaexG97XGpVsUZWCZ3Q== 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=h3d6U8hLC8JBh4W/SMG/72osSR8J+9mWFjLs02HrwPk=; b=Fe9xPRNqYnAsWT/rD0juIn3tH+sv+G7FjT6gEDhPN3jj/REj1CvLyy5M92Z9aSuh1UUgbV88Bq7KQbEBSsyoOJt+6GsVP7SHLsZlRK8kmcFB+9jDYq/r5vpqTT02cP1qIowlR5qN85TfQ+WPlEVdf3++dcFpndJe7NWUFK9by5E= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from MN2PR12MB3053.namprd12.prod.outlook.com (2603:10b6:208:c7::24) by DM6PR12MB4012.namprd12.prod.outlook.com (2603:10b6:5:1cc::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.17; Tue, 26 Apr 2022 11:43:34 +0000 Received: from MN2PR12MB3053.namprd12.prod.outlook.com ([fe80::6807:1261:8f60:2449]) by MN2PR12MB3053.namprd12.prod.outlook.com ([fe80::6807:1261:8f60:2449%7]) with mapi id 15.20.5186.021; Tue, 26 Apr 2022 11:43:34 +0000 Message-ID: Date: Tue, 26 Apr 2022 17:13:21 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Subject: Re: [PATCH 3/6] perf/tool/amd/ibs: Warn about sampling period skew Content-Language: en-US To: Robert Richter Cc: peterz@infradead.org, acme@kernel.org, mingo@redhat.com, mark.rutland@arm.com, jolsa@kernel.org, namhyung@kernel.org, tglx@linutronix.de, bp@alien8.de, irogers@google.com, yao.jin@linux.intel.com, james.clark@arm.com, leo.yan@linaro.org, kan.liang@linux.intel.com, ak@linux.intel.com, eranian@google.com, like.xu.linux@gmail.com, x86@kernel.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, sandipan.das@amd.com, ananth.narayan@amd.com, kim.phillips@amd.com, santosh.shukla@amd.com, Ravi Bangoria References: <20220425044323.2830-1-ravi.bangoria@amd.com> <20220425044323.2830-4-ravi.bangoria@amd.com> From: Ravi Bangoria In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: PN3PR01CA0103.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:9b::15) To MN2PR12MB3053.namprd12.prod.outlook.com (2603:10b6:208:c7::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ce68d2e9-cb7c-448a-18e9-08da2779fe97 X-MS-TrafficTypeDiagnostic: DM6PR12MB4012: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: 2HpFAkXGEZbnbFi2f6RehuL0fE9WuQdQ/I/3sNegP0q3ypsFER3dGVgYAd+vkhQ4P1LYqKg8ebtxRVMUcBb8X85r9YFeW2rlAGebUe9YMpzuxP2AWhv1YRdnK/j/o329/7MTNPd5ne6HwUthn2R50AtWbDFMbCtv2mIkHNhm8zYT/riYTuBtTOyOOM6k6bSAu7n6gMkNfgXCN5dw9iegZaVXyf/goGsr2bxo5yJ6E89THFfV7AqT9cURNR1LKZXfVJRtL/pWp5LbS6HdCNSPgaGK4SSlffn1t65cXLgSNwePCZcvC9MroCS4qmQBpdbaKVZF070/1ERcDaGXPxnF5srnWj9b7/pdh0wLG89asEbaWZlwEBmQCUodbwO5igqvq7Td2xv/zJ9GhGQGCB+qrBxS9VrdU2HZsDHj7Exq/4ymtVEd8OAzmbRjFUZMIf/AfFYE6Eg1Aj24wcujrP5KDxJ9geIjL29ldnVqGHF/drOiPzVdbjcEo7PMtzm3Arv2pWZDzd6B/2emH5vtdlJfAHt9WzvZQjAc8oYIBLC9M4MMqCSHyUqe8lXP083c+F1nT+9QdAaHYf4Vyx/OPCsOpII17F+DU4JXdaJCrzpUwW4vwJR21BkZHRU2qWg4qZeVHMYiNlExSPtVxEBJV04UiEIsbv7JMQB7MCrtXVj6MldZDOq7bDNZXX+wGN8OlJZ933bgaFJJb16kg46F32p52jwHZPTfdN1KdQ13Ct7aO0Q= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB3053.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(2616005)(31696002)(508600001)(6506007)(6512007)(6666004)(86362001)(6636002)(186003)(53546011)(36756003)(31686004)(7416002)(44832011)(8936002)(4326008)(6862004)(38100700002)(5660300002)(2906002)(8676002)(66556008)(66476007)(66946007)(26005)(316002)(37006003)(6486002)(83380400001)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?MlcyZHVnTlRiaFR2a1VYdnFHcWw4d1M5WStyUXkxdFF3cXpSRmtMVDNQRUxy?= =?utf-8?B?VHFUZGZ2ZXU3cUMrWVFyVlZVUWRWT0k3WGo5QS9ZM293aGZJRTh0cC9Ld044?= =?utf-8?B?SDlQc0xUa3lTRzNIVXVxY0NWbkpmalZyOVpzdXNqZTRUeU10WjVud3NJOWpO?= =?utf-8?B?ZWRMVzBVdkJULzRIUEJRN290dEtmS1J0T1psemZDWFNnaUJ4SC9OZU02VnZY?= =?utf-8?B?WWxpR2wrSzRXckNHbFdVaUZMYnduaFlZTkw3eDdNcVA0TTVwUTJGSG9ibGMz?= =?utf-8?B?OExrcnd2b1JaRmdETU1pSWlaRHI0dDRMSS9yZXFvRzZ5YllFTUl5MXR2dEp1?= =?utf-8?B?WkExOUN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FA0d1A3VlZRZHVXakJYRWha?= =?utf-8?B?Ym1GTXlWMFpieWJFYXBqcktsbTJIQXRjVnA5VjR5dSs0OU9Cako3ZUc5OXFa?= =?utf-8?B?MXBXaTFQMHltQlRWM0VhU09lZkMvYThCTzRJU0d1OGU5dEhnQmphdXk5Wlgw?= =?utf-8?B?SUMxTWI4Q0ZTd2FkdVhodm9aYUFSdWlhMkNxbW54Ky9DREFxSGY4Zz09?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce68d2e9-cb7c-448a-18e9-08da2779fe97 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB3053.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2022 11:43:34.6562 (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: XpoBRymOrc4yjX4BzxkrLO09hAsei9zc6leKENOnI4lTuzzy8ht7shVcU07Hvvl0e5hvAo6VIMidOF81JU3nKA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4012 X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham 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 26-Apr-22 3:39 PM, Robert Richter wrote: > On 25.04.22 10:13:20, Ravi Bangoria wrote: > >> @@ -29,3 +31,32 @@ void arch_evsel__fixup_new_cycles(struct perf_event_attr *attr) >> >> free(env.cpuid); >> } >> + >> +void arch_evsel__warn_ambiguity(struct evsel *evsel, struct perf_event_attr *attr) > > Have an 'ibs_' string in the name? No, this is not ibs specific. Any arch can define it's own version. > >> +{ >> + struct perf_env *env = evsel__env(evsel); >> + struct perf_pmu *evsel_pmu = evsel__find_pmu(evsel); >> + struct perf_pmu *ibs_fetch_pmu = perf_pmu__find("ibs_fetch"); >> + struct perf_pmu *ibs_op_pmu = perf_pmu__find("ibs_op"); >> + static int warned_once; >> + >> + if (warned_once || !perf_env__cpuid(env) || !env->cpuid || >> + !strstarts(env->cpuid, "AuthenticAMD") || !evsel_pmu) >> + return; >> + >> + if (ibs_fetch_pmu && ibs_fetch_pmu->type == evsel_pmu->type) { >> + if (attr->config & (1ULL << 59)) { >> + pr_warning( >> +"WARNING: Hw internally resets sampling period when L3 Miss Filtering is enabled\n" >> +"and tagged operation does not cause L3 Miss. This causes sampling period skew.\n"); >> + warned_once = 1; >> + } >> + } else if (ibs_op_pmu && ibs_op_pmu->type == evsel_pmu->type) { >> + if (attr->config & (1ULL << 16)) { >> + pr_warning( >> +"WARNING: Hw internally resets sampling period when L3 Miss Filtering is enabled\n" >> +"and tagged operation does not cause L3 Miss. This causes sampling period skew.\n"); > > Avoid duplicate code. You could move it to the end of the function and > early return if the config bit is not set. Sure. Thanks, Ravi