From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 3077227F017 for ; Wed, 29 Apr 2026 18:49:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777488568; cv=none; b=R2BXbBteO2NqXjZyWTiGmJEbkC5QnPFz70ikR4H0UIGiJK64ZQTNuFHvx15x1yI/OBEKv8/k1Vfdb7R1qlVxwo55rqI8sfQ02F2EuR+XISfP/oUI2vLB3LWY1zIHNHoYZl93GS+KVGseKeOw7scOZvFpqN4Ql8gktIqVCy9TMWQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777488568; c=relaxed/simple; bh=xNTNK/75KML/j4U9TRC6Wx+YLGkaG8GrlGihkDxsK+8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qugfctdSKbJuABoq62rPuZWtiIULoNOH5jpuhETebRgmlNO+YalztRdoEbzamseTT4saqNZ05/SicCJj4tIjQoilSEn1icZPhJNp1sLN+bX3TJXNLn3Ph+9/EVlrHakOytT2KW3HhKCl9NfEN9M5qRehI1rsm7mCuFILCiVvOLE= 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=PNNZY1Fk; arc=none smtp.client-ip=198.175.65.12 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="PNNZY1Fk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1777488564; x=1809024564; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xNTNK/75KML/j4U9TRC6Wx+YLGkaG8GrlGihkDxsK+8=; b=PNNZY1Fku/RnDMUdGnM5caq83I23cFh9XZIUTugmvi7jloi/hiPBxPkh 5IgdeevMMCCHOTYCM71QlZwhrxHCwjaUl/pxNJIozw/f4NeDQ1FNUv+4/ n6MxvSSudSFYjdCYqbQwxC/wQ1uJvKvq5kWIgUg5nobEs5fOkjmCT3zX7 m4f+EScuh0vMspW1pRZK/TksMbej9DJ5q5+tir4nDylV6Sa2Ho0jpCBE3 221Q8ICVnB5ftmf3yj9M/rsUJjtOuH9szy2srtO+yVzn33C0x/1Y7EPmL 4h2p+eFreHZrpq+Roq9VjMhIxjb2SO/oFqoP60Bqif2KADDu61/f4bcqV g==; X-CSE-ConnectionGUID: m8WtiVeyQcqdyWytOUv03w== X-CSE-MsgGUID: KeuK69u2SEi/ez20Z4nX8g== X-IronPort-AV: E=McAfee;i="6800,10657,11771"; a="89890754" X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="89890754" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2026 11:49:09 -0700 X-CSE-ConnectionGUID: wFpEGzeURE6/rw7YT1dcfg== X-CSE-MsgGUID: 9ubC7sEHRl2OQPcNGkR1/A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="238323040" Received: from mjruhl-desk.amr.corp.intel.com (HELO agluck-desk3.home.arpa) ([10.124.222.13]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2026 11:49:08 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin , Chen Yu , David E Box , x86@kernel.org Cc: Christoph Hellwig , linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v6 08/10] fs/resctrl: Call architecture hooks for every mount/unmount Date: Wed, 29 Apr 2026 11:48:56 -0700 Message-ID: <20260429184858.36423-9-tony.luck@intel.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260429184858.36423-1-tony.luck@intel.com> References: <20260429184858.36423-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: 8bit Architecture code for AET needs to acquire INTEL_PMT_TELEMETRY module references on mount and release them on unmount. Add hooks for every mount/unmount of the resctrl file system so that architecture code can allocate on mount and free on unmount. Signed-off-by: Tony Luck --- include/linux/resctrl.h | 7 +++++-- fs/resctrl/rdtgroup.c | 9 +++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 9534d42e0c57..e8a87c3664db 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -552,12 +552,15 @@ void resctrl_online_cpu(unsigned int cpu); void resctrl_offline_cpu(unsigned int cpu); /* - * Architecture hook called at beginning of first file system mount attempt. + * Architecture hook called before attempting to mount the file system. * No locks are held. */ void resctrl_arch_pre_mount(void); -/* Called to report unmount. */ +/* + * Architecture hook called when mount fails, or on unmount. + * No locks are held. + */ void resctrl_arch_unmount(void); /** diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 2e31ff753114..134ad69de194 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -2790,7 +2789,7 @@ static int rdt_get_tree(struct fs_context *fc) struct rdt_resource *r; int ret; - DO_ONCE_SLEEPABLE(resctrl_arch_pre_mount); + resctrl_arch_pre_mount(); cpus_read_lock(); mutex_lock(&rdtgroup_mutex); @@ -2899,6 +2898,10 @@ static int rdt_get_tree(struct fs_context *fc) rdt_last_cmd_clear(); mutex_unlock(&rdtgroup_mutex); cpus_read_unlock(); + + if (ret) + resctrl_arch_unmount(); + return ret; } @@ -3191,6 +3194,8 @@ static void rdt_kill_sb(struct super_block *sb) kernfs_kill_sb(sb); mutex_unlock(&rdtgroup_mutex); cpus_read_unlock(); + + resctrl_arch_unmount(); } static struct file_system_type rdt_fs_type = { -- 2.53.0