Project

General

Profile

Actions

Feature #14525

closed

Would like kmdb module for vmm

Added by Andy Fiddaman almost 2 years ago. Updated 24 days ago.

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

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
External Bug:

Description

It would be nice if kmdb knew how to list virtual machines nicely, and provided an easy way to quickly find the data structure addresses for the virtual machine you're interested in.

Seasoned bhyve developers tend to just walk the global vmm_list, I at least keep typing `::vmm` and expecting it to produce something useful.


Related issues

Has duplicate illumos gate - Feature #15652: want dcmd to list running bhvye guestsDuplicate

Actions
Actions #1

Updated by Electric Monk over 1 year ago

  • Gerrit CR set to 2285
Actions #2

Updated by Andy Fiddaman 7 months ago

  • Has duplicate Feature #15652: want dcmd to list running bhvye guests added
Actions #3

Updated by Andy Fiddaman 7 months ago

  • Assignee changed from Andy Fiddaman to Carlos Neira
Actions #4

Updated by Bill Sommerfeld about 2 months ago

  • Gerrit CR changed from 2285 to 3095

Updating Gerrit CR to the one which is actually under review.

Actions #5

Updated by Carlos Neira about 1 month ago

As part of the work required to add this new mdb dcmd, a new mdb walker was added to mdb API.
The reason behind this change is that the current local mdb walker has a fixed set of flags and this new dcmd
needed a way to signal if the current invocation needed to be PIPED_OUT.

To accomplish that, a new local walker was created mdb_fpwalk_dcmd that has the same functionality as mdb_pwalk_dcmd.
The difference is that this new walker has a flags argument, so a consumer could specify other required flags by their dcmds.

int mdb_fpwalk_dcmd(const char *wname, const char *dcname, it argc, const mdb_arg_t *argv, uintptr_t addr, uint_t flags );

Testing notes:

- Help

> ::help vmm

NAME
  vmm - print virtual machine information

SYNOPSIS
  [ addr ] ::vmm [-n vmname]

DESCRIPTION
  Prints summary information about vmm instances.

  The resulting output is a table of bhyve virtual machines on the system.
  The columns in the output are:

  SOFTC         Soft state, pointer to vmm_softc_t
  VM            state, pointer to 'struct vm'
  TOPO          topology as sockets/cores/threads
  MiB           allocated memory
  F             Flags   G - VMM is created in the global zone.
                        T - VMM is using transient memory.
                        R - VMM is using memory from reservoir.
                        D - VMM is set to auto-destruct.
  NAME          The virtual machine name.
  ZONE          The zone_t pointer to zone where the vm is running.

OPTIONS
  -n <name>     Only show the virtual machine called <name>

NOTES
  The MiB column sums up all memory segments and includes any
  memory allocated for the bootrom or framebuffer.

  Passing the output of this command into a pipeline results in
  the address of the vmm_softc_t in '.'

ATTRIBUTES

  Target: kvm
  Module: vmm
  Interface Stability: Unstable

>

 

- Single invocation :

> ::vmm
           SOFTC               VM             ZONE  TOPO MiB    F   NAME    
fffffe0ac1542040 fffffe0ada88d000 fffffe0adadb8a80 4/1/1 1041    T  test2  

- PIPE_OUT :

> ::vmm  | ::print vmm_softc_t vmm_name
vmm_name = [ "test2" ]

- Walker

> ::walk vmm | ::print vmm_softc_t vmm_kstat_vm
vmm_kstat_vm = 0xfffffe0ac9f47660

- Running vms in the global zone

 > ::vmm
           SOFTC               VM             ZONE  TOPO MiB    F   NAME
fffffe0aca3d5880 fffffe0abb53a000 fffffffffbd16980 4/1/1 1024   GT  vm
fffffe0aca7ed300 fffffe0abe92c000 fffffffffbd16980 4/1/1 1024   GT  vm1
fffffe0ab5d44880 fffffe0ab6597000 fffffffffbd16980 4/1/1 1025   GT  test2
fffffe0ac995cd40 fffffe0abaef3000 fffffffffbd16980 4/1/1 1040   GT  vm2
> fffffffffbd16980::print zone_t zone_name
zone_name = 0xfffffffffbb53c9b "global" 

Actions #6

Updated by Electric Monk 24 days ago

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

git commit 65bed588e62c7f3a0da5d65fcc588b46b470f5a7

commit  65bed588e62c7f3a0da5d65fcc588b46b470f5a7
Author: Andy Fiddaman <illumos@fiddaman.net>
Date:   2023-11-14T23:48:54.000Z

    14525 Would like kmdb module for vmm
    Portions contributed by: Carlos Neira <cneirabustos@gmail.com>
    Reviewed by: Jordan Hendricks <jordan@oxide.computer>
    Reviewed by: Dan McDonald <danmcd@mnx.io>
    Approved by: Robert Mustacchi <rm@fingolfin.org>

Actions

Also available in: Atom PDF