Re: [PATCH v5 2/5] x86/kexec: do unconditional WBINVD for bare-metal in relocate_kernel()

Huang, Kai
2024-09-04T23:55:51Z

On 5/09/2024 3:30 am, Borislav Petkov wrote:
> On Fri, Aug 16, 2024 at 12:29:18AM +1200, Kai Huang wrote:
>> diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c
>> index 9c9ac606893e..07ca9d3361a3 100644
>> --- a/arch/x86/kernel/machine_kexec_64.c
>> +++ b/arch/x86/kernel/machine_kexec_64.c
>> @@ -392,7 +392,7 @@ void machine_kexec(struct kimage *image)
>> (unsigned long)page_list,
>> image->start,
>> image->preserve_context,
>> - host_mem_enc_active);
>> + !boot_cpu_has(X86_FEATURE_HYPERVISOR));
>
> Everytime you feel the need to check a X86_FEATURE_ flag, make sure you use
> cpu_feature_enabled().
>

Thanks for review. Yeah will do.