linux-um archives
 help / color / mirror / Atom feed
* Re: [PATCH v3] lib/raid/xor: x86: Add AVX-512 optimized xor_gen()
       [not found]     ` <20260615212922.GA28589@quark>
@ 2026-06-15 23:53       ` Borislav Petkov
  2026-06-16  0:29         ` Dave Hansen
  0 siblings, 1 reply; 3+ messages in thread
From: Borislav Petkov @ 2026-06-15 23:53 UTC (permalink / raw)
  To: Eric Biggers, Richard Weinberger
  Cc: x86, Christoph Hellwig, linux-crypto, David Laight, linux-raid,
	Andrew Morton, linux-kernel, linux-um

On Mon, Jun 15, 2026 at 02:29:22PM -0700, Eric Biggers wrote:
> On Mon, Jun 15, 2026 at 09:16:55PM +0000, Borislav Petkov wrote:
> > On June 15, 2026 8:10:50 PM UTC, Eric Biggers <ebiggers@kernel.org> wrote:
> > >
> > >But I wanted to ask: do we really care about the case where features are
> > >"supported" but their XCR0 bits aren't set?  Perhaps the kernel just
> > >doesn't/shouldn't support weird cases like "-cpu max,xsave=off"?
> > >
> > 
> > Yes, our aim is to support only configurations which are actually
> > present in real hardware and not a "oh, it would be good if it did
> > that, just because..."
> 
> Seems reasonable to me.  Would the same apply to UML here?

Good question.

Richi?

> > >If this case indeed needs to be handled, could we make things easier for
> > >the kernel's AVX and AVX-512 optimized code?  Currently AVX-512 needs:
> > >
> > >        if (boot_cpu_has(X86_FEATURE_AVX512F) &&
> > >            cpu_has_xfeatures(XFEATURE_MASK_FP | XFEATURE_MASK_SSE |
> > >                              XFEATURE_MASK_YMM | XFEATURE_MASK_AVX512, NULL))
> > >
> > >How about we make X86_FEATURE_AVX512F depend on XCR0=111xx111, and
> > >X86_FEATURE_AVX depend on XCR0=xxxxx111?  Then the cpu_has_xfeatures()
> > >check wouldn't be needed.  Is there any reason not to do that?
> > 
> >  How do you want to accomplish that? Very early during boot on the BSP
> >  you sanity-check XCR0 and clear feature flags if components are not
> >  set? 
> 
> That would be the idea.  Something similar to what
> arch/x86/kernel/cpu/cpuid-deps.c does. 

Yap.

> Except that seems to only enforce the dependencies when the kernel itself is
> disabling things; if the hypervisor is broken then it just warns.

Not the kernel's problem. We deliberately don't want to maintain a zoo of
options which are not present in real hw. If HV is doing funny things, oh
well...


> In any case, I'd like these to go away:
> 
>     $ git grep cpu_has_xfeatures | wc -l
>     31

Yeah, all in crypto. I can certainly see why.

@dhansen, any other thoughts?

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] lib/raid/xor: x86: Add AVX-512 optimized xor_gen()
  2026-06-15 23:53       ` [PATCH v3] lib/raid/xor: x86: Add AVX-512 optimized xor_gen() Borislav Petkov
@ 2026-06-16  0:29         ` Dave Hansen
  2026-06-17  5:44           ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Hansen @ 2026-06-16  0:29 UTC (permalink / raw)
  To: Borislav Petkov, Eric Biggers, Richard Weinberger
  Cc: x86, Christoph Hellwig, linux-crypto, David Laight, linux-raid,
	Andrew Morton, linux-kernel, linux-um

On 6/15/26 16:53, Borislav Petkov wrote:
> 
>> In any case, I'd like these to go away:
>>
>>     $ git grep cpu_has_xfeatures | wc -l
>>     31
> Yeah, all in crypto. I can certainly see why.
> 
> @dhansen, any other thoughts?

If we can get rid of cpu_has_xfeatures(), I'm all for it. I'm not quite
sure how the code would look so I'm reserving judgement until I see the
patches. But it's worth a try.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] lib/raid/xor: x86: Add AVX-512 optimized xor_gen()
  2026-06-16  0:29         ` Dave Hansen
@ 2026-06-17  5:44           ` Christoph Hellwig
  0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2026-06-17  5:44 UTC (permalink / raw)
  To: Dave Hansen
  Cc: Borislav Petkov, Eric Biggers, Richard Weinberger, x86,
	Christoph Hellwig, linux-crypto, David Laight, linux-raid,
	Andrew Morton, linux-kernel, linux-um

On Mon, Jun 15, 2026 at 05:29:58PM -0700, Dave Hansen wrote:
> On 6/15/26 16:53, Borislav Petkov wrote:
> > 
> >> In any case, I'd like these to go away:
> >>
> >>     $ git grep cpu_has_xfeatures | wc -l
> >>     31
> > Yeah, all in crypto. I can certainly see why.
> > 
> > @dhansen, any other thoughts?
> 
> If we can get rid of cpu_has_xfeatures(), I'm all for it. I'm not quite
> sure how the code would look so I'm reserving judgement until I see the
> patches. But it's worth a try.

I think the most important part is to be consistent.  Either use it
everywhere or not at all.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-06-17  5:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260615190338.26581-1-ebiggers@kernel.org>
     [not found] ` <20260615201050.GB1764@quark>
     [not found]   ` <255CAE3E-7FD3-4DC2-B3DE-46BE67EF22A8@alien8.de>
     [not found]     ` <20260615212922.GA28589@quark>
2026-06-15 23:53       ` [PATCH v3] lib/raid/xor: x86: Add AVX-512 optimized xor_gen() Borislav Petkov
2026-06-16  0:29         ` Dave Hansen
2026-06-17  5:44           ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox