mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jinjie Ruan <ruanjinjie@huawei.com>
To: Andre Przywara <andre.przywara@arm.com>, <james.morse@arm.com>,
	<ben.horgan@arm.com>, <reinette.chatre@intel.com>,
	<fenghuay@nvidia.com>, <gshan@redhat.com>,
	<jonathan.cameron@oss.qualcomm.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] arm_mpam: Restore the cached configuration when a write to an MSC fails
Date: Thu, 5 Nov 2026 17:44:14 +0800	[thread overview]
Message-ID: <88f7174c-8f78-4232-9edc-1eeeef71eff6@huawei.com> (raw)
In-Reply-To: <7fcc1d9a-1c19-4827-b602-0db416af2e2f@arm.com>



在 2026/11/4 19:24, Andre Przywara 写道:
> Hi,
> 
> On 11/4/26 11:15, Jinjie Ruan wrote:
>> mpam_apply_config() caches the new configuration before writing it to
>> the RISes. When mpam_touch_msc() fails, the cache keeps the new values,
>> so a retry with the same schemata is skipped as a no-op and never
>> reaches the hardware.
> 
> Do we really need this? Has this been observed to solve a problem?
> If any of the MSC accesses fail (for MPAM-Fb only), we already tear down
> the whole MPAM driver immediately, so any subsequent accesses wouldn't

Yes we call mpam_fb_disable_mpam() for MPAM-Fb .

I originally worried about the MMIO path and it turns out not need
the rollback too and the current behavior is correct, see below.

last CPU of the MSC related cpu goes offline
       ↓
    hardware back to default value
       ↓
  user writes schemata  → mpam_apply_config() update comp->cfg[partid]
        ↓
   mpam_touch_msc() → smp_call_on_cpu()
        → -ENXIO only if accessibility has no online CPU
        → comp->cfg[partid] keeps the new values     <- this is right
          ↓
  a CPU of the MSC comes back online
     → mpam_reprogram_msc() replays new comp->cfg[] into the hardware


> work. So I think there is little point in trying to fix or restore any
> configuration?

I think we should drop this patch.

> 
> Propagating errors up the call chain is another issue, but I don't think
> we need to care about any hardware settings in case of a failure.
> 
> Cheers,
> Andre
> 
>>
>> Restore the cached configuration on failure so the retry writes it to
>> the RISes again.
>>
>> Only arm64 MPAM systems are affected; x86 does not support MPAM.
>>
>> Fixes: 60e33a1864fd ("arm_mpam: propagate MSC access errors for
>> mpam_reprogram_ris_partid()")
>> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
>> Cc: <stable@vger.kernel.org> # 7.4.x
>> ---
>>   drivers/resctrl/mpam_devices.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/
>> mpam_devices.c
>> index c067b6d57d71..bb667a416660 100644
>> --- a/drivers/resctrl/mpam_devices.c
>> +++ b/drivers/resctrl/mpam_devices.c
>> @@ -3412,6 +3412,7 @@ static bool mpam_update_config(struct
>> mpam_config *cfg,
>>   int mpam_apply_config(struct mpam_component *comp, u16 partid,
>>                 struct mpam_config *cfg)
>>   {
>> +    struct mpam_config old_cfg = comp->cfg[partid];
>>       struct mpam_write_config_arg arg;
>>       struct mpam_msc_ris *ris;
>>       struct mpam_vmsc *vmsc;
>> @@ -3439,8 +3440,10 @@ int mpam_apply_config(struct mpam_component
>> *comp, u16 partid,
>>                        srcu_read_lock_held(&mpam_srcu)) {
>>               arg.ris = ris;
>>               ret = mpam_touch_msc(msc, __write_config, &arg);
>> -            if (ret)
>> +            if (ret) {
>> +                comp->cfg[partid] = old_cfg;
>>                   return ret;
>> +            }
>>               ris->in_reset_state = false;
>>           }
>>       }
> 

-- 
Best regards,
Jinjie


      reply	other threads:[~2026-11-05  9:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 10:15 Jinjie Ruan
2026-11-04 11:24 ` Andre Przywara
2026-11-05  9:44   ` Jinjie Ruan [this message]

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=88f7174c-8f78-4232-9edc-1eeeef71eff6@huawei.com \
    --to=ruanjinjie@huawei.com \
    --cc=andre.przywara@arm.com \
    --cc=ben.horgan@arm.com \
    --cc=fenghuay@nvidia.com \
    --cc=gshan@redhat.com \
    --cc=james.morse@arm.com \
    --cc=jonathan.cameron@oss.qualcomm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®