From: Andriy Gapon <avg at FreeBSD.org>
To: devel@acpica.org
Subject: Re: [Devel] ref-counting races?
Date: Sun, 24 Mar 2013 12:54:52 +0200 [thread overview]
Message-ID: <514EDB7C.8040202@FreeBSD.org> (raw)
In-Reply-To: 94F2FBAB4432B54E8AACC7DFDE6C92E36F48C23B@ORSMSX101.amr.corp.intel.com
[-- Attachment #1: Type: text/plain, Size: 1946 bytes --]
on 22/03/2013 22:23 Moore, Robert said the following:
> Andriy,
>
> This will of course take a bit of time for us to completely sort out. You are
> correct that there are unlocked calls to the reference count mechanism. This
> could be a result of some code restructuring sometime in the past, as I hope
> that this didn't happen as an oversight.
>
> I want to investigate some older code as well as the original design of the
> reference counts.
Thank you!
> If we do need a separate lock for the reference count mechanism, perhaps a
> spin lock could be used instead of a mutex, as there is nothing that will
> block for any length of time. This may not make any difference on FreeBSD as
> spinlocks may not be available, I'm not sure.
I agree that a spinlock would be more appropriate. Just in case, FreeBSD does
provide ACPICA spinlock implementation.
> In the meantime, I have removed the REF_FORCE_DELETE option as per your
> suggestion; it was implemented in case it was ever needed, which it has not.
Thank you again.
Do you perhaps have an advice on an interim solution for FreeBSD users who seem
to keep bumping into this issue?
I will have a look into trying to prevent concurrency at the battery driver
level. To, at least, reduce the chances of hitting the problem.
In fact, I'll ask the user who helped me, kron24(a)gmail.com, to test the
following (rather coarse) patch:
--- a/sys/dev/acpica/acpi_battery.c
+++ b/sys/dev/acpica/acpi_battery.c
@@ -360,6 +360,8 @@ acpi_battery_ioctl(u_long cmd, caddr_t addr, void *arg)
int error, unit;
device_t dev;
+ mtx_lock(&Giant);
+
/* For commands that use the ioctl_arg struct, validate it first. */
error = ENXIO;
unit = 0;
@@ -417,6 +419,7 @@ acpi_battery_ioctl(u_long cmd, caddr_t addr, void *arg)
error = EINVAL;
}
+ mtx_unlock(&Giant);
return (error);
}
--
Andriy Gapon
next reply other threads:[~2013-03-24 10:54 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-24 10:54 Andriy Gapon [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-03-24 11:10 [Devel] ref-counting races? Andriy Gapon
2013-03-22 20:23 Moore, Robert
2013-03-22 4:28 Zheng, Lv
2013-03-21 19:46 Moore, Robert
2013-03-21 18:07 Andriy Gapon
2012-11-21 15:18 Moore, Robert
2012-11-20 23:08 Andriy Gapon
2012-11-13 16:50 Moore, Robert
2012-11-13 1:51 Moore, Robert
2012-11-10 15:04 Andriy Gapon
2012-11-09 16:03 Andriy Gapon
2012-11-09 15:59 Andriy Gapon
2012-11-09 15:50 Moore, Robert
2012-11-09 15:42 Moore, Robert
2012-11-09 14:41 Andriy Gapon
2012-11-09 14:28 Moore, Robert
2012-11-09 7:33 Andriy Gapon
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=514EDB7C.8040202@FreeBSD.org \
--to=devel@acpica.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 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.