Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: qemu/qemu
base: master
Choose a base ref
...
head repository: roolebo/qemu
compare: hvf-debug-kick
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 11 commits
  • 17 files changed
  • 1 contributor

Commits on Aug 13, 2020

  1. ui/cocoa: Fix openFile: deprecation on Big Sur

    ui/cocoa.m:1188:44: warning: 'openFile:' is deprecated: first deprecated in macOS 11.0 - Use -[NSWorkspace openURL:] instead.
          [-Wdeprecated-declarations]
            if ([[NSWorkspace sharedWorkspace] openFile: full_file_path] == YES) {
                                               ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSWorkspace.h:350:1: note:
          'openFile:' has been explicitly marked deprecated here
    - (BOOL)openFile:(NSString *)fullPath API_DEPRECATED("Use -[NSWorkspace openURL:] instead.", macos(10.0, 11.0));
    ^
    
    Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
    Roman Bolshakov committed Aug 13, 2020
    Copy the full SHA
    e3f0e87 View commit details
    Browse the repository at this point in the history
  2. i386: hvf: Sync unusable bit with present

    Current code sets LDT even if it's not present. This causes Invalid
    Guest State VM-entry failure.
    
    Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
    Roman Bolshakov committed Aug 13, 2020
    Copy the full SHA
    d539349 View commit details
    Browse the repository at this point in the history
  3. i386: hvf: Add support for exception helper

    WIP
    
    Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
    Roman Bolshakov committed Aug 13, 2020
    Copy the full SHA
    393500d View commit details
    Browse the repository at this point in the history
  4. i386: hvf: Add Mov DR VM-exit handler

    macOS Big Sur Beta 3 sets MOV-DR exiting (Bit 23) in Primary
    processor-based execution controls even if it wasn't asked to set it.
    That breaks HVF because it lacks a handler for MOV DR exit reason.
    
    Apple-Feedback: FB8194745
    Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
    Roman Bolshakov committed Aug 13, 2020
    Copy the full SHA
    a449a02 View commit details
    Browse the repository at this point in the history
  5. scripts/tracetool: Fix dtrace generation for macOS

    dtrace USDT is fully supported since OS X 10.6. There are a few
    peculiarities compared to other dtrace flavors.
    
    1. It doesn't accept empty files.
    2. It doesn't recognize bool type but accepts C99 _Bool.
    3. It converts int8_t * in probe points to char * in
       header files and introduces [-Wpointer-sign] warning.
    
    Cc: Cameron Esfahani <dirty@apple.com>
    Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
    Roman Bolshakov committed Aug 13, 2020
    Copy the full SHA
    473da86 View commit details
    Browse the repository at this point in the history
  6. scripts/tracetool: Use void pointer for vcpu

    dtrace on macOS complains that CPUState * is used for a few probes:
    
      dtrace: failed to compile script trace-dtrace-root.dtrace: line 130: syntax error near "CPUState"
    
    A comment in scripts/tracetool/__init__.py mentions that:
    
      We only want to allow standard C types or fixed sized
      integer types. We don't want QEMU specific types
      as we can't assume trace backends can resolve all the
      typedefs
    
    Fixes: 3d211d9 ("trace: Add 'vcpu' event property to trace guest vCPU")
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Cc: Cameron Esfahani <dirty@apple.com>
    Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
    Roman Bolshakov committed Aug 13, 2020
    Copy the full SHA
    9e22aec View commit details
    Browse the repository at this point in the history
  7. build: Don't make object files for dtrace on macOS

    dtrace on macOS uses unresolved symbols with a special prefix to define
    probes [1], only headers should be generated for USDT (dtrace(1)). But
    it doesn't support backwards compatible no-op -G flag [2] and implicit
    build rules fail.
    
    1. https://markmail.org/message/6grq2ygr5nwdwsnb
    2. https://markmail.org/message/5xrxt2w5m42nojkz
    
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Cc: Cameron Esfahani <dirty@apple.com>
    Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
    Roman Bolshakov committed Aug 13, 2020
    Copy the full SHA
    01ef7b7 View commit details
    Browse the repository at this point in the history
  8. net/colo: Match is-enabled probe to tracepoint

    Build of QEMU with dtrace fails on macOS:
    
      LINK    x86_64-softmmu/qemu-system-x86_64
    error: probe colo_compare_miscompare doesn't exist
    error: Could not register probes
    ld: error creating dtrace DOF section for architecture x86_64
    
    The reason of the error is explained by Adam Leventhal [1]:
    
      Note that is-enabled probes don't have the stability magic so I'm not
      sure how things would work if only is-enabled probes were used.
    
    net/colo code uses is-enabled probes to determine if other probes should
    be used but colo_compare_miscompare itself is not used explicitly.
    Linker doesn't include the symbol and build fails.
    
    The issue can be resolved if is-enabled probe matches the actual trace
    point that is used inside the test. Packet dump toggle is replaced with
    a compile-time conditional definition.
    
    1. http://markmail.org/message/6grq2ygr5nwdwsnb
    
    Fixes: f4b6183 ("colo-compare: add TCP, UDP, ICMP packet comparison")
    Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
    Cc: Cameron Esfahani <dirty@apple.com>
    Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
    Roman Bolshakov committed Aug 13, 2020
    Copy the full SHA
    0dab157 View commit details
    Browse the repository at this point in the history
  9. i386: hvf: Implement CPU kick

    HVF doesn't have a CPU kick and without it it's not possible to perform
    an action on CPU thread until a VMEXIT happens. The kick is also needed
    for timely interrupt delivery.
    
    Existing implementation of CPU kick sends SIG_IPI (aka SIGUSR1) to vCPU
    thread, but it's different from what hv_vcpu_interrupt does. The latter
    one results in invocation of mp_cpus_kick() in XNU kernel [1].
    
    mp_cpus_kick() sends an IPI through the host LAPIC to the HVF vCPU.
    And the kick interrupt leads to VM exit because "external-interrupt
    exiting” VM-execution control is enabled for HVF.
    
    hv_vcpu_interrupt() has no effect if it's delivered when vCPU is outside
    of a guest, therefore to avoid kick loss it's complemented with a
    SIG_IPI handler and zero VMX-preemption timer. If the kick happens
    outside of hv_vcpu_run(), the signal handler will re-queue the kick by
    setting exit_request. exit_request is cleared when the request is
    satisifed, i.e. when vCPU thread returns with EXCP_INTERRUPT.
    
    So we get the following scenarios time/location-wise for the kick:
    
    1) vCPU thread is far away before hv_vcpu_run(), then exit_request is
       scheduled. As soon as vCPU thread approaches hv_vcpu_run(), the
       exit request is satasified.
    
    2) vCPU thread is about to enter the guest, then VMX-preemption timer is
       enabled to expedite immediate VM-exit. The VMX-preemption timer is
       then cleared in VM-exit handler, exit from vCPU thread is performed.
    
    3) The guest is running, then hv_vcpu_run() is interrupted by
       hv_vcpu_interrupt() and vCPU thread quits.
    
    4) vCPU thread has just made VM-exit, then exit_request is recorded and
       VMX-preemption timer is enabled but the exit request won't be
       satisfied until the next iteration of vCPU thread, no kick loss
       happens.
    
    5) vCPU thread is far after hv_vcpu_run(), then exit_request is recorded
       and VMX-preemption timer is not enabled. The exit request will be
       satasfied on the next iteration of vCPU thread, like in 4). The kick
       is not lost.
    
    6) If some external interupt happens we can satisify exit request and can
       clear VMX-preemption timer, i.e. kicks are coalesced with interrupts.
    
    While at it, correct type of hvf_fd to the type of hv_vcpuid_t to avoid
    compilation warnings.
    
    1. https://opensource.apple.com/source/xnu/xnu-6153.81.5/osfmk/i386/mp.c
    
    Cc: Cameron Esfahani <dirty@apple.com>
    Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
    Roman Bolshakov committed Aug 13, 2020
    Copy the full SHA
    5e52113 View commit details
    Browse the repository at this point in the history
  10. i386: hvf: Add a trace point for vmexit

    Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
    Roman Bolshakov committed Aug 13, 2020
    Copy the full SHA
    dc4f454 View commit details
    Browse the repository at this point in the history
  11. i386: hvf: Add trace points for event injection

    Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
    Roman Bolshakov committed Aug 13, 2020
    Copy the full SHA
    7b50e54 View commit details
    Browse the repository at this point in the history