mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Morse <james.morse@arm.com>
To: Amit Singh Tomar <amitsinght@marvell.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Fenghua Yu <fenghua.yu@intel.com>,
	Reinette Chatre <reinette.chatre@intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	H Peter Anvin <hpa@zytor.com>, Babu Moger <Babu.Moger@amd.com>,
	"shameerali.kolothum.thodi@huawei.com"
	<shameerali.kolothum.thodi@huawei.com>,
	D Scott Phillips OS <scott@os.amperecomputing.com>,
	"carl@os.amperecomputing.com" <carl@os.amperecomputing.com>,
	Linu Cherian <lcherian@marvell.com>,
	"bobo.shaobowang@huawei.com" <bobo.shaobowang@huawei.com>,
	"tan.shaopeng@fujitsu.com" <tan.shaopeng@fujitsu.com>,
	"baolin.wang@linux.alibaba.com" <baolin.wang@linux.alibaba.com>,
	Jamie Iles <quic_jiles@quicinc.com>,
	Xin Hao <xhao@linux.alibaba.com>,
	"peternewman@google.com" <peternewman@google.com>,
	"dfustini@baylibre.com" <dfustini@baylibre.com>,
	"muhammad.zahid@nokia.com" <muhammad.zahid@nokia.com>
Subject: Re: [EXT] [PATCH v7 06/24] x86/resctrl: Access per-rmid structures by index
Date: Mon, 22 Jan 2024 18:07:32 +0000	[thread overview]
Message-ID: <b1f38afc-2dc6-5663-393f-4c1a4b4e2ac8@arm.com> (raw)
In-Reply-To: <MW4PR18MB5084D16A8BE24416D05F8853C6762@MW4PR18MB5084.namprd18.prod.outlook.com>

Hi Amit,

On 21/01/2024 10:27, Amit Singh Tomar wrote:
> -----Original Message-----
> From: James Morse <james.morse@arm.com> 
> Sent: Monday, December 11, 2023 8:03 PM
> To: Amit Singh Tomar <amitsinght@marvell.com>; x86@kernel.org; linux-kernel@vger.kernel.org
> Cc: Fenghua Yu <fenghua.yu@intel.com>; Reinette Chatre <reinette.chatre@intel.com>; Thomas Gleixner <tglx@linutronix.de>; Ingo Molnar <mingo@redhat.com>; Borislav Petkov <bp@alien8.de>; H Peter Anvin <hpa@zytor.com>; Babu Moger <Babu.Moger@amd.com>; shameerali.kolothum.thodi@huawei.com; D Scott Phillips OS <scott@os.amperecomputing.com>; carl@os.amperecomputing.com; Linu Cherian <lcherian@marvell.com>; bobo.shaobowang@huawei.com; tan.shaopeng@fujitsu.com; baolin.wang@linux.alibaba.com; Jamie Iles <quic_jiles@quicinc.com>; Xin Hao <xhao@linux.alibaba.com>; peternewman@google.com; dfustini@baylibre.com; muhammad.zahid@nokia.com
> Subject: Re: [EXT] [PATCH v7 06/24] x86/resctrl: Access per-rmid structures by index

> 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

>> 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://urldefense.proofpoint.com/v2/url?u=https-3A__git.kernel.org_pu
>> b_scm_linux_kernel_git_morse_linux.git_tree_fs_resctrl_monitor.c-3Fh-3
>> Dmpam_snapshot_v6.2-23n695&d=DwICaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=V_GK7jR
>> uCHDErm6txmgDK1-MbUihtnSQ3gPgB-A-JKU&m=yHcjuc1ZrYfPWXGxTPifeglinf_gMfy
>> AgnvZfOw-ZD2zRG8G61IfH8hignwaxlV6&s=X3Ie_NqTHtzN2ttkl3yiTYHzNpkWW2wPPI
>> DJ7XTWW40&e=
> 
> Interesting - I didn't think this could happen. Could you share the full splat?


(this bit here is your reply?:)

> Unfortunately, I don't have  access to the test set-up where this splat has been observed.
> However, I have requested Zahid (Cc) to provide the splat logs.
> Additionally, from what I've learned, this splat has been observed on an x86 machine that
> doesn't support monitor groups. Do you see this as problem?



> 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.

Your 'doesn't support monitor groups' explains why boot_cpu_data.x86_cache_max_rmid is -1.

As you've said you're testing the whole tree - not this series, I suspect this is coming
from "x86/resctrl: Move monitor init work to a resctrl init call", which moves
initialisation of filesystem structures to filesystem code.

It looks like I missed that get_rdt_mon_resources() can bale out before calling
rdt_get_mon_l3_config(), which I think would explain what you hint at here.


Adding this to the "x86/resctrl: Move monitor init work to a resctrl init call" should fix
that. (It'll be in the next snapshot I push)
---------------------%<---------------------
diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c
index b3f245c85e00..791554db7c69 100644
--- a/arch/x86/kernel/cpu/resctrl/monitor.c
+++ b/arch/x86/kernel/cpu/resctrl/monitor.c
@@ -1030,12 +1030,14 @@ int resctrl_mon_resource_init(void)
        struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3);
        int ret;

+       if (!r->mon_capable)
+               return 0;
+
        ret = dom_data_init(r);
        if (ret)
                return ret;

-       if (r->mon_capable)
-               l3_mon_evt_init(r);
+       l3_mon_evt_init(r);

        return 0;
 }
---------------------%<---------------------


Thanks,

James

  reply	other threads:[~2024-01-22 18:07 UTC|newest]

Thread overview: 103+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-25 18:03 [PATCH v7 00/24] x86/resctrl: monitored closid+rmid together, separate arch/fs locking James Morse
2023-10-25 18:03 ` [PATCH v7 01/24] tick/nohz: Move tick_nohz_full_mask declaration outside the #ifdef James Morse
2023-10-25 18:03 ` [PATCH v7 02/24] x86/resctrl: kfree() rmid_ptrs from rdtgroup_exit() James Morse
2023-11-09 17:39   ` Reinette Chatre
2023-12-13 18:03     ` James Morse
2023-12-13 23:27       ` Reinette Chatre
2023-12-14 18:28         ` James Morse
2023-12-14 19:06           ` Reinette Chatre
2023-12-15 17:40             ` James Morse
2023-11-09 20:28   ` Moger, Babu
2023-12-13 18:03     ` James Morse
2023-10-25 18:03 ` [PATCH v7 03/24] x86/resctrl: Create helper for RMID allocation and mondata dir creation James Morse
2023-11-09 17:40   ` Reinette Chatre
2023-11-09 20:28   ` Moger, Babu
2023-12-13 18:03     ` James Morse
2023-10-25 18:03 ` [PATCH v7 04/24] x86/resctrl: Move rmid allocation out of mkdir_rdt_prepare() James Morse
2023-11-09 20:29   ` Moger, Babu
2023-12-13 18:03     ` James Morse
2023-10-25 18:03 ` [PATCH v7 05/24] x86/resctrl: Track the closid with the rmid James Morse
2023-11-09 17:41   ` Reinette Chatre
2023-12-13 18:03     ` James Morse
2023-11-09 20:31   ` Moger, Babu
2023-12-13 18:04     ` James Morse
2023-10-25 18:03 ` [PATCH v7 06/24] x86/resctrl: Access per-rmid structures by index James Morse
2023-10-31  7:43   ` [EXT] " Amit Singh Tomar
2023-12-11 14:33     ` James Morse
2024-01-21 10:27       ` Amit Singh Tomar
2024-01-22 18:07         ` James Morse [this message]
2023-11-09 17:42   ` Reinette Chatre
2023-12-13 18:04     ` James Morse
2023-11-09 20:32   ` Moger, Babu
2023-10-25 18:03 ` [PATCH v7 07/24] x86/resctrl: Allow RMID allocation to be scoped by CLOSID James Morse
2023-11-09 17:42   ` Reinette Chatre
2023-11-09 20:32   ` Moger, Babu
2023-10-25 18:03 ` [PATCH v7 08/24] x86/resctrl: Track the number of dirty RMID a CLOSID has James Morse
2023-11-09 17:43   ` Reinette Chatre
2023-12-13 18:04     ` James Morse
2023-11-09 20:38   ` Moger, Babu
2023-12-13 18:04     ` James Morse
2023-10-25 18:03 ` [PATCH v7 09/24] x86/resctrl: Use __set_bit()/__clear_bit() instead of open coding James Morse
2023-11-09 17:44   ` Reinette Chatre
2023-12-13 18:05     ` James Morse
2023-11-09 20:38   ` Moger, Babu
2023-12-13 18:05     ` James Morse
2023-10-25 18:03 ` [PATCH v7 10/24] x86/resctrl: Allocate the cleanest CLOSID by searching closid_num_dirty_rmid James Morse
2023-11-09 17:46   ` Reinette Chatre
2023-12-14 11:36     ` James Morse
2023-11-09 20:39   ` Moger, Babu
2023-12-14 11:37     ` James Morse
2023-10-25 18:03 ` [PATCH v7 11/24] x86/resctrl: Move CLOSID/RMID matching and setting to use helpers James Morse
2023-11-09 20:39   ` Moger, Babu
2023-12-14 11:37     ` James Morse
2023-11-09 20:39   ` Moger, Babu
2023-10-25 18:03 ` [PATCH v7 12/24] x86/resctrl: Add cpumask_any_housekeeping() for limbo/overflow James Morse
2023-11-09 17:46   ` Reinette Chatre
2023-11-09 20:40   ` Moger, Babu
2023-10-25 18:03 ` [PATCH v7 13/24] x86/resctrl: Queue mon_event_read() instead of sending an IPI James Morse
2023-11-09 17:46   ` Reinette Chatre
2023-11-09 20:40   ` Moger, Babu
2023-12-14 11:37     ` James Morse
2023-10-25 18:03 ` [PATCH v7 14/24] x86/resctrl: Allow resctrl_arch_rmid_read() to sleep James Morse
2023-11-09 17:47   ` Reinette Chatre
2023-12-14 11:37     ` James Morse
2023-12-14 18:52       ` Reinette Chatre
2023-11-09 20:42   ` Moger, Babu
2023-12-14 11:37     ` James Morse
2023-10-25 18:03 ` [PATCH v7 15/24] x86/resctrl: Allow arch to allocate memory needed in resctrl_arch_rmid_read() James Morse
2023-11-09 20:47   ` Moger, Babu
2023-12-14 11:38     ` James Morse
2023-10-25 18:03 ` [PATCH v7 16/24] x86/resctrl: Make resctrl_mounted checks explicit James Morse
2023-11-09 20:47   ` Moger, Babu
2023-12-14 11:38     ` James Morse
2023-10-25 18:03 ` [PATCH v7 17/24] x86/resctrl: Move alloc/mon static keys into helpers James Morse
2023-11-09 20:48   ` Moger, Babu
2023-10-25 18:03 ` [PATCH v7 18/24] x86/resctrl: Make rdt_enable_key the arch's decision to switch James Morse
2023-11-09 20:48   ` Moger, Babu
2023-10-25 18:03 ` [PATCH v7 19/24] x86/resctrl: Add helpers for system wide mon/alloc capable James Morse
2023-11-09 20:51   ` Moger, Babu
2023-12-14 11:38     ` James Morse
2023-10-25 18:03 ` [PATCH v7 20/24] x86/resctrl: Add CPU online callback for resctrl work James Morse
2023-11-09 20:51   ` Moger, Babu
2023-12-14 11:38     ` James Morse
2023-10-25 18:03 ` [PATCH v7 21/24] x86/resctrl: Allow overflow/limbo handlers to be scheduled on any-but cpu James Morse
2023-11-09 17:48   ` Reinette Chatre
2023-12-14 11:38     ` James Morse
2023-12-14 18:53       ` Reinette Chatre
2023-12-15 17:41         ` James Morse
2023-11-09 20:51   ` Moger, Babu
2023-12-14 11:38     ` James Morse
2023-10-25 18:03 ` [PATCH v7 22/24] x86/resctrl: Add CPU offline callback for resctrl work James Morse
2023-11-09 20:52   ` Moger, Babu
2023-12-14 11:39     ` James Morse
2023-10-25 18:03 ` [PATCH v7 23/24] x86/resctrl: Move domain helper migration into resctrl_offline_cpu() James Morse
2023-11-09 20:52   ` Moger, Babu
2023-10-25 18:03 ` [PATCH v7 24/24] x86/resctrl: Separate arch and fs resctrl locks James Morse
2023-11-09 17:48   ` Reinette Chatre
2023-12-14 11:39     ` James Morse
2023-11-09 20:52   ` Moger, Babu
2023-12-14 11:39     ` James Morse
2023-11-09 14:05 ` [PATCH v7 00/24] x86/resctrl: monitored closid+rmid together, separate arch/fs locking Moger, Babu
2023-12-14 11:39   ` James Morse
2023-11-13  1:54 ` Shaopeng Tan (Fujitsu)
2023-12-14 18:28   ` James Morse

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=b1f38afc-2dc6-5663-393f-4c1a4b4e2ac8@arm.com \
    --to=james.morse@arm.com \
    --cc=Babu.Moger@amd.com \
    --cc=amitsinght@marvell.com \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=bobo.shaobowang@huawei.com \
    --cc=bp@alien8.de \
    --cc=carl@os.amperecomputing.com \
    --cc=dfustini@baylibre.com \
    --cc=fenghua.yu@intel.com \
    --cc=hpa@zytor.com \
    --cc=lcherian@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=muhammad.zahid@nokia.com \
    --cc=peternewman@google.com \
    --cc=quic_jiles@quicinc.com \
    --cc=reinette.chatre@intel.com \
    --cc=scott@os.amperecomputing.com \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=tan.shaopeng@fujitsu.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=xhao@linux.alibaba.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®