A udev rule to serve the change event of ACPI container?

From: joeyli
Date: Mon Jun 26 2017 - 02:27:24 EST


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