public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Keshavamurthy Anil S <anil.s.keshavamurthy-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Bjorn Helgaas <bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
Cc: naveen.b.s-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	anil.s.keshavamurthy-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: ACPI hot-plug notification help needed
Date: Mon, 25 Jul 2005 17:39:11 -0700	[thread overview]
Message-ID: <20050725173911.A24040@unix-os.sc.intel.com> (raw)
In-Reply-To: <200507251735.23394.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>; from bjorn.helgaas-VXdhtT5mjnY@public.gmane.org on Mon, Jul 25, 2005 at 05:35:23PM -0600

On Mon, Jul 25, 2005 at 05:35:23PM -0600, Bjorn Helgaas wrote:
> Can somebody explain how the notification stuff in the ACPI
> memory and container drivers works?
Sure.
> 
> The usual ACPI driver registers its IDs and add() and remove()
> functions with acpi_bus_register_driver(), and the ACPI core
> calls the add() function when it finds a device that is present
> (based on _STA) and whose _HID or _CID matches.

Humm.. I would say that ACPI core calls the add() functions
for all the devices which it has seen during its boot( of course
based on _STA) and whose _HID or _CID matches. 

Here is how the current core works.
During system boot the ACPI core scans for all the devices 
in its root namespace scope i.e by calling acpi_bus_scan() 
and for each device whose _STA is present calls acpi_bus_add() 
which stores the device in linked list. Later when ACPI driver 
registers its IDs the ACPI core just looks in this device list.
The core does not keep track of devices whose _STA became present
after boot.

> 
> The memory and container drivers (acpi_memhotplug.c[1] and container.c)
> also do this.  But in addition, they traverse the entire ACPI namespace
> and attach notify handlers to any devices that match the IDs[2], even
> if the _STA indicates "not present".

This is how the ACPI core expects us to register for all the devices
for which we care notifications. We want to register for all the devices
i.e for the devices which are present and for devices which are not present.
To do this we walk the entire namespace scope and check for _HID or _CID
match and register a notify handler for this device.

> 
> It seems strange to attach notify handlers to devices that are
> not present.  Maybe ACPI allows events to be sent to devices that
> don't exist, but it just seems weird.  I'd expect a hotplug add to

When we were implementing this even for us it looked strange that
we have to attach a notify handlers for each and every device. Believe
me this is how we had to do.

> cause events to some previously-present *parent* of the new device.
> The parent's driver could then re-scan its children and add any
> that are newly-added or newly-marked "present".

This might not alway be true. Some f/w might not want to send
notification on the parent as the re-scan might be a costly operation
as the parent might contain a large number of children. Imaging a case
where we want to attach a device under _SB scope, in case if the 
notification went to _SB and we have rescan the whole namespace here.

> 
> But these drivers seem to expect hot-add events on the new device
> itself, and then they go through the motions of acpi_bus_add()
> directly.  This seems like it belongs somewhere in the ACPI core.

The core functionality still recides inside ACPI core, it just that
these drivers which support hotplug are responsible for registering
for a notification and based on the notification they have to call
acpi_bus_add() to add the device and from then on the acpi_bus_add()
function takes care of doing rest of the stuff including calling
add() function of the driver.

> 
> I just noticed that the processor_core and acpiphp_glue drivers
> do the same thing.  Does this mean that other ACPI drivers that
> want to handle hot-plug will also have to go through this dance
> of attaching notify handlers to non-present devices?  Does ACPI
Don't you think even acpiphp drivers which support slot hotplug
also does the same thing?
> have to supply nodes for every possible hot-pluggable device in
> the namespace at boot-time, just to provide places to hang these
> handlers?
Yes, the ACPI namespace has to list its max possible configuration
in its namespace.

> 
> Please enlighten me.
> 
> [1] "acpi_memhotplug.c" seems redundant.  Wouldn't "memory.c"
>      be just as descriptive?  It's in the ACPI directory, so
>      we don't need "acpi_", and ACPI drivers in general can
>      support hotplug, so it doesn't seem like we need that either.
Naveen, any thoughts on this one?
> 
> [2] This match is not as completely implemented as that in the
>     ACPI core, so it doesn't check _CID.  So this seems like a
>     case where duplication of functionality leads to maintenance
>     problems.  Compare is_root_bridge(), is_memory_device(), and
>     container_walk_namespace_cb().
Patch welcome:-)

-Anil


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click

  parent reply	other threads:[~2005-07-26  0:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-25 23:35 ACPI hot-plug notification help needed Bjorn Helgaas
     [not found] ` <200507251735.23394.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
2005-07-26  0:39   ` Keshavamurthy Anil S [this message]
     [not found]     ` <20050725173911.A24040-39QZ/XbsZ5/mO6KZMuUCQVaTQe2KTcn/@public.gmane.org>
2005-07-26 19:56       ` Bjorn Helgaas
     [not found]         ` <200507261356.08152.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
2005-07-27  0:05           ` Keshavamurthy Anil S
     [not found]             ` <20050726170459.A5591-39QZ/XbsZ5/mO6KZMuUCQVaTQe2KTcn/@public.gmane.org>
2005-07-27 23:06               ` Bjorn Helgaas
     [not found] ` <200508011620.02609.bjorn.helgaas@hp.com>
     [not found]   ` <20050801170345.A16268@unix-os.sc.intel.com>
     [not found]     ` <20050801170345.A16268-39QZ/XbsZ5/mO6KZMuUCQVaTQe2KTcn/@public.gmane.org>
2005-08-02 22:41       ` Bjorn Helgaas
     [not found]         ` <200508021641.26007.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
2005-08-03  4:37           ` Kenji Kaneshige
2005-08-03 19:36           ` Keshavamurthy Anil S
     [not found]             ` <20050803123627.A4443-39QZ/XbsZ5/mO6KZMuUCQVaTQe2KTcn/@public.gmane.org>
2005-08-03 20:27               ` Bjorn Helgaas
     [not found]                 ` <200508031427.11057.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
2005-08-03 20:55                   ` Keshavamurthy Anil S
     [not found]                     ` <20050803135511.B5010-39QZ/XbsZ5/mO6KZMuUCQVaTQe2KTcn/@public.gmane.org>
2005-08-03 21:13                       ` Bjorn Helgaas
     [not found]                         ` <200508031513.30570.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
2005-08-03 21:41                           ` Keshavamurthy Anil S
  -- strict thread matches above, loose matches on Subject: below --
2005-07-26  4:28 S, Naveen B

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050725173911.A24040@unix-os.sc.intel.com \
    --to=anil.s.keshavamurthy-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=bjorn.helgaas-VXdhtT5mjnY@public.gmane.org \
    --cc=naveen.b.s-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox