From: Dmitry Torokhov <dtor_core-yWtbtysYrB+LZ21kGMrzwg@public.gmane.org>
To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Cc: castet.matthieu-GANU6spQydw@public.gmane.org
Subject: Re: [RFC/patch] ACPI in linux PnP layer
Date: Wed, 8 Sep 2004 23:26:47 -0500 [thread overview]
Message-ID: <200409082326.50984.dtor_core@ameritech.net> (raw)
In-Reply-To: <1094641221.413ee645d2cb6-/A4Sof3AOA+ksujEA26zIQ@public.gmane.org>
On Wednesday 08 September 2004 06:00 am, castet.matthieu-GANU6spQydw@public.gmane.org wrote:
> Any comment ?
>
> + spin_lock(&acpi_device_lock);
> + list_for_each_safe(node, next, &acpi_device_list) {
> + struct acpi_device * dev = container_of(node, struct acpi_device, g_list);
> + spin_unlock(&acpi_device_lock);
> + handler(dev);
> + spin_lock(&acpi_device_lock);
> + }
> + spin_unlock(&acpi_device_lock);
>
What exactly that does spinlock do? Note that list_for_each_safe is only
"safe" in sense that the current element can be deleted from the list
_by the same thread_ that is doing iteration. That is it. If some other
thread accesses the same list it is not safe at all and that spinlock is
next to useless because it is dropped in the middle of the loop. The whole
construct should be protected by a semaphore, acpi_subsys.rewsem is a good
candidate (I hope Len will eventually apply my patch to the scan.c that
does just that).
--
Dmitry
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
next prev parent reply other threads:[~2004-09-09 4:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-08 11:00 [RFC/patch] ACPI in linux PnP layer castet.matthieu-GANU6spQydw
[not found] ` <1094641221.413ee645d2cb6-/A4Sof3AOA+ksujEA26zIQ@public.gmane.org>
2004-09-08 15:48 ` castet.matthieu-GANU6spQydw
2004-09-09 4:26 ` Dmitry Torokhov [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-09-09 2:57 Li, Shaohua
[not found] <16A54BF5D6E14E4D916CE26C9AD305752500E0@pdsmsx402.ccr.corp.intel.com>
[not found] ` <16A54BF5D6E14E4D916CE26C9AD305752500E0-4yWAQGcml66iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2004-09-26 18:17 ` matthieu castet
2004-09-27 3:33 Li, Shaohua
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=200409082326.50984.dtor_core@ameritech.net \
--to=dtor_core-ywtbtysyrb+lz21kgmrzwg@public.gmane.org \
--cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=castet.matthieu-GANU6spQydw@public.gmane.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