From: Alexey Starikovskiy <astarikovskiy@suse.de>
To: Shaohua Li <shaohua.li@intel.com>
Cc: Zhang Rui <rui.zhang@intel.com>,
linux-acpi@vger.kernel.org, "Moore,
Robert" <robert.moore@intel.com>
Subject: Re: Bug: linux/acpi may execute notify handler that has been removed
Date: Thu, 27 Sep 2007 10:33:32 +0400 [thread overview]
Message-ID: <46FB4EBC.8030107@suse.de> (raw)
In-Reply-To: <1190873430.22927.1.camel@sli10-conroe.sh.intel.com>
Shaohua Li wrote:
> On Thu, 2007-09-27 at 10:24 +0400, Alexey Starikovskiy wrote:
>> Shaohua Li wrote:
>>> On Thu, 2007-09-27 at 11:30 +0800, Zhang Rui wrote:
>>>> Hi, all,
>>>>
>>>> I found a bug that linux/acpi may execute notify handler that
>>>> has been removed.
>>>>
>>>> When a system notify(0~0x7f) is received, linux/acpi will
>>>> first invoke the generic system notify handler (acpi_bus_notify)
>>>> and then invoke the per-device notify handler if present.
>>>>
>>>> In my case, I add some code in acpi_bus_notify for battery
>>>> hotplug support, so that the generic system notify handler will
>>>> remove the battery device, including the per-device notify handler
>>>> acpi_battery_notify() when receiving notification
>>>> ACPI_NOTIFY_EJECT_REQUEST.
>>>> But linux/acpi invokes the per-device notify handler soon and
>>>> this breaks the system.
>>>>
>>>> Further more, device hot-removal is not the only case to encounter
>>>> this bug. For example, linux/acpi receives a notification and adds it
>>>> in the workqueue, and then the driver(notify handler) is removed
>>>> before kacpid_notify invoke it...
>>> For the non-hotplug case, adding a flush work queue just after notify
>>> handler is removed should be ok.
>> I think, the real problem with ACPI hotplug is that we know which devices might appear --
>> they are all enumerated in DSDT, but we don't add them until they appear.
>> If we do .add for all devices in DSDT, and then just .start/.stop them as they appear/disappear,
>> we will have to do much less work, and avoid a problem described above...
> If a device is not present, you can't access any method of it.
What is because you didn't call .add() yet, or already called .remove(), yes?
>
> The real problem here is ACPICA will call some drivers routines
> (notification handler), but doesn't get a reference count of the driver
> module.
We just should be able to load drivers for declared, but physically absent devices.
>
> Thanks,
> Shaohua
next prev parent reply other threads:[~2007-09-27 6:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-27 3:30 Bug: linux/acpi may execute notify handler that has been removed Zhang Rui
2007-09-27 4:53 ` Alexey Starikovskiy
2007-09-27 5:03 ` Zhang Rui
2007-09-27 4:54 ` Shaohua Li
2007-09-27 6:24 ` Alexey Starikovskiy
2007-09-27 6:10 ` Shaohua Li
2007-09-27 6:33 ` Alexey Starikovskiy [this message]
2007-09-28 3:37 ` Zhang Rui
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=46FB4EBC.8030107@suse.de \
--to=astarikovskiy@suse.de \
--cc=linux-acpi@vger.kernel.org \
--cc=robert.moore@intel.com \
--cc=rui.zhang@intel.com \
--cc=shaohua.li@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.