From nobody Sun Oct 5 01:49:31 2025 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 6F0252E2DFC for ; Mon, 11 Aug 2025 18:17:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754936264; cv=none; b=G6NE3auQAsBq+MeksylNe2i8Pwo9tNNcXUR+Nc/CUuBCUbF1jD1tRE00XEKbRG0mETlPF7HVGPyoGUuP0cZnykdqreSf3sxvhSR3OeLckG1H6KPY8StyzvixUv2LVmax4nVq84qW8CGJwrbFOmXybzpTy6PQ9LuT7liLq1PCNFU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754936264; c=relaxed/simple; bh=tiN+hbV8N2y0qYnYfboP2LM2eI9E8FHvJartB9jdL6E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TvBdYQPRKvnRfG82BcM5RvFkRHRL6PQmNdMVLRuOk0oHqjOnmH1r67Rsbnug0aAJpj7ZUUySTGFjM5n6VCTfYxrj2EabBTdCT6qWoq0nNcyPMIlnqWivKI02cDN63FUnmPh9yhtKRo+EaU+S7EgXE4nps+LAgHTYTWxvHIGXPJk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=M63EKbeM; arc=none smtp.client-ip=198.175.65.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="M63EKbeM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1754936263; x=1786472263; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tiN+hbV8N2y0qYnYfboP2LM2eI9E8FHvJartB9jdL6E=; b=M63EKbeMhYZolHgLT6Cfl4xWvCfLLDSQPZ8rVRFv7maSMI/rLckFV5ZG 2lqgm0OOPQHGd/YwnENFrv1xbAJoYmoAQzr4b6ydVm57lBrLscqLxmEpM h4fQDVXga2kk/gpbFMBW7UHZr/Y/sOJh51lg0n8qkpIR84Pr3GaNE3rHy P/xBmaG1qPJOQNpNSerxZ3rguFAzVAXRyj4+bIJ/NGGmyCEHdzL9AP+9X CruAw1VoNcObsrYMc+HqK7POA9yJwOk5OK+n21wNF3KzvXV04RR/ZOwET 0JSURc/uolmupPKB5kiOxr1eBElkJloo4kuKpLuS2IHyftz98rqwTvv5s Q==; X-CSE-ConnectionGUID: 9mjhvPibTtu+VwTp7vqAlw== X-CSE-MsgGUID: NDiGjEuEQB6agu1HRGq8JQ== X-IronPort-AV: E=McAfee;i="6800,10657,11518"; a="68277431" X-IronPort-AV: E=Sophos;i="6.17,278,1747724400"; d="scan'208";a="68277431" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2025 11:17:27 -0700 X-CSE-ConnectionGUID: OoFydq4GRMuuVhIE5KtHQA== X-CSE-MsgGUID: hzh363I5Rlm/p216ei15RA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.17,278,1747724400"; d="scan'208";a="196825661" Received: from puneetse-mobl.amr.corp.intel.com (HELO agluck-desk3.home.arpa) ([10.124.221.229]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2025 11:17:24 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin , Anil Keshavamurthy , Chen Yu Cc: x86@kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v8 15/32] x86,fs/resctrl: Add an architectural hook called for each mount Date: Mon, 11 Aug 2025 11:16:49 -0700 Message-ID: <20250811181709.6241-16-tony.luck@intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250811181709.6241-1-tony.luck@intel.com> References: <20250811181709.6241-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Enumeration of Intel telemetry events is an asyncronnous process involving several mutually dependent drivers added as auxiliary devices during the device_initcall() phase of Linux boot. The process completes after the probe functions for these drivers are called. But this happens after resctrl_arch_late_init() is executed. Tracing the enumeration process shows that it does complete a full seven seconds before the earliest possible mount of the resctrl file system (when included in /etc/fstab for automatic mount by systemd). Add a hook at the beginning of the mount code that will be used to check for telemetry events and initialize if any are found. Call the hook on every attempted mount. But expectations are that most actions (like enumeration) will only need to be performed on the first call. The call is made with no locks held. Architecture code is responsible for any required locking. Signed-off-by: Tony Luck --- include/linux/resctrl.h | 6 ++++++ arch/x86/kernel/cpu/resctrl/core.c | 9 +++++++++ fs/resctrl/rdtgroup.c | 2 ++ 3 files changed, 17 insertions(+) diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 38809c497b44..19409227ccd0 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -461,6 +461,12 @@ void resctrl_offline_mon_domain(struct rdt_resource *r= , struct rdt_domain_hdr *h void resctrl_online_cpu(unsigned int cpu); void resctrl_offline_cpu(unsigned int cpu); =20 +/* + * Architecture hook called at beginning of each file system mount attempt. + * No locks are held. + */ +void resctrl_arch_pre_mount(void); + /** * resctrl_arch_rmid_read() - Read the eventid counter corresponding to rm= id * for this resource and domain. diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resct= rl/core.c index f6fda15da9c1..480e381d416e 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -718,6 +718,15 @@ static int resctrl_arch_offline_cpu(unsigned int cpu) return 0; } =20 +void resctrl_arch_pre_mount(void) +{ + static atomic_t only_once =3D ATOMIC_INIT(0); + int old =3D 0; + + if (!atomic_try_cmpxchg(&only_once, &old, 1)) + return; +} + enum { RDT_FLAG_CMT, RDT_FLAG_MBM_TOTAL, diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index b917d48a806a..31f9425783ef 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -2585,6 +2585,8 @@ static int rdt_get_tree(struct fs_context *fc) struct rdt_resource *r; int ret; =20 + resctrl_arch_pre_mount(); + cpus_read_lock(); mutex_lock(&rdtgroup_mutex); /* --=20 2.50.1