linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux PCI <linux-pci@vger.kernel.org>,
	"Moore, Robert" <robert.moore@intel.com>,
	Toshi Kani <toshi.kani@hp.com>, Yinghai Lu <yinghai@kernel.org>,
	Zhang Rui <rui.zhang@intel.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Aaron Lu <aaron.lu@intel.com>, Lv Zheng <lv.zheng@intel.com>
Subject: Re: [PATCH 7/10] ACPI / hotplug: Move container-specific code out of the core
Date: Wed, 4 Dec 2013 14:43:24 +0900	[thread overview]
Message-ID: <529EC0FC.1010400@jp.fujitsu.com> (raw)
In-Reply-To: <81535269.SKoBMiGyoU@vostro.rjw.lan>

(2013/12/03 22:15), Rafael J. Wysocki wrote:
> On Tuesday, December 03, 2013 11:46:24 AM Yasuaki Ishimatsu wrote:
>> (2013/11/29 22:08), Rafael J. Wysocki wrote:
>>> On Friday, November 29, 2013 11:36:55 AM Yasuaki Ishimatsu wrote:
>>>> Hi Rafael,
>>>
>>> Hi,
>>>
>>>> Replying to this mail may be wrong.
>>>
>>> OK, so this particular patch doesn't break things any more?
>>
>> Yes.
>>
>>>
>>>> Do you remember following your patch?
>>>> http://lkml.org/lkml/2013/2/23/97
>>>>
>>>> I want to add autoeject variable in acpi_hotplug_profile structure and
>>>> set autoecjet of container device "false".
>>>
>>> Then after the series the $subject patch belongs to it will work almost the
>>> same way as /sys/firmware/acpi/container/enabled (hot add will still work after
>>> patch [4/10] if "enabled" is 0), but only for containers.
>>>
>>>> Currently, I have a problem on ejecting container device. Since linux-3.12,
>>>> container device is removed by acpi_scan_hot_remove.
>>>>
>>>> I think this has two problems.
>>>>
>>>>      1. easily fail
>>>>         My container device has CPU device and Memory device, and maximum size of
>>>>         memory is 3Tbyte. In my environment, hot removing container device fails
>>>>         on offlining memory if memory is used by application.
>>>>         I think if offlininig memory, we must retly to offline memory several
>>>>         times.
>>>
>>> Yes, that's correct.  But then you can try to offline the memory upfront
>>> and only remove the container after that has been successful.
>>>
>>>>      2. cannot work with userland's application
>>>>         Hot removing CPU and memory on container device, we need take care of
>>>>         userland application. Before linux-3.12, container device just notifies
>>>>         KOBJ_OFFLINE to udev. So by using udev, if application binds to removed
>>>>         CPU or node, applications can change them before hot removing container
>>>>         device.
>>>>         Currently, KOBJ_OFFLINE is notified to udev. But acpi_scan_hot_remove
>>>>         also runs simultaneously for hot removing container device. So when
>>>>         applications runs for corresponding to the deletion of the devices,
>>>>         the devices may have been deleted.
>>>
>>
>>> So the expectation is that the container will refuse to offline, but instead
>>> it will emit KOBJ_OFFLINE so that user space can do some cleanup and offline
>>> it through the "eject" attribute, right?
>>
>> Yes, that's right.
>>
>>>
>>>> I don't know what devices are on hotpluggable conatainer device of other
>>>> vendors. At least, my container device cannot be hot removed correctly.
>>>> Then I want to add autoeject variable in acpi_hotplug_profile so that user
>>>> can change the parameter to "true" or "false".
>>>
>>> I have a different idea.
>>>
>>> Why don't we create a bus type for containers in analogy with CPUs and memory
>>> and make it support offline.  Then, the container scan handler will create a
>>> "physical" container device under that bus type and the new bus type code will
>>> implement the logic you need (that is, it will have a sysfs flag that will
>>> cause the offline to fail emitting a uevent of some sort if set and will allow
>>> the offline to happen when unset).  That "physical" container device will go
>>> away (again, via the container scan handler) during container removal.
>>>
>>
>>> The eject work flow can be:
>>>     (1) an eject event occurs,
>>>     (2) the container "physical" device fails offline in acpi_scan_hot_remove()
>>>         emmitting, say, KOBJ_CHANGE for the "physical" device,
>>>     (3) user space notices the KOBJ_CHANGE and does the cleanup as needed,
>>>     (4) user space changes the "physical" container device flag controlling
>>>         offline to 0,
>>>     (5) user space uses the sysfs "eject" attribute of the ACPI container object
>>>         to finally eject the container,
>>>     (6) the offline in acpi_scan_hot_remove() is now successful, because the
>>>         flag controlling it has been set to 0 in step (4),
>>>     (7) the "physical" container device goes away before executing _EJ0,
>>>     (8) the container is ejected.
>>>
>>> Of course, if the flag controlling container offline is 0 to start with, step
>>> (6) will now occur directly after (1), so whoever wants containers to be
>>> hot-removed automatically may just clear that flag for all of them on boot.
>>>
>>> How does that sound?
>>
>>
>> The above ideas are almost O.K. I want kernel to notify user space of KOBJ_OFFLINE.
>> Even if user space catches "KOBJ_CHANGE", user doesn't know whether the notification
>> is offline or not.
>

> It is easy to figure out, though.  Since the KOBJ_CHANGE will be emitted for
> container devices only in that situation, user space can see that (1) it is
> from a container and (2) it is KOBJ_CHANGE, so it must mean "container offline
> has been attempted".
>
> My concern with using KOBJ_OFFLINE for that is that device_offline() emits it
> too on success and it may be easily confused with the one emitted on failure
> for containers.

I have no objection.

Thanks,
Yasuaki Ishimatsu

>
> Thanks,
> Rafael
>



  reply	other threads:[~2013-12-04  5:43 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-17 16:29 [PATCH 0/10] ACPI: Device objects for all namespace nodes and PCI root hotplug integration Rafael J. Wysocki
2013-11-17 16:31 ` [PATCH 1/10] ACPICA: Delete all attached data objects on node deletion Rafael J. Wysocki
2013-11-17 16:31 ` [PATCH 2/10] ACPI / scan: Define non-empty device removal handler Rafael J. Wysocki
2013-11-17 16:33 ` [PATCH 3/10] ACPI / scan: Add acpi_device objects for all device nodes in the namespace Rafael J. Wysocki
2013-11-17 16:33 ` [PATCH 4/10] ACPI / hotplug: Do not fail bus and device checks for disabled hotplug Rafael J. Wysocki
2013-11-17 16:34 ` [PATCH 5/10] ACPI / hotplug: Introduce common hotplug function acpi_device_hotplug() Rafael J. Wysocki
2013-11-17 16:35 ` [PATCH 6/10] ACPI / hotplug: Make ACPI PCI root hotplug use common hotplug code Rafael J. Wysocki
2013-11-17 16:36 ` [PATCH 7/10] ACPI / hotplug: Move container-specific code out of the core Rafael J. Wysocki
2013-11-29  2:36   ` Yasuaki Ishimatsu
2013-11-29 13:08     ` Rafael J. Wysocki
2013-12-03  2:46       ` Yasuaki Ishimatsu
2013-12-03 13:15         ` Rafael J. Wysocki
2013-12-04  5:43           ` Yasuaki Ishimatsu [this message]
2013-12-13  2:56           ` Yasuaki Ishimatsu
2013-12-13  4:56             ` Rafael J. Wysocki
2013-12-13  5:17               ` Yasuaki Ishimatsu
2013-12-14  5:07                 ` Rafael J. Wysocki
2013-11-17 16:36 ` [PATCH 8/10] ACPI / hotplug: Rework generic code to handle suprise removals Rafael J. Wysocki
2013-11-17 16:37 ` [PATCH 9/10] ACPI / hotplug: Drop unfinished global notification handling routines Rafael J. Wysocki
2013-11-17 16:38 ` [PATCH 10/10] ACPI: Introduce acpi_set_device_status() Rafael J. Wysocki
2013-11-19 14:30 ` [PATCH 0/10] ACPI: Device objects for all namespace nodes and PCI root hotplug integration Mika Westerberg
2013-11-19 20:51   ` Rafael J. Wysocki
2013-11-19 21:05     ` Mika Westerberg

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=529EC0FC.1010400@jp.fujitsu.com \
    --to=isimatu.yasuaki@jp.fujitsu.com \
    --cc=aaron.lu@intel.com \
    --cc=bhelgaas@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lv.zheng@intel.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rjw@rjwysocki.net \
    --cc=robert.moore@intel.com \
    --cc=rui.zhang@intel.com \
    --cc=toshi.kani@hp.com \
    --cc=yinghai@kernel.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;
as well as URLs for NNTP newsgroup(s).