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:55:15 +0000 (10:55 -0700)
commit16fba839f0006543f5abf5aff8882d19e47f465a
tree9a40690d1eee4273b4236802d730202648e2724b
parent7f0942f061072f32c56ff97b3b4269cb530a8c52
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