public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI / scan: Treat power resources in a special way
@ 2012-12-31  0:46 Rafael J. Wysocki
  2013-01-07 17:16 ` Toshi Kani
  0 siblings, 1 reply; 3+ messages in thread
From: Rafael J. Wysocki @ 2012-12-31  0:46 UTC (permalink / raw)
  To: ACPI Devel Maling List
  Cc: LKML, Bjorn Helgaas, Yinghai Lu, Jiang Liu, Toshi Kani

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Commit 1d57433 (ACPI: Separate adding ACPI device objects from
probing ACPI drivers) introduced an ACPI power resources management
regression, because it didn't ensure that the power resources
driver bind to the struct acpi_device objects corresponding
to power resources as soon as they were created.  As a result,
ACPI power management routines may attempt to access power resource
objects before they are ready to use.

To fix this problem, tell the acpi_add_single_object() in
acpi_bus_check_add() to probe the driver for objects of type
ACPI_BUS_TYPE_POWER.  This fix has been verified to work on
HP nx6325 where the problem was first observed.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---

The commit mentioned in the changelog is in linux-next only for now, but
it's likely to go upstream in this form anyway and the fix on top of the
whole ACPI scan series is trivial.

Thanks,
Rafael

---
 drivers/acpi/scan.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux/drivers/acpi/scan.c
===================================================================
--- linux.orig/drivers/acpi/scan.c
+++ linux/drivers/acpi/scan.c
@@ -1606,7 +1606,8 @@ static acpi_status acpi_bus_check_add(ac
 		return AE_CTRL_DEPTH;
 	}
 
-	acpi_add_single_object(&device, handle, type, sta, false);
+	acpi_add_single_object(&device, handle, type, sta,
+			       type == ACPI_BUS_TYPE_POWER);
 	if (!device)
 		return AE_CTRL_DEPTH;
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ACPI / scan: Treat power resources in a special way
  2012-12-31  0:46 [PATCH] ACPI / scan: Treat power resources in a special way Rafael J. Wysocki
@ 2013-01-07 17:16 ` Toshi Kani
  2013-01-07 21:02   ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Toshi Kani @ 2013-01-07 17:16 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: ACPI Devel Maling List, LKML, Bjorn Helgaas, Yinghai Lu,
	Jiang Liu

On Mon, 2012-12-31 at 00:46 +0000, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Commit 1d57433 (ACPI: Separate adding ACPI device objects from
> probing ACPI drivers) introduced an ACPI power resources management

I am seeing a different commit id for this.

commit 805d410fb0dbd65e1a57a810858fa2491e75822d
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Fri Dec 21 00:36:39 2012 +0100

    ACPI: Separate adding ACPI device objects from probing ACPI drivers

> regression, because it didn't ensure that the power resources
> driver bind to the struct acpi_device objects corresponding
> to power resources as soon as they were created.  As a result,
> ACPI power management routines may attempt to access power resource
> objects before they are ready to use.
> 
> To fix this problem, tell the acpi_add_single_object() in
> acpi_bus_check_add() to probe the driver for objects of type
> ACPI_BUS_TYPE_POWER.  This fix has been verified to work on
> HP nx6325 where the problem was first observed.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

The change looks good.

Acked-by: Toshi Kani <toshi.kani@hp.com>

Thanks,
-Toshi

> ---
> 
> The commit mentioned in the changelog is in linux-next only for now, but
> it's likely to go upstream in this form anyway and the fix on top of the
> whole ACPI scan series is trivial.
> 
> Thanks,
> Rafael
> 
> ---
>  drivers/acpi/scan.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> Index: linux/drivers/acpi/scan.c
> ===================================================================
> --- linux.orig/drivers/acpi/scan.c
> +++ linux/drivers/acpi/scan.c
> @@ -1606,7 +1606,8 @@ static acpi_status acpi_bus_check_add(ac
>  		return AE_CTRL_DEPTH;
>  	}
>  
> -	acpi_add_single_object(&device, handle, type, sta, false);
> +	acpi_add_single_object(&device, handle, type, sta,
> +			       type == ACPI_BUS_TYPE_POWER);
>  	if (!device)
>  		return AE_CTRL_DEPTH;
>  
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ACPI / scan: Treat power resources in a special way
  2013-01-07 17:16 ` Toshi Kani
@ 2013-01-07 21:02   ` Rafael J. Wysocki
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2013-01-07 21:02 UTC (permalink / raw)
  To: Toshi Kani
  Cc: ACPI Devel Maling List, LKML, Bjorn Helgaas, Yinghai Lu,
	Jiang Liu

On Monday, January 07, 2013 10:16:59 AM Toshi Kani wrote:
> On Mon, 2012-12-31 at 00:46 +0000, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > 
> > Commit 1d57433 (ACPI: Separate adding ACPI device objects from
> > probing ACPI drivers) introduced an ACPI power resources management
> 
> I am seeing a different commit id for this.
> 
> commit 805d410fb0dbd65e1a57a810858fa2491e75822d
> Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Date:   Fri Dec 21 00:36:39 2012 +0100
> 
>     ACPI: Separate adding ACPI device objects from probing ACPI drivers
> 

My bad, sorry.

I rebased the branch without modifying the changelog of this patch.  It should
be fixed now, but please note that the acpi-scan branch has changed.

> > regression, because it didn't ensure that the power resources
> > driver bind to the struct acpi_device objects corresponding
> > to power resources as soon as they were created.  As a result,
> > ACPI power management routines may attempt to access power resource
> > objects before they are ready to use.
> > 
> > To fix this problem, tell the acpi_add_single_object() in
> > acpi_bus_check_add() to probe the driver for objects of type
> > ACPI_BUS_TYPE_POWER.  This fix has been verified to work on
> > HP nx6325 where the problem was first observed.
> > 
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> The change looks good.
> 
> Acked-by: Toshi Kani <toshi.kani@hp.com>

Thanks a lot,
Rafael


> > ---
> > 
> > The commit mentioned in the changelog is in linux-next only for now, but
> > it's likely to go upstream in this form anyway and the fix on top of the
> > whole ACPI scan series is trivial.
> > 
> > Thanks,
> > Rafael
> > 
> > ---
> >  drivers/acpi/scan.c |    3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > Index: linux/drivers/acpi/scan.c
> > ===================================================================
> > --- linux.orig/drivers/acpi/scan.c
> > +++ linux/drivers/acpi/scan.c
> > @@ -1606,7 +1606,8 @@ static acpi_status acpi_bus_check_add(ac
> >  		return AE_CTRL_DEPTH;
> >  	}
> >  
> > -	acpi_add_single_object(&device, handle, type, sta, false);
> > +	acpi_add_single_object(&device, handle, type, sta,
> > +			       type == ACPI_BUS_TYPE_POWER);
> >  	if (!device)
> >  		return AE_CTRL_DEPTH;
> >  
> > 
> 
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-01-07 20:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-31  0:46 [PATCH] ACPI / scan: Treat power resources in a special way Rafael J. Wysocki
2013-01-07 17:16 ` Toshi Kani
2013-01-07 21:02   ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox