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 D10ED313E34; Sat, 30 May 2026 18:35:18 +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=1780166119; cv=none; b=HqYkRFtgXewkRzJ9j01RBk24LsLa85KYcnME1ut+30nCe3p4m8myO6rW1jiYgEZaabrcUhvZOQezsnIL1mQz7DySW7KFkcLrZKacZ7MixacLdH9I0vDWpuRSviXyaxZ17/90iRvAvNXnBBIm6hPTMQ1QsZC9wjXaKCr8hzvM73w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780166119; c=relaxed/simple; bh=84rJdSGtgKBhGNqy163o2YGqfcgUl1tvtMPQ+e2ShiM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KybU/CcX56mSnrrKixJj5PECpry94vsEftthOmLef2rDehdl79650iD8CeYtqwp8jk5jGZ3u1gCoRm1UpP7eSiIjiPJJ1y0tOIDDjKcCqkjr1a/UTwRawDvzsd3t4hzyFI8JR14YLNFPXTQMu62p41fFC2YnqlOw5RATE1Q4eG8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=cIw0jRnF; 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="cIw0jRnF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 238601F00898; Sat, 30 May 2026 18:35:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780166118; bh=5Tv3tSYEUa5aXRu2CJLO8Z6p/yIpARE2T7IMYNUUBnw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=cIw0jRnFpP42MOsBffn3XjCJR8cF4w/SpFV6xm+JLdbq5q8tYQjnHbUJecEJ7tXMu 5piETLU+TrEV8aLOtI3G5Cd1DYeO0rti+tsF3WF/dcWva5hQ2TI0PubohMnRmlHiL5 OZVlkuP+3paDREpcCCJPn4vgEhYn7YhDR6cfwibc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Mukesh Kumar Chaurasiya (IBM)" , Shrikanth Hegde , Madhavan Srinivasan Subject: [PATCH 5.10 245/589] cpuidle: powerpc: avoid double clear when breaking snooze Date: Sat, 30 May 2026 18:02:06 +0200 Message-ID: <20260530160231.436997162@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160224.570625122@linuxfoundation.org> References: <20260530160224.570625122@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-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Shrikanth Hegde commit 64ed1e3e728afb57ba9acb59e69de930ead847d9 upstream. snooze_loop is done often in any system which has fair bit of idle time. So it qualifies for even micro-optimizations. When breaking the snooze due to timeout, TIF_POLLING_NRFLAG is cleared twice. Clearing the bit invokes atomics. Avoid double clear and thereby avoid one atomic write. dev->poll_time_limit indicates whether the loop was broken due to timeout. Use that instead of defining a new variable. Fixes: 7ded429152e8 ("cpuidle: powerpc: no memory barrier after break from idle") Cc: stable@vger.kernel.org Reviewed-by: Mukesh Kumar Chaurasiya (IBM) Signed-off-by: Shrikanth Hegde Signed-off-by: Madhavan Srinivasan Link: https://patch.msgid.link/20260311061709.1230440-1-sshegde@linux.ibm.com Signed-off-by: Greg Kroah-Hartman --- drivers/cpuidle/cpuidle-powernv.c | 5 ++++- drivers/cpuidle/cpuidle-pseries.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) --- a/drivers/cpuidle/cpuidle-powernv.c +++ b/drivers/cpuidle/cpuidle-powernv.c @@ -93,7 +93,10 @@ static int snooze_loop(struct cpuidle_de HMT_medium(); ppc64_runlatch_on(); - clear_thread_flag(TIF_POLLING_NRFLAG); + + /* Avoid double clear when breaking */ + if (!dev->poll_time_limit) + clear_thread_flag(TIF_POLLING_NRFLAG); local_irq_disable(); --- a/drivers/cpuidle/cpuidle-pseries.c +++ b/drivers/cpuidle/cpuidle-pseries.c @@ -61,7 +61,10 @@ static int snooze_loop(struct cpuidle_de } HMT_medium(); - clear_thread_flag(TIF_POLLING_NRFLAG); + + /* Avoid double clear when breaking */ + if (!dev->poll_time_limit) + clear_thread_flag(TIF_POLLING_NRFLAG); local_irq_disable();