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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALMp9eQ+vRQhbmTh1j4YT7AhGcvRxnmzttTbjN3UKHaijwpqAw@mail.gmail.com>
Date:   Thu, 3 Feb 2022 12:50:53 -0800
From:   Jim Mattson <jmattson@...gle.com>
To:     Dave Hansen <dave.hansen@...el.com>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
        "H. Peter Anvin" <hpa@...or.com>,
        Paolo Bonzini <pbonzini@...hat.com>,
        Tony Luck <tony.luck@...el.com>,
        Peter Zijlstra <peterz@...radead.org>,
        "Chang S. Bae" <chang.seok.bae@...el.com>,
        Juergen Gross <jgross@...e.com>,
        Andrew Cooper <andrew.cooper3@...rix.com>,
        Babu Moger <Babu.Moger@....com>,
        Jing Liu <jing2.liu@...el.com>,
        Sean Christopherson <seanjc@...gle.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] x86/cpufeatures: Add macros for Intel's new fast rep
 string features

On Thu, Feb 3, 2022 at 12:25 PM Dave Hansen <dave.hansen@...el.com> wrote:
>
> On 2/3/22 11:43, Jim Mattson wrote:
> > Even if no one else cares, these features should be exposed to kvm
> > guests, and the code for the KVM_GET_SUPPORTED_CPUID ioctl is more
> > readable if the bits have corresponding X86_FEATURE macros.
>
> I went digging around KVM_GET_SUPPORTED_CPUID and didn't see any obvious
> unreadable things resulting from not having these defines.  Maybe I'm
> looking in the wrong spot.  Do you have a slightly more specific pointer?

These features are not currently enumerated by
KVM_GET_SUPPORTED_CPUID. They would be added as follows [gmail mangles
diffs; sorry]:

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 28be02adc669..11e621b6faac 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -599,7 +599,7 @@ void kvm_set_cpu_caps(void)
                kvm_cpu_cap_set(X86_FEATURE_SPEC_CTRL_SSBD);

        kvm_cpu_cap_mask(CPUID_7_1_EAX,
-               F(AVX_VNNI) | F(AVX512_BF16)
+                F(AVX_VNNI) | F(AVX512_BF16) | F(FZRM) | F(FSRS) | F(FSRC)
        );

        kvm_cpu_cap_mask(CPUID_D_1_EAX,

(Of course, we can always define these macros in that file, if that's
preferable.)

> > +#define X86_FEATURE_FZRM             (12*32+10) /* Fast zero-length REP MOVSB */
> > +#define X86_FEATURE_FSRS             (12*32+11) /* Fast short REP STOSB */
> > +#define X86_FEATURE_FSRC             (12*32+12) /* Fast short REP {CMPSB,SCASB} */
>
> If the use really is for inside the kernel, maybe we should hide them
> from cpuinfo:
>
> #define X86_FEATURE_FSRC                (12*32+12) /* "" Fast short REP {CMPSB,SCASB} */

That sounds good to me.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ