Re: [PATCH v2 2/2] KVM: SEV: Prefer WBNOINVD over WBINVD for cache maintenance efficiency

Kirill A. Shutemov
2025-01-10T08:23:23Z

On Thu, Jan 09, 2025 at 10:55:33PM +0000, Kevin Loughlin wrote:
> @@ -710,6 +711,14 @@ static void sev_clflush_pages(struct page *pages[], unsigned long npages)
> }
> }
>
> +static void sev_wb_on_all_cpus(void)
> +{
> + if (boot_cpu_has(X86_FEATURE_WBNOINVD))
> + wbnoinvd_on_all_cpus();
> + else
> + wbinvd_on_all_cpus();

I think the X86_FEATURE_WBNOINVD check should be inside wbnoinvd().
wbnoinvd() should fallback to WBINVD if the instruction is not supported
rather than trigger #UD.

--
Kiryl Shutsemau / Kirill A. Shutemov