Re: [PATCH] x86/apic: Fix the issues in x2apic_disable()
From: Yuntao Wang
Date: Mon Aug 12 2024 - 11:54:55 EST
On Mon, 12 Aug 2024 16:48:05 +0200, Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> On Mon, Aug 12 2024 at 18:08, Yuntao Wang wrote:
> > static __init void x2apic_disable(void)
> > {
> > - u32 x2apic_id, state = x2apic_state;
> > + u32 x2apic_id;
> >
> > - x2apic_mode = 0;
> > - x2apic_state = X2APIC_DISABLED;
> > -
> > - if (state != X2APIC_ON)
> > - return;
> > + if (x2apic_state < X2APIC_ON)
> > + goto out;
>
> There is no point in overwriting the state in case it is < ON, no?
Are you saying that we should replace 'goto out' with a return statement?
However, when x2apic_disable() is called, it's possible that x2apic_state
is X2APIC_OFF. In that case, we should set x2apic_state to X2APIC_DISABLED.
So, I think overwriting the state is necessary.
Thanks,
Yuntao
> Thanks,
>
> tglx