Project

General

Profile

Feature #12899

Want bhyve svm vmexit sdt probe

Added by Michael Zeller 4 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Normal
Category:
bhyve
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:

Description

We currently only have an sdt probe for vmx:

root@ellie:~# dtrace -ln 'sdt:vmm::'
   ID   PROVIDER            MODULE                          FUNCTION NAME
15414        sdt               vmm                           vmx_run vmm-vexit

We should add the equivalent for svm.

History

#1

Updated by Electric Monk 4 months ago

  • Gerrit CR set to 756
#2

Updated by Michael Zeller 4 months ago

To test the patch I ran a dtrace script to observe an ubuntu bhyve guest during boot.

root@ellie:~# dtrace -ln 'sdt:vmm::'
   ID   PROVIDER            MODULE                          FUNCTION NAME
 3082        sdt               vmm                        svm_vmexit vmm-vexit
 3083        sdt               vmm                           vmx_run vmm-vexit
root@ellie:~# ./exits.d
dtrace: script './exits.d' matched 3 probes
CPU     ID                    FUNCTION:NAME
  2  72982                        :tick-10s
  VMCB_EXIT_IO                                                      8
  VMCB_EXIT_MSR                                                     8
  VMCB_EXIT_CPUID                                                   9
  VMCB_EXIT_INTR                                                  487
  VMCB_EXIT_NPF                                                  1148

  2  72982                        :tick-10s
  VMCB_EXIT_MSR                                                     7
  VMCB_EXIT_CPUID                                                   9
  VMCB_EXIT_IO                                                     78
  VMCB_EXIT_INTR                                                  568
  VMCB_EXIT_NPF                                                  3002

^C

The script for anyone that would find it useful:

#!/usr/sbin/dtrace -Cs

/* VMCB exit code, APM vol2 Appendix C */
#define VMCB_EXIT_MC                    0x52
#define VMCB_EXIT_INTR                  0x60
#define VMCB_EXIT_NMI                   0x61
#define VMCB_EXIT_VINTR                 0x64
#define VMCB_EXIT_PUSHF                 0x70
#define VMCB_EXIT_POPF                  0x71
#define VMCB_EXIT_CPUID                 0x72
#define VMCB_EXIT_IRET                  0x74
#define VMCB_EXIT_PAUSE                 0x77
#define VMCB_EXIT_HLT                   0x78
#define VMCB_EXIT_IO                    0x7B
#define VMCB_EXIT_MSR                   0x7C
#define VMCB_EXIT_SHUTDOWN              0x7F
#define VMCB_EXIT_VMSAVE                0x83
#define VMCB_EXIT_MONITOR               0x8A
#define VMCB_EXIT_MWAIT                 0x8B
#define VMCB_EXIT_NPF                   0x400
#define VMCB_EXIT_INVALID               -1

inline string vmexit[int reason] =
        reason == VMCB_EXIT_MC ?        "VMCB_EXIT_MC" :
        reason == VMCB_EXIT_INTR ?      "VMCB_EXIT_INTR" :
        reason == VMCB_EXIT_NMI ?       "VMCB_EXIT_NMI" :
        reason == VMCB_EXIT_VINTR ?     "VMCB_EXIT_VINTR" :
        reason == VMCB_EXIT_PUSHF ?     "VMCB_EXIT_PUSHF" :
        reason == VMCB_EXIT_POPF ?      "VMCB_EXIT_POPF" :
        reason == VMCB_EXIT_CPUID ?     "VMCB_EXIT_CPUID" :
        reason == VMCB_EXIT_IRET ?      "VMCB_EXIT_IRET" :
        reason == VMCB_EXIT_PAUSE ?     "VMCB_EXIT_PAUSE" :
        reason == VMCB_EXIT_HLT ?       "VMCB_EXIT_HLT" :
        reason == VMCB_EXIT_IO ?        "VMCB_EXIT_IO" :
        reason == VMCB_EXIT_MSR ?       "VMCB_EXIT_MSR" :
        reason == VMCB_EXIT_SHUTDOWN ?  "VMCB_EXIT_SHUTDOWN" :
        reason == VMCB_EXIT_VMSAVE ?    "VMCB_EXIT_VMSAVE" :
        reason == VMCB_EXIT_MONITOR ?   "VMCB_EXIT_MONITOR" :
        reason == VMCB_EXIT_MWAIT ?     "VMCB_EXIT_MWAIT" :
        reason == VMCB_EXIT_NPF ?       "VMCB_EXIT_NPF" :
        reason == VMCB_EXIT_INVALID ?   "VMCB_EXIT_INVALID" :
        "VMCB_EXIT_UNKNOWN"; /* Shouldn't ever hit this */

sdt:vmm:svm_vmexit:vmm-vexit
{
        @[vmexit[arg2]] = count();
}

tick-10s
{
        printa(@);
        trunc(@);
}

#3

Updated by Electric Monk 4 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

git commit 84a6857c97529f897af28666ef8d704e16941470

commit  84a6857c97529f897af28666ef8d704e16941470
Author: Mike Zeller <mike@mikezeller.net>
Date:   2020-07-02T01:48:56.000Z

    12899 Want bhyve svm vmexit sdt probe
    Reviewed by: Patrick Mooney <pmooney@pfmooney.com>
    Approved by: Robert Mustacchi <rm@fingolfin.org>

Also available in: Atom PDF