From patchwork Mon Feb 24 07:43:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: WangYuli X-Patchwork-Id: 13987514 Received: from smtpbgsg1.qq.com (smtpbgsg1.qq.com [54.254.200.92]) (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 107F0134AB; Mon, 24 Feb 2025 07:47:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=54.254.200.92 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740383282; cv=none; b=A+48xRjumtX5VRMdcSuB/0ILZ3GSYsFqyVLGGfraI9lUooEYz02867xk3FTXBEvUo3Fn+BqGVy2TLXWXqUkx+76QsCPVkrjR6RM7slxaeDrIZUoTe3Wlz/kW3gY7Bv8ShEJPoLa0g0/ffiXd5kNXg7IBBCWsJ4kAXwwXYHBscEk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740383282; c=relaxed/simple; bh=QgMoDqFA4Xm41gdv7f4UTTcLqqWKoOdtzL+m3RfcUu0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=toLHSnxwyyz1YptaPrkTnMLkqf7kmtu6XDKsbUzYPlIER3WxJU+jCLAW/rC/gRwII2nmy4cfBTnXm7EGQngsGEVvxFrTyFHe58dsIRIiIs00JnYcceiKtjcoiRwoONg5ZJZGq4Q2UwYBaTUkp7nf28s10lqJ3SS2e+JCV2X0p1A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uniontech.com; spf=pass smtp.mailfrom=uniontech.com; dkim=pass (1024-bit key) header.d=uniontech.com header.i=@uniontech.com header.b=TFGJj6fQ; arc=none smtp.client-ip=54.254.200.92 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uniontech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=uniontech.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=uniontech.com header.i=@uniontech.com header.b="TFGJj6fQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uniontech.com; s=onoh2408; t=1740383109; bh=Jf6ITo4s7xR7v45XyJbqqJSz6q1dIgPfXfKuSzS6Ki4=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=TFGJj6fQ9wPoOoam22GCZPy68sjQSlMvRE4PofrlHym4tMh5liBke8sXRC1aH5sJ6 Pd05tPzKfAKQ1ggmLEnDsXGy+glF8X6LZ8Ns0rX28QIrQTyODnuzfJiLvVFat8yBlt IiAlYr10W7zolh42m17/hzDxpartih0kgm8U1i1M= X-QQ-mid: bizesmtpip4t1740383055tuh3phr X-QQ-Originating-IP: qNhz+YbDATmHpQzl00uFaa4wQn8B9O7SEGBWcl535dQ= Received: from localhost.localdomain ( [localhost]) by bizesmtp.qq.com (ESMTP) with id ; Mon, 24 Feb 2025 15:44:12 +0800 (CST) X-QQ-SSF: 0002000000000000000000000000000 X-QQ-GoodBg: 1 X-BIZMAIL-ID: 16862361414539914337 From: WangYuli To: rafael@kernel.org, pavel@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, zhanjun@uniontech.com, niecheng1@uniontech.com, chenlinxuan@uniontech.com, WangYuli , Huacai Chen , Wentao Guan Subject: [RFC PATCH] x86 / hibernate: Eliminate the redundant smp_ops.play_dead assignment Date: Mon, 24 Feb 2025 15:43:57 +0800 Message-ID: X-Mailer: git-send-email 2.47.2 Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtpip:uniontech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oriTAfclYFg9Q1N1lqb6PT57OoJuB 7z/EDShEqQm1lc2ByoRuuPps8VeJWiJAC0eKDEbAjFSwCRoUkJzOhK3+CEZk4= X-QQ-XMRINFO: MPJ6Tf5t3I/ycC2BItcBVIA= X-QQ-RECHKSPAM: 0 It's unnecessary to re-initialize smp_ops.play_dead to play_dead as it naturally goes back to play_dead in the freshly booted kernel upon device resume. Suggested-by: Huacai Chen Co-developed-by: Wentao Guan Signed-off-by: Wentao Guan Signed-off-by: WangYuli --- arch/x86/power/cpu.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c index 63230ff8cf4f..023cf9421467 100644 --- a/arch/x86/power/cpu.c +++ b/arch/x86/power/cpu.c @@ -297,9 +297,6 @@ static void __noreturn resume_play_dead(void) int hibernate_resume_nonboot_cpu_disable(void) { - void (*play_dead)(void) = smp_ops.play_dead; - int ret; - /* * Ensure that MONITOR/MWAIT will not be used in the "play dead" loop * during hibernate image restoration, because it is likely that the @@ -316,13 +313,11 @@ int hibernate_resume_nonboot_cpu_disable(void) * resume) sleep afterwards, and the resumed kernel will decide itself * what to do with them. */ - ret = cpuhp_smt_enable(); + int ret = cpuhp_smt_enable(); if (ret) return ret; smp_ops.play_dead = resume_play_dead; - ret = freeze_secondary_cpus(0); - smp_ops.play_dead = play_dead; - return ret; + return freeze_secondary_cpus(0); } #endif