Re: [PATCH 3/7] x86: Grant AMX permission for guest

2022-01-28 Thread Paolo Bonzini
On 1/27/22 14:45, Yang Zhong wrote: Thanks Paolo, from your below KVM changes: https://lore.kernel.org/kvm/20220126152210.3044876-3-pbonz...@redhat.com/T/#m7bf9a03c47c29d21deb78604bc290a45aa5e98f5 So the changes in kvm_arch_get_supported_cpuid() like below? +} else if (funct

Re: [PATCH 3/7] x86: Grant AMX permission for guest

2022-01-27 Thread Yang Zhong
On Mon, Jan 24, 2022 at 11:16:36AM +0100, Paolo Bonzini wrote: > On 1/24/22 08:55, Yang Zhong wrote: > >Kernel allocates 4K xstate buffer by default. For XSAVE features > >which require large state component (e.g. AMX), Linux kernel > >dynamically expands the xstate buffer only after the process ha

Re: [PATCH 3/7] x86: Grant AMX permission for guest

2022-01-24 Thread Paolo Bonzini
On 1/24/22 08:55, Yang Zhong wrote: Kernel allocates 4K xstate buffer by default. For XSAVE features which require large state component (e.g. AMX), Linux kernel dynamically expands the xstate buffer only after the process has acquired the necessary permissions. Those are called dynamically- enab

[PATCH 3/7] x86: Grant AMX permission for guest

2022-01-24 Thread Yang Zhong
Kernel allocates 4K xstate buffer by default. For XSAVE features which require large state component (e.g. AMX), Linux kernel dynamically expands the xstate buffer only after the process has acquired the necessary permissions. Those are called dynamically- enabled XSAVE features (or dynamic xfeatur

Re: [RFC PATCH 3/7] x86: Grant AMX permission for guest

2022-01-21 Thread Yang Zhong
On Tue, Jan 18, 2022 at 02:06:55PM +0100, Paolo Bonzini wrote: > Sorry, hit send on the wrong window. This is the only patch that > will require a bit more work. > > On 1/18/22 13:52, Paolo Bonzini wrote: > >>@@ -124,6 +150,8 @@ void x86_cpus_init(X86MachineState *x86ms, > >>int default_cpu_versi

Re: [RFC PATCH 3/7] x86: Grant AMX permission for guest

2022-01-18 Thread Paolo Bonzini
Sorry, hit send on the wrong window. This is the only patch that will require a bit more work. On 1/18/22 13:52, Paolo Bonzini wrote: @@ -124,6 +150,8 @@ void x86_cpus_init(X86MachineState *x86ms, int default_cpu_version)   MachineState *ms = MACHINE(x86ms);   MachineClass *mc = MACHI

Re: [RFC PATCH 3/7] x86: Grant AMX permission for guest

2022-01-18 Thread Paolo Bonzini
On 1/7/22 10:31, Yang Zhong wrote: +static void x86_xsave_req_perm(void) +{ +unsigned long bitmask; + +long rc = syscall(SYS_arch_prctl, ARCH_REQ_XCOMP_GUEST_PERM, + XSTATE_XTILE_DATA_BIT); +if (rc) { +/* + * The older kernel version(<5.15) can't s

Re: [RFC PATCH 3/7] x86: Grant AMX permission for guest

2022-01-10 Thread Yang Zhong
On Mon, Jan 10, 2022 at 04:36:13PM +0800, Tian, Kevin wrote: > > From: Zhong, Yang > > Sent: Friday, January 7, 2022 5:32 PM > > > > Kernel mechanism for dynamically enabled XSAVE features > > there is no definition of "dynamically-enabled XSAVE features). > Thanks! > > asks userspace VMM r

RE: [RFC PATCH 3/7] x86: Grant AMX permission for guest

2022-01-10 Thread Tian, Kevin
> From: Zhong, Yang > Sent: Friday, January 7, 2022 5:32 PM > > Kernel mechanism for dynamically enabled XSAVE features there is no definition of "dynamically-enabled XSAVE features). > asks userspace VMM requesting guest permission if it wants > to expose the features. Only with the permission

[RFC PATCH 3/7] x86: Grant AMX permission for guest

2022-01-07 Thread Yang Zhong
Kernel mechanism for dynamically enabled XSAVE features asks userspace VMM requesting guest permission if it wants to expose the features. Only with the permission, kernel can try to enable the features when detecting the intention from guest in runtime. Qemu should request the permission for gues