From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 95B9F211A2A; Wed, 7 May 2025 18:50:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746643855; cv=none; b=Hb465Cb9HzGfvB+EyNXgIronLlDWTooMqfPsPIkTJrocr7/BGQXw3yL5WtXwxHoSSsRkXRXg47KL+tk53eR+Q9GzEf0qPOR3jahsGt2GCoj49dgd1Opuz4NSssyfItwhPleIkvdxHlI1W7M4ExwqUeZkTpmcvdK/cxZ87wmU36U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746643855; c=relaxed/simple; bh=ARrZNclFeMQQu8NQViiU8P79UMRTsGuZMFeK7/64S3Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=P4kFlh73ArHEOuXBgnZUpULb8xkPFx/byRutEH9DEyv0et7j5F5DfBd8kv+RamM9NdsObgTMcMFm/BNWY4tjyl/lYjIf7duNA466VEjlIzR7iEQuHk7v36/oXyh90bj4GqJRJWwWY6w8rZAnX9eC18wnYSVRlufmdGVSxegCEDI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=WgmnTRmx; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="WgmnTRmx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7D18C4AF0C; Wed, 7 May 2025 18:50:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1746643855; bh=ARrZNclFeMQQu8NQViiU8P79UMRTsGuZMFeK7/64S3Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WgmnTRmxaCsRDyMUijEIabeAHSLvQSAmPIomh4AEfCmSlhfHj7TJbUAYuMCBDBnXp Bhzd+TzOZpuR/lBG7VBEK26HVtFQa5jiqTYwS+9Ed0S1kky6W3AfyudWPrASw8/ytV mATplfagB3rlY2djcCqphuijLoMZR2XnNxRzvHKQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Shouye Liu , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 6.14 039/183] platform/x86/intel-uncore-freq: Fix missing uncore sysfs during CPU hotplug Date: Wed, 7 May 2025 20:38:04 +0200 Message-ID: <20250507183826.278831046@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250507183824.682671926@linuxfoundation.org> References: <20250507183824.682671926@linuxfoundation.org> User-Agent: quilt/0.68 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.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Shouye Liu commit 8d6955ed76e8a47115f2ea1d9c263ee6f505d737 upstream. In certain situations, the sysfs for uncore may not be present when all CPUs in a package are offlined and then brought back online after boot. This issue can occur if there is an error in adding the sysfs entry due to a memory allocation failure. Retrying to bring the CPUs online will not resolve the issue, as the uncore_cpu_mask is already set for the package before the failure condition occurs. This issue does not occur if the failure happens during module initialization, as the module will fail to load in the event of any error. To address this, ensure that the uncore_cpu_mask is not set until the successful return of uncore_freq_add_entry(). Fixes: dbce412a7733 ("platform/x86/intel-uncore-freq: Split common and enumeration part") Signed-off-by: Shouye Liu Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20250417032321.75580-1-shouyeliu@gmail.com Reviewed-by: Ilpo Järvinen Signed-off-by: Ilpo Järvinen Signed-off-by: Greg Kroah-Hartman --- drivers/platform/x86/intel/uncore-frequency/uncore-frequency.c | 13 ++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) --- a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency.c +++ b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency.c @@ -146,15 +146,13 @@ static int uncore_event_cpu_online(unsig { struct uncore_data *data; int target; + int ret; /* Check if there is an online cpu in the package for uncore MSR */ target = cpumask_any_and(&uncore_cpu_mask, topology_die_cpumask(cpu)); if (target < nr_cpu_ids) return 0; - /* Use this CPU on this die as a control CPU */ - cpumask_set_cpu(cpu, &uncore_cpu_mask); - data = uncore_get_instance(cpu); if (!data) return 0; @@ -163,7 +161,14 @@ static int uncore_event_cpu_online(unsig data->die_id = topology_die_id(cpu); data->domain_id = UNCORE_DOMAIN_ID_INVALID; - return uncore_freq_add_entry(data, cpu); + ret = uncore_freq_add_entry(data, cpu); + if (ret) + return ret; + + /* Use this CPU on this die as a control CPU */ + cpumask_set_cpu(cpu, &uncore_cpu_mask); + + return 0; } static int uncore_event_cpu_offline(unsigned int cpu)