git: nvmm - Fix event commit logic

Aaron LI aly at crater.dragonflybsd.org
Tue Jul 20 16:30:33 PDT 2021


commit dd353e3086ebbad842607aab7b78ac7f759aa284
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Mon Jul 5 23:22:22 2021 -0700

    nvmm - Fix event commit logic
    
    * Because DragonFly needs to do some tests after hard interrupt
      disablement, possibly aborting a VM entry before the VM is actually
      run.  Certain assumptions made by QEMU related to event injection
      might not hold.  Two situations can cause events to be lost.
    
      (1) QEMU overwrites its own event after assuming the event would be
      injected when it might not be.
    
      (2) Or nvmm overwrites an event for the same reason.
    
    * To fix this we avoid trying to inject the event unless we are
      absolutely sure that we will issue the VM entry instruction, and we
      force the system call (the ioctl() actually) to restart with ERESTART
      to ensure that QEMU doesn't see the ioctl() return until the event is
      actually injected.
    
    * The tests DragonFly needs to do relate to ASTs and SWIs that might be
      queued via an IPI prior to VM entry.  We absolutely do not want to run
      the VM if any such flags are pending as it might cause other unrelated
      interactive processes to stall out for too long a period of time, or
      allow a signal delivery to the QEMU process to race the VM entry.

Summary of changes:
 sys/dev/virtual/nvmm/x86/nvmm_x86_svm.c | 28 ++++++++++++++++++++++++++--
 sys/dev/virtual/nvmm/x86/nvmm_x86_vmx.c | 28 ++++++++++++++++++++++++++--
 2 files changed, 52 insertions(+), 4 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/dd353e3086ebbad842607aab7b78ac7f759aa284


-- 
DragonFly BSD source repository



More information about the Commits mailing list