From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 B65D2432E65; Thu, 30 Jul 2026 14:17:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785421071; cv=none; b=DskVGP0t3Vhr4ublnHYCd6y3nxsEtneGwyOR1TlRmPpXfnDyMm8dShZHqN0/hmiwjrxfcKG0Kv8aVJPjmVSTuW3X+H//gXDG1EKh33qOhZnvozTpU8hU7HpCjYmNBWdAKkkJNT2nJfQsCdMZfSEL2h6iVS+mfppjsgANQjifdH4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785421071; c=relaxed/simple; bh=i3P/tU3PmwnGhcviNFIvbz/kSSluc2ukYBy7R8zttAQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LvoQzzSME1zQNbk5I39D+nfHM+SWNPHb6xHzpCOytriBNtNmniUiYgzD9TD6BPQ7vu4ZqrCgk87PYB0cduP3WeRZwZlC2UiieRbu4YbjhjMBeXrCfAevkO1tF6+8GYAAFgibY6+aNDwopIVOxxs42G982AlHLLARk36g6FZqfHE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=KsGv/1Fo; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="KsGv/1Fo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A47A1F00A3D; Thu, 30 Jul 2026 14:17:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1785421069; bh=XafiF2sNhTllvwSSdmyg1asAFawPZ7yFIGrDSS9fCaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=KsGv/1FoIrZAKU/Tt08wNGQcjfMyBILPCFcLtFngqL0yB5P3hI01ZbEDH3PtZCiMF w8/1oJFygQ9SlCEirf66DzFZEooNdLf+vf+jTL8CKyQbmvttK7WWRptukrV0z6Wve5 +vPL0nB5DFAbiFrksf04tBKsFMM4iW1IxpVNvkio= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Srinivas Pandruvada , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Guixiong Wei , Sasha Levin Subject: [PATCH 6.18 001/675] platform/x86/intel-uncore-freq: Fix current_freq_khz after CPU hotplug Date: Thu, 30 Jul 2026 16:05:31 +0200 Message-ID: <20260730141445.146060347@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260730141445.110192266@linuxfoundation.org> References: <20260730141445.110192266@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Guixiong Wei commit 6b63520ed14b17bbe9c2103debbd2152dde1fba3 upstream. When the last CPU of a legacy uncore die goes offline, uncore_freq_remove_die_entry() clears control_cpu. During CPU hotplug re-add, uncore_freq_add_entry() still populates sysfs attributes before assigning the new control CPU. As a result, the current frequency read returns -ENXIO and current_freq_khz is omitted from the recreated sysfs group. Assign control_cpu before the initial read paths and before create_attr_group() so sysfs recreation uses the new online CPU. If sysfs creation fails, restore control_cpu to -1 to keep the error path state consistent. Fixes: 4d73c6772ab7 ("platform/x86: intel-uncore-freq: Conditionally create attribute for read frequency") Cc: stable@vger.kernel.org Acked-by: Srinivas Pandruvada Link: https://patch.msgid.link/20260602020752.3126-1-weiguixiong@bytedance.com Reviewed-by: Ilpo Järvinen Signed-off-by: Ilpo Järvinen Signed-off-by: Guixiong Wei Signed-off-by: Sasha Levin --- .../x86/intel/uncore-frequency/uncore-frequency-common.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c index 65897fae17dfba..6091b617480ff6 100644 --- a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c +++ b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c @@ -274,15 +274,20 @@ int uncore_freq_add_entry(struct uncore_data *data, int cpu) sprintf(data->name, "package_%02d_die_%02d", data->package_id, data->die_id); } + /* + * Set the control CPU before any read path so entry recreation after CPU + * hotplug can populate read-only attributes from the new online CPU. + */ + data->control_cpu = cpu; uncore_read(data, &data->initial_min_freq_khz, UNCORE_INDEX_MIN_FREQ); uncore_read(data, &data->initial_max_freq_khz, UNCORE_INDEX_MAX_FREQ); ret = create_attr_group(data, data->name); if (ret) { + data->control_cpu = -1; if (data->domain_id != UNCORE_DOMAIN_ID_INVALID) ida_free(&intel_uncore_ida, data->instance_id); } else { - data->control_cpu = cpu; data->valid = true; } -- 2.53.0