From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Yinghai Lu <yinghai@kernel.org>
Cc: ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>, Jiang Liu <liuj97@gmail.com>,
"Alexander E. Patrakov" <patrakov@gmail.com>
Subject: Re: [PATCH 1/3] ACPI / dock: Rework the handling of notifications
Date: Sun, 30 Jun 2013 16:18:42 +0200 [thread overview]
Message-ID: <1494881.y5W1zydDGl@vostro.rjw.lan> (raw)
In-Reply-To: <CAE9FiQXc9WKDZdABOB8p0soT+OTcRbJb7JTgrPz6ffd2dyPEHA@mail.gmail.com>
On Saturday, June 29, 2013 09:12:59 AM Yinghai Lu wrote:
> On Sat, Jun 29, 2013 at 4:16 AM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> > On Friday, June 28, 2013 04:34:21 PM Yinghai Lu wrote:
> >> On Fri, Jun 28, 2013 at 3:53 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> >> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >> >
> >> > The ACPI dock driver uses register_acpi_bus_notifier() which
> >> > installs a notifier triggered globally for all system notifications.
> >> > That first of all is inefficient, because the dock driver is only
> >> > interested in notifications associated with the devices it handles,
> >> > but it has to handle all system notifies for all devices. Moreover,
> >> > it does that even if no docking stations are present in the system
> >> > (CONFIG_ACPI_DOCK set is sufficient for that to happen). Besides,
> >> > that is inconvenient, because it requires the driver to do extra work
> >> > for each notification to find the target dock station object.
> >> >
> >> > For these reasons, rework the dock driver to install a notify
> >> > handler individually for each dock station in the system using
> >> > acpi_install_notify_handler(). This allows the dock station
> >> > object to be passed directly to the notify handler and makes it
> >> > possible to simplify the dock driver quite a bit. It also
> >> > reduces the overhead related to the handling of all system
> >> > notifies when CONFIG_ACPI_DOCK is set.
> >>
> >> original change to use register_acpi_bus_notifier, have two assumption
> >> 1. two dock_station will have same handle.
> >
> > Well, that would mean that dock_add() might be called twice for the same handle
> > and I don't see how that's possible.
> >
> > Moreover, even if that were possible, the loop in acpi_dock_notifier_call()
> > would break after finding the *first* matching handle anyway, so
> > acpi_dock_deferred_cb() wouldn't be called for the second dock station with
> > the same handle, if there were two.
>
> related commit:
> commit 6bd00a61ab63d4ceb635ae0316353c11c900b8d8
> Author: Shaohua Li <shaohua.li@intel.com>
> Date: Thu Aug 28 10:04:29 2008 +0800
>
> ACPI: introduce notifier change to avoid duplicates
>
> The battery driver already registers notification handler.
> To avoid registering notification handler again,
> introduce a notifier chain in global system notifier handler
> and use it in dock driver.
>
> so it is not two dock station have same handle. it is battery acpi driver.
>
> but notitifer installing is changed
>
> commit d94066910943837558d2a461c6766da981260bf0
> Author: Bjorn Helgaas <bjorn.helgaas@hp.com>
> Date: Thu Apr 30 09:35:47 2009 -0600
>
> ACPI: battery: use .notify method instead of installing handler directly
>
> This patch adds a .notify() method. The presence of .notify() causes
> Linux/ACPI to manage event handlers and notify handlers on our behalf,
> so we don't have to install and remove them ourselves.
>
> This driver apparently relies on seeing ALL notify events, not just
> device-specific ones (because it used ACPI_ALL_NOTIFY). We use the
> ACPI_DRIVER_ALL_NOTIFY_EVENTS driver flag to request all events.
>
> Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
> CC: Alexey Starikovskiy <alexey.y.starikovskiy@linux.intel.com>
> Signed-off-by: Len Brown <len.brown@intel.com>
>
>
> >
> >> 2. acpi subsystem: non root acpi device only can have one system
> >> notifier installed.
> >
> > No, that limitation is long gone. We removed it when we were working on ACPI
> > wakeup support for runtime PM.
>
> looks like i misread that...
>
> * NOTES: The Root namespace object may have only one handler for each
> * type of notify (System/Device). Device/Thermal/Processor objects
> * may have one device notify handler, and multiple system notify
> * handlers.
>
> device could have multiple system notify handlers.
>
> So
>
> Acked-by: Yinghai Lu <yinghai@kernel.org>
Thanks (and for the other ACKs too)!
next prev parent reply other threads:[~2013-06-30 14:09 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-28 19:44 [PATCH 0/4] ACPI / dock: Cleanups and simplifications Rafael J. Wysocki
2013-06-28 19:45 ` [PATCH 1/4] ACPI / dock: Drop the hp_lock mutex from struct dock_station Rafael J. Wysocki
2013-06-28 19:46 ` [PATCH 2/4] ACPI / dock: Rework and simplify find_dock_devices() Rafael J. Wysocki
2013-06-28 20:08 ` Yinghai Lu
2013-06-28 19:47 ` [PATCH 3/4] ACPI / dock: Walk list in reverse order during removal of devices Rafael J. Wysocki
2013-06-28 20:14 ` Yinghai Lu
2013-06-28 19:48 ` [PATCH 4/4] ACPI / dock: Simplify dock_init_hotplug() and dock_release_hotplug() Rafael J. Wysocki
2013-06-28 20:16 ` Yinghai Lu
2013-06-28 22:47 ` [PATCH 0/3] ACPI / dock: Notification rework and memory leak fix Rafael J. Wysocki
2013-06-28 22:53 ` [PATCH 1/3] ACPI / dock: Rework the handling of notifications Rafael J. Wysocki
2013-06-28 23:34 ` Yinghai Lu
2013-06-29 11:16 ` Rafael J. Wysocki
2013-06-29 16:12 ` Yinghai Lu
2013-06-30 14:18 ` Rafael J. Wysocki [this message]
2013-07-01 20:21 ` Bjorn Helgaas
2013-07-02 1:28 ` Rafael J. Wysocki
2013-06-28 22:54 ` [PATCH 2/3] ACPI: Drop ACPI bus notifier call chain Rafael J. Wysocki
2013-06-28 22:54 ` [PATCH 3/3] ACPI / dock: Do not leak memory on falilures to add a dock station Rafael J. Wysocki
2013-07-03 23:23 ` [PATCH 0/4] ACPI / dock: One fix and more cleanups Rafael J. Wysocki
2013-07-03 23:25 ` [PATCH 1/4] ACPI / dock: Actually define acpi_dock_init() as void Rafael J. Wysocki
2013-07-03 23:26 ` [PATCH 2/4] ACPI / dock: Do not check CONFIG_ACPI_DOCK_MODULE Rafael J. Wysocki
2013-07-03 23:27 ` [PATCH 3/4] ACPI / dock / PCI: Drop ACPI dock notifier chain Rafael J. Wysocki
2013-07-03 23:28 ` [PATCH 4/4] ACPI / dock: Drop unnecessary local variable from dock_add() Rafael J. Wysocki
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=1494881.y5W1zydDGl@vostro.rjw.lan \
--to=rjw@sisk.pl \
--cc=bhelgaas@google.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuj97@gmail.com \
--cc=patrakov@gmail.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
all inboxes | Powered by JetHome®