[LOR] ACPI related on 9-current

View: New views
4 Messages — Rating Filter:   Alert me  

[LOR] ACPI related on 9-current

by Munehiro Matsuda :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

I've got two LORs related to ACPI on 9-current system from few days old world.
The second one with "ACPI AC adapter", may relate to using sysutils/xbattbar
from ports.
If you need more info, please let me know.

=--------------------------------------------------------------------------
lock order reversal:
 1st 0xc09450a4 sysctl lock (sysctl lock) @ kern/kern_sysctl.c:1521
 2nd 0xc0c11738 ACPI video (ACPI video) @ /home/haro/tmp/sys-7/modules/acpi/acpi_video/../../../dev/acpica/acpi_video.c:627
KDB: stack backtrace:
db_trace_self_wrapper(c0897ffe,debd7aac,c0625515,c061634b,c089ae63,...) at db_trace_self_wrapper+0x26
kdb_backtrace(c061634b,c089ae63,c3cfbda8,c3cfdc88,debd7b08,...) at kdb_backtrace+0x29
_witness_debugger(c089ae63,c0c11738,c0c104d0,c3cfdc88,c0c100b7,...) at _witness_debugger+0x25
witness_checkorder(c0c11738,9,c0c100b7,273,0,...) at witness_checkorder+0x839
_sx_xlock(c0c11738,0,c0c100b7,273,0,...) at _sx_xlock+0x85
acpi_video_vo_active_sysctl(c3e3f3c0,c3e3f480,0,debd7ba4,debd7ba4,...) at acpi_video_vo_active_sysctl+0x44
sysctl_root(debd7ba4,0,c0895b7a,5f1,c41b5d20,...) at sysctl_root+0x187
userland_sysctl(c41b5d20,debd7c10,5,0,bfbfdc40,...) at userland_sysctl+0x17c
__sysctl(c41b5d20,debd7cf8,18,c089bc8a,c08f5458,...) at __sysctl+0x94
syscall(debd7d38) at syscall+0x2a3
Xint0x80_syscall() at Xint0x80_syscall+0x20
--- syscall (202, FreeBSD ELF32, __sysctl), eip = 0x2817dc0f, esp = 0xbfbfdb4c, ebp = 0xbfbfdb78 ---

=--------------------------------------------------------------------------
lock order reversal:
 1st 0xc09450a4 sysctl lock (sysctl lock) @ kern/kern_sysctl.c:1521
 2nd 0xc0c6fefc ACPI AC adapter (ACPI AC adapter) @ /home/haro/tmp/sys-7/modules/acpi/acpi/../../../dev/acpica/acpi_acad.c:109
KDB: stack backtrace:
db_trace_self_wrapper(c0897ffe,ded3da70,c0625515,c061634b,c089ae63,...) at db_trace_self_wrapper+0x26
kdb_backtrace(c061634b,c089ae63,c3cfbda8,c3cfd878,ded3dacc,...) at kdb_backtrace+0x29
_witness_debugger(c089ae63,c0c6fefc,c0c6a865,c3cfd878,c0c6a7ad,...) at _witness_debugger+0x25
witness_checkorder(c0c6fefc,9,c0c6a7ad,6d,0,...) at witness_checkorder+0x839
_sx_xlock(c0c6fefc,0,c0c6a7ad,6d,c3e225c0,...) at _sx_xlock+0x85
acpi_acad_get_status(c3e2fb00,0,ded3db50,c4007370,ded3db58,...) at acpi_acad_get_status+0xb8
acpi_acad_get_acline(ded3db50,589,0,0,c4007370,...) at acpi_acad_get_acline+0x3e
acpi_acad_sysctl(c40107c0,c4007370,0,ded3dba4,ded3dba4,...) at acpi_acad_sysctl+0x12
sysctl_root(ded3dba4,0,c0895b7a,5f1,c42b3d20,...) at sysctl_root+0x187
userland_sysctl(c42b3d20,ded3dc10,3,bfbfe27c,bfbfe274,...) at userland_sysctl+0x17c
__sysctl(c42b3d20,ded3dcf8,18,c089bc8a,c08f5458,...) at __sysctl+0x94
syscall(ded3dd38) at syscall+0x2a3
Xint0x80_syscall() at Xint0x80_syscall+0x20
--- syscall (202, FreeBSD ELF32, __sysctl), eip = 0x282a0c0f, esp = 0xbfbfe13c, ebp = 0xbfbfe168 ---

=--------------------------------------------------------------------------

Thanks,
  Haro
=------------------------------------------------------------------------------
           _ _    Munehiro (haro) Matsuda
 -|- /_\  |_|_|   Internet Solution Dept., KGT Inc.
 /|\ |_|  |_|_|
_______________________________________________
freebsd-acpi@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-acpi
To unsubscribe, send any mail to "freebsd-acpi-unsubscribe@..."

Re: [LOR] ACPI related on 9-current

by John Baldwin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Saturday 26 September 2009 10:41:36 am Munehiro Matsuda wrote:
> Hi all,
>
> I've got two LORs related to ACPI on 9-current system from few days old
world.
> The second one with "ACPI AC adapter", may relate to using sysutils/xbattbar
> from ports.
> If you need more info, please let me know.

Try this patch.  It avoids holding the ACPI adapter lock while calling all the
power manager eventhandler routines, and it splits the ACPI video lock up
into two locks: one to manage the "bus" of video output devices, and one that
serves as the softc lock for each of the video output devices.

Index: dev/acpica/acpi_acad.c
===================================================================
--- dev/acpica/acpi_acad.c (revision 197430)
+++ dev/acpica/acpi_acad.c (working copy)
@@ -109,13 +109,14 @@
     ACPI_SERIAL_BEGIN(acad);
     if (newstatus != -1 && sc->status != newstatus) {
  sc->status = newstatus;
+ ACPI_SERIAL_END(acad);
  power_profile_set_state(newstatus ? POWER_PROFILE_PERFORMANCE :
     POWER_PROFILE_ECONOMY);
  ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
     "%s Line\n", newstatus ? "On" : "Off");
  acpi_UserNotify("ACAD", h, newstatus);
-    }
-    ACPI_SERIAL_END(acad);
+    } else
+ ACPI_SERIAL_END(acad);
 }
 
 static void
Index: dev/acpica/acpi_video.c
===================================================================
--- dev/acpica/acpi_video.c (revision 197438)
+++ dev/acpica/acpi_video.c (working copy)
@@ -170,7 +170,13 @@
 static struct acpi_video_output_queue crt_units, tv_units,
     ext_units, lcd_units, other_units;
 
+/*
+ * The 'video' lock protects the hierarchy of video output devices
+ * (the video "bus").  The 'video_output' lock protects per-output
+ * data is equivalent to a softc lock for each video output.
+ */
 ACPI_SERIAL_DECL(video, "ACPI video");
+ACPI_SERIAL_DECL(video_output, "ACPI video output");
 MALLOC_DEFINE(M_ACPIVIDEO, "acpivideo", "ACPI video extension");
 
 static int
@@ -236,12 +242,14 @@
  acpi_sc = devclass_get_softc(devclass_find("acpi"), 0);
  if (acpi_sc == NULL)
  return (ENXIO);
+ ACPI_SERIAL_BEGIN(video);
  if (acpi_video_sysctl_tree == NULL) {
  acpi_video_sysctl_tree = SYSCTL_ADD_NODE(&acpi_video_sysctl_ctx,
     SYSCTL_CHILDREN(acpi_sc->acpi_sysctl_tree),
     OID_AUTO, "video", CTLFLAG_RD, 0,
     "video extension control");
  }
+ ACPI_SERIAL_END(video);
 
  sc->device = dev;
  sc->handle = acpi_get_handle(dev);
@@ -316,6 +324,7 @@
  dss_p = 0;
  lasthand = NULL;
  ACPI_SERIAL_BEGIN(video);
+ ACPI_SERIAL_BEGIN(video_output);
  STAILQ_FOREACH(vo, &sc->vid_outputs, vo_next) {
  dss = vo_get_graphics_state(vo->handle);
  dcs = vo_get_device_status(vo->handle);
@@ -331,6 +340,7 @@
  }
  if (lasthand != NULL)
  vo_set_device_state(lasthand, dss_p|DSS_COMMIT);
+ ACPI_SERIAL_END(video_output);
  ACPI_SERIAL_END(video);
  break;
  case VID_NOTIFY_REPROBE:
@@ -367,12 +377,14 @@
  return;
 
  ACPI_SERIAL_BEGIN(video);
+ ACPI_SERIAL_BEGIN(video_output);
  STAILQ_FOREACH(vo, &sc->vid_outputs, vo_next) {
  if (vo->vo_levels != NULL && vo->vo_brightness == -1)
  vo_set_brightness(vo->handle,
     state == POWER_PROFILE_ECONOMY ?
     vo->vo_economy : vo->vo_fullpower);
  }
+ ACPI_SERIAL_END(video_output);
  ACPI_SERIAL_END(video);
 }
 
@@ -550,7 +562,7 @@
 acpi_video_vo_bind(struct acpi_video_output *vo, ACPI_HANDLE handle)
 {
 
- ACPI_SERIAL_ASSERT(video);
+ ACPI_SERIAL_BEGIN(video_output);
  if (vo->vo_levels != NULL)
  AcpiOsFree(vo->vo_levels);
  vo->handle = handle;
@@ -565,6 +577,7 @@
  /* XXX - see above. */
  vo->vo_economy = vo->vo_levels[BCL_ECONOMY];
  }
+ ACPI_SERIAL_END(video_output);
 }
 
 static void
@@ -605,7 +618,7 @@
 {
  int i;
 
- ACPI_SERIAL_ASSERT(video);
+ ACPI_SERIAL_ASSERT(video_output);
  if (vo->vo_levels == NULL)
  return (ENODEV);
  for (i = 0; i < vo->vo_numlevels; i++)
@@ -624,7 +637,7 @@
  vo = (struct acpi_video_output *)arg1;
  if (vo->handle == NULL)
  return (ENXIO);
- ACPI_SERIAL_BEGIN(video);
+ ACPI_SERIAL_BEGIN(video_output);
  state = (vo_get_device_status(vo->handle) & DCS_ACTIVE) ? 1 : 0;
  err = sysctl_handle_int(oidp, &state, 0, req);
  if (err != 0 || req->newptr == NULL)
@@ -632,7 +645,7 @@
  vo_set_device_state(vo->handle,
     DSS_COMMIT | (state ? DSS_ACTIVE : DSS_INACTIVE));
 out:
- ACPI_SERIAL_END(video);
+ ACPI_SERIAL_END(video_output);
  return (err);
 }
 
@@ -644,7 +657,7 @@
  int level, preset, err;
 
  vo = (struct acpi_video_output *)arg1;
- ACPI_SERIAL_BEGIN(video);
+ ACPI_SERIAL_BEGIN(video_output);
  if (vo->handle == NULL) {
  err = ENXIO;
  goto out;
@@ -674,7 +687,7 @@
  vo_set_brightness(vo->handle, (level == -1) ? preset : level);
 
 out:
- ACPI_SERIAL_END(video);
+ ACPI_SERIAL_END(video_output);
  return (err);
 }
 
@@ -686,7 +699,7 @@
 
  err = 0;
  vo = (struct acpi_video_output *)arg1;
- ACPI_SERIAL_BEGIN(video);
+ ACPI_SERIAL_BEGIN(video_output);
  if (vo->handle == NULL) {
  err = ENXIO;
  goto out;
@@ -717,7 +730,7 @@
  *preset = level;
 
 out:
- ACPI_SERIAL_END(video);
+ ACPI_SERIAL_END(video_output);
  return (err);
 }
 
@@ -729,7 +742,7 @@
  int err;
 
  vo = (struct acpi_video_output *)arg1;
- ACPI_SERIAL_BEGIN(video);
+ ACPI_SERIAL_BEGIN(video_output);
  if (vo->vo_levels == NULL) {
  err = ENODEV;
  goto out;
@@ -742,7 +755,7 @@
     vo->vo_numlevels * sizeof(*vo->vo_levels), req);
 
 out:
- ACPI_SERIAL_END(video);
+ ACPI_SERIAL_END(video_output);
  return (err);
 }
 
@@ -892,6 +905,7 @@
 {
  ACPI_STATUS status;
 
+ ACPI_SERIAL_ASSERT(video_output);
  status = acpi_SetInteger(handle, "_BCM", level);
  if (ACPI_FAILURE(status))
  printf("can't evaluate %s._BCM - %s\n",
@@ -904,6 +918,7 @@
  UINT32 dcs;
  ACPI_STATUS status;
 
+ ACPI_SERIAL_ASSERT(video_output);
  dcs = 0;
  status = acpi_GetInteger(handle, "_DCS", &dcs);
  if (ACPI_FAILURE(status))
@@ -933,6 +948,7 @@
 {
  ACPI_STATUS status;
 
+ ACPI_SERIAL_ASSERT(video_output);
  status = acpi_SetInteger(handle, "_DSS", state);
  if (ACPI_FAILURE(status))
  printf("can't evaluate %s._DSS - %s\n",

--
John Baldwin
_______________________________________________
freebsd-acpi@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-acpi
To unsubscribe, send any mail to "freebsd-acpi-unsubscribe@..."

Re: [LOR] ACPI related on 9-current

by Munehiro Matsuda :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

From: John Baldwin <jhb@...>
Date: Mon, 28 Sep 2009 08:29:24 -0400
::On Saturday 26 September 2009 10:41:36 am Munehiro Matsuda wrote:
::> Hi all,
::>
::> I've got two LORs related to ACPI on 9-current system from few days old
::world.
::> The second one with "ACPI AC adapter", may relate to using sysutils/xbattbar
::> from ports.
::> If you need more info, please let me know.
::
::Try this patch.  It avoids holding the ACPI adapter lock while calling all the
::power manager eventhandler routines, and it splits the ACPI video lock up
::into two locks: one to manage the "bus" of video output devices, and one that
::serves as the softc lock for each of the video output devices.

Hello John,

Thanks for the quick patch.
It does seem to fix the LORs with ACPI.

I'll test for few more days, and if I get any odd I'll report back.

Thank you,
 Haro
=------------------------------------------------------------------------------
           _ _    Munehiro (haro) Matsuda
 -|- /_\  |_|_|   Internet Solution Dept., KGT Inc.
 /|\ |_|  |_|_|
_______________________________________________
freebsd-acpi@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-acpi
To unsubscribe, send any mail to "freebsd-acpi-unsubscribe@..."

Re: [LOR] ACPI related on 9-current

by Munehiro Matsuda :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

From: Munehiro Matsuda <haro_at_h4.dion.ne.jp>
Date: Tue, 29 Sep 2009 02:45:47 +0900 (JST)
::From: John Baldwin <jhb_at_freebsd.org>
::Date: Mon, 28 Sep 2009 08:29:24 -0400
::::On Saturday 26 September 2009 10:41:36 am Munehiro Matsuda wrote:
::::> Hi all,
::::>
::::> I've got two LORs related to ACPI on 9-current system from few days old
::::world.
::::> The second one with "ACPI AC adapter", may relate to using sysutils/xbattbar
::::> from ports.
::::> If you need more info, please let me know.
::::
::::Try this patch.  It avoids holding the ACPI adapter lock while calling all the
::::power manager eventhandler routines, and it splits the ACPI video lock up
::::into two locks: one to manage the "bus" of video output devices, and one that
::::serves as the softc lock for each of the video output devices.
::
::Hello John,
::
::Thanks for the quick patch.
::It does seem to fix the LORs with ACPI.
::
::I'll test for few more days, and if I get any odd I'll report back.

Hello John,

I've run the patch for the past day or two and haven't seen any ACPI
related LoR or issues with it.
So I think it's alright to commit it.

Thank you,
 Haro
=------------------------------------------------------------------------------
           _ _    Munehiro (haro) Matsuda
 -|- /_\  |_|_|   Internet Solution Dept., KGT Inc.
 /|\ |_|  |_|_|

_______________________________________________
freebsd-acpi@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-acpi
To unsubscribe, send any mail to "freebsd-acpi-unsubscribe@..."