linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Luck, Tony" <tony.luck@intel.com>
To: "Moger, Babu" <babu.moger@amd.com>
Cc: Fenghua Yu <fenghuay@nvidia.com>,
	Reinette Chatre <reinette.chatre@intel.com>,
	Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>,
	Peter Newman <peternewman@google.com>,
	James Morse <james.morse@arm.com>,
	Drew Fustini <dfustini@baylibre.com>,
	Dave Martin <Dave.Martin@arm.com>,
	linux-kernel@vger.kernel.org, patches@lists.linux.dev
Subject: Re: [PATCH] x86/resctrl: Refactor to make adding extra MBM events easy
Date: Mon, 17 Mar 2025 09:37:12 -0700	[thread overview]
Message-ID: <Z9hPuMV5n_FY02MM@agluck-desk3> (raw)
In-Reply-To: <d4263bf7-9bd1-447f-976c-69fd96d3f204@amd.com>

Hi Babu,

Thanks for taking a look.

On Mon, Mar 17, 2025 at 09:54:59AM -0500, Moger, Babu wrote:
> >  static void mbm_update(struct rdt_resource *r, struct rdt_mon_domain *d,
> >  		       u32 closid, u32 rmid)
> >  {
> > +	int evt;
> > +
> >  	/*
> >  	 * This is protected from concurrent reads from user as both
> >  	 * the user and overflow handler hold the global mutex.
> >  	 */
> > -	if (resctrl_arch_is_mbm_total_enabled())
> > -		mbm_update_one_event(r, d, closid, rmid, QOS_L3_MBM_TOTAL_EVENT_ID);
> > -
> > -	if (resctrl_arch_is_mbm_local_enabled())
> > -		mbm_update_one_event(r, d, closid, rmid, QOS_L3_MBM_LOCAL_EVENT_ID);
> > +	for_each_set_bit(evt, &rdt_mon_features, sizeof(rdt_mon_features))
> > +		mbm_update_one_event(r, d, closid, rmid, evt);
> 
> You need a check resctrl_arch_is_mbm_event() here.

Right. This is definitely broken. Needs that check.

> Will that be reason for your hang issue?

Might have. But it isn't my only problem. After fixing this my
kernel dies on a deref NULL.

> > @@ -1075,20 +1062,37 @@ static void dom_data_exit(struct rdt_resource *r)
> >  	mutex_unlock(&rdtgroup_mutex);
> >  }
> >  
> > -static struct mon_evt llc_occupancy_event = {
> > -	.name		= "llc_occupancy",
> > -	.evtid		= QOS_L3_OCCUP_EVENT_ID,
> > +static struct mon_evt all_events[] = {
> 
> There is one empty event here. You may need to make that clear.

Yes. I went with "some wasted space" for code simplicity just
using the bit numbers in rdt_mon_features to index this array.

Also applies to the mbm_states[] field in rdt_mon_domain and
the arch_mbm_states[] array in rdt_hw_mon_domain. The wasted
space could be reclaimed with some macros to convert from
bit numbers to array indices should this patch ever be
considered for inclusion.

-Tony

  reply	other threads:[~2025-03-17 16:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-14 20:26 [PATCH] x86/resctrl: Refactor to make adding extra MBM events easy Tony Luck
2025-03-14 20:45 ` Luck, Tony
2025-03-17 14:54 ` Moger, Babu
2025-03-17 16:37   ` Luck, Tony [this message]
2025-03-17 18:23 ` Luck, Tony

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=Z9hPuMV5n_FY02MM@agluck-desk3 \
    --to=tony.luck@intel.com \
    --cc=Dave.Martin@arm.com \
    --cc=babu.moger@amd.com \
    --cc=dfustini@baylibre.com \
    --cc=fenghuay@nvidia.com \
    --cc=james.morse@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maciej.wieczor-retman@intel.com \
    --cc=patches@lists.linux.dev \
    --cc=peternewman@google.com \
    --cc=reinette.chatre@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).