kernel - Add workaround for improper yield in ACPI path
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 8 Aug 2016 17:46:35 +0000 (10:46 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 8 Aug 2016 17:46:35 +0000 (10:46 -0700)
commitfbe960762198e27378a857bfa91c5d82e625aa3b
tree5e5b0147b572d97421edd8b33f7a96f0325a6754
parente08b3836c962ce70abfb9137690df94b596d7357
kernel - Add workaround for improper yield in ACPI path

* For now add a workaround for an improper yield that can occur indirectly
  via the ACPI path.  The problem is that the ACPI contrib code can hold
  a spinlock across a kmalloc() call.

* The ACPI code, in particular AcpiOsAcquireLock(), uses a spin lock.  At
  the same time it MUST use a spinlock because it might be called from
  the idle thread.  But it also appears that the code might call kmalloc()
  while holding a spinlock.

  The kmalloc path ACPI calls is with M_INTWAIT, which reduces the chance
  that kmalloc might try to block.  However, kmalloc is used to execute
  staged kfrees which can create a sequence:

  kmalloc -> kmem_slab_free -> (vm system) ->
  vm_object_page_remove_callback -> lwkt_user_yield().
sys/kern/lwkt_thread.c