Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp1129348rdg; Fri, 11 Aug 2023 10:34:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEzjOwMx/KTOk0IZT7Mrwn/W0zFo5/J/J1RO9GGs8jROXaD8JuMttUg0CK/QJc3Sx11i53F X-Received: by 2002:a17:906:3f48:b0:99d:6eea:8e34 with SMTP id f8-20020a1709063f4800b0099d6eea8e34mr2086536ejj.75.1691775291938; Fri, 11 Aug 2023 10:34:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691775291; cv=none; d=google.com; s=arc-20160816; b=vM+vymITLTU6DN2Xg2ivXdLyGY/R2kDXtGxK8i9jWNURUCe2i/mdfnL2ECCzx7Aywy elZkTLUSdBbSPzfMAwwDIiH4ULJDof+tDseyMwVjBGn/jJJbuHiI1lcDkmQT86OSSuKG yVact5hXKTjQM4og4M9epqnrKZWuvZfz4G3KX1Yl1x6002wCyhkC3q0Pp+ZEEQmV/fBV +1bx5NIMdXKELizTs3RGtCZwptDNzwnaJoYQ6o/dkE9IrWXfU7cBwZ+q0KX7buZG3dSd 4SYx2Qz64jxMf1eqxay8IsjkejxJxKe6ndwCrjzWz2uipaCcPpL1rrfDaxKsZo0ljWUB GtoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IJRHoT4fhes4GgaWroXMPjpCYA8l4Ixor+bhxWQVlig=; fh=B15Ov2cShcY+dslvQFXR3OOrlAZYP5T4L/0y7SElBZE=; b=0mp2UKJGcV1sGjqplTjvlFYti6ZeSe2uIDy15g/eBfQ4BRge3TtmwYFZkab3X3sKVD FpmKm/zVyPm/NyEUQ41mkHO6AXb6pmrnsr6xCDsN9uKN/i3cmACuTPfEfU/zM/XKImG9 JNq84KEO4LMdRvHVOukIKkebZUwUHdb5F+Gw81OsFXc4wRBYKWAl290EBBNaVx7Y9MiJ wh8wqPIZeco/riC9ydcTVW6GvlYGQyjMtgR03edXzEOiMWyGLygV3+FUSbxKgJru65TG 4fj/rI21KJzDdo+1+O1ETuAH5vxaWyw1rkC5V9NPSIgk9dUljUaBHVLkj6Yp2AXUwCiD MIhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tsZvUQ8y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rh22-20020a17090720f600b00977d04a8fd4si3339062ejb.1054.2023.08.11.10.34.20; Fri, 11 Aug 2023 10:34:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tsZvUQ8y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231426AbjHKRBq (ORCPT + 99 others); Fri, 11 Aug 2023 13:01:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236258AbjHKRBT (ORCPT ); Fri, 11 Aug 2023 13:01:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D34C30F4 for ; Fri, 11 Aug 2023 10:01:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B406B65816 for ; Fri, 11 Aug 2023 17:01:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A9C4C433CC; Fri, 11 Aug 2023 17:01:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691773275; bh=MZmgDtu6USFXQ4e5nMMY/JREFBhjkYnO2RkDI2BMkjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tsZvUQ8ySYF4A2/3RW0XnSo8R5YkRZYqdUrubU/I4yprZB7EkuAc8o0ZDWS6CgdIj /pti4fyBFMT4Sv5SBTP1DZ9IRU8YcGYdjcDmsKDoZ/rHHBT5zmVCoPU9Q3MjhOn8/C E9AuFAiCgmS2cl/iDyxSVbPN47DpkxdEM6o8+FBYHd0GnoMFW3PT3fUriTZ71egoNH by8fx8X7n9VDlixdvztUxnZdl4Hwp0qoCeTXDXltjXgxrB/tHMV9Q2f0oVRYsGAPD4 xUhRjxJQ6Bdp+cro5zKPo1PCtBsS9f+d30qWxh2lr1VXdSqk/+Te1ThPAtMV016YG5 4HiBbDkUAESlA== From: Frederic Weisbecker To: LKML Cc: Frederic Weisbecker , Len Brown , Peter Zijlstra , "Rafael J . Wysocki" , Daniel Lezcano , Thomas Gleixner , Anna-Maria Behnsen Subject: [PATCH 09/10] x86: Remove the current_clr_polling() call upon mwait exit Date: Fri, 11 Aug 2023 19:00:48 +0200 Message-Id: <20230811170049.308866-10-frederic@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230811170049.308866-1-frederic@kernel.org> References: <20230811170049.308866-1-frederic@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org mwait_idle_with_hints() is mostly called from cpuidle which already sets back TIF_NR_POLLING and fold TIF_NEED_RESCHED if necessary. The only non-cpuidle caller is power_saving_thread() which acts as an idle loop and is the only reason why mwait_idle_with_hints() carries a costly fully ordered atomic operation upon idle exit. Make this overhead proper to power_saving_thread() instead which already duplicates quite some cpuidle code. Signed-off-by: Frederic Weisbecker --- arch/x86/include/asm/mwait.h | 1 - drivers/acpi/acpi_pad.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/include/asm/mwait.h b/arch/x86/include/asm/mwait.h index 920426d691ce..c1be3775b94a 100644 --- a/arch/x86/include/asm/mwait.h +++ b/arch/x86/include/asm/mwait.h @@ -134,7 +134,6 @@ static __always_inline void mwait_idle_with_hints(unsigned long eax, unsigned lo } } } - current_clr_polling(); } /* diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index 7a453c5ff303..5a44afafe185 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c @@ -174,6 +174,7 @@ static int power_saving_thread(void *data) stop_critical_timings(); mwait_idle_with_hints(power_saving_mwait_eax, 1); + current_clr_polling(); start_critical_timings(); tick_broadcast_exit(); -- 2.34.1