From: Reinette Chatre <reinette.chatre@intel.com>
To: "Luck, Tony" <tony.luck@intel.com>,
Peter Newman <peternewman@google.com>
Cc: "Yu, Fenghua" <fenghua.yu@intel.com>,
"babu.moger@amd.com" <babu.moger@amd.com>,
"bp@alien8.de" <bp@alien8.de>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"Eranian, Stephane" <eranian@google.com>,
"hpa@zytor.com" <hpa@zytor.com>,
"james.morse@arm.com" <james.morse@arm.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"mingo@redhat.com" <mingo@redhat.com>,
"nert.pinx@gmail.com" <nert.pinx@gmail.com>,
"tan.shaopeng@fujitsu.com" <tan.shaopeng@fujitsu.com>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"x86@kernel.org" <x86@kernel.org>
Subject: Re: [PATCH v2 2/2] x86/resctrl: Don't workqueue local event counter reads
Date: Thu, 7 Nov 2024 14:46:33 -0800 [thread overview]
Message-ID: <a593dd7b-f502-449f-a866-5e6494de506f@intel.com> (raw)
In-Reply-To: <SJ1PR11MB6083BA9392D4B176FA2DA170FC5C2@SJ1PR11MB6083.namprd11.prod.outlook.com>
Hi Tony,
On 11/7/24 2:14 PM, Luck, Tony wrote:
>> I think maybe the issue you are trying to address is a user assigning a counter
>> and then reading the cached data and getting cached data from a previous
>> configuration? Please note that in the current implementation the cached
>> data is reset directly on counter assignment [1]. If a user assigns a new
>> counter and then immediately read cached data then the cached data will
>> reflect the assignment even if the overflow worker thread did not get a chance
>> to run since the assignment.
>
> The issue is that AMD's ABMC implementation resets counts when reassigning
> h/w counters to events in resctrl groups. If the processes reading counters is
> not fully aware of h/w counter reassignment, insanity will occur.
>
> E.g. read a counter:
>
> $ cat mbm_local_bytes
> 123456789
>
> H/w counter for this event/group assigned elsewhere.
>
> H/w counter assigned back to this event/group
>
> $ cat mbm_local_bytes
> 23456
>
> Bandwidth calculation sees traffic amount:
> (23456 - 123456789) = -123433333
> Oops. Negative!
As I understand this is already an issue today on AMD systems without assignable counters
that may run out of counters. On these systems, any RMID that is no longer being tracked will
be reset to zero. [1]
The support for assignable counters give user space control over this unexpected reset of
counters.
The scenario you present seem to demonstrate how two independent user space systems
can trample on each other when interacting with the same resources. Is this something you expect
resctrl should protect against? I would expect that there would be a single user space system
doing something like above and it would reset history after unassigning a counter.
This does indeed highlight that if resctrl does start to dynamically assign counters (which
has only been speculated in this thread and is not part of current [1] design) then it may cause
problems on user space side.
Reinette
[1] https://lore.kernel.org/all/cover.1730244116.git.babu.moger@amd.com/
next prev parent reply other threads:[~2024-11-07 22:46 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-06 15:43 [PATCH v2 1/2] selftests/resctrl: fastcat for benchmarking counter reads Peter Newman
2024-11-06 15:43 ` [PATCH v2 2/2] x86/resctrl: Don't workqueue local event " Peter Newman
2024-11-07 1:10 ` Reinette Chatre
2024-11-07 11:01 ` Peter Newman
2024-11-07 14:26 ` Peter Newman
2024-11-07 16:57 ` Tony Luck
2024-11-07 19:15 ` Reinette Chatre
2024-11-07 20:58 ` Luck, Tony
2024-11-07 22:03 ` Reinette Chatre
2024-11-07 22:14 ` Luck, Tony
2024-11-07 22:46 ` Reinette Chatre [this message]
2024-11-07 23:30 ` Luck, Tony
2024-11-08 0:21 ` Reinette Chatre
2024-11-07 19:14 ` Reinette Chatre
2024-11-13 13:28 ` Peter Newman
2024-11-14 5:40 ` Reinette Chatre
2024-11-14 10:18 ` Peter Newman
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=a593dd7b-f502-449f-a866-5e6494de506f@intel.com \
--to=reinette.chatre@intel.com \
--cc=babu.moger@amd.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=eranian@google.com \
--cc=fenghua.yu@intel.com \
--cc=hpa@zytor.com \
--cc=james.morse@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=nert.pinx@gmail.com \
--cc=peternewman@google.com \
--cc=tan.shaopeng@fujitsu.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--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