Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4976348iob; Mon, 9 May 2022 06:09:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWzkO56Fw1ALJdgVUeLvk99GziGHPgfM/IyBIufDL7flTneq5p8dcPtnaTh0oTMwCLIZX5 X-Received: by 2002:a17:90b:1e04:b0:1dc:9252:efbc with SMTP id pg4-20020a17090b1e0400b001dc9252efbcmr18204999pjb.39.1652101761845; Mon, 09 May 2022 06:09:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1652101761; cv=pass; d=google.com; s=arc-20160816; b=J6fxAmcgAcsZb7e7F2pOhndr6+pHdYVwrlyrkDNvLA7USrCue1unlpbi3feyooD1C4 H/HG2EKygUFdTe/a+BiX/7cIvm/7FvuLKseWxG6IOXwrOXNe0qvwBOWuXuO0WaBr154+ 6Wy86Odgld/JrWo31gDH64PHZwjxFNyqUbeX1YBhSKYd9eitMuOvL3CH3R5oIa7sBuac GPSpSbcng7VBI4fB3OM05LKW8o8Y+/r7kxKhX+4s+mOU1/LC1fi480UWkcRCOGh9gTZi V6RYYHagvg3vn5+ijBiWqk7ipSj0XZkfikuScxQDWaftoAgXcIrynLvgTbraabQx8I1m oN2w== 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=lavdKApkZ8q2tFopxbvJKi6VXohi/Tg0mFm882ldXGE=; b=bE16r2WM4uoCBcwh+P1rFhjdbZud1Lquq7THSnhx8P3zPWGiw+ClTpw9XtH1uRqDv9 Qm67mtoyeKwhF/vs8P0zho7L+3+4U8jDHhHJIuhsqP09SSNxGjHIzLg6Yxlyyh78AmNY 7rsYaZf8E1uKBZ7oGReeUZ6Men1q/t6ilcn8mOM5jjX7aKK7rrkZ1918NT245s3JyArf seT5vbRvgGu9glH1COd4sdJEQxOrtcKl8vRIjvtnOawzTyfkHfWw3rqjCCoXwO6Lys3D pYsw2fssY5F6RYhiT0VlY2rBRZGVA3PQ/Rzh+CLM5pgEuX3hwWb0KsESSBPqKXR3+V0b aiLg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=mtXS3pNZ; 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 z8-20020a6553c8000000b00398f1f7ab55si13927163pgr.333.2022.05.09.06.09.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 06:09:21 -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=mtXS3pNZ; 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 68C572A5E96; Mon, 9 May 2022 06:08:53 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235146AbiEINMl (ORCPT + 99 others); Mon, 9 May 2022 09:12:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235210AbiEINMg (ORCPT ); Mon, 9 May 2022 09:12:36 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2079.outbound.protection.outlook.com [40.107.93.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB6702A2F43; Mon, 9 May 2022 06:08:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BpDKDQ90dG2N2e2aPh4OwqmhIJ6WdKThbU6XYTZPRTTQqGFBDD0nBPTBdT0WUF8lK0DzYlYtkZHSfOrFSOvwxtpOmaAMBsle1Vbt7Kkv2slaB8WDKS/Ssu+S552WWR3cuQoqGz6p8++bE7AIVUBEo1e1wGFCt1aoKA5u/Ag3SjsphT8HLt9A6CUN3rzkyS/XnCbx7+LUgt8TYkyPCwOAItVoSq7tWP/6/Y058DsVOddQUj41THgCpx2Rmh5SSurA9siXq0WfPynHG6q9FMVVX9jD+GqnAsrkKhpz5uPV7nX/q1j4H/K4kZcbn0ZwxCMvG77/h949OKZvexRtShZUQA== 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=lavdKApkZ8q2tFopxbvJKi6VXohi/Tg0mFm882ldXGE=; b=gz8zB6J5xkRdPfUfj6TK+rSr/59WV8V7F3JZiomIQ+91OaoCSoXwhQoMTw3RJfqfpTEeriAP7aLaVsP0S+m+OV15pf+dCtnG7IrrBajGW0una/1TpjD0vWK4fALKjyrskrMccU2uHH0AQROI9I5zs24E89Ap00SnnylMhvuvw63AFUJCJ03tfj7oULG2b5E7irFhhc3xqwZG0/MDPefE/nmNay1xeszmkNglSXn3NYm70TpmgphBgm9TYSXmtz5okxg74w4unNup0mg7hzoL36K1WM+H98tu1dgKVFJS2GR0eJymbR8dXMPJXdyS6mi/y3srYIIlJEdaskMpB/c5VA== 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=lavdKApkZ8q2tFopxbvJKi6VXohi/Tg0mFm882ldXGE=; b=mtXS3pNZfj93bWv7gqtYyimC920LJmgIYZ+IvobOlgw7sHxX6rnOLF1lslCFieAdzNVTgeMVI6cEHqILPHR7ou9pTqddet6jNj3uiY3u8vvaa/602SzmPsfqJTk6ygs4qSyC1CpXZSWKnV2FZecF0WijFV6Qt1AqcqunGfi40ng= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from PH7PR12MB5712.namprd12.prod.outlook.com (2603:10b6:510:1e3::13) by CH2PR12MB4166.namprd12.prod.outlook.com (2603:10b6:610:78::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.21; Mon, 9 May 2022 13:08:35 +0000 Received: from PH7PR12MB5712.namprd12.prod.outlook.com ([fe80::8d3b:6561:8563:4f1b]) by PH7PR12MB5712.namprd12.prod.outlook.com ([fe80::8d3b:6561:8563:4f1b%9]) with mapi id 15.20.5227.023; Mon, 9 May 2022 13:08:35 +0000 Message-ID: <96e41431-eb80-f61d-9ab9-c76cd9b6086a@amd.com> Date: Mon, 9 May 2022 18:38:19 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH v4 3/7] perf/x86/amd/core: Detect PerfMonV2 support Content-Language: en-US To: Like Xu Cc: peterz@infradead.org, bp@alien8.de, dave.hansen@linux.intel.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, namhyung@kernel.org, jolsa@kernel.org, tglx@linutronix.de, mingo@redhat.com, pbonzini@redhat.com, jmattson@google.com, eranian@google.com, puwen@hygon.cn, ananth.narayan@amd.com, ravi.bangoria@amd.com, santosh.shukla@amd.com, "linux-kernel@vger.kernel.org" , linux-perf-users@vger.kernel.org, x86@kernel.org References: <8d3e23760726cf6647a98999e1fcd12a37f36a42.1651058600.git.sandipan.das@amd.com> <78e001bd-42bd-5481-5a19-1a0bcca9a63c@gmail.com> From: Sandipan Das In-Reply-To: <78e001bd-42bd-5481-5a19-1a0bcca9a63c@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: PN3PR01CA0004.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:95::12) To PH7PR12MB5712.namprd12.prod.outlook.com (2603:10b6:510:1e3::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 53dfc8a5-e2fc-4605-e437-08da31bd0621 X-MS-TrafficTypeDiagnostic: CH2PR12MB4166: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: a5r6Q9ppy6VX0TlktNSH8sK5iILmhoXftbotC0yKEClvgHvvC/U+o1GTb8Qnvag8hPOYRFPfjW8a7gFoNMvGdKwasJl7cyHSfJhoOMwdxPo7nqaF1VQt6QYh5palqzSyol8YLPUQBslQLwiRjMhZ8Cgpl0c8Gg0PTvOIASrWN0cSPy/8u8cRtatMzv7wwAr/5s86+z4XMYkNfDaJcMrSKiQwXJiTl4O7i4tianSXfJfxhbqtfkpp9K1qMSsjgy6mhCfhFWEsmKtCByHqNQUXt+2HzQM3BIU/F1IigFUCvqJ/9I+H17cCgpT2dUpF5IFWvoK3hJlV+a629SP2rdzkvmLPdN1EKW81qqNMsuTD0egMyhtjdJCUHm6mwALWZLbRgv4L8aGGZGh3Z8YNP78ZJjYcF1IPoVP997cFGFx86/NtvK48OAv1DO23OQuqVBbmdeDyt0Xkhwu2PWdzURM6YOyTXQYMdDqDO7fCd/skD0nBJ7w+NbJJSimGqbiA/JITSnWJgXhfoUPR2yTNCtTmoWO4uyzh2JRqbKkk0Q6MsSd2yacN4LaemKaHfvueoAqgr39XRycbVtPoBX+heDjT/0bBY7AuA62lApZjD7sCBZpUxgJ/knij03lR5Mev87n4KYJTjre7N0I2EfM0UFa6vCirDPh+Lljey21aPyIi92p/LZBKNIthag8VcGBcV1DeyH1Uk7xJrazE4dlqSAv5DAU4Z6bfcjvXaiL1G9mrYJ0= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR12MB5712.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(2616005)(5660300002)(7416002)(83380400001)(31696002)(2906002)(44832011)(4744005)(66556008)(66946007)(66476007)(4326008)(8676002)(38100700002)(316002)(31686004)(36756003)(8936002)(6486002)(186003)(508600001)(26005)(6916009)(6512007)(6666004)(53546011)(6506007)(86362001)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?VzdkR1VUUjdyZWxPVVF3SUNIUVdPTmcwNnRmMkF0RFNtdFFBNG8wMlU1RG9V?= =?utf-8?B?K29qY24xYXVwazd5RFBUU3lzRjJpQzhzSTR5djZuQlI0ZmhHYUFsSFNrWXJm?= =?utf-8?B?TDFFOFZiSlNzY0VKOEhjeFJDelZoZ2dHRmVJQmFhNy9PNm4yODFEa0hPN2t2?= =?utf-8?B?ZGx2MU1PWkFIWXBaeU9OZGFFZnpRa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ESVVtR1VRcnBzQTA0TFYrQWRYK2hsK1d4SXR3cHZGOVpVemhTaml2cFk2?= =?utf-8?B?SW1YOWRQN1FoUTVoZ3IyYWpIWGJmcG9ONEV4RXpIZjh4eDJoa1ZRdVVoTU15?= =?utf-8?B?RSs0RFZCWDgvTDQvdVZ5d3dSV1RhblYyTCsxaU5laVhzUW45bXFRejQ1VG1D?= =?utf-8?B?d2p1emVtZ2pneE9NbWYvU21JVm1HSjhmRUNxVWRSTERQWm5QcTBJY1ZTZ1BY?= =?utf-8?B?VnRUemkxSXdBQ0xOTFV3UHBnelZQcGVpaGZ0WlZpd2JRdkl2VEFXbFVCWFFW?= =?utf-8?B?c05GMmRLU21qaTFXaUxydXZUWUFUTnkycldTNklVSENBSmh5L2FRZz09?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 53dfc8a5-e2fc-4605-e437-08da31bd0621 X-MS-Exchange-CrossTenant-AuthSource: PH7PR12MB5712.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2022 13:08:35.2510 (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: SqRkgKOS94Q0fXRtNniSnP2AvlRFhLWASLwPDB1KizAJ4ULt8gtL0CFf+DFyEYWpLSl4Wtwnoej8O9Il1OCySQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4166 X-Spam-Status: No, score=-3.1 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=unavailable 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 5/9/2022 6:31 PM, Like Xu wrote: > On 27/4/2022 7:31 pm, Sandipan Das wrote: > >>       x86_pmu.num_counters    = AMD64_NUM_COUNTERS_CORE; > > Thus boot_cpu_has(X86_FEATURE_PERFCTR_CORE) is true. > >> + >> +    /* Check for Performance Monitoring v2 support */ >> +    if (boot_cpu_has(X86_FEATURE_PERFMON_V2)) { >> +        /* Update PMU version for later usage */ >> +        x86_pmu.version = 2; > > Is it safe to assume that once AMD CPU has the PERFMON_V2 (or further) bit, > > it must also have the PERFCTR_CORE bit set ? > Yes, always. There won't be a case where PERFCTR_CORE is absent but PERFMON_V2 is present. - Sandipan