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 E6CC73C1D6D; Thu, 30 Jul 2026 14:18:01 +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=1785421086; cv=none; b=bQjQSZR9mGKzG6fgJKEqr6Tjbrz+8u2w1TE+BUNRzHXGSDOAEDV30cvjPeN6CG9xzTqb5BQJS6Wf/GEK7Il5SbQLH4WcZxBKe5ERuqaW1wzi9gVXbOiZRzHy0eakpPW6LOkXNBUF0kJyoAAgRVeZocuMyKQaZ4I8V0JQRnpJ948= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785421086; c=relaxed/simple; bh=cjHCNnDaYKh9/9JCYekzHejgADMg34obaaP8uhwZgNQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NyuLYgyNQM9ZYm2jdpZWo7XQ3sOboGuW47lt44jgfGwcGP5tXxsLHQNi2fJroDxV55Wc7KPHNmQpF3Xet/6iS3FhgsrscTrHt9d1Oi/86A8uXQfhyHYG6V6Nm/Rtc2pljrJTzYOLUNjLkyYbruJCRTlRaoItozHKiiPU6WEvROM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=otfrgbs6; 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="otfrgbs6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E80791F00A3D; Thu, 30 Jul 2026 14:18:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1785421081; bh=SMyKMhlkQtRpvyTep7Pj1TU/vOP496i+IFBgc9v1kpQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=otfrgbs6SLVSdmfE14EbiAiFDr8EFZHfuksFtJ4qAgNXtMkRgzWu/laDB+U3hJ+JX ueUlf9Tn4E3ZwSMascg1yg40i3V63cM+trNucn8hW/v7ebMyYhR8/catI9Qgrtt4GS O6JAkqFmzYVPhUi9NkBrrzyrN1ngitWyqAQ/q6F0= 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 7.1 001/744] platform/x86/intel-uncore-freq: Fix current_freq_khz after CPU hotplug Date: Thu, 30 Jul 2026 16:04:34 +0200 Message-ID: <20260730141444.305917925@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260730141444.267951807@linuxfoundation.org> References: <20260730141444.267951807@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 7.1-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 7070c94324e0ed..f8137ee92e4754 100644 --- a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c +++ b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c @@ -275,15 +275,20 @@ int uncore_freq_add_entry(struct uncore_data *data, int cpu) 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