From: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: rafael.j.wysocki@intel.com, mika.westerberg@linux.intel.com,
linux-acpi@vger.kernel.org, jlee@suse.com
Subject: Re: [PATCH] acpi : Add container online uevent to acpi_bus_attach
Date: Wed, 10 Sep 2014 12:16:43 +0900 [thread overview]
Message-ID: <540FC29B.7010808@jp.fujitsu.com> (raw)
In-Reply-To: <6346979.uGFiy3j9K2@vostro.rjw.lan>
(2014/09/08 6:34), Rafael J. Wysocki wrote:
> On Friday, September 05, 2014 03:57:43 PM Yasuaki Ishimatsu wrote:
>> Container online uevent was deleted by "46394fd01 : ACPI / hotplug:
>> Move container-specific code out of the core" because container-
>> specific uevent is raised to udev by attaching container device.
>> But the container-specific uevent is not useful.
>>
>> In my box, conainer device has CPU and memory devices. In this case,
>> when hot adding container device, the following uevets are raised to
>> udev.
>>
>> # udevadm monitor --kernel
>> monitor will print the received events for:
>> KERNEL - the kernel uevent
>>
>> KERNEL[...] add /devices/system/container/ACPI0004:01 (container)
>> <snip>
>> KERNEL[...] add /devices/system/memory/memory2048 (memory)
>> KERNEL[...] add /devices/system/memory/memory2049 (memory)
>> <snip>
>> KERNEL[...] add /devices/system/memory/memory2063 (memory)
>> <snip>
>> KERNEL[...] add /devices/system/cpu/cpu60 (cpu)
>> <snip>
>> KERNEL[...] add /devices/system/cpu/cpu119 (cpu)
>>
>> When udev catches the container add uevent in my box, udev executes
>> user land script for onlining all child's devices. But memory and CPU
>> devices have not been attached at this time. So user land script fails.
>>
>> One of solutions is that user land script waits for all child's devices
>> to attach. But user land script has no way to know all child's devices
>> were attached.
>>
>> So the patch adds container online uevent to acpi_bus_sttach(). By
>> applying
>> the patch, container online uevent is raised to udev after all child's
>> devices were attached as follows:
>>
>> # udevadm monitor --kernel
>> monitor will print the received events for:
>> KERNEL - the kernel uevent
>>
>> KERNEL[...] add /devices/system/container/ACPI0004:01 (container)
>> <snip>
>> KERNEL[...] add /devices/system/memory/memory2048 (memory)
>> KERNEL[...] add /devices/system/memory/memory2049 (memory)
>> <snip>
>> KERNEL[...] add /devices/system/memory/memory2063 (memory)
>> <snip>
>> KERNEL[...] add /devices/system/cpu/cpu60 (cpu)
>> <snip>
>> KERNEL[...] add /devices/system/cpu/cpu119 (cpu)
>> KERNEL[...] online /devices/system/container/ACPI0004:01 (container)
>>
>> So if user land script is executed after raising the container online
>> uevent, it guarantees that all child's devices were attached.
>
> I see the problem, but I don't like the patch.
>
> For example, we don't need to match the container's name again, we can use
> the fact that we've already matched the container scan handler to it.
>
> Does the one below work too?
Hi Rafael,
Thank you for posting your patch. I confirmed that your patch fixed my issue
as folloes:
# udevadm monitor --kernel
monitor will print the received events for:
KERNEL - the kernel uevent
KERNEL[...] add /devices/system/container/ACPI0004:01 (container)
<snip>
KERNEL[...] add /devices/system/memory/memory2048 (memory)
<snip>
KERNEL[...] add /devices/system/memory/memory2063 (memory)
<snip>
KERNEL[...] add /devices/system/cpu/cpu60 (cpu)
<snip>
KERNEL[...] add /devices/system/cpu/cpu119 (cpu)
KERNEL[...] online /devices/system/container/ACPI0004:01 (container)
So feel free to add "Tested-by : Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>"
to the patch.
Thanks,
Yasuaki Ishimatsu
>
> Rafael
>
>
> ---
> drivers/acpi/container.c | 8 ++++++++
> drivers/acpi/scan.c | 3 +++
> include/acpi/acpi_bus.h | 1 +
> 3 files changed, 12 insertions(+)
>
> Index: linux-pm/include/acpi/acpi_bus.h
> ===================================================================
> --- linux-pm.orig/include/acpi/acpi_bus.h
> +++ linux-pm/include/acpi/acpi_bus.h
> @@ -118,6 +118,7 @@ struct acpi_device;
> struct acpi_hotplug_profile {
> struct kobject kobj;
> int (*scan_dependent)(struct acpi_device *adev);
> + void (*notify_online)(struct acpi_device *adev);
> bool enabled:1;
> bool demand_offline:1;
> };
> Index: linux-pm/drivers/acpi/container.c
> ===================================================================
> --- linux-pm.orig/drivers/acpi/container.c
> +++ linux-pm/drivers/acpi/container.c
> @@ -99,6 +99,13 @@ static void container_device_detach(stru
> device_unregister(dev);
> }
>
> +static void container_device_online(struct acpi_device *adev)
> +{
> + struct device *dev = acpi_driver_data(adev);
> +
> + kobject_uevent(&dev->kobj, KOBJ_ONLINE);
> +}
> +
> static struct acpi_scan_handler container_handler = {
> .ids = container_device_ids,
> .attach = container_device_attach,
> @@ -106,6 +113,7 @@ static struct acpi_scan_handler containe
> .hotplug = {
> .enabled = true,
> .demand_offline = true,
> + .notify_online = container_device_online,
> },
> };
>
> Index: linux-pm/drivers/acpi/scan.c
> ===================================================================
> --- linux-pm.orig/drivers/acpi/scan.c
> +++ linux-pm/drivers/acpi/scan.c
> @@ -2190,6 +2190,9 @@ static void acpi_bus_attach(struct acpi_
> ok:
> list_for_each_entry(child, &device->children, node)
> acpi_bus_attach(child);
> +
> + if (device->handler && device->handler->hotplug.notify_online)
> + device->handler->hotplug.notify_online(device);
> }
>
> /**
>
next prev parent reply other threads:[~2014-09-10 3:17 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-05 6:57 [PATCH] acpi : Add container online uevent to acpi_bus_attach Yasuaki Ishimatsu
2014-09-05 12:14 ` joeyli
2014-09-09 13:55 ` Rafael J. Wysocki
2014-09-10 3:20 ` Yasuaki Ishimatsu
2014-09-07 21:34 ` Rafael J. Wysocki
2014-09-10 3:16 ` Yasuaki Ishimatsu [this message]
2014-09-10 23:38 ` Rafael J. Wysocki
2014-09-11 7:17 ` joeyli
2014-09-11 13:14 ` Rafael J. Wysocki
2014-09-19 5:53 ` Yasuaki Ishimatsu
2014-09-21 0:01 ` Rafael J. Wysocki
2014-09-25 2:23 ` Yasuaki Ishimatsu
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=540FC29B.7010808@jp.fujitsu.com \
--to=isimatu.yasuaki@jp.fujitsu.com \
--cc=jlee@suse.com \
--cc=linux-acpi@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=rafael.j.wysocki@intel.com \
--cc=rjw@rjwysocki.net \
/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;
as well as URLs for NNTP newsgroup(s).