mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Reinette Chatre <reinette.chatre@intel.com>
To: Ben Horgan <ben.horgan@arm.com>
Cc: <tony.luck@intel.com>, <x86@kernel.org>, <Dave.Martin@arm.com>,
	<james.morse@arm.com>, <babu.moger@amd.com>,
	<fenghuay@nvidia.com>, <bp@alien8.de>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] fs/resctrl: Allocate rmid_ptrs[] using kvzalloc_objs()
Date: Thu, 17 Sep 2026 11:50:21 -0700	[thread overview]
Message-ID: <e741cbee-342b-419a-9c71-bb5e1f3b8570@intel.com> (raw)
In-Reply-To: <0bb072be-71d6-43b9-a258-aa745711012b@arm.com>

Hi Ben,

On 9/17/26 9:15 AM, Ben Horgan wrote:
> On 16/09/2026 17:52, Reinette Chatre wrote:
>> On 9/11/26 9:06 AM, Ben Horgan wrote:
>>> On an MPAM system the number of entries in rmid_ptrs[] is the number of PARTIDs
>>> multiplied by the number of PMGs. The maximum possible number of PARTIDs is
>>> 0x10000 and the maximum number of PMGs is 0x100. On a system pushing the limits
>>> of the MPAM specification this can be large enough to consistently fail the
>>> kzalloc_objs() allocation and hence fail to mount the resctrl filesystem.
>>>
>>> Switch to allocating rmid_ptrs[] using kvzalloc_objs() so that large allocations
>>> fall back to vmalloc().
>>>
>>> Fixes: 264c285999fc ("arm_mpam: resctrl: Add monitor initialisation and domain boilerplate")
>>> Signed-off-by: Ben Horgan <ben.horgan@arm.com>
>>> Reviewed-by: Tony Luck <tony.luck@intel.com>
>>> ---
>>> I found this by testing the extremes of a software model and don't expect this
>>> to effect real systems.
>>> ---
>>>  fs/resctrl/monitor.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
>>> index 73413cb128ea..2d7df60973d1 100644
>>> --- a/fs/resctrl/monitor.c
>>> +++ b/fs/resctrl/monitor.c
>>> @@ -979,7 +979,7 @@ int setup_rmid_lru_list(void)
>>>  		return 0;
>>>  
>>>  	idx_limit = resctrl_arch_system_num_rmid_idx();
>>> -	rmid_ptrs = kzalloc_objs(struct rmid_entry, idx_limit);
>>> +	rmid_ptrs = kvzalloc_objs(struct rmid_entry, idx_limit);
>>>  	if (!rmid_ptrs)
>>>  		return -ENOMEM;
>>>  
>>
>> resctrl_arch_system_num_rmid_idx() that guides the rmid_ptrs[] allocation is
>> also used to size the L3 monitoring state rdt_l3_mon_domain::rmid_busy_llc[]
>> and rdt_l3_mon_domain::mbm_states[]. Each RMID is expected to have associated
>> states in these structures so to fully support this their allocation needs
>> to change also? 
> 
> At least, rdt_l3_mon_domain::mbm_states[] should use kvcalloc. I realise that I didn't hit this on
> the model I was using to test this didn't have memory bandwidth monitors.
> 
> For, rdt_l3_mon_domain::rmid_busy_llc[] the allocation will have succeeded on a model as there are
> cache occupancy counters. The allocation here is smaller than the others as it allocates a bit per
> RMID rather than multiple bytes per RMID like the other two allocations. This gives a limit here of
> 0x100 * 0x10000 / 0x8 = 0x200000 bytes, 2MB. My view here would be that, although this is quite big,
> it's not standing in the way of testing on a model and physical systems even approaching this size
> are not likely to ever be built and so doesn't justify either open coding the bitmap allocation and
> freeing or creating a new bitmap allocator. Does that make sense?

I think this may still stand in the way of testing on a model since it depends on when that testing
onlines the domains and how fragmented the memory is at that time. A simple "boot with all domains
already online" may be ok but I am not sure.

Reinette

      reply	other threads:[~2026-09-17 18:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-11 16:06 Ben Horgan
2026-09-16  9:26 ` Ben Horgan
2026-09-16 16:52 ` Reinette Chatre
2026-09-17 16:15   ` Ben Horgan
2026-09-17 18:50     ` Reinette Chatre [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=e741cbee-342b-419a-9c71-bb5e1f3b8570@intel.com \
    --to=reinette.chatre@intel.com \
    --cc=Dave.Martin@arm.com \
    --cc=babu.moger@amd.com \
    --cc=ben.horgan@arm.com \
    --cc=bp@alien8.de \
    --cc=fenghuay@nvidia.com \
    --cc=james.morse@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®