From: Michael Ellerman <mpe@ellerman•id.au>
To: Tyrel Datwyler <tyreld@linux•ibm.com>,
Scott Cheloha <cheloha@linux•ibm.com>,
linuxppc-dev@ozlabs•org
Cc: Nathan Lynch <nathanl@linux•ibm.com>
Subject: Re: [PATCH v2 2/2] powerpc/pseries: new lparcfg key/value pair: partition_affinity_score
Date: Thu, 06 Aug 2020 22:44:54 +1000 [thread overview]
Message-ID: <871rkkymd5.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <bc9858c9-7d55-88c0-1f85-157af48e1d8c@linux.ibm.com>
Tyrel Datwyler <tyreld@linux•ibm.com> writes:
> On 7/27/20 11:46 AM, Scott Cheloha wrote:
>> The H_GetPerformanceCounterInfo (GPCI) PHYP hypercall has a subcall,
>> Affinity_Domain_Info_By_Partition, which returns, among other things,
>> a "partition affinity score" for a given LPAR. This score, a value on
>> [0-100], represents the processor-memory affinity for the LPAR in
>> question. A score of 0 indicates the worst possible affinity while a
>> score of 100 indicates perfect affinity. The score can be used to
>> reason about performance.
>>
>> This patch adds the score for the local LPAR to the lparcfg procfile
>> under a new 'partition_affinity_score' key.
>>
>> Signed-off-by: Scott Cheloha <cheloha@linux•ibm.com>
>
> I was hoping Michael would chime in the first time around on this patch series
> about adding another key/value pair to lparcfg.
That guy is so unreliable.
I don't love adding new stuff in lparcfg, but given the file already
exists and there's no prospect of removing it, it's probably not worth
the effort to put the new field anywhere else.
My other query with this was how on earth anyone is meant to interpret
the metric. ie. if my metric is 50, what does that mean? If it's 90
should I worry?
Which makes me realise we have no documentation for lparcfg in the
kernel at all.
So it would be nice to have it mentioned somewhere in Documentation,
even if it just points to the manpage in powerpc-ibm-utils.
cheers
> So, barring a NACK from mpe:
>
> Reviewed-by: Tyrel Datwyler <tyreld@linux•ibm.com>
>
>> ---
>> arch/powerpc/platforms/pseries/lparcfg.c | 35 ++++++++++++++++++++++++
>> 1 file changed, 35 insertions(+)
>>
>> diff --git a/arch/powerpc/platforms/pseries/lparcfg.c b/arch/powerpc/platforms/pseries/lparcfg.c
>> index b8d28ab88178..e278390ab28d 100644
>> --- a/arch/powerpc/platforms/pseries/lparcfg.c
>> +++ b/arch/powerpc/platforms/pseries/lparcfg.c
>> @@ -136,6 +136,39 @@ static unsigned int h_get_ppp(struct hvcall_ppp_data *ppp_data)
>> return rc;
>> }
>>
>> +static void show_gpci_data(struct seq_file *m)
>> +{
>> + struct hv_gpci_request_buffer *buf;
>> + unsigned int affinity_score;
>> + long ret;
>> +
>> + buf = kmalloc(sizeof(*buf), GFP_KERNEL);
>> + if (buf == NULL)
>> + return;
>> +
>> + /*
>> + * Show the local LPAR's affinity score.
>> + *
>> + * 0xB1 selects the Affinity_Domain_Info_By_Partition subcall.
>> + * The score is at byte 0xB in the output buffer.
>> + */
>> + memset(&buf->params, 0, sizeof(buf->params));
>> + buf->params.counter_request = cpu_to_be32(0xB1);
>> + buf->params.starting_index = cpu_to_be32(-1); /* local LPAR */
>> + buf->params.counter_info_version_in = 0x5; /* v5+ for score */
>> + ret = plpar_hcall_norets(H_GET_PERF_COUNTER_INFO, virt_to_phys(buf),
>> + sizeof(*buf));
>> + if (ret != H_SUCCESS) {
>> + pr_debug("hcall failed: H_GET_PERF_COUNTER_INFO: %ld, %x\n",
>> + ret, be32_to_cpu(buf->params.detail_rc));
>> + goto out;
>> + }
>> + affinity_score = buf->bytes[0xB];
>> + seq_printf(m, "partition_affinity_score=%u\n", affinity_score);
>> +out:
>> + kfree(buf);
>> +}
>> +
>> static unsigned h_pic(unsigned long *pool_idle_time,
>> unsigned long *num_procs)
>> {
>> @@ -487,6 +520,8 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v)
>> partition_active_processors * 100);
>> }
>>
>> + show_gpci_data(m);
>> +
>> seq_printf(m, "partition_active_processors=%d\n",
>> partition_active_processors);
>>
>>
next prev parent reply other threads:[~2020-08-06 12:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-27 18:46 [PATCH v2 1/2] powerpc/perf: consolidate GPCI hcall structs into asm/hvcall.h Scott Cheloha
2020-07-27 18:46 ` [PATCH v2 2/2] powerpc/pseries: new lparcfg key/value pair: partition_affinity_score Scott Cheloha
2020-08-05 22:42 ` Tyrel Datwyler
2020-08-06 12:44 ` Michael Ellerman [this message]
2020-08-06 15:17 ` Nathan Lynch
2020-08-06 15:18 ` Nathan Lynch
2020-08-05 22:37 ` [PATCH v2 1/2] powerpc/perf: consolidate GPCI hcall structs into asm/hvcall.h Tyrel Datwyler
2020-08-06 15:19 ` Nathan Lynch
2020-09-09 13:27 ` Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871rkkymd5.fsf@mpe.ellerman.id.au \
--to=mpe@ellerman$(echo .)id.au \
--cc=cheloha@linux$(echo .)ibm.com \
--cc=linuxppc-dev@ozlabs$(echo .)org \
--cc=nathanl@linux$(echo .)ibm.com \
--cc=tyreld@linux$(echo .)ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox