From: Babu Moger <babu.moger@amd.com>
To: Reinette Chatre <reinette.chatre@intel.com>,
James Morse <james.morse@arm.com>,
x86@kernel.org, linux-kernel@vger.kernel.org
Cc: Fenghua Yu <fenghua.yu@intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
H Peter Anvin <hpa@zytor.com>,
shameerali.kolothum.thodi@huawei.com,
Jamie Iles <jamie@nuviainc.com>,
D Scott Phillips OS <scott@os.amperecomputing.com>,
lcherian@marvell.com, bobo.shaobowang@huawei.com,
tan.shaopeng@fujitsu.com
Subject: Re: [PATCH v2 17/23] x86/resctrl: Abstract __rmid_read()
Date: Wed, 20 Oct 2021 14:22:01 -0500 [thread overview]
Message-ID: <81826a4f-c3de-787f-8059-4808815b4800@amd.com> (raw)
In-Reply-To: <dfe2f33c-6103-9699-42f9-73983fa62057@intel.com>
Hi Reinette,
On 10/20/21 1:15 PM, Reinette Chatre wrote:
> Hi Babu,
>
> On 10/19/2021 4:20 PM, Babu Moger wrote:
>> Hi James,
>>
>> On 10/1/21 11:02 AM, James Morse wrote:
>>> __rmid_read() selects the specified eventid and returns the counter
>>> value from the msr. The error handling is architecture specific, and
>>> handled by the callers, rdtgroup_mondata_show() and __mon_event_count().
>>>
>>> Error handling should be handled by architecture specific code, as
>>> a different architecture may have different requirements. MPAM's
>>> counters can report that they are 'not ready', requiring a second
>>> read after a short delay. This should be hidden from resctrl.
>>>
>>> Make __rmid_read() the architecture specific function for reading
>>> a counter. Rename it resctrl_arch_rmid_read() and move the error
>>> handling into it.
>>>
>>> Signed-off-by: James Morse <james.morse@arm.com>
>>> ---
>>> Changes since v1:
>>> * Return EINVAL from the impossible case in __mon_event_count() instead
>>> of an x86 hardware specific value.
>>> ---
>>> arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 4 +--
>>> arch/x86/kernel/cpu/resctrl/internal.h | 2 +-
>>> arch/x86/kernel/cpu/resctrl/monitor.c | 42 +++++++++++++++--------
>>> include/linux/resctrl.h | 1 +
>>> 4 files changed, 31 insertions(+), 18 deletions(-)
>>>
>>> diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
>>> b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
>>> index 25baacd331e0..c8ca7184c6d9 100644
>>> --- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
>>> +++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
>>> @@ -579,9 +579,9 @@ int rdtgroup_mondata_show(struct seq_file *m, void
>>> *arg)
>>> mon_event_read(&rr, r, d, rdtgrp, evtid, false);
>>> - if (rr.val & RMID_VAL_ERROR)
>>> + if (rr.err == -EIO)
>>> seq_puts(m, "Error\n");
>>> - else if (rr.val & RMID_VAL_UNAVAIL)
>>> + else if (rr.err == -EINVAL)
>>> seq_puts(m, "Unavailable\n");
>>> else
>>> seq_printf(m, "%llu\n", rr.val * hw_res->mon_scale);
>>
>> This patch breaks the earlier fix
>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Ftorvalds%2Flinux.git%2Fcommit%2F%3Fh%3Dv5.15-rc6%26id%3D064855a69003c24bd6b473b367d364e418c57625&data=04%7C01%7Cbabu.moger%40amd.com%7C85219a5827114935cdaa08d993f59fa0%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637703505420472920%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=yP8awDgGGZ%2BWj5ZItdTNJItTVuK828yGnibwq%2BrVaf0%3D&reserved=0
>>
>>
>> When the user reads the events on the default monitoring group with
>> multiple subgroups, the events on all subgroups are consolidated
>> together. In case if the last rmid read was resulted in error then whole
>> group will be reported as error. The err field needs to be cleared.
>>
>> Please add this patch to clear the error.
>>
>> diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c
>> b/arch/x86/kernel/cpu/resctrl/monitor.c
>> index 14bc843043da..0e4addf237ec 100644
>> --- a/arch/x86/kernel/cpu/resctrl/monitor.c
>> +++ b/arch/x86/kernel/cpu/resctrl/monitor.c
>> @@ -444,6 +444,8 @@ void mon_event_count(void *info)
>> /* Report error if none of rmid_reads are successful */
>> if (ret_val)
>> rr->val = ret_val;
>> + else
>> + rr->err = 0;
>> }
>>
>> /*
>>
>
> Good catch, thank you.
>
> Even so, I do not think mon_event_count()'s usage of __mon_event_count()
> was taken into account by this patch and needs a bigger rework than the
> above fixup. For example, if I understand correctly ret_val is the error
> and rr->val no longer expected to contain the error after this patch. So
> keeping that assignment to rr->val is not correct.
Yes. You are right. rr->val is not expected to contain the error.
Hopefully, this should help.
diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c
b/arch/x86/kernel/cpu/resctrl/monitor.c
index 14bc843043da..105d972cc511 100644
--- a/arch/x86/kernel/cpu/resctrl/monitor.c
+++ b/arch/x86/kernel/cpu/resctrl/monitor.c
@@ -441,9 +441,9 @@ void mon_event_count(void *info)
}
}
- /* Report error if none of rmid_reads are successful */
- if (ret_val)
- rr->val = ret_val;
+ /* Clear the error if at least one of the rmid reads succeed */
+ if (ret_val == 0)
+ rr->err = 0;
}
/*
next prev parent reply other threads:[~2021-10-20 19:22 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-01 16:02 [PATCH v2 00/23] x86/resctrl: Make resctrl_arch_rmid_read() return values in bytes James Morse
2021-10-01 16:02 ` [PATCH v2 01/23] x86/resctrl: Free the ctrlval arrays when domain_setup_mon_state() fails James Morse
2021-10-01 16:02 ` [PATCH v2 02/23] x86/resctrl: Fix kfree() of the wrong type in domain_add_cpu() James Morse
2021-10-01 16:02 ` [PATCH v2 03/23] x86/resctrl: Kill off alloc_enabled James Morse
2021-10-15 22:19 ` Reinette Chatre
2021-10-01 16:02 ` [PATCH v2 04/23] x86/resctrl: Merge mon_capable and mon_enabled James Morse
2021-10-19 23:18 ` Babu Moger
2021-10-22 18:30 ` James Morse
2021-10-01 16:02 ` [PATCH v2 05/23] x86/resctrl: Add domain online callback for resctrl work James Morse
2021-10-15 22:19 ` Reinette Chatre
2021-10-22 18:30 ` James Morse
2021-10-19 23:19 ` Babu Moger
2021-10-22 18:30 ` James Morse
2021-10-01 16:02 ` [PATCH v2 06/23] x86/resctrl: Group struct rdt_hw_domain cleanup James Morse
2021-10-01 16:02 ` [PATCH v2 07/23] x86/resctrl: Add domain offline callback for resctrl work James Morse
2021-10-19 23:19 ` Babu Moger
2021-10-22 18:30 ` James Morse
2021-10-01 16:02 ` [PATCH v2 08/23] x86/resctrl: Create mba_sc configuration in the rdt_domain James Morse
2021-10-15 22:26 ` Reinette Chatre
2021-10-22 18:30 ` James Morse
2021-10-01 16:02 ` [PATCH v2 09/23] x86/resctrl: Switch over to the resctrl mbps_val list James Morse
2021-10-15 22:26 ` Reinette Chatre
2021-10-27 16:49 ` James Morse
2021-10-01 16:02 ` [PATCH v2 10/23] x86/resctrl: Remove architecture copy of mbps_val James Morse
2021-10-15 22:27 ` Reinette Chatre
2021-10-27 16:49 ` James Morse
2021-10-01 16:02 ` [PATCH v2 11/23] x86/resctrl: Remove set_mba_sc()s control array re-initialisation James Morse
2021-10-01 16:02 ` [PATCH v2 12/23] x86/resctrl: Abstract and use supports_mba_mbps() James Morse
2021-10-07 6:13 ` tan.shaopeng
2021-10-27 16:50 ` James Morse
2021-10-15 22:28 ` Reinette Chatre
2021-10-01 16:02 ` [PATCH v2 13/23] x86/resctrl: Allow update_mba_bw() to update controls directly James Morse
2021-10-15 22:28 ` Reinette Chatre
2021-10-27 16:49 ` James Morse
2021-10-01 16:02 ` [PATCH v2 14/23] x86/resctrl: Calculate bandwidth from the previous __mon_event_count() chunks James Morse
2021-10-15 22:28 ` Reinette Chatre
2021-10-27 16:50 ` James Morse
2021-10-27 20:41 ` Reinette Chatre
2021-10-29 15:50 ` James Morse
2021-10-29 22:22 ` Reinette Chatre
2021-10-01 16:02 ` [PATCH v2 15/23] x86/recstrl: Add per-rmid arch private storage for overflow and chunks James Morse
2021-10-15 22:29 ` Reinette Chatre
2021-10-01 16:02 ` [PATCH v2 16/23] x86/recstrl: Allow per-rmid arch private storage to be reset James Morse
2021-10-07 6:16 ` tan.shaopeng
2021-10-01 16:02 ` [PATCH v2 17/23] x86/resctrl: Abstract __rmid_read() James Morse
2021-10-15 22:29 ` Reinette Chatre
2021-10-19 23:20 ` Babu Moger
2021-10-20 18:15 ` Reinette Chatre
2021-10-20 19:22 ` Babu Moger [this message]
2021-10-20 20:28 ` Reinette Chatre
2021-10-27 16:50 ` James Morse
2021-10-27 18:59 ` Babu Moger
2021-10-01 16:02 ` [PATCH v2 18/23] x86/resctrl: Pass the required parameters into resctrl_arch_rmid_read() James Morse
2021-10-15 22:30 ` Reinette Chatre
2021-10-01 16:02 ` [PATCH v2 19/23] x86/resctrl: Move mbm_overflow_count() " James Morse
2021-10-01 16:02 ` [PATCH v2 20/23] x86/resctrl: Move get_corrected_mbm_count() " James Morse
2021-10-01 16:03 ` [PATCH v2 21/23] x86/resctrl: Rename and change the units of resctrl_cqm_threshold James Morse
2021-10-01 16:03 ` [PATCH v2 22/23] x86/resctrl: Add resctrl_rmid_realloc_limit to abstract x86's boot_cpu_data James Morse
2021-10-01 16:03 ` [PATCH v2 23/23] x86/resctrl: Make resctrl_arch_rmid_read() return values in bytes James Morse
2021-10-13 2:09 ` [PATCH v2 00/23] " tan.shaopeng
2021-10-19 23:17 ` Babu Moger
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=81826a4f-c3de-787f-8059-4808815b4800@amd.com \
--to=babu.moger@amd.com \
--cc=bobo.shaobowang@huawei.com \
--cc=bp@alien8.de \
--cc=fenghua.yu@intel.com \
--cc=hpa@zytor.com \
--cc=james.morse@arm.com \
--cc=jamie@nuviainc.com \
--cc=lcherian@marvell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=reinette.chatre@intel.com \
--cc=scott@os.amperecomputing.com \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=tan.shaopeng@fujitsu.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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
all inboxes | Powered by JetHome®