Re: [PATCH 0/3] zstd: probe the CPU for BMI2 support once, not per context
From: David Sterba
Date: Mon Aug 31 2026 - 15:32:43 EST
On Fri, Aug 28, 2026 at 10:54:07PM +0100, Usama Arif wrote:
> > pattern entirely, and be taught to have a *helper* macro that just turns
> > into 0 for when DYNAMIC_BMI2 is not set, and turns into using that stupid
> > flag in user mode, and for the kernel it should just turn into that
> > "cpu_feature_enabled(X86_FEATURE_BMI2)"
> >
> > Why does it check for both BMI1 and BMI2 anyway? And Arif added an
> > extra check for ABM. That all looks bogus. You can't have BMI2 without
> > having BMI1, so all this code looks completely bogus to begin with.
> >
>
> The three checks came from interpreting BMI2_TARGET_ATTRIBUTE("lzcnt,bmi,bmi2")
> as requiring all three feature bits. Agreed that this is unnecessary here.
> The kernel path should check only X86_FEATURE_BMI2.
>
> I was also trying to preserve zstd’s standalone-library behavior.
I've created https://github.com/facebook/zstd/issues/4752 upstream so
the canges can be synced back and not lost on next update. Regarding the
whole ZSTD code update, there's no 1.6.0 release yet.