lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <29103c7d-8108-cce8-8369-496a08c5c6d8@amd.com>
Date:   Tue, 10 May 2022 14:06:35 +0530
From:   Sandipan Das <sandipan.das@....com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Like Xu <like.xu.linux@...il.com>, bp@...en8.de,
        dave.hansen@...ux.intel.com, acme@...nel.org, mark.rutland@....com,
        alexander.shishkin@...ux.intel.com, namhyung@...nel.org,
        jolsa@...nel.org, tglx@...utronix.de, mingo@...hat.com,
        pbonzini@...hat.com, jmattson@...gle.com, eranian@...gle.com,
        puwen@...on.cn, ananth.narayan@....com, ravi.bangoria@....com,
        santosh.shukla@....com,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        linux-perf-users@...r.kernel.org, x86@...nel.org
Subject: Re: [PATCH v4 3/7] perf/x86/amd/core: Detect PerfMonV2 support

Hi Peter,

On 5/9/2022 6:41 PM, Peter Zijlstra wrote:
> On Mon, May 09, 2022 at 06:38:19PM +0530, Sandipan Das wrote:
>>
>> 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.
> 
> Let me introduce you to this dodgy virt stuff :-) Best put a sanity
> check on it.

I see that amd_core_pmu_init() returns if X86_FEATURE_PERFCTR_CORE is
not found right after entry. Is there anywhere else that you feel should
have an additional sanity check?

I also noticed a bug in the X86_FEATURE_PERFCTR_CORE feature check where
it should have returned something like -ENODEV instead of 0. Will send
out a fix for it.


- Sandipan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ