Skip to content

Commit

Permalink
From patchwork series 402778
Browse files Browse the repository at this point in the history
  • Loading branch information
Fox Snowpatch committed Apr 12, 2024
1 parent 4db4221 commit 777b2a7
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 16 deletions.
2 changes: 1 addition & 1 deletion arch/powerpc/include/asm/hvcall.h
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ struct hvcall_mpp_data {
unsigned long backing_mem;
};

int h_get_mpp(struct hvcall_mpp_data *);
long h_get_mpp(struct hvcall_mpp_data *mpp_data);

struct hvcall_mpp_x_data {
unsigned long coalesced_bytes;
Expand Down
6 changes: 3 additions & 3 deletions arch/powerpc/platforms/pseries/lpar.c
Original file line number Diff line number Diff line change
Expand Up @@ -1886,10 +1886,10 @@ notrace void __trace_hcall_exit(long opcode, long retval, unsigned long *retbuf)
* h_get_mpp
* H_GET_MPP hcall returns info in 7 parms
*/
int h_get_mpp(struct hvcall_mpp_data *mpp_data)
long h_get_mpp(struct hvcall_mpp_data *mpp_data)
{
int rc;
unsigned long retbuf[PLPAR_HCALL9_BUFSIZE];
unsigned long retbuf[PLPAR_HCALL9_BUFSIZE] = {0};
long rc;

rc = plpar_hcall9(H_GET_MPP, retbuf);

Expand Down
45 changes: 33 additions & 12 deletions arch/powerpc/platforms/pseries/lparcfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ struct hvcall_ppp_data {
*/
static unsigned int h_get_ppp(struct hvcall_ppp_data *ppp_data)
{
unsigned long rc;
unsigned long retbuf[PLPAR_HCALL9_BUFSIZE];
unsigned long retbuf[PLPAR_HCALL9_BUFSIZE] = {0};
long rc;

rc = plpar_hcall9(H_GET_PPP, retbuf);

Expand Down Expand Up @@ -170,20 +170,24 @@ static void show_gpci_data(struct seq_file *m)
kfree(buf);
}

static unsigned h_pic(unsigned long *pool_idle_time,
unsigned long *num_procs)
static long h_pic(unsigned long *pool_idle_time,
unsigned long *num_procs)
{
unsigned long rc;
unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
long rc;
unsigned long retbuf[PLPAR_HCALL_BUFSIZE] = {0};

rc = plpar_hcall(H_PIC, retbuf);

*pool_idle_time = retbuf[0];
*num_procs = retbuf[1];
if (pool_idle_time)
*pool_idle_time = retbuf[0];
if (num_procs)
*num_procs = retbuf[1];

return rc;
}

unsigned long boot_pool_idle_time;

Check warning on line 189 in arch/powerpc/platforms/pseries/lparcfg.c

View workflow job for this annotation

GitHub Actions / sparse (ppc64, fedora-38, ppc64)

symbol 'boot_pool_idle_time' was not declared. Should it be static?

Check warning on line 189 in arch/powerpc/platforms/pseries/lparcfg.c

View workflow job for this annotation

GitHub Actions / sparse (ppc64le, ppc64le, fedora-38)

symbol 'boot_pool_idle_time' was not declared. Should it be static?

/*
* parse_ppp_data
* Parse out the data returned from h_get_ppp and h_pic
Expand All @@ -193,7 +197,7 @@ static void parse_ppp_data(struct seq_file *m)
struct hvcall_ppp_data ppp_data;
struct device_node *root;
const __be32 *perf_level;
int rc;
long rc;

rc = h_get_ppp(&ppp_data);
if (rc)
Expand All @@ -215,9 +219,15 @@ static void parse_ppp_data(struct seq_file *m)
seq_printf(m, "pool_capacity=%d\n",
ppp_data.active_procs_in_pool * 100);

h_pic(&pool_idle_time, &pool_procs);
seq_printf(m, "pool_idle_time=%ld\n", pool_idle_time);
seq_printf(m, "pool_num_procs=%ld\n", pool_procs);
/* In case h_pic call is not successful, this would result in
* APP values being wrong in tools like lparstat.
*/

if (h_pic(&pool_idle_time, &pool_procs) == H_SUCCESS) {
seq_printf(m, "pool_idle_time=%ld\n", pool_idle_time);
seq_printf(m, "pool_num_procs=%ld\n", pool_procs);
seq_printf(m, "boot_pool_idle_time=%ld\n", boot_pool_idle_time);
}
}

seq_printf(m, "unallocated_capacity_weight=%d\n",
Expand Down Expand Up @@ -792,6 +802,7 @@ static const struct proc_ops lparcfg_proc_ops = {
static int __init lparcfg_init(void)
{
umode_t mode = 0444;
long retval;

/* Allow writing if we have FW_FEATURE_SPLPAR */
if (firmware_has_feature(FW_FEATURE_SPLPAR))
Expand All @@ -801,6 +812,16 @@ static int __init lparcfg_init(void)
printk(KERN_ERR "Failed to create powerpc/lparcfg\n");
return -EIO;
}

/* If this call fails, it would result in APP values
* being wrong for since boot reports of lparstat
*/
retval = h_pic(&boot_pool_idle_time, NULL);

if (retval != H_SUCCESS)
pr_debug("H_PIC failed during lparcfg init retval: %ld\n",
retval);

return 0;
}
machine_device_initcall(pseries, lparcfg_init);

0 comments on commit 777b2a7

Please sign in to comment.