Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1674461 > unrolled thread
| Started by | joeyli <jlee@suse.com> |
|---|---|
| First post | 2017-06-26 08:30 +0200 |
| Last post | 2017-06-29 06:00 +0200 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.kernel
A udev rule to serve the change event of ACPI container? joeyli <jlee@suse.com> - 2017-06-26 08:30 +0200
Re: A udev rule to serve the change event of ACPI container? Michal Hocko <mhocko@kernel.org> - 2017-06-26 11:00 +0200
Re: A udev rule to serve the change event of ACPI container? YASUAKI ISHIMATSU <yasu.isimatu@gmail.com> - 2017-06-28 22:00 +0200
Re: A udev rule to serve the change event of ACPI container? joeyli <jlee@suse.com> - 2017-06-29 06:00 +0200
| From | joeyli <jlee@suse.com> |
|---|---|
| Date | 2017-06-26 08:30 +0200 |
| Subject | A udev rule to serve the change event of ACPI container? |
| Message-ID | <tWvH3-7d0-7@gated-at.bofh.it> |
Hi all,
If ACPI received ejection request for a ACPI container, kernel
emits KOBJ_CHANGE uevent when it found online children devices
below the acpi container.
Base on the description of caa73ea15 kernel patch, user space
is expected to offline all devices below the container and the
container itself. Then, user space can finalize the removal of
the container with the help of its ACPI device object's eject
attribute in sysfs.
That means that kernel relies on users space to peform the offline
and ejection jobs to acpi container and children devices. The
discussion is here:
https://lkml.org/lkml/2013/11/28/520
The mail loop didn't explain why the userspace is responsible for
the whole container offlining. Is it possible to do that transparently
from the kernel? What's the difference between offlining memory and
processors which happends without any cleanup and container which
does essentially the same except it happens at once?
- After a couple of years, can we let the container hot-remove
process transparently?
- Except udev rule, does there have any other mechanism to trigger
auto offline/ejection?
The attached patch is a udev rule that it's used to perform the
offlien/ejection jobs on user space. I want to send it to systemd.
Thanks a lot!
Joey Lee
From 6c95d4858e0e7c280e490491c1a00c1b5226a029 Mon Sep 17 00:00:00 2001
From: "Lee, Chun-Yi" <jlee@suse.com>
Date: Mon, 26 Jun 2017 11:40:03 +0800
Subject: [PATCH] rules: handle the change event of ACPI container
Currently the ACPI in kernel emits KOBJ_CHANGE uevent when there
have online children devices below the acpi container.
Base on the description of caa73ea15 kernel patch, user space
is expected to offline all devices below the container and the
container itself. Then, user space can finalize the removal of
the container with the help of its ACPI device object's eject
attribute in sysfs.
This udev rule can be a default user space application to meet
kernel's expectations. This rule walks through the sysfs tree
to trigger the offline of each child device then ejects the
container.
The ACPI_CONTAINER_EJECT environoment variable can be used to
turn off the the ejection logic of container if the ejection
will be triggered by other ways, e.g. BIOS or other user space
application.
Reference: https://lkml.org/lkml/2013/11/28/520
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Michal Hocko <mhocko@suse.cz>
Signed-off-by: "Lee, Chun-Yi" <jlee@suse.com>
---
rules/80-acpi-container-hotremove.rules | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
create mode 100644 rules/80-acpi-container-hotremove.rules
diff --git a/rules/80-acpi-container-hotremove.rules b/rules/80-acpi-container-hotremove.rules
new file mode 100644
index 000000000..ef4ceb5fb
--- /dev/null
+++ b/rules/80-acpi-container-hotremove.rules
@@ -0,0 +1,16 @@
+# do not edit this file, it will be overwritten on update
+
+SUBSYSTEM=="container", ACTION=="change", DEVPATH=="*/ACPI0004:??", ENV{ACPI_CONTAINER_EJECT}="1"\
+RUN+="/bin/sh -c ' \
+if [ $(cat /sys/$env{DEVPATH}/online) -eq 1 ]; then \
+ find -L /sys/$env{DEVPATH}/firmware_node/*/physical_node* -maxdepth 1 -name online | \
+ while read line; do \
+ if [ $(cat $line) -eq 1 ]; then \
+ /bin/echo 0 > $line; \
+ fi \
+ done; \
+ /bin/echo 0 > /sys/$env{DEVPATH}/online; \
+ if [$env{ACPI_CONTAINER_EJECT} -eq 1] && [ $(cat /sys/$env{DEVPATH}/online) -eq 0 ]; then \
+ /bin/echo 1 > /sys/$env{DEVPATH}/firmware_node/eject; \
+ fi \
+fi'"
--
2.12.0
[toc] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2017-06-26 11:00 +0200 |
| Message-ID | <tWy2d-7H-3@gated-at.bofh.it> |
| In reply to | #1674461 |
On Mon 26-06-17 14:26:57, Joey Lee wrote: > Hi all, > > If ACPI received ejection request for a ACPI container, kernel > emits KOBJ_CHANGE uevent when it found online children devices > below the acpi container. > > Base on the description of caa73ea15 kernel patch, user space > is expected to offline all devices below the container and the > container itself. Then, user space can finalize the removal of > the container with the help of its ACPI device object's eject > attribute in sysfs. > > That means that kernel relies on users space to peform the offline > and ejection jobs to acpi container and children devices. The > discussion is here: > https://lkml.org/lkml/2013/11/28/520 > > The mail loop didn't explain why the userspace is responsible for > the whole container offlining. Is it possible to do that transparently > from the kernel? What's the difference between offlining memory and > processors which happends without any cleanup and container which > does essentially the same except it happens at once? > > - After a couple of years, can we let the container hot-remove > process transparently? > - Except udev rule, does there have any other mechanism to trigger > auto offline/ejection? I would be also interested whether the kernel can simply send an udev event to all devices in the container. -- Michal Hocko SUSE Labs
[toc] | [prev] | [next] | [standalone]
| From | YASUAKI ISHIMATSU <yasu.isimatu@gmail.com> |
|---|---|
| Date | 2017-06-28 22:00 +0200 |
| Message-ID | <tXri2-1Hi-21@gated-at.bofh.it> |
| In reply to | #1674461 |
On 06/26/2017 02:26 AM, joeyli wrote:
> Hi all,
>
> If ACPI received ejection request for a ACPI container, kernel
> emits KOBJ_CHANGE uevent when it found online children devices
> below the acpi container.
>
> Base on the description of caa73ea15 kernel patch, user space
> is expected to offline all devices below the container and the
> container itself. Then, user space can finalize the removal of
> the container with the help of its ACPI device object's eject
> attribute in sysfs.
>
> That means that kernel relies on users space to peform the offline
> and ejection jobs to acpi container and children devices. The
> discussion is here:
> https://lkml.org/lkml/2013/11/28/520
>
> The mail loop didn't explain why the userspace is responsible for
> the whole container offlining. Is it possible to do that transparently
> from the kernel? What's the difference between offlining memory and
> processors which happends without any cleanup and container which
> does essentially the same except it happens at once?
We don't know what devices mount on the container device. I think
devices mount on the container device are different each vendor's server.
If memory device mounts on the container, memory offline easily fails.
Other devices may have other concerns. So the following udev rule you
write does not work correctly.
I think we need to change offline processing for each device. So currently
the userspace is responsible for the whole container offlining.
Thanks,
Yasuaki Ishimatsu
`
>
> - After a couple of years, can we let the container hot-remove
> process transparently?
> - Except udev rule, does there have any other mechanism to trigger
> auto offline/ejection?
>
> The attached patch is a udev rule that it's used to perform the
> offlien/ejection jobs on user space. I want to send it to systemd.
>
> Thanks a lot!
> Joey Lee
>
> From 6c95d4858e0e7c280e490491c1a00c1b5226a029 Mon Sep 17 00:00:00 2001
> From: "Lee, Chun-Yi" <jlee@suse.com>
> Date: Mon, 26 Jun 2017 11:40:03 +0800
> Subject: [PATCH] rules: handle the change event of ACPI container
>
> Currently the ACPI in kernel emits KOBJ_CHANGE uevent when there
> have online children devices below the acpi container.
>
> Base on the description of caa73ea15 kernel patch, user space
> is expected to offline all devices below the container and the
> container itself. Then, user space can finalize the removal of
> the container with the help of its ACPI device object's eject
> attribute in sysfs.
>
> This udev rule can be a default user space application to meet
> kernel's expectations. This rule walks through the sysfs tree
> to trigger the offline of each child device then ejects the
> container.
>
> The ACPI_CONTAINER_EJECT environoment variable can be used to
> turn off the the ejection logic of container if the ejection
> will be triggered by other ways, e.g. BIOS or other user space
> application.
>
> Reference: https://lkml.org/lkml/2013/11/28/520
> Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Cc: Michal Hocko <mhocko@suse.cz>
> Signed-off-by: "Lee, Chun-Yi" <jlee@suse.com>
> ---
> rules/80-acpi-container-hotremove.rules | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
> create mode 100644 rules/80-acpi-container-hotremove.rules
>
> diff --git a/rules/80-acpi-container-hotremove.rules b/rules/80-acpi-container-hotremove.rules
> new file mode 100644;a
> index 000000000..ef4ceb5fb
> --- /dev/null
> +++ b/rules/80-acpi-container-hotremove.rules
> @@ -0,0 +1,16 @@
> +# do not edit this file, it will be overwritten on update
> +
> +SUBSYSTEM=="container", ACTION=="change", DEVPATH=="*/ACPI0004:??", ENV{ACPI_CONTAINER_EJECT}="1"\
> +RUN+="/bin/sh -c ' \
> +if [ $(cat /sys/$env{DEVPATH}/online) -eq 1 ]; then \
> + find -L /sys/$env{DEVPATH}/firmware_node/*/physical_node* -maxdepth 1 -name online | \
> + while read line; do \
> + if [ $(cat $line) -eq 1 ]; then \
> + /bin/echo 0 > $line; \
> + fi \
> + done; \
> + /bin/echo 0 > /sys/$env{DEVPATH}/online; \
> + if [$env{ACPI_CONTAINER_EJECT} -eq 1] && [ $(cat /sys/$env{DEVPATH}/online) -eq 0 ]; then \
> + /bin/echo 1 > /sys/$env{DEVPATH}/firmware_node/eject; \
> + fi \
> +fi
>
[toc] | [prev] | [next] | [standalone]
| From | joeyli <jlee@suse.com> |
|---|---|
| Date | 2017-06-29 06:00 +0200 |
| Message-ID | <tXyMy-2r1-5@gated-at.bofh.it> |
| In reply to | #1677122 |
Hi YASUAKI, Thanks for your response. On Wed, Jun 28, 2017 at 03:53:16PM -0400, YASUAKI ISHIMATSU wrote: > > On 06/26/2017 02:26 AM, joeyli wrote: > > Hi all, > > > > If ACPI received ejection request for a ACPI container, kernel > > emits KOBJ_CHANGE uevent when it found online children devices > > below the acpi container. > > > > Base on the description of caa73ea15 kernel patch, user space > > is expected to offline all devices below the container and the > > container itself. Then, user space can finalize the removal of > > the container with the help of its ACPI device object's eject > > attribute in sysfs. > > > > That means that kernel relies on users space to peform the offline > > and ejection jobs to acpi container and children devices. The > > discussion is here: > > https://lkml.org/lkml/2013/11/28/520 > > > > The mail loop didn't explain why the userspace is responsible for > > the whole container offlining. Is it possible to do that transparently > > from the kernel? What's the difference between offlining memory and > > processors which happends without any cleanup and container which > > does essentially the same except it happens at once? > > We don't know what devices mount on the container device. I think > devices mount on the container device are different each vendor's server. > > If memory device mounts on the container, memory offline easily fails. > Other devices may have other concerns. So the following udev rule you > write does not work correctly. > IMHO, if the memory hot-remove(offline/ejection) has problem, then we should report the issue and fix it in mm subsystem. Michal Hocko works hard on this. I think that the CPU or IO subsystem are the same. Current kernel can not complete the container hot-remove job without userspace's involvement. So I sent the udev rule as a example to response change uevents. > I think we need to change offline processing for each device. So currently > the userspace is responsible for the whole container offlining. > It depends on what is the expectation of the deivce offline function in kernel. If a subsystem supports offline in kernel, then it should not affects the running user space application. Otherwise the issue should be fixed. Thanks a lot! Joey Lee
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web