From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) (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 CE32C3DFC7E for ; Thu, 11 Jun 2026 11:17:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781176642; cv=none; b=nnSlixnfzxOMUbDs//RUm5jplxDMJY4JPx8uFQK6V4+skB+0144jCjxscfkvBJpUGlWZFcop/MPN10xe0uuJ+YDsybsBWtBVmrvo8BaetosRp/2I1DM0JBECnWRYMHX3p1M5+l963s3qCdD9BfWWkCEE1soKz8OQLRwYFSBS/9E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781176642; c=relaxed/simple; bh=SAV2zH5rd+ug8Cpl90hOiXeT+z32lZrAO0GnVd9nUOs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=D6tj8K3NjUdNiDbG1K5VKTl1XPdyfwmpV7t77fWfQ1XAhTMGuVdL3GBoP/p+c5Zx6vR4z0V5qG39H2Hstttsu1NrnH3uB6BHlZGIs10pk7lfWaOi8YNc5tF1dYej6a+Y0SoX49IxcPRIW4A5mx9Ik4tsccE4y3+YvPQ1459Xv7I= 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=Ny7DqKmx; arc=none smtp.client-ip=115.124.30.133 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="Ny7DqKmx" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1781176632; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=XfpSW325KHCr15vG40gB/HT9hCmnVr35xfmcl1IkQ+o=; b=Ny7DqKmxx7D7JncKMN7W9GG36vh1qp069Ns1ysBU1F8olmdyIoh4B4Ug8FAA2QdX4+UfSIsEFUQ3y9SiWZ1fanXRw4wVDw9JtNFYbgaEhGYpcCVpAQ+bcdQd4W8YHJBc5c4rLMTePc3HqtLgySGrEhoBjwA+PgwSTachI8mn75o= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037026112;MF=qinyuntan@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0X4dSibg_1781176630; Received: from banye.tbsite.net(mailfrom:qinyuntan@linux.alibaba.com fp:SMTPD_---0X4dSibg_1781176630 cluster:ay36) by smtp.aliyun-inc.com; Thu, 11 Jun 2026 19:17:12 +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 0/4] x86,fs/resctrl: kernel-mode (PLZA) fixes found during review Date: Thu, 11 Jun 2026 19:17:02 +0800 Message-ID: <20260611111706.1981788-1-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 Hi Babu, While reviewing this v3 series I found a few issues in the kernel-mode (PLZA) support and wrote a fix for each. I'm sending them as a small follow-up set on top of v3 so they are easy to fold into the next revision, or to take as separate patches -- whichever you prefer. The patches are ordered by dependency (build fix -> semantic fix -> the two binding fixes) so the series is bisectable on top of v3. Patch 1 (ARM MPAM build fix): fs/resctrl now calls resctrl_arch_get_kmode_support()/resctrl_arch_configure_kmode(), which are only implemented on x86, so an aarch64 allyesconfig (MPAM) fails to link. Add empty arch stubs, and hide info/kernel_mode on platforms that advertise no mode beyond inherit_ctrl_and_mon. Patch 2 (RMID_EN + RDTMON_GROUP): RMID_EN is hardcoded to 1, so inherit_mon counts kernel-mode traffic under the PLZA RMID instead of inheriting from PQR_ASSOC; and assign_mon is forced to bind an RDTMON_GROUP, wasting an RMID. Make RMID_EN mode-based and let assign_mon also accept a control group. This is the issue we discussed earlier and you confirmed; this is the patch for it. Patch 3 (atomic switch): resctrl_kernel_mode_write() releases the previous binding before it programs the new one. If programming the new binding fails (-ENOMEM, or a pseudo-locked target group), the old, working binding is already gone -- a user who only tried to switch loses the original configuration too. Make the switch atomic: all fallible work is done before the old binding is released, so a failed switch is a no-op. Patch 4 (CPU online): the PLZA MSR is per-CPU and is only written over the CPUs that are online at bind time / mask change; nothing reprograms a CPU that comes online afterwards. A hot-added vCPU, or a CPU that was offline at bind time, then runs with PLZA off although it is in scope, while info/kernel_mode still reports the binding as active. Drive the per-CPU state from resctrl_online_cpu() so it is synced idempotently on every online (and stale enable bits are cleared for a CPU that left the scope while offline). Concretely, the patch 4 failure mode is: offline a CPU, bind a global-assign mode while it is absent, then online it -- the onlined CPU is left with PLZA_EN=0 although it is in scope, while a CPU that was present at bind time has PLZA_EN=1, so its CPL0 traffic is not accounted to the bound kernel-mode group. I'd appreciate your view on whether these match your intent for the design. Qinyun Tan (4): resctrl: Add kmode arch stubs for ARM MPAM and hide kernel_mode on non-PLZA platforms resctrl: Fix PLZA RMID_EN to be mode-based and relax RDTMON_GROUP constraint for assign_mon fs/resctrl: make a failed kernel-mode switch a no-op fs/resctrl: program PLZA on a CPU that comes online under a binding arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 9 +- drivers/resctrl/mpam_resctrl.c | 9 + fs/resctrl/rdtgroup.c | 235 ++++++++++++++-------- include/linux/resctrl.h | 8 +- 4 files changed, 171 insertions(+), 90 deletions(-) -- 2.43.7