[RFC PATCH v2 22/35] ACPI: Check _STA present bit before making CPUs not present

Russell King (Oracle) linux at armlinux.org.uk
Fri Nov 3 07:09:02 PDT 2023


On Thu, Sep 14, 2023 at 03:31:10PM +0100, Jonathan Cameron wrote:
> On Wed, 13 Sep 2023 16:38:10 +0000
> James Morse <james.morse at arm.com> wrote:
> > -#ifdef CONFIG_ACPI_HOTPLUG_PRESENT_CPU
> >  /* Removal */
> > -static void acpi_processor_post_eject(struct acpi_device *device)
> > +static void acpi_processor_make_not_present(struct acpi_device *device)
> >  {
> >  	struct acpi_processor *pr;
> >  
> > -	if (!device || !acpi_driver_data(device))
> > +	if (!IS_ENABLED(CONFIG_ACPI_HOTPLUG_PRESENT_CPU))
> 
> Would it be possible to do all the ifdef to IS_ENABLED changes in a separate
> patch?  I haven't figure out if any of them have dependencies on the other
> changes, but they do create a bunch of noise I'd rather not see in the more
> complex corners of this.

I'm also wondering why we want to do this check here, rather than...

> > +static void acpi_processor_post_eject(struct acpi_device *device)
> > +{
> > +	struct acpi_processor *pr;
> > +	unsigned long long sta;
> > +	acpi_status status;

... here, because none of the code below has any effect if
acpi_processor_make_not_present() merely returns. So the below seems
like a waste of code space when CONFIG_ACPI_HOTPLUG_PRESENT_CPU is
disabled.

> > +
> > +	if (!device)
> > +		return;
> > +
> > +	pr = acpi_driver_data(device);
> > +	if (!pr || pr->id >= nr_cpu_ids || invalid_phys_cpuid(pr->phys_id))
> > +		return;
> > +
> > +	status = acpi_evaluate_integer(pr->handle, "_STA", NULL, &sta);
> > +	if (ACPI_FAILURE(status))
> > +		return;
> > +
> > +	if (cpu_present(pr->id) && !(sta & ACPI_STA_DEVICE_PRESENT)) {
> > +		acpi_processor_make_not_present(device);
> > +		return;
> > +	}
> > +}

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!



More information about the linux-riscv mailing list