Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pcp-xsos should also include Hyper-V balloon usage information #13

Open
PinakR90 opened this issue Jul 2, 2024 · 1 comment
Open

pcp-xsos should also include Hyper-V balloon usage information #13

PinakR90 opened this issue Jul 2, 2024 · 1 comment

Comments

@PinakR90
Copy link

PinakR90 commented Jul 2, 2024

Hyper-V Balloon Usage Information:

cat /sys/kernel/debug/hv-balloon

host_version : 2.0
capabilities : enabled hot_add
state : 1 (Initialized)
page_size : 4096 /* HV Page Size /
pages_added : 0 /
Pages added with hot_add to the Guest /
pages_onlined : 0 /
Pages that are "onlined"/used from pages_added /
pages_ballooned : 3276800 /
Pages we have given back to host */
total_pages_committed : 4026223
max_dynamic_page_count: 4706304

Here's the corresponding kernel source code: drivers/hv/hv_balloon.c

/**

  • hv_balloon_debug_show - shows statistics of balloon operations.

  • @f: pointer to the &struct seq_file.

  • @offset: ignored.

  • Provides the statistics that can be accessed in hv-balloon in the debugfs.

  • Return: zero on success or an error code.
    */
    static int hv_balloon_debug_show(struct seq_file *f, void *offset)
    {
    struct hv_dynmem_device *dm = f->private;
    char *sname;

     seq_printf(f, "%-22s: %u.%u\n", "host_version",
                             DYNMEM_MAJOR_VERSION(dm->version),
                             DYNMEM_MINOR_VERSION(dm->version));
    
     seq_printf(f, "%-22s:", "capabilities");
     if (ballooning_enabled())
             seq_puts(f, " enabled");
    
     if (hot_add_enabled())
             seq_puts(f, " hot_add");
    
     seq_puts(f, "\n");
    
     seq_printf(f, "%-22s: %u", "state", dm->state);
     switch (dm->state) {
     case DM_INITIALIZING:
                     sname = "Initializing";
                     break;
     case DM_INITIALIZED:
                     sname = "Initialized";
                     break;
     case DM_BALLOON_UP:
                     sname = "Balloon Up";
                     break;
     case DM_BALLOON_DOWN:
                     sname = "Balloon Down";
                     break;
     case DM_HOT_ADD:
                     sname = "Hot Add";
                     break;
     case DM_INIT_ERROR:
                     sname = "Error";
                     break;
     default:
                     sname = "Unknown";
     }
     seq_printf(f, " (%s)\n", sname);
    
     /* HV Page Size */
     seq_printf(f, "%-22s: %ld\n", "page_size", HV_HYP_PAGE_SIZE);
    
     /* Pages added with hot_add */
     seq_printf(f, "%-22s: %u\n", "pages_added", dm->num_pages_added);
    
     /* pages that are "onlined"/used from pages_added */
     seq_printf(f, "%-22s: %u\n", "pages_onlined", dm->num_pages_onlined);
    
     /* pages we have given back to host */
     seq_printf(f, "%-22s: %u\n", "pages_ballooned", dm->num_pages_ballooned);   <<< - - - 
    
     seq_printf(f, "%-22s: %lu\n", "total_pages_committed",
                             get_pages_committed(dm));
    
     seq_printf(f, "%-22s: %llu\n", "max_dynamic_page_count",
                             dm->max_dynamic_page_count);
    
     return 0;
    

}

struct hv_dynmem_device {
struct hv_device *dev;
enum hv_dm_state state;
struct completion host_event;
struct completion config_event;

    /*
     * Number of pages we have currently ballooned out.
     */
    unsigned int num_pages_ballooned;          <<< - - - 

Refer Jira: https://issues.redhat.com/browse/RHEL-45715

@natoscott
Copy link
Member

I've added the following metrics to PCP:

$ pminfo hyperv.balloon
hyperv.balloon.state
hyperv.balloon.pagesize
hyperv.balloon.added
hyperv.balloon.onlined
hyperv.balloon.ballooned
hyperv.balloon.total_committed

Does anyone else have spare cycles to add the pcp-xsos reporting of these?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants