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 CDFF431619D for ; Mon, 15 Jun 2026 18:25:10 +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=1781547912; cv=none; b=Nh1d4BCiTgYQ/TGpHZw3ohRqpQdFe4m3SwxGlYA4Hm+3aV3TL4yKVRADUvCvNJ8X82zmdCuIMUbxfocz8/gvvdNfvonM6Yn9Qg4QUyNsPhLMhDFr9/JL4uIBZ5oDVvcCsBs24QHGXYfom9KqxFypLRKQTz+yygcwi56ZXGkjSOY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781547912; c=relaxed/simple; bh=0iKcIZsqX45bD5N+at4BI0K+0YFsdRGRBhddBITR9bM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VkadkQgzhve1TfsiSaLa7kNHYA/njAGbptcLJ62YmfH0eNpqAiejMAeOoC/bXzDbXM4YQCHdA0WqiSwXGNV3nqA2Noho2SQNbq+Zr2fLmbttCuHl+RJxScSizh6ceCCnY8D9JI0G3HZCAhfEtjreyP4Jg6hRL+hzIJaeZqDLssE= 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=YZ/KOCnw; 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="YZ/KOCnw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1781547911; x=1813083911; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0iKcIZsqX45bD5N+at4BI0K+0YFsdRGRBhddBITR9bM=; b=YZ/KOCnwgWM13ave5+fB/IXo1ODUZVZ9UwpPtg/z4l7vWzss1yICg8TG f0QgTHiJVwf/Qfb33IJoMnS3/z8LM1skuu00DeEvJ/GRD1JyEn8x1wITB S5Hai/pisv5irctHl5XDbRkvPe79bARWg/VIyYkHc8KhmK+CLibEXqyEK 6LolzCeBQsydgrrRCpA+UFZi5L+u6vHagLyMZ84WAPXRciFzMbqrskpVZ lIoMkUzBByRAK2/uZhA+4ybUs0bHXflyllEnkpau0pY9FHfwrAP8Zg4Uc s8ypEXLA5BcPQz8v2iShN+0B0PGhwPeUWwoho74zNWE+lmSCVvJ7tyvch g==; X-CSE-ConnectionGUID: FcRa6wm4SBSTCl+nyelsjQ== X-CSE-MsgGUID: HxvQrEHDTZumWH188pny0g== X-IronPort-AV: E=McAfee;i="6800,10657,11818"; a="93789957" X-IronPort-AV: E=Sophos;i="6.24,206,1774335600"; d="scan'208";a="93789957" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2026 11:25:08 -0700 X-CSE-ConnectionGUID: PJAP5uxIRBCBVnijK3BMRw== X-CSE-MsgGUID: ehw1ztdFRZeM5dMTtITsiQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.24,206,1774335600"; d="scan'208";a="247620619" Received: from spandruv-desk1.amr.corp.intel.com (HELO agluck-desk3.intel.com) ([10.124.221.121]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2026 11:25:07 -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 v8 05/16] platform/x86/intel/pmt: Prevent unbind of PMT telemetry driver Date: Mon, 15 Jun 2026 11:24:46 -0700 Message-ID: <20260615182457.14725-6-tony.luck@intel.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260615182457.14725-1-tony.luck@intel.com> References: <20260615182457.14725-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 The resctrl AET code uses intel_pmt_get_regions_by_feature() (exported by the pmt_telemetry module) to obtain pmt_feature_group instances that are populated using data from the pmt_discovery module. The returned telemetry_region::addr values are MMIO mappings created in the telemetry driver's probe path, and resctrl reads from them while a mount is active. However, a user can unbind the auxiliary driver from its device via the sysfs "unbind" attribute. Unbinding the telemetry driver would tear down the MMIO mappings, leaving resctrl with stale pointers and causing a fault on the next access. It is safe for the discovery driver to be unbound. It does all its work at initial probe time and saves a copy of the features and RMID count. Set device_driver::suppress_bind_attrs in the telemetry driver so that the "bind" and "unbind" sysfs attributes are not exposed and the user cannot detach the driver from its devices while resctrl (or any other in-kernel consumer) may be using the resources. Fixes: 1fb2daa60de6 ("x86/resctrl: Discover hardware telemetry events") Assisted-by: Claude:Opus-4.7 Signed-off-by: Tony Luck -- v8: New patch --- drivers/platform/x86/intel/pmt/telemetry.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/platform/x86/intel/pmt/telemetry.c b/drivers/platform/x86/intel/pmt/telemetry.c index bdc7c24a3678..daa6da9bad2a 100644 --- a/drivers/platform/x86/intel/pmt/telemetry.c +++ b/drivers/platform/x86/intel/pmt/telemetry.c @@ -421,6 +421,9 @@ static struct auxiliary_driver pmt_telem_aux_driver = { .id_table = pmt_telem_id_table, .remove = pmt_telem_remove, .probe = pmt_telem_probe, + .driver = { + .suppress_bind_attrs = true, + }, }; static int __init pmt_telem_init(void) -- 2.54.0