From: "Moger, Babu" <babu.moger@amd.com>
To: Peter Newman <peternewman@google.com>
Cc: corbet@lwn.net, tony.luck@intel.com, reinette.chatre@intel.com,
tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
dave.hansen@linux.intel.com, james.morse@arm.com,
dave.martin@arm.com, fenghuay@nvidia.com, x86@kernel.org,
hpa@zytor.com, paulmck@kernel.org, akpm@linux-foundation.org,
thuth@redhat.com, rostedt@goodmis.org, ardb@kernel.org,
gregkh@linuxfoundation.org, daniel.sneddon@linux.intel.com,
jpoimboe@kernel.org, alexandre.chartre@oracle.com,
pawan.kumar.gupta@linux.intel.com, thomas.lendacky@amd.com,
perry.yuan@amd.com, seanjc@google.com, kai.huang@intel.com,
xiaoyao.li@intel.com, kan.liang@linux.intel.com,
xin3.li@intel.com, ebiggers@google.com, xin@zytor.com,
sohil.mehta@intel.com, andrew.cooper3@citrix.com,
mario.limonciello@amd.com, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, maciej.wieczor-retman@intel.com,
eranian@google.com, Xiaojian.Du@amd.com, gautham.shenoy@amd.com
Subject: Re: [PATCH v13 24/27] x86/resctrl: Introduce the interface to modify assignments in a group
Date: Tue, 27 May 2025 10:24:03 -0500 [thread overview]
Message-ID: <c6baeaf0-35a1-4798-946b-029f3af47066@amd.com> (raw)
In-Reply-To: <CALPaoCjvUSKLKOXzF85j8mHT=eZYM-7R0=gJ3PRgOk4yuF5ZhQ@mail.gmail.com>
Hi Peter,
On 5/26/25 04:48, Peter Newman wrote:
> Hi Babu,
>
> On Fri, May 16, 2025 at 12:56 AM Babu Moger <babu.moger@amd.com> wrote:
>
>> diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
>> index 8d970b99bbbd..ea1782723f81 100644
>> --- a/fs/resctrl/rdtgroup.c
>> +++ b/fs/resctrl/rdtgroup.c
>> @@ -2126,6 +2126,168 @@ static int mbm_L3_assignments_show(struct kernfs_open_file *of, struct seq_file
>> return ret;
>> }
>>
>> +/*
>> + * mbm_get_mon_event_by_name() - Return the mon_evt entry for the matching
>> + * event name.
>> + */
>> +static struct mon_evt *mbm_get_mon_event_by_name(struct rdt_resource *r,
>> + char *name)
>> +{
>> + struct mon_evt *mevt;
>> +
>> + list_for_each_entry(mevt, &r->mon.evt_list, list) {
>> + if (!strcmp(mevt->name, name))
>> + return mevt;
>> + }
>> +
>> + return NULL;
>> +}
>> +
>> +static unsigned int resctrl_get_assing_type(char *assign)
>> +{
>> + unsigned int mon_state = ASSIGN_NONE;
>> + int len = strlen(assign);
>
> [ 395.013183] BUG: kernel NULL pointer dereference, address: 0000000000000000
> [ 395.013426] #PF: supervisor read access in kernel mode
> [ 395.013600] #PF: error_code(0x0000) - not-present page
> [ 395.013779] PGD 39322c067 P4D 2a4f49067 PUD 2a4f4a067 PMD 0
> [ 395.013973] Oops: Oops: 0000 [#1] SMP DEBUG_PAGEALLOC NOPTI
> [ 395.014156] CPU: 37 UID: 0 PID: 24147 Comm: bash Not tainted
> 6.15.0-dbg-DEV #13 NONE
> [ 395.014403] Hardware name: Google Astoria-Turin/astoria, BIOS
> 0.20241223.2-0 01/17/2025
> [ 395.014652] RIP: 0010:strlen+0xb/0x20
> [ 395.014778] Code: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 90
> 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 48 c7 c0 ff
> ff ff ff <80> 7c 07 01 00 48 8d 40 01 75 f5 c3 cc cc cc cc cc 0f 1f 40
> 00 90
> [ 395.015356] RSP: 0018:ffa000002f743d58 EFLAGS: 00010246
> [ 395.015522] RAX: ffffffffffffffff RBX: ff11000129a00600 RCX: 0000000000000000
> [ 395.015747] RDX: ff110001299f5253 RSI: ffffffff827b9651 RDI: 0000000000000000
> [ 395.015968] RBP: 0000000000000000 R08: 000000000000003d R09: 0000000000000000
> [ 395.016202] R10: ffffffff827b9652 R11: 0000000000000000 R12: ffffffff8305b7f8
> [ 395.016421] R13: ff110001299f5240 R14: 0000000000000014 R15: 0000000000000000
> [ 395.016644] FS: 00007f1281ff8b80(0000) GS:ff1100bdc8276000(0000)
> knlGS:0000000000000000
> [ 395.016893] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [ 395.017071] CR2: 0000000000000000 CR3: 0000000420bc8002 CR4: 0000000000771ef0
> [ 395.017298] PKRU: 55555554
> [ 395.017388] Call Trace:
> [ 395.017471] <TASK>
> [ 395.017545] mbm_L3_assignments_write+0x2d4/0x4e0
> [ 395.017700] kernfs_fop_write_iter+0x132/0x1c0
> [ 395.017851] vfs_write+0x2bf/0x3c0
> [ 395.017963] ksys_write+0x82/0x100
> [ 395.018074] do_syscall_64+0xee/0x210
> [ 395.018198] ? exc_page_fault+0x81/0xe0
> [ 395.018321] entry_SYSCALL_64_after_hwframe+0x77/0x7f
> [ 395.018482] RIP: 0033:0x7f128177f8b3
> [ 395.018598] Code: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc
> cc cc cc cc cc cc cc 48 8b 05 99 91 07 00 83 38 00 75 10 b8 01 00 00
> 00 0f 05 <48> 3d 01 f0 ff ff 73 4d c3 55 48 89 e5 41 57 41 56 53 50 48
> 89 d3
> [ 395.019167] RSP: 002b:00007ffff66e80f8 EFLAGS: 00000246 ORIG_RAX:
> 0000000000000001
> [ 395.019409] RAX: ffffffffffffffda RBX: 0000000000000014 RCX: 00007f128177f8b3
> [ 395.019636] RDX: 0000000000000014 RSI: 0000000001eedb60 RDI: 0000000000000001
> [ 395.019861] RBP: 00007ffff66e8120 R08: 0000000000000000 R09: 0000000000000000
> [ 395.020081] R10: 00007ffff66e81b0 R11: 0000000000000246 R12: 0000000001eedb60
> [ 395.020303] R13: 0000000000000001 R14: 00007f12817fa650 R15: 0000000000000014
> [ 395.020532] </TASK>
>
Yes. Got it. Missing NULL check. Simplified the function now. Thanks
static unsigned int resctrl_get_assign_type(char *assign)
{
if (!assign || strlen(assign) != 1)
return ASSIGN_INVALID;
switch (*assign) {
case 'e':
return ASSIGN_EXCLUSIVE;
case '_':
return ASSIGN_NONE;
default:
return ASSIGN_INVALID;
}
}
>> +
>> + if (!len || len > 1)
>> + return ASSIGN_INVALID;
>> +
>> + switch (*assign) {
>> + case 'e':
>> + mon_state = ASSIGN_EXCLUSIVE;
>> + break;
>> + case '_':
>> + mon_state = ASSIGN_NONE;
>> + break;
>> + default:
>> + mon_state = ASSIGN_INVALID;
>> + break;
>> + }
>> +
>> + return mon_state;
>> +}
>> +
>> +static int resctrl_process_assign(struct rdt_resource *r, struct rdtgroup *rdtgrp,
>> + char *config, char *tok)
>> +{
>> + struct rdt_mon_domain *d;
>> + char *dom_str, *id_str;
>> + unsigned long dom_id = 0;
>> + struct mon_evt *mevt;
>> + int assign_type;
>> + char domain[10];
>> + bool found;
>> + int ret;
>> +
>> + mevt = mbm_get_mon_event_by_name(r, config);
>> + if (!mevt) {
>> + rdt_last_cmd_printf("Invalid assign configuration %s\n", config);
>> + return -ENOENT;
>> + }
>> +
>> +next:
>> + if (!tok || tok[0] == '\0')
>> + return 0;
>> +
>> + /* Start processing the strings for each domain */
>> + dom_str = strim(strsep(&tok, ";"));
>> +
>> + id_str = strsep(&dom_str, "=");
>
> If there's no '=' then dom_str becomes NULL...
Yea. That is correct.
>
>> +
>> + /* Check for domain id '*' which means all domains */
>> + if (id_str && *id_str == '*') {
>> + d = NULL;
>> + goto check_state;
>> + } else if (!id_str || kstrtoul(id_str, 10, &dom_id)) {
>> + rdt_last_cmd_puts("Missing domain id\n");
>> + return -EINVAL;
>> + }
>> +
>> + /* Verify if the dom_id is valid */
>> + found = false;
>> + list_for_each_entry(d, &r->mon_domains, hdr.list) {
>> + if (d->hdr.id == dom_id) {
>> + found = true;
>> + break;
>> + }
>> + }
>> +
>> + if (!found) {
>> + rdt_last_cmd_printf("Invalid domain id %ld\n", dom_id);
>> + return -EINVAL;
>> + }
>> +
>> +check_state:
>> + assign_type = resctrl_get_assing_type(dom_str);
>
> then the resulting type of whatever this is supposed to mean is "panic"
>
> Thanks,
> -Peter
>
--
Thanks
Babu Moger
next prev parent reply other threads:[~2025-05-27 15:24 UTC|newest]
Thread overview: 114+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-15 22:51 [PATCH v13 00/27] x86/resctrl : Support AMD Assignable Bandwidth Monitoring Counters (ABMC) Babu Moger
2025-05-15 22:51 ` [PATCH v13 01/27] x86/cpufeatures: Add support for " Babu Moger
2025-05-22 20:51 ` Reinette Chatre
2025-05-27 17:23 ` Moger, Babu
2025-05-27 17:54 ` Reinette Chatre
2025-05-27 18:40 ` Moger, Babu
2025-05-27 23:42 ` Reinette Chatre
2025-05-28 16:18 ` Moger, Babu
2025-05-15 22:51 ` [PATCH v13 02/27] x86/resctrl: Add ABMC feature in the command line options Babu Moger
2025-05-15 22:51 ` [PATCH v13 03/27] x86/resctrl: Consolidate monitoring related data from rdt_resource Babu Moger
2025-05-22 20:52 ` Reinette Chatre
2025-05-27 18:49 ` Moger, Babu
2025-05-15 22:51 ` [PATCH v13 04/27] x86/resctrl: Detect Assignable Bandwidth Monitoring feature details Babu Moger
2025-05-22 20:54 ` Reinette Chatre
2025-05-27 19:52 ` Moger, Babu
2025-05-27 20:15 ` Moger, Babu
2025-05-15 22:51 ` [PATCH v13 05/27] x86/resctrl: Add support to enable/disable AMD ABMC feature Babu Moger
2025-05-22 20:56 ` Reinette Chatre
2025-05-27 20:21 ` Moger, Babu
2025-05-15 22:51 ` [PATCH v13 06/27] x86/resctrl: Introduce the interface to display monitor mode Babu Moger
2025-05-22 20:56 ` Reinette Chatre
2025-05-27 20:33 ` Moger, Babu
2025-05-15 22:51 ` [PATCH v13 07/27] x86/resctrl: Introduce interface to display number of monitoring counters Babu Moger
2025-05-15 22:51 ` [PATCH v13 08/27] x86/resctrl: Introduce mbm_cntr_cfg to track assignable counters at domain Babu Moger
2025-05-22 21:02 ` Reinette Chatre
2025-05-28 16:56 ` Moger, Babu
2025-05-28 17:34 ` Reinette Chatre
2025-05-28 19:05 ` Moger, Babu
2025-05-15 22:51 ` [PATCH v13 09/27] x86/resctrl: Introduce interface to display number of free MBM counters Babu Moger
2025-05-15 22:51 ` [PATCH v13 10/27] x86/resctrl: Add data structures and definitions for ABMC assignment Babu Moger
2025-05-22 21:10 ` Reinette Chatre
2025-05-28 19:15 ` Moger, Babu
2025-05-15 22:51 ` [PATCH v13 11/27] x86/resctrl: Implement resctrl_arch_config_cntr() to assign a counter with ABMC Babu Moger
2025-05-22 21:51 ` Reinette Chatre
2025-05-22 22:16 ` Luck, Tony
2025-05-23 21:08 ` Luck, Tony
2025-05-26 13:14 ` Peter Newman
2025-05-27 21:41 ` Luck, Tony
2025-05-28 21:41 ` Moger, Babu
2025-05-28 22:00 ` Luck, Tony
2025-05-28 22:13 ` Luck, Tony
2025-05-28 23:48 ` Moger, Babu
2025-06-09 14:01 ` Moger, Babu
2025-05-28 21:39 ` Moger, Babu
2025-05-15 22:51 ` [PATCH v13 12/27] x86/resctrl: Introduce event configuration modes Babu Moger
2025-05-22 22:05 ` Reinette Chatre
2025-05-29 15:21 ` Moger, Babu
2025-05-15 22:51 ` [PATCH v13 13/27] x86/resctrl: Add the functionality to assign MBM events Babu Moger
2025-05-22 22:41 ` Reinette Chatre
2025-05-29 16:05 ` Moger, Babu
2025-05-15 22:51 ` [PATCH v13 14/27] x86/resctrl: Add the functionality to unassign " Babu Moger
2025-05-22 22:49 ` Reinette Chatre
2025-05-29 16:25 ` Moger, Babu
2025-05-15 22:52 ` [PATCH v13 15/27] x86/resctrl: Report 'Unassigned' for MBM events in mbm_cntr_assign mode Babu Moger
2025-05-22 23:01 ` Reinette Chatre
2025-05-29 16:58 ` Moger, Babu
2025-05-15 22:52 ` [PATCH v13 16/27] x86/resctrl: Pass entire struct rdtgroup rather than passing individual members Babu Moger
2025-05-22 23:05 ` Reinette Chatre
2025-05-29 18:07 ` Moger, Babu
2025-05-15 22:52 ` [PATCH v13 17/27] x86/resctrl: Add the support for reading ABMC counters Babu Moger
2025-05-22 23:31 ` Reinette Chatre
2025-05-29 18:25 ` Moger, Babu
2025-05-15 22:52 ` [PATCH v13 18/27] x86/resctrl: Add definitions for MBM event configuration Babu Moger
2025-05-23 4:41 ` Reinette Chatre
2025-05-29 19:00 ` Moger, Babu
2025-05-29 20:58 ` Reinette Chatre
2025-06-03 13:41 ` Moger, Babu
2025-05-15 22:52 ` [PATCH v13 19/27] x86/resctrl: Add event configuration directory under info/L3_MON/ Babu Moger
2025-05-23 4:43 ` Reinette Chatre
2025-05-29 19:54 ` Moger, Babu
2025-05-15 22:52 ` [PATCH v13 20/27] x86/resctrl: Provide interface to update the event configurations Babu Moger
2025-05-23 4:45 ` Reinette Chatre
2025-05-29 22:35 ` Moger, Babu
2025-05-15 22:52 ` [PATCH v13 21/27] x86/resctrl: Introduce mbm_assign_on_mkdir to configure assignments Babu Moger
2025-05-23 4:48 ` Reinette Chatre
2025-05-29 23:03 ` Moger, Babu
2025-05-30 20:54 ` Reinette Chatre
2025-06-03 14:00 ` Moger, Babu
2025-05-15 22:52 ` [PATCH v13 22/27] x86/resctrl: Auto assign/unassign counters when mbm_cntr_assign is enabled Babu Moger
2025-05-15 22:52 ` [PATCH v13 23/27] x86/resctrl: Introduce mbm_L3_assignments to list assignments in a group Babu Moger
2025-05-23 4:47 ` Reinette Chatre
2025-05-30 0:55 ` Moger, Babu
2025-05-15 22:52 ` [PATCH v13 24/27] x86/resctrl: Introduce the interface to modify " Babu Moger
2025-05-26 9:48 ` Peter Newman
2025-05-27 15:24 ` Moger, Babu [this message]
2025-05-15 22:52 ` [PATCH v13 25/27] x86/resctrl: Hide the BMEC related files when mbm_cnt_assign is enabled Babu Moger
2025-05-15 22:52 ` [PATCH v13 26/27] x86/resctrl: Introduce the interface to switch between monitor modes Babu Moger
2025-05-15 22:52 ` [PATCH v13 27/27] x86/resctrl: Configure mbm_cntr_assign mode if supported Babu Moger
2025-05-19 15:59 ` [PATCH v13 00/27] x86/resctrl : Support AMD Assignable Bandwidth Monitoring Counters (ABMC) Peter Newman
2025-05-20 15:28 ` Moger, Babu
2025-05-20 16:06 ` Reinette Chatre
2025-05-20 17:51 ` Moger, Babu
2025-05-20 18:23 ` Reinette Chatre
2025-05-20 23:25 ` Moger, Babu
2025-05-20 23:44 ` Reinette Chatre
2025-05-21 9:18 ` Peter Newman
2025-05-21 23:03 ` Reinette Chatre
2025-05-21 23:43 ` Luck, Tony
2025-05-22 0:10 ` Reinette Chatre
2025-05-22 0:21 ` Luck, Tony
2025-05-22 8:47 ` Peter Newman
2025-05-22 16:32 ` Reinette Chatre
2025-05-22 17:21 ` Luck, Tony
2025-05-22 15:44 ` Moger, Babu
2025-05-22 16:33 ` Reinette Chatre
2025-05-22 19:15 ` Moger, Babu
2025-06-10 23:19 ` Moger, Babu
2025-06-11 18:29 ` Reinette Chatre
2025-06-11 21:21 ` Moger, Babu
2025-05-21 14:27 ` Peter Newman
2025-05-21 23:05 ` Reinette Chatre
2025-05-22 9:14 ` Peter Newman
2025-05-22 16:33 ` Reinette Chatre
2025-05-22 20:44 ` Reinette Chatre
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=c6baeaf0-35a1-4798-946b-029f3af47066@amd.com \
--to=babu.moger@amd.com \
--cc=Xiaojian.Du@amd.com \
--cc=akpm@linux-foundation.org \
--cc=alexandre.chartre@oracle.com \
--cc=andrew.cooper3@citrix.com \
--cc=ardb@kernel.org \
--cc=bp@alien8.de \
--cc=corbet@lwn.net \
--cc=daniel.sneddon@linux.intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=dave.martin@arm.com \
--cc=ebiggers@google.com \
--cc=eranian@google.com \
--cc=fenghuay@nvidia.com \
--cc=gautham.shenoy@amd.com \
--cc=gregkh@linuxfoundation.org \
--cc=hpa@zytor.com \
--cc=james.morse@arm.com \
--cc=jpoimboe@kernel.org \
--cc=kai.huang@intel.com \
--cc=kan.liang@linux.intel.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maciej.wieczor-retman@intel.com \
--cc=mario.limonciello@amd.com \
--cc=mingo@redhat.com \
--cc=paulmck@kernel.org \
--cc=pawan.kumar.gupta@linux.intel.com \
--cc=perry.yuan@amd.com \
--cc=peternewman@google.com \
--cc=reinette.chatre@intel.com \
--cc=rostedt@goodmis.org \
--cc=seanjc@google.com \
--cc=sohil.mehta@intel.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=thuth@redhat.com \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
--cc=xiaoyao.li@intel.com \
--cc=xin3.li@intel.com \
--cc=xin@zytor.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®