2022-06-23 10:00:23

by Jan Beulich

[permalink] [raw]
Subject: Re: [PATCH v2 1/3] x86/xen: use clear_bss() for Xen PV guests

On 23.06.2022 11:46, Juergen Gross wrote:
> --- a/arch/x86/xen/enlighten_pv.c
> +++ b/arch/x86/xen/enlighten_pv.c
> @@ -1183,15 +1183,19 @@ static void __init xen_domu_set_legacy_features(void)
> extern void early_xen_iret_patch(void);
>
> /* First C function to be called on Xen boot */
> -asmlinkage __visible void __init xen_start_kernel(void)
> +asmlinkage __visible void __init xen_start_kernel(struct start_info *si)
> {
> struct physdev_set_iopl set_iopl;
> unsigned long initrd_start = 0;
> int rc;
>
> - if (!xen_start_info)
> + if (!si)
> return;
>
> + clear_bss();

As per subsequent observation, this shouldn't really be needed: The
hypervisor (or tool stack for DomU-s) already does so. While I guess
we want to keep it to be on the safe side, maybe worth a comment?

Jan


2022-06-28 12:33:21

by Jürgen Groß

[permalink] [raw]
Subject: Re: [PATCH v2 1/3] x86/xen: use clear_bss() for Xen PV guests

On 23.06.22 11:51, Jan Beulich wrote:
> On 23.06.2022 11:46, Juergen Gross wrote:
>> --- a/arch/x86/xen/enlighten_pv.c
>> +++ b/arch/x86/xen/enlighten_pv.c
>> @@ -1183,15 +1183,19 @@ static void __init xen_domu_set_legacy_features(void)
>> extern void early_xen_iret_patch(void);
>>
>> /* First C function to be called on Xen boot */
>> -asmlinkage __visible void __init xen_start_kernel(void)
>> +asmlinkage __visible void __init xen_start_kernel(struct start_info *si)
>> {
>> struct physdev_set_iopl set_iopl;
>> unsigned long initrd_start = 0;
>> int rc;
>>
>> - if (!xen_start_info)
>> + if (!si)
>> return;
>>
>> + clear_bss();
>
> As per subsequent observation, this shouldn't really be needed: The
> hypervisor (or tool stack for DomU-s) already does so. While I guess
> we want to keep it to be on the safe side, maybe worth a comment?

Are you sure all possible boot loaders are clearing alloc-only sections?

I'd rather not count on e.g. grub doing this in all cases.


Juergen


Attachments:
OpenPGP_0xB0DE9DD628BF132F.asc (3.08 kB)
OpenPGP public key
OpenPGP_signature (505.00 B)
OpenPGP digital signature
Download all attachments