2021-09-16 18:57:03

by Jan Beulich

[permalink] [raw]
Subject: [PATCH] xen/x86: drop redundant zeroing from cpu_initialize_context()

Just after having obtained the pointer from kzalloc() there's no reason
at all to set part of the area to all zero yet another time. Similarly
there's no point explicitly clearing "ldt_ents".

Signed-off-by: Jan Beulich <[email protected]>

--- a/arch/x86/xen/smp_pv.c
+++ b/arch/x86/xen/smp_pv.c
@@ -290,8 +290,6 @@ cpu_initialize_context(unsigned int cpu,

gdt = get_cpu_gdt_rw(cpu);

- memset(&ctxt->fpu_ctxt, 0, sizeof(ctxt->fpu_ctxt));
-
/*
* Bring up the CPU in cpu_bringup_and_idle() with the stack
* pointing just below where pt_regs would be if it were a normal
@@ -308,8 +306,6 @@ cpu_initialize_context(unsigned int cpu,

xen_copy_trap_info(ctxt->trap_ctxt);

- ctxt->ldt_ents = 0;
-
BUG_ON((unsigned long)gdt & ~PAGE_MASK);

gdt_mfn = arbitrary_virt_to_mfn(gdt);


2021-09-17 10:54:13

by Boris Ostrovsky

[permalink] [raw]
Subject: Re: [PATCH] xen/x86: drop redundant zeroing from cpu_initialize_context()


On 9/16/21 11:05 AM, Jan Beulich wrote:
> Just after having obtained the pointer from kzalloc() there's no reason
> at all to set part of the area to all zero yet another time. Similarly
> there's no point explicitly clearing "ldt_ents".
>
> Signed-off-by: Jan Beulich <[email protected]>


Reviewed-by: Boris Ostrovsky <[email protected]>


2021-09-20 16:50:57

by Jürgen Groß

[permalink] [raw]
Subject: Re: [PATCH] xen/x86: drop redundant zeroing from cpu_initialize_context()

On 16.09.21 17:05, Jan Beulich wrote:
> Just after having obtained the pointer from kzalloc() there's no reason
> at all to set part of the area to all zero yet another time. Similarly
> there's no point explicitly clearing "ldt_ents".
>
> Signed-off-by: Jan Beulich <[email protected]>

Pushed to xen/tip.git for-linus-5.15b


Juergen


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