From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-124.freemail.mail.aliyun.com (out30-124.freemail.mail.aliyun.com [115.124.30.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58AAA3DFC7B for ; Thu, 11 Jun 2026 11:17:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781176645; cv=none; b=DS0X4hpIEjPVKGSnVOEMVZzVoiCHARzrVJK7RDGVZnb7oPSuTHeUmIOAiDi3ehsYvAN9p4Fa1+nSO0aH7VyZShgvJwfjKDHO0dF6SsT/dJ3CCCD3KiJhR+s1WmYlSpPtrdMCsdPpeFIwt9PKpzavpCcFeZKlBFV7q/WzW3QPnno= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781176645; c=relaxed/simple; bh=32Jtf5jnkE1C7T9wb4lp61lkLg7DZyog4aN13wfolYs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eRWwtnwFbNDsoKc8EJBf3UcynNmMiQvwi29g2kitfSctblRFzj7NjEOqhxBYhg2HQrCsjM3gjoJPqqiG9qpNqAtIyiOo7/Hvj/zpucdm9yPoGop3ZYAGeWeZZ5G4h4aHvOkSVJ0p6OqbyKUb01YepFg6lfdu0eiXSFNC21BqJ1E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=AxpYAoZc; arc=none smtp.client-ip=115.124.30.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="AxpYAoZc" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1781176633; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=lV7Tt9R2jPjozz2PG0uezA6r76cncCAbIsU1IZt7128=; b=AxpYAoZcUIc3oESza9xmS5Nj5QfKy64ikoorA72AbMlUm2adj4esvvZu1DxX6bN0RYR22z6ZWWUvl5CEhTitYnavdk5ktL8059pqPbVlL+Fgy2/Wn3JyU/UplRACg28SYdJ4GWX/c2nOcAmZdAkdFE5JGjgHAzxYmlVYIDKB3aM= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R211e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037009110;MF=qinyuntan@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0X4dSic9_1781176632; Received: from banye.tbsite.net(mailfrom:qinyuntan@linux.alibaba.com fp:SMTPD_---0X4dSic9_1781176632 cluster:ay36) by smtp.aliyun-inc.com; Thu, 11 Jun 2026 19:17:13 +0800 From: Qinyun Tan To: babu.moger@amd.com Cc: tony.luck@intel.com, reinette.chatre@intel.com, james.morse@arm.com, Dave.Martin@arm.com, tglx@kernel.org, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, linux-kernel@vger.kernel.org, feng.tang@linux.alibaba.com, xlpang@linux.alibaba.com, Qinyun Tan Subject: [PATCH 1/4] resctrl: Add kmode arch stubs for ARM MPAM and hide kernel_mode on non-PLZA platforms Date: Thu, 11 Jun 2026 19:17:03 +0800 Message-ID: <20260611111706.1981788-2-qinyuntan@linux.alibaba.com> X-Mailer: git-send-email 2.43.7 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit fs/resctrl/rdtgroup.c calls resctrl_arch_get_kmode_support() and resctrl_arch_configure_kmode() which are only implemented under arch/x86/. ARM MPAM enables CONFIG_RESCTRL_FS but has no PLZA hardware, causing link failures on aarch64 allyesconfig: undefined reference to `resctrl_arch_configure_kmode' undefined reference to `resctrl_arch_get_kmode_support' Add empty stubs in drivers/resctrl/mpam_resctrl.c, following the same pattern used for resctrl_arch_io_alloc_enable(). Additionally, the kernel_mode file under info/ was unconditionally visible (fflags = RFTYPE_TOP_INFO). On platforms without PLZA (ARM MPAM, older AMD/Intel), the file shows only inherit_ctrl_and_mon with no other options, which is unnecessary. Set the initial fflags to 0 and dynamically enable the file in resctrl_kmode_init() only when resctrl_arch_get_kmode_support() registers additional modes, matching the io_alloc pattern. Signed-off-by: Qinyun Tan Reviewed-by: Xunlei Pang --- drivers/resctrl/mpam_resctrl.c | 9 +++++++++ fs/resctrl/rdtgroup.c | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c index 1dd3bbd0772cd..fc2b3f508c039 100644 --- a/drivers/resctrl/mpam_resctrl.c +++ b/drivers/resctrl/mpam_resctrl.c @@ -161,6 +161,15 @@ bool resctrl_arch_get_io_alloc_enabled(struct rdt_resource *r) return false; } +void resctrl_arch_get_kmode_support(struct resctrl_kmode_cfg *kcfg) +{ +} + +void resctrl_arch_configure_kmode(const struct cpumask *cpu_mask, u32 closid, + u32 rmid, bool enable) +{ +} + void resctrl_arch_pre_mount(void) { } diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index dd9c4da836983..0b2606f10e2e9 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -2602,7 +2602,7 @@ static struct rftype res_common_files[] = { .kf_ops = &rdtgroup_kf_single_ops, .seq_show = resctrl_kernel_mode_show, .write = resctrl_kernel_mode_write, - .fflags = RFTYPE_TOP_INFO, + .fflags = 0, }, { .name = "mbm_assign_on_mkdir", @@ -2968,6 +2968,9 @@ static void resctrl_kmode_init(void) resctrl_kcfg.k_rdtgrp = &rdtgroup_default; resctrl_arch_get_kmode_support(&resctrl_kcfg); + + if (resctrl_kcfg.kmode != BIT(INHERIT_CTRL_AND_MON)) + resctrl_file_fflags_init("kernel_mode", RFTYPE_TOP_INFO); } void resctrl_file_fflags_init(const char *config, unsigned long fflags) -- 2.43.7