From patchwork Tue Apr 11 10:30:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Gaiser X-Patchwork-Id: 13207333 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0ADA2C76196 for ; Tue, 11 Apr 2023 10:31:14 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.519618.806585 (Exim 4.92) (envelope-from ) id 1pmBGs-0005Hl-6I; Tue, 11 Apr 2023 10:30:42 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 519618.806585; Tue, 11 Apr 2023 10:30:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pmBGs-0005He-3S; Tue, 11 Apr 2023 10:30:42 +0000 Received: by outflank-mailman (input) for mailman id 519618; Tue, 11 Apr 2023 10:30:40 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pmBGq-0005HY-7j for xen-devel@lists.xenproject.org; Tue, 11 Apr 2023 10:30:40 +0000 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id e56b8fec-d853-11ed-8611-37d641c3527e; Tue, 11 Apr 2023 12:30:37 +0200 (CEST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 9CA585C01FA; Tue, 11 Apr 2023 06:30:35 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 11 Apr 2023 06:30:35 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 11 Apr 2023 06:30:33 -0400 (EDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e56b8fec-d853-11ed-8611-37d641c3527e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= invisiblethingslab.com; h=cc:cc:content-type:content-type:date :date:from:from:in-reply-to:message-id:mime-version:reply-to :sender:subject:subject:to:to; s=fm2; t=1681209035; x= 1681295435; bh=uvIpKHbegzj4xJPF2DM2w/cwsEorqqtDcMgBzDcQiro=; b=M XRgYMx/i98nvYqN4igFeDSN8a7RAmtIwdDTTj/cwqHrzkOrZO6kl1Sht0uxQsxa+ awf/kIEfOVg9PVGUSd34h3lvxW4QzsdGcPZBcixeC6trV83NmvfitqSm81nWC/Ci jgSdgn0JovxylGbSFyR3KmZMFY5pjPYq4rJjjY04Wmcr9R6RNA1gaeZT4Z/3ElG8 DTd2iKQ5xMZZQaHbycv13Z8lZNMEhjPg9O5FAuyCpdEgRi8LPLtkfEoefJoLVq6m s2CiKi0J3Ut/19RRRQsSAaQU0XdlFRESEFRmP51+MtbGbPeIW3r4UL0C5RphgfeF 4wa6+tMQ8sAqaCGJ+o2oQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1681209035; x=1681295435; bh=uvIpKHbegzj4xJPF2DM2w/cwsEorqqtDcMg BzDcQiro=; b=K1avxbKVpjhEKX4yRjjGqz78k5/JPOdDrS3fgKY0SqX/EcEePoE nr8y7H/A1f5i8ePjjXo91IV+IPybpB8jTpR/96NGtwt4nuclMGORuD4ZCrbQUnYt aAFrT9Cq2FXEwYhTxHy5N71e6Lz1DaWRt/MXDehDCygdQoBgQ1/BOn1lEESnbo+K h9rUn7yXRl4zccj9q3kyPiAVW0f68ieT+H4DIMTzXQk2IX4JEOOtUPuJ4nniOJMl SZ95SVTk2vNbt2rYh1FXMCR7ZD4uvYMb4nHRN4hYlT6zQwEliuPsGKIQYOn/ZLwm fPi8Kf54eqCXyz2hb3m6lPZXWjoRY7c7rLw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdekgedgvdekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffggfvvefhufgtsehgtderredttdejnecuhfhrohhmpefuihhmohhnucfi rghishgvrhcuoehsihhmohhnsehinhhvihhsihgslhgvthhhihhnghhslhgrsgdrtghomh eqnecuggftrfgrthhtvghrnhepheegfeelteekieeuvdduvdffheetieeiheelgfeiheff veefhffhgfejveevieehnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsihhmohhnsehinhhv ihhsihgslhgvthhhihhnghhslhgrsgdrtghomh X-ME-Proxy: Feedback-ID: idc5945a3:Fastmail Message-ID: Date: Tue, 11 Apr 2023 12:30:10 +0200 MIME-Version: 1.0 Content-Language: en-US To: xen-devel Cc: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= From: Simon Gaiser Subject: RFC: disable HPET legacy mode after timer check Hi, I have been recently looking into getting S0ix working on Xen [1]. Thanks to a tip from Andrew I found that the HPET legacy mode was preventing my test system from reaching a package C-state lower than PC7 and thereby also preventing S0ix residency. For testing I simply modified check_timer() to disable it again after it checked the timer irq: With this [2] I'm able to reach S0ix residency for some time and for short periods the systems power consumption goes down to the same level as with native Linux! It reaches low power states only for a fraction of the suspend to idle time, so something still makes the CPU/chipset think it should leave the low power mode, but that's another topic. I tried to understand how all the timer code interacts with disabling the legacy mode. I think it only would break cpuidle if X86_FEATURE_ARAT is not available (Which is available on my test system and indeed I didn't run into obvious breakage). Is this (disabled PIT && !ARAT) a configuration that exists (and needs to be supported)? Did I miss something else? (Very much possible, given that this is way above my existing experience with X86 and Xen internals.) Simon [1]: https://lore.kernel.org/xen-devel/9051e484-b128-715a-9253-48af8e47bb9d@invisiblethingslab.com/ [2]: Plus [3] and some hack to have mwait-idle on Tiger Lake. [3]: https://lore.kernel.org/xen-devel/20230313134102.3157-1-simon@invisiblethingslab.com/ --- a/xen/arch/x86/io_apic.c +++ b/xen/arch/x86/io_apic.c @@ -1966,6 +1969,8 @@ static void __init check_timer(void) if ( timer_irq_works() ) { + hpet_disable_legacy_replacement_mode(); local_irq_restore(flags); return; }