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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 14 Jun 2019 19:47:01 +0200
From:   Borislav Petkov <bp@...en8.de>
To:     Fenghua Yu <fenghua.yu@...el.com>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, H Peter Anvin <hpa@...or.com>,
        Christopherson Sean J <sean.j.christopherson@...el.com>,
        Ravi V Shankar <ravi.v.shankar@...el.com>,
        linux-kernel <linux-kernel@...r.kernel.org>, x86 <x86@...nel.org>
Subject: Re: [RFC PATCH 1/3] x86/resctrl: Get max rmid and occupancy scale
 directly from CPUID instead of cpuinfo_x86

On Fri, Jun 14, 2019 at 09:55:28AM -0700, Fenghua Yu wrote:
> When this function is called, X86_FEATURE_CQM_LLC must be supported and
> one of X86_FEATURE_CQM_OCCUP_LLC, X86_FEATURE_CQM_MBM_LOCAL, and
> X86_FEATURE_CQM_MBM_TOTAL must be supported. Otherwise,
> get_rdt_mon_resource() is returned before calling rdt_get_mon_l3_config().
> 
> So CPUID.f.0 and CPUID.f.1 must be readable and return meaningful
> data without testing the features.

How's that?

static void __init get_cqm_info(struct rdt_resource *r)
{
        u32 eax, ebx, ecx, edx;

        /*
         * At this point, CQM LLC and one of occupancy, MBM total, and
         * MBM local monitoring features must be supported.
         */
        cpuid_count(0xf, 1, &eax, &ebx, &ecx, &edx);

        if (rdt_mon_features & QOS_L3_OCCUP_EVENT_ID)
                r->num_rmid = ecx + 1;
        else
                /*
                 * Fallback maximum range (zero-based) of RMID within
                 * this physical processor of all types, in subleaf 0,
                 * EBX.
                 */
                r->num_rmid = cpuid_ebx(0xf) + 1;

        if (rdt_mon_features & (QOS_L3_MBM_TOTAL_EVENT_ID |
                                QOS_L3_MBM_LOCAL_EVENT_ID))
                r->mon_scale = ebx;
	else
                r->mon_scale = -1;
}

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

Powered by blists - more mailing lists