Messages in this thread | ![/](/images/icornerl.gif) | | Date | Mon, 11 Dec 2023 14:33:06 +0000 | Subject | Re: [EXT] [PATCH v7 06/24] x86/resctrl: Access per-rmid structures by index | From | James Morse <> |
| |
Hi Amit,
On 31/10/2023 07:43, Amit Singh Tomar wrote: > -----Original Message----- > From: James Morse <james.morse@arm.com> > Sent: Wednesday, October 25, 2023 11:33 PM > Subject: [EXT] [PATCH v7 06/24] x86/resctrl: Access per-rmid structures by index
Looks like you are afflicted with outlook - let me know if I didn't find all the changes you made to the original message ...
[..]
> diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c > index 2a0233cd0bc9..c02cf32cd17c 100644 > --- a/arch/x86/kernel/cpu/resctrl/monitor.c > +++ b/arch/x86/kernel/cpu/resctrl/monitor.c > @@ -735,19 +768,20 @@ void mbm_setup_overflow_handler(struct rdt_domain *dom, unsigned long delay_ms) > > static int dom_data_init(struct rdt_resource *r) { > + u32 idx_limit = resctrl_arch_system_num_rmid_idx(); > struct rmid_entry *entry = NULL; > - int i, nr_rmids; > + u32 idx; > + int i; > > - nr_rmids = r->num_rmid; > - rmid_ptrs = kcalloc(nr_rmids, sizeof(struct rmid_entry), GFP_KERNEL); > + rmid_ptrs = kcalloc(idx_limit, sizeof(struct rmid_entry), GFP_KERNEL); > > [>>] Is there a chance, it could result in "ZERO_SIZE_PTR", and we should guard it against ZERO_OR_NULL_PTR in the following if condition? > It might be related, while testing the snapshot[1] (and subsequent snapshots has similar change) on x86 platform, Zahid is seeing Kernel panic: > https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git/tree/fs/resctrl/monitor.c?h=mpam/snapshot/v6.2#n695
Interesting - I didn't think this could happen. Could you share the full splat?
This would imply idx_limit was zero, so boot_cpu_data.x86_cache_max_rmid would be -1. But wouldn't this happen before this patch? idx_limit has the same value as nr_rmids on x86, its only MPAM that needs a different value.
Thanks,
James
| ![\](/images/icornerr.gif) |