mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Morse <james.morse@arm.com>
To: Andre Przywara <andre.przywara@arm.com>,
	Lorenzo Pieralisi <lpieralisi@kernel.org>,
	Hanjun Guo <guohanjun@huawei.com>,
	Sudeep Holla <sudeep.holla@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>, Ben Horgan <ben.horgan@arm.com>,
	Reinette Chatre <reinette.chatre@intel.com>,
	Fenghua Yu <fenghuay@nvidia.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Srivathsa L Rao <srivathsa.rao@oss.qualcomm.com>,
	Ganapatrao Kulkarni <ganapatrao.kulkarni@oss.qualcomm.com>,
	Trilok Soni <tsoni@quicinc.com>,
	Srinivas Ramana <sramana@qti.qualcomm.com>,
	Niyas Sait <niyas.sait@arm.com>, Lee Trager <lee@trager.us>,
	Ritwick Sharma <ritwick.sharma@arm.com>,
	Gavin Shan <gshan@redhat.com>,
	linux-acpi@vger.kernel.org--cc,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v12 03/13] arm_mpam: propagate MSC access errors for MBWU counters
Date: Fri, 2 Oct 2026 18:39:28 +0100	[thread overview]
Message-ID: <0bedf04c-24ef-40de-909f-b41dd72b8e78@arm.com> (raw)
In-Reply-To: <20261001153439.3295416-4-andre.przywara@arm.com>

Hi Andre,

I've picked up this series to send on to Catalin and Will ...

On 01/10/2026 16:34, Andre Przywara wrote:
> Allow the mpam_msc_read_mbwu_l() function to return an error, and
> propagate errors from the lower level up. This also changes the users
> of this function.

> diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
> index 3aefeab371788..583560798dd8b 100644
> --- a/drivers/resctrl/mpam_devices.c
> +++ b/drivers/resctrl/mpam_devices.c
> @@ -1327,10 +1338,12 @@ static void __ris_msmon_read(void *arg)
>  	struct mpam_msc *msc = m->ris->vmsc->msc;
>  	u32 mon_sel, ctl_val, flt_val, cur_ctl, cur_flt;
>  
> -	if (!mpam_mon_sel_lock(msc)) {
> +	ACQUIRE(mon_sel_lock, guard)(msc);
> +	if (ACQUIRE_ERR(mon_sel_lock, &guard)) {
>  		m->err = -EIO;
>  		return;
>  	}
> +
>  	mon_sel = FIELD_PREP(MSMON_CFG_MON_SEL_MON_SEL, ctx->mon) |
>  		  FIELD_PREP(MSMON_CFG_MON_SEL_RIS, ris->ris_idx);
>  	mpam_write_monsel_reg(msc, CFG_MON_SEL, mon_sel);


This conflicts with Ben's fixes [0] that turn this into __ris_msmon_read_locked().
I don't think the ACQUIRE buys us anything after that, as none of the callers need
to return early, and __ris_msmon_read_locked() can always just return.

The same thing happens in mpam_save_mbwu_state() where Ben's change means you no
longer need an early return after mpam_msc_read_mbwu_l().

Please double check I've not botched your patch when fixing up the conflict!
https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git/tag/?h=mpam/for-next/v7.4_v2

Thanks,

James


[0] https://lore.kernel.org/linux-arm-kernel/20260917145617.2202986-1-ben.horgan@arm.com/


> @@ -1423,7 +1438,6 @@ static void __ris_msmon_read(void *arg)
>  	default:
>  		m->err = -EINVAL;
>  	}
> -	mpam_mon_sel_unlock(msc);
>  
>  	if (nrdy)
>  		m->err = -EBUSY;
> @@ -1784,6 +1798,7 @@ static int mpam_save_mbwu_state(void *arg)
>  {
>  	int i;
>  	u64 val;
> +	int ret;
>  	struct mon_cfg *cfg;
>  	u32 cur_flt, cur_ctl, mon_sel;
>  	struct mpam_msc_ris *ris = arg;
> @@ -1794,7 +1809,8 @@ static int mpam_save_mbwu_state(void *arg)
>  		mbwu_state = &ris->mbwu_state[i];
>  		cfg = &mbwu_state->cfg;
>  
> -		if (WARN_ON_ONCE(!mpam_mon_sel_lock(msc)))
> +		ACQUIRE(mon_sel_lock, guard)(msc);
> +		if (ACQUIRE_ERR(mon_sel_lock, &guard))
>  			return -EIO;
>  
>  		mon_sel = FIELD_PREP(MSMON_CFG_MON_SEL_MON_SEL, i) |
> @@ -1805,7 +1821,9 @@ static int mpam_save_mbwu_state(void *arg)
>  		mpam_write_monsel_reg(msc, CFG_MBWU_CTL, 0);
>  
>  		if (mpam_ris_has_mbwu_long_counter(ris)) {
> -			val = mpam_msc_read_mbwu_l(msc);
> +			ret = mpam_msc_read_mbwu_l(msc, &val);
> +			if (ret)
> +				return ret;
>  			mpam_msc_zero_mbwu_l(msc);
>  		} else {
>  			u32 val32;
> @@ -1821,7 +1839,6 @@ static int mpam_save_mbwu_state(void *arg)
>  		cfg->partid = FIELD_GET(MSMON_CFG_x_FLT_PARTID, cur_flt);
>  		mbwu_state->correction += val;
>  		mbwu_state->enabled = FIELD_GET(MSMON_CFG_x_CTL_EN, cur_ctl);
> -		mpam_mon_sel_unlock(msc);
>  	}
>  
>  	return 0;


  reply	other threads:[~2026-10-02 17:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01 15:34 [PATCH v12 00/13] arm_mpam: Add MPAM-Fb firmware support Andre Przywara
2026-10-01 15:34 ` [PATCH v12 01/13] arm_mpam: let low level MSC accessors return an error Andre Przywara
2026-10-01 15:34 ` [PATCH v12 02/13] arm_mpam: propagate MSC access errors for hw_probe functions Andre Przywara
2026-10-01 15:34 ` [PATCH v12 03/13] arm_mpam: propagate MSC access errors for MBWU counters Andre Przywara
2026-10-02 17:39   ` James Morse [this message]
2026-10-01 15:34 ` [PATCH v12 04/13] arm_mpam: propagate MSC access errors for msmon helpers Andre Przywara
2026-10-01 15:34 ` [PATCH v12 05/13] arm_mpam: propagate MSC access errors for __ris_msmon_read() Andre Przywara
2026-10-01 15:34 ` [PATCH v12 06/13] arm_mpam: propagate MSC access errors for state saving function Andre Przywara
2026-10-01 15:34 ` [PATCH v12 07/13] arm_mpam: propagate MSC access errors for mpam_reprogram_ris_partid() Andre Przywara
2026-10-01 15:34 ` [PATCH v12 08/13] arm_mpam: propagate MSC access errors for interrupt control Andre Przywara
2026-10-02 15:35   ` Ben Horgan
2026-10-01 15:34 ` [PATCH v12 09/13] arm_mpam: propagate MSC access errors in mpam_reset_class_locked() Andre Przywara
2026-10-02 15:37   ` Ben Horgan
2026-10-01 15:34 ` [PATCH v12 10/13] arm_mpam: prepare mon_sel locking for MPAM-Fb Andre Przywara
2026-10-01 15:34 ` [PATCH v12 11/13] arm_mpam: add MPAM-Fb MSC firmware access support Andre Przywara
2026-10-02 15:39   ` Ben Horgan
2026-10-01 15:34 ` [PATCH v12 12/13] arm_mpam: change MPAM-Fb error IRQ to use a threaded IRQ handler Andre Przywara
2026-10-02 15:41   ` Ben Horgan
2026-10-01 15:34 ` [PATCH v12 13/13] arm_mpam: detect and enable MPAM-Fb PCC support Andre Przywara
2026-10-02 15:42   ` Ben Horgan

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=0bedf04c-24ef-40de-909f-b41dd72b8e78@arm.com \
    --to=james.morse@arm.com \
    --cc=andre.przywara@arm.com \
    --cc=ben.horgan@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=fenghuay@nvidia.com \
    --cc=ganapatrao.kulkarni@oss.qualcomm.com \
    --cc=gshan@redhat.com \
    --cc=guohanjun@huawei.com \
    --cc=jic23@kernel.org \
    --cc=lee@trager.us \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org--cc \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=niyas.sait@arm.com \
    --cc=rafael@kernel.org \
    --cc=reinette.chatre@intel.com \
    --cc=ritwick.sharma@arm.com \
    --cc=sramana@qti.qualcomm.com \
    --cc=srivathsa.rao@oss.qualcomm.com \
    --cc=sudeep.holla@kernel.org \
    --cc=tsoni@quicinc.com \
    --cc=will@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®