From nobody Mon Mar 23 19:51:59 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1773334495; cv=none; d=zohomail.com; s=zohoarc; b=Cnw4tbsHaP2okzlTS2iTHJVsf1/3Sr84phmonRWyMmECpjjtI22UqFxr9Z8HbfkE5qDVFFyuv+6CG4GFA/jRpYFGB0ElDXedgmHSdRvbMDg4FFumZGEPWpYMcF3Yb1501NhwVj11U0buqbADsbB1SnQpTmXpivuXN/V92u0Hmf8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773334495; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=dmoB6PX7E346IlhtAnwu7loC1BtwOSw/XEBFSLwwDtY=; b=LEcxqeX6IWsDotaW0qWIqXfXaanl/9d10r4c/ZbWSavGuzaIgwT6xTqEjQAos7bZkD+LoxUjIfW6A2GGCS4ZeDH3ENbwoSNEfyHXojbf2w2AKTR1tv75b4lymmZPRGDSjYLlHOi/lRX1YuLb1p6zQUrT7jiwKnlr07K1n4RJ2pQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1773334495492310.7216478435764; Thu, 12 Mar 2026 09:54:55 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1252746.1549308 (Exim 4.92) (envelope-from ) id 1w0jJ0-00080g-1C; Thu, 12 Mar 2026 16:54:38 +0000 Received: by outflank-mailman (output) from mailman id 1252746.1549308; Thu, 12 Mar 2026 16:54:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w0jIz-00080W-Rj; Thu, 12 Mar 2026 16:54:37 +0000 Received: by outflank-mailman (input) for mailman id 1252746; Thu, 12 Mar 2026 16:54:36 +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 1w0jIy-0007oX-6x for xen-devel@lists.xenproject.org; Thu, 12 Mar 2026 16:54:36 +0000 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [2a00:1450:4864:20::329]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 24c33f1e-1e34-11f1-9ccf-f158ae23cfc8; Thu, 12 Mar 2026 17:54:33 +0100 (CET) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-485392de558so7899425e9.1 for ; Thu, 12 Mar 2026 09:54:33 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4854e2537c3sm130839255e9.15.2026.03.12.09.54.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Mar 2026 09:54:31 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 24c33f1e-1e34-11f1-9ccf-f158ae23cfc8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1773334472; x=1773939272; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=dmoB6PX7E346IlhtAnwu7loC1BtwOSw/XEBFSLwwDtY=; b=alFQUu+/YbCrNDl2LsdSAiAbljmNzUAZTnKIIEiMSQMlokUkSDGPXZvbwzcLxmheiv ZhoWAbkGEr1BKgfEG/qK7bS2Uo/qF3NMB8j69Uq7Hh2Mu21rM12+7by4lOrELM/klKzQ tfbvOey4adGG1faI91n+ViX+7JBe1v2OQiCIjQWKSFKThKLow/SZKFdOmu9p8yVedc4b 2lu2LSop8sZ7lFwo505eMMh5//hL3RfjDYXHeVamwXWWmFDGUImdXydVCgfptz/jMg0B iCH1k9M6wbOubkVQeKIhg7tNImujlarEpYk5DRV//inmRojsLFTPYf/Z0K3ojds241Tl qHNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773334472; x=1773939272; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=dmoB6PX7E346IlhtAnwu7loC1BtwOSw/XEBFSLwwDtY=; b=l7simorpG+vB12wmpC09UeVVf51RwlvL6/jWnBnLQ01iv2C78zrc20/C/No3sjoVCV p+Ul6fjRIeVOnVIkoz4yW48okgVHNoEQN8UJxcxIjraKpmtQo1Zq/a/fOc9TleqXZt5C dQazl8X+JWteAXBitTgaX3pnHk/CCP23KZt+bdCOinkOGtQUW78gstfIzcNEVQFXybjv 5klHVStqm9NrH+FdRBpM+kV66z5jNquaNAzKIzX5XUO/xdiCNOSnQP00w0Czlv3FTDNY G1n+kV5GZfqaTTsuOtubUT1vydPcNc8Vh4tOIjyGg4yyqkl03eJZsx7pwmPYCaD/Yqvx 9n3g== X-Gm-Message-State: AOJu0YwZZaTFfl3b+1bqYQGiZ5xNAU0/w5nHXvrMW97VVcE3mNsgI4IW fBDnVp5VIgtYERJf6Gwg9nRh29S+bsZ5xaDmgAvrxgcnWv9xWjLMz2ZgZlZsdHsWH40XGYVS5k0 81ks= X-Gm-Gg: ATEYQzymRYQPNBLSpUrd6wXSJzmpR2AtNUU8SDFWNV4MA3KeERF3SuZHcoq1xWCsgoT HRu06ccHe82pconInj+n0KxNgmeyf6yO6sosYyFQDbSL1lToVwHzymI6sbygCzYZ/atV6Dy15r/ ZsqdevTERGaKM8KtgdEndejKALWxmJJc/sikXX5dbEBASvOu+VV7oG4TBEN+715lTK+1bZNlg8D Q83b1geOmcSmHcRNaUK94t/SRjVyWOgcVNNjHufwOGBaJ5QQjSKmC6HnnhVcJl7siTPl68++y+E oFki39ui0L+bC5hTqzTbe8E1K8Tbm1GHgDaaOjSEGR/EDm2ENZh54+ci5P6VWdPavWN8tp+pfOm NKTIbMi58BYmrq4gHOInveYTKCyRYMswS8ZGyhuC5SqmZ8zO9jhT8TIqRw/YUrc/jKGaaJMb+RX NDEFb2zVKKwTTXjFiQIAziV1261MGnQrLtYeuCjPi6rP/CHJYcYxst4O9QTvxaFkFcDTENWOH7+ e3rdwpGlsjmXEI= X-Received: by 2002:a05:600c:45cb:b0:483:703e:4ad5 with SMTP id 5b1f17b1804b1-4854b109d3fmr114189105e9.22.1773334472428; Thu, 12 Mar 2026 09:54:32 -0700 (PDT) Message-ID: Date: Thu, 12 Mar 2026 17:54:30 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 1/9] x86/mwait-idle: arrange for BSP MSR adjustments during S3 resume From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= References: <7b7a677e-a5b9-42c8-beec-3c506b4eac52@suse.com> Content-Language: en-US Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <7b7a677e-a5b9-42c8-beec-3c506b4eac52@suse.com> Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1773334497521158501 Content-Type: text/plain; charset="utf-8" mwait_idle_cpu_init() is only called for APs, yet MSR writes will typically need re-doing post-S3 even for the BSP. When multiple cores / threads are present (and to come back online) in a package, for package scope MSRs this may be covered by APs doing the writes, but we can't rely on that. Signed-off-by: Jan Beulich --- a/xen/arch/x86/acpi/power.c +++ b/xen/arch/x86/acpi/power.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -299,6 +300,7 @@ static int enter_state(u32 state) acpi_sleep_post(state); if ( hvm_cpu_up() ) BUG(); + mwait_idle_resume(); cpufreq_add_cpu(0); =20 enable_cpu: --- a/xen/arch/x86/cpu/mwait-idle.c +++ b/xen/arch/x86/cpu/mwait-idle.c @@ -1680,6 +1680,28 @@ static int __init mwait_idle_probe(void) return 0; } =20 +static void mwait_idle_cpu_tweak(unsigned int cpu) +{ + if (icpu->auto_demotion_disable_flags) + on_selected_cpus(cpumask_of(cpu), auto_demotion_disable, NULL, 1); + + if (icpu->byt_auto_demotion_disable_flag) + on_selected_cpus(cpumask_of(cpu), byt_auto_demotion_disable, NULL, 1); + + switch (icpu->c1e_promotion) { + case C1E_PROMOTION_DISABLE: + on_selected_cpus(cpumask_of(cpu), c1e_promotion_disable, NULL, 1); + break; + + case C1E_PROMOTION_ENABLE: + on_selected_cpus(cpumask_of(cpu), c1e_promotion_enable, NULL, 1); + break; + + case C1E_PROMOTION_PRESERVE: + break; + } +} + static int cf_check mwait_idle_cpu_init( struct notifier_block *nfb, unsigned long action, void *hcpu) { @@ -1762,24 +1784,7 @@ static int cf_check mwait_idle_cpu_init( dev->count++; } =20 - if (icpu->auto_demotion_disable_flags) - on_selected_cpus(cpumask_of(cpu), auto_demotion_disable, NULL, 1); - - if (icpu->byt_auto_demotion_disable_flag) - on_selected_cpus(cpumask_of(cpu), byt_auto_demotion_disable, NULL, 1); - - switch (icpu->c1e_promotion) { - case C1E_PROMOTION_DISABLE: - on_selected_cpus(cpumask_of(cpu), c1e_promotion_disable, NULL, 1); - break; - - case C1E_PROMOTION_ENABLE: - on_selected_cpus(cpumask_of(cpu), c1e_promotion_enable, NULL, 1); - break; - - case C1E_PROMOTION_PRESERVE: - break; - } + mwait_idle_cpu_tweak(cpu); =20 return NOTIFY_DONE; } @@ -1811,6 +1816,14 @@ int __init mwait_idle_init(struct notifi return err; } =20 +void mwait_idle_resume(void) +{ + if (!icpu) + return; + + mwait_idle_cpu_tweak(smp_processor_id()); +} + /* Helper function for HPET. */ bool __init mwait_pc10_supported(void) { --- a/xen/arch/x86/include/asm/mwait.h +++ b/xen/arch/x86/include/asm/mwait.h @@ -14,9 +14,12 @@ #define MWAIT_ECX_INTERRUPT_BREAK 0x1 =20 void mwait_idle_with_hints(unsigned int eax, unsigned int ecx); + #ifdef CONFIG_INTEL +void mwait_idle_resume(void); bool mwait_pc10_supported(void); #else +static inline void mwait_idle_resume(void) {} static inline bool mwait_pc10_supported(void) { return false; From nobody Mon Mar 23 19:51:59 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1773334514; cv=none; d=zohomail.com; s=zohoarc; b=aXSjtOlRH7TkR6jFsssD/EM4acMDrrelIPzpBGGglOQwP/dqArCLfk1/zE13d53p/Uzop7Mi9pAwrYE4YL4OO13yZBpQQauVvrGcd4kEiaEcRRA1Ym136PoQ9YsS8c8h1DrBloQ+UjAnAuOwgMFU3ngu2RtdmHCXrqxyyKN9S/8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773334514; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=R5UX7rhqlDYYvqPxFRQg96W4qwOAL8dxcHZMY3uLDNc=; b=N1EGJC7ZZ84WRSOJq2rYeA4BwlTL30VRBH+k3YkFQkE1KNon0C+fpURHIMlYzxPn7BzK4Kul7PVzLVVsRqtFA94ivpqY3ALr2mrWg69cfBbzjyYpqmrQw9ZJn2VFpEj/nZzOlTif7kBXxJ87OPS9tKLhy15eXfqRd2ygOcNFFoI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1773334514975244.9193976501175; Thu, 12 Mar 2026 09:55:14 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1252755.1549315 (Exim 4.92) (envelope-from ) id 1w0jJO-0008QD-5P; Thu, 12 Mar 2026 16:55:02 +0000 Received: by outflank-mailman (output) from mailman id 1252755.1549315; Thu, 12 Mar 2026 16:55:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w0jJO-0008Q6-2S; Thu, 12 Mar 2026 16:55:02 +0000 Received: by outflank-mailman (input) for mailman id 1252755; Thu, 12 Mar 2026 16:55:01 +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 1w0jJN-0007oX-5H for xen-devel@lists.xenproject.org; Thu, 12 Mar 2026 16:55:01 +0000 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [2a00:1450:4864:20::42f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 3469e879-1e34-11f1-9ccf-f158ae23cfc8; Thu, 12 Mar 2026 17:54:59 +0100 (CET) Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-439b9cf8cb5so1397636f8f.0 for ; Thu, 12 Mar 2026 09:54:59 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-439fe2187aasm8766001f8f.30.2026.03.12.09.54.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Mar 2026 09:54:57 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 3469e879-1e34-11f1-9ccf-f158ae23cfc8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1773334499; x=1773939299; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=R5UX7rhqlDYYvqPxFRQg96W4qwOAL8dxcHZMY3uLDNc=; b=a7VUtB1184aqabHp4Dvm4UelGYdqdKthkAQxEm4OFy+hrAEU0VuE0ADfYvscDLVLzK A4gxMD/C/QVQfFYLm1dJ9lVjT+CGpmFLmo59VKohcWPLk2+OUnh3Sx8FmAWCKbWZEmIT nGKlp8NLHKZevqrlIbdsT86wnpMquJM7gWIyoItrEThgOPajAJqHKa+Fu2ai9WPdf6ES KLAQDHDIK2z5VIk2L5UWyRUYlF+aY/ydxlFB6MuJYCf9OiWG6iEDbgSjQDX5aK89vUoU LRry9HX7JRalhHxDXFHl50uQIiLRZAh8J/p6dc0AowaM9nLoe6Pjinrp2lEcwtWbtaQU NZ6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773334499; x=1773939299; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=R5UX7rhqlDYYvqPxFRQg96W4qwOAL8dxcHZMY3uLDNc=; b=lqIWjhbsNMvVDG8Sq8Z7dtXl/Lj9sO7b05jdF6IDAtH6fMoGwseGDLpB9Kc2Xyadop 5WMTRzSwcam+TbQgBz9JdWdGAi793H62RwC4VMUDYeTUiGhy4vKcmPKKPGgAJqBv6RtB BHACIHErDXrG1zT+AEER7qnuykKirW/7IRkCeYJQ3oM5m5M6rmcq10Uq/z0d8oOGQ/GT GGIHcOHmkgA0jj0b8A78RH6NXjBYPeGb9QWPqx5B1Hwo5nH3kM/zU8ci8maJAFWr0CLR EjgFzoIkUw55SBIjNPrUtX8+86KAqs93U0cP5xQkFffyGIWxkYpdfcnCpzBWlCAd21vP SHuA== X-Gm-Message-State: AOJu0YzDqNy+t9u8Sm9jWtwLop23zf8QF0nH14kXjgLv0SY+r0FH+diu TOvc2N2lFkzmP8LLlMe+N1vVMsDhmhvgEhyDPLWx3RAE5yrhDEEidAf/DsIdZSN1t5uiXOJhPGC 2pe4= X-Gm-Gg: ATEYQzyM13wVHweRjUb3Noo0GW0gFierL4CkLNpTuuVYPVt0figM2wQGLIVRCQARnG/ t/AvnnTD9qmLx7njUm3d0aKT7mgks7qaWyjrQXogQ3PflwOx8+tINQ7k65mGXtbFZJ+LHYaeg71 c2e2wNkjPW+ApDx+1MvF/OtA7WVwynxwitL3WuHPRHuaAztfCCROH+LLrt7kQd4evVEyF/okzDH LVKjISBe8DZ/xlTXStr4g9vIavQgonB7OJiQLmb1Rfb8VOmibrKYYWOv8/cY9R+owAdovoU1uvq 1ILBUySmJyHR1biakhYjFys8+inQLkAr+kClN0coKpPo8ZlMXCM7eZ52LtaJtdsQMA3LxhSY8Fw KD4hnFojGCjK39q0Ar9Mg+JOpadgalHsObDlm7QGfKvzlOPd/hmyVHhsIQOlpzSEbH3hX1nRF2h HxGV0SDnWX+QUrG4um1kzBRprgv05+ZGHDIqG5uC+ia4w80+Lz2dN03mmUsvCKoTkuI4dQwPkdt oMSLlt39CJhxt4= X-Received: by 2002:a05:6000:240e:b0:439:a95b:3c44 with SMTP id ffacd0b85a97d-43a04db618cmr685748f8f.30.1773334498673; Thu, 12 Mar 2026 09:54:58 -0700 (PDT) Message-ID: Date: Thu, 12 Mar 2026 17:54:56 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 2/9] x86/mwait-idle: clean up BYT/CHT auto demotion disable From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= References: <7b7a677e-a5b9-42c8-beec-3c506b4eac52@suse.com> Content-Language: en-US Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <7b7a677e-a5b9-42c8-beec-3c506b4eac52@suse.com> Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1773334515324158500 Content-Type: text/plain; charset="utf-8" Bay Trail (BYT) and Cherry Trail (CHT) platforms have a very specific way of disabling auto-demotion via specific MSR bits. Clean up the code so that BYT/CHT-specifics do not show up in the common 'struct idle_cpu' data structure. Remove the 'byt_auto_demotion_disable_flag' flag from 'struct idle_cpu', because a better coding pattern is to avoid very case-specific fields like 'bool byt_auto_demotion_disable_flag' in a common data structure, which is used for all platforms, not only BYT/CHT. The code is just more readable when common data structures contain only commonly used fields. Instead, match BYT/CHT in the 'intel_idle_init_cstates_icpu()' function, and introduce a small helper to take care of BYT/CHT auto-demotion. This is consistent with how platform-specific things are done for other platforms. No intended functional changes. Inspired by (and description largely taken from) Linux'es c93d13b661a6 ("intel_idle: clean up BYT/CHT auto demotion disable"). Signed-off-by: Jan Beulich --- a/xen/arch/x86/cpu/mwait-idle.c +++ b/xen/arch/x86/cpu/mwait-idle.c @@ -104,7 +104,6 @@ struct idle_cpu { * Indicate which enable bits to clear here. */ unsigned long auto_demotion_disable_flags; - bool byt_auto_demotion_disable_flag; enum c1e_promotion c1e_promotion; }; =20 @@ -1144,7 +1143,7 @@ static void cf_check auto_demotion_disab wrmsrl(MSR_PKG_CST_CONFIG_CONTROL, msr_bits); } =20 -static void cf_check byt_auto_demotion_disable(void *dummy) +static void byt_cht_auto_demotion_disable(void) { wrmsrl(MSR_CC6_DEMOTION_POLICY_CONFIG, 0); wrmsrl(MSR_MC6_DEMOTION_POLICY_CONFIG, 0); @@ -1195,13 +1194,11 @@ static const struct idle_cpu idle_cpu_sn static const struct idle_cpu idle_cpu_byt =3D { .state_table =3D byt_cstates, .c1e_promotion =3D C1E_PROMOTION_DISABLE, - .byt_auto_demotion_disable_flag =3D true, }; =20 static const struct idle_cpu idle_cpu_cht =3D { .state_table =3D cht_cstates, .c1e_promotion =3D C1E_PROMOTION_DISABLE, - .byt_auto_demotion_disable_flag =3D true, }; =20 static const struct idle_cpu idle_cpu_ivb =3D { @@ -1680,14 +1677,11 @@ static int __init mwait_idle_probe(void) return 0; } =20 -static void mwait_idle_cpu_tweak(unsigned int cpu) +static void mwait_idle_cpu_tweak(unsigned int cpu, bool bsp) { if (icpu->auto_demotion_disable_flags) on_selected_cpus(cpumask_of(cpu), auto_demotion_disable, NULL, 1); =20 - if (icpu->byt_auto_demotion_disable_flag) - on_selected_cpus(cpumask_of(cpu), byt_auto_demotion_disable, NULL, 1); - switch (icpu->c1e_promotion) { case C1E_PROMOTION_DISABLE: on_selected_cpus(cpumask_of(cpu), c1e_promotion_disable, NULL, 1); @@ -1700,12 +1694,24 @@ static void mwait_idle_cpu_tweak(unsigne case C1E_PROMOTION_PRESERVE: break; } + + /* Pkg-scope MSRs on 1-socket-only systems need writing only once. */ + if (!bsp) + return; + + switch (boot_cpu_data.vfm) { + case INTEL_ATOM_SILVERMONT: + case INTEL_ATOM_AIRMONT: + byt_cht_auto_demotion_disable(); + break; + } } =20 static int cf_check mwait_idle_cpu_init( struct notifier_block *nfb, unsigned long action, void *hcpu) { unsigned int cpu =3D (unsigned long)hcpu, cstate; + static bool first; struct acpi_processor_power *dev =3D processor_powers[cpu]; =20 switch (action) { @@ -1784,7 +1790,8 @@ static int cf_check mwait_idle_cpu_init( dev->count++; } =20 - mwait_idle_cpu_tweak(cpu); + mwait_idle_cpu_tweak(cpu, first); + first =3D false; =20 return NOTIFY_DONE; } @@ -1821,7 +1828,7 @@ void mwait_idle_resume(void) if (!icpu) return; =20 - mwait_idle_cpu_tweak(smp_processor_id()); + mwait_idle_cpu_tweak(smp_processor_id(), true); } =20 /* Helper function for HPET. */ From nobody Mon Mar 23 19:51:59 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1773334542; cv=none; d=zohomail.com; s=zohoarc; b=ZaDn7r7AuvUjavxjWQm+WTWAuQ82/mW0RFgdaf5fv7kcHnKP4bxyDEHRmUyna4nqvXggHKtRTw5IWyA28kPauUAEoudsVascsTMX5sRBiwio5Ig1OOIawOHnb3ISXSWbgo0tx9ni7Dv8jOmOocdICTHhNp0p54Yb6KucLb7YdVc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773334542; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=YORkC10FLOdP4ZPuyWf26dj7CDdAeRGQhEwwoPkwu48=; b=CdbJS3B9VgSo5kHwutsIhqiwN1+NkBvwT8BWJMraXf1dRg+dmU7mLCxNqJbMLr7shQSs5I90N4tFoasG7VL5GVYc2sOptPLRhDUN7Wfris94rO1Qy33ITRraPzkwCw5dASSYwBamKKpZ/iuWws+3wYJT6LRs7wulPZcc99/ld0M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1773334542138327.00976240612476; Thu, 12 Mar 2026 09:55:42 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1252764.1549324 (Exim 4.92) (envelope-from ) id 1w0jJn-0000Qs-Cy; Thu, 12 Mar 2026 16:55:27 +0000 Received: by outflank-mailman (output) from mailman id 1252764.1549324; Thu, 12 Mar 2026 16:55:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w0jJn-0000Ql-AI; Thu, 12 Mar 2026 16:55:27 +0000 Received: by outflank-mailman (input) for mailman id 1252764; Thu, 12 Mar 2026 16:55:26 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w0jJm-0000EC-CS for xen-devel@lists.xenproject.org; Thu, 12 Mar 2026 16:55:26 +0000 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [2a00:1450:4864:20::42e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 43f8a4e1-1e34-11f1-b164-2bf370ae4941; Thu, 12 Mar 2026 17:55:25 +0100 (CET) Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-439c56e822eso1282164f8f.2 for ; Thu, 12 Mar 2026 09:55:25 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-439fe228986sm7866764f8f.35.2026.03.12.09.55.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Mar 2026 09:55:23 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 43f8a4e1-1e34-11f1-b164-2bf370ae4941 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1773334525; x=1773939325; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=YORkC10FLOdP4ZPuyWf26dj7CDdAeRGQhEwwoPkwu48=; b=bwiC1ev88ZAmCC54nAdIPSUgd+azdNzx3ds6x8WyxKX3Ax7saCHi20rYp6kDb8/TrY hXt5zrd2ojJSutiB7v6exc/iyZeddbYmlr5kcSJCQl93n+lpEatj87+JBYkDhP13VIEb Cbv6GlnDpReFYpSeLxzcXcfRpgmgH0KIffll7H3onFFspzWXxuflKt2/tNIi1DuaRN9d VnlsScMo7N/CWpt2vjBL5VufYHd3GUIrU0IM4fRPZ5JIYTn41DspDJrYec367fprp8Or 7i8nZJ173QcRCvuqAZ3/nNu4IA3un/hP7Sn9Fu0n3dv7/AOBCkZl6n5pW6flFg/4uD4s +MCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773334525; x=1773939325; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=YORkC10FLOdP4ZPuyWf26dj7CDdAeRGQhEwwoPkwu48=; b=w2p3Nik7v6BlayR4kEtIeSQApfsLGHFB0jfvUVsfmWhgYKuqyAb09fBN0unLWt9ygT R1P7zLTuXYuuSOIVuE9TG1Wd8akPQCnlgl9HNuJ7GADJbARy1Z9wdL4vP6+2vyf1elTn 1Q7CRceo1a8PJQ7NKV0SPFhrOJey4M1ND09OOTSCsv369tM7y3Fne94P3o4gN8Su2pOL VaR/NVBYKY0qDJHrL11UwKE2DzCFbkLb/PfcZNuiF9XY39hE/VVsgX+KFiCrt33dCcLE GFxg8RRdnexzlMcovIZUFgn95kUNhDE4VPRv/4kTRB7MHU0cBTFQb1lsvHqp38YtcK2u PmfQ== X-Gm-Message-State: AOJu0YzoHnYEs0iLXBCsBBnbw946/UBqQvPCI9aDliRGzP+QCdlmz4s4 GWuR1pQLOacPvrvAZsjGPGQpzilT7NcDqt0PZ/ktPtc/Fv4Sd1yjF0opzeUjzAd6qqOEJX+2+2Z lWa4= X-Gm-Gg: ATEYQzxfgaNc6sK6VbBTGeP0E1ObaeNadbnMnHafZRXJGl0UkSvupVrnfgQHf0bGMiW B9dG2ocYER+FV9xmUXsYnJfphBbUHv/6KvwUDceOQ/2u/e6xreF0PeUe3PAbIe9D2DmP5/Lj/If Xn/xh8jdLuDaigSIiOa8H5VX51+a6jbJ7wFaQPY/JNuCJZhd8lTtotN717VhkCZVqp945RaNut/ HFYwThBh0tHEk8kKUvCBNNAwDiPZlqKydXaeMZxkxp9o5piJoTV8sLxgCWHOG0Sw44wVjcOo6af uwpPF8SAHJksyhIWAe3TJXbRhVgCuSNqEshCjPiRSqMbCPzTHSpz7WUw9o3fV/NoSrKHh4XJvGR 7vVw92mgrOH4po1W6FOnU30+DAfrxPcM4NnXAvHDjZDymCbZbJVBltOpJT9wwsiKvE41nuQHbrj pyAeA89nNeJkJlXJPI34nCN2/N/DgH8fTxAqQqH7By6NeRFSq5NKwQxpsNh7D0OqBGHyUnjT96i CRU+cnQ6iq2fAoxHP0wYPqaDg== X-Received: by 2002:a05:6000:178b:b0:439:b7c9:2edc with SMTP id ffacd0b85a97d-43a04dc0b96mr751381f8f.48.1773334524773; Thu, 12 Mar 2026 09:55:24 -0700 (PDT) Message-ID: <5d12d537-7c6b-4730-b963-a4a9e13a7413@suse.com> Date: Thu, 12 Mar 2026 17:55:22 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 3/9] x86/mwait-idle: latch struct idle_cpu contents From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= References: <7b7a677e-a5b9-42c8-beec-3c506b4eac52@suse.com> Content-Language: en-US Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <7b7a677e-a5b9-42c8-beec-3c506b4eac52@suse.com> Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1773334544796154100 Content-Type: text/plain; charset="utf-8" Rather than storing a pointer (and needing to keep all struct instances in memory post-init), and rather than (like the Linux counterpart has it) keeping individual variables, simply copy the respective structure instance. By implication, subsequent updates now need doing to the copy. Signed-off-by: Jan Beulich --- a/xen/arch/x86/cpu/mwait-idle.c +++ b/xen/arch/x86/cpu/mwait-idle.c @@ -107,14 +107,14 @@ struct idle_cpu { enum c1e_promotion c1e_promotion; }; =20 -static const struct idle_cpu *__ro_after_init icpu; +static struct idle_cpu __ro_after_init icpu; =20 -static const struct cpuidle_state { +struct cpuidle_state { char name[16]; unsigned int flags; unsigned int exit_latency; /* in US */ unsigned int target_residency; /* in US */ -} *__ro_after_init cpuidle_state_table; +}; =20 #define CPUIDLE_FLAG_DISABLED 0x1 /* @@ -1097,7 +1097,7 @@ static void cf_check mwait_idle(void) * leave_mm() to avoid costly and often unnecessary wakeups * for flushing the user TLB's associated with the active mm. */ - if (cpuidle_state_table[].flags & CPUIDLE_FLAG_TLB_FLUSHED) + if (icpu.state_table[].flags & CPUIDLE_FLAG_TLB_FLUSHED) leave_mm(cpu); #endif =20 @@ -1139,7 +1139,7 @@ static void cf_check auto_demotion_disab u64 msr_bits; =20 rdmsrl(MSR_PKG_CST_CONFIG_CONTROL, msr_bits); - msr_bits &=3D ~(icpu->auto_demotion_disable_flags); + msr_bits &=3D ~icpu.auto_demotion_disable_flags; wrmsrl(MSR_PKG_CST_CONFIG_CONTROL, msr_bits); } =20 @@ -1371,10 +1371,10 @@ static void __init ivt_idle_state_table_ /* 1 and 2 socket systems use default ivt_cstates */ break; case 2: case 3: - cpuidle_state_table =3D ivt_cstates_4s; + icpu.state_table =3D ivt_cstates_4s; break; default: - cpuidle_state_table =3D ivt_cstates_8s; + icpu.state_table =3D ivt_cstates_8s; break; } } @@ -1525,14 +1525,12 @@ static void __init adl_idle_state_table_ adl_l_cstates[1].flags |=3D CPUIDLE_FLAG_DISABLED; =20 /* Disable C1E by clearing the "C1E promotion" bit. */ - idle_cpu_adl.c1e_promotion =3D C1E_PROMOTION_DISABLE; - idle_cpu_adl_l.c1e_promotion =3D C1E_PROMOTION_DISABLE; + icpu.c1e_promotion =3D C1E_PROMOTION_DISABLE; return; } =20 /* Make sure C1E is enabled by default */ - idle_cpu_adl.c1e_promotion =3D C1E_PROMOTION_ENABLE; - idle_cpu_adl_l.c1e_promotion =3D C1E_PROMOTION_ENABLE; + icpu.c1e_promotion =3D C1E_PROMOTION_ENABLE; } =20 /* @@ -1593,6 +1591,7 @@ static int __init mwait_idle_probe(void) { unsigned int eax, ebx, ecx; const struct x86_cpu_id *id; + const struct idle_cpu *idle_cpu; const char *str; =20 if (boot_cpu_data.vendor !=3D X86_VENDOR_INTEL) @@ -1627,8 +1626,8 @@ static int __init mwait_idle_probe(void) =20 pr_debug(PREFIX "MWAIT substates: %#x\n", mwait_substates); =20 - icpu =3D id->driver_data; - cpuidle_state_table =3D icpu->state_table; + idle_cpu =3D id->driver_data; + icpu =3D *idle_cpu; =20 if (boot_cpu_has(X86_FEATURE_XEN_ARAT)) lapic_timer_reliable_states =3D LAPIC_TIMER_ALWAYS_RELIABLE; @@ -1647,7 +1646,7 @@ static int __init mwait_idle_probe(void) const char *ss; =20 do { - const struct cpuidle_state *state =3D icpu->state_table; + const struct cpuidle_state *state =3D idle_cpu->state_table; unsigned int bit =3D 1; =20 ss =3D strchr(str, ','); @@ -1679,10 +1678,10 @@ static int __init mwait_idle_probe(void) =20 static void mwait_idle_cpu_tweak(unsigned int cpu, bool bsp) { - if (icpu->auto_demotion_disable_flags) + if (icpu.auto_demotion_disable_flags) on_selected_cpus(cpumask_of(cpu), auto_demotion_disable, NULL, 1); =20 - switch (icpu->c1e_promotion) { + switch (icpu.c1e_promotion) { case C1E_PROMOTION_DISABLE: on_selected_cpus(cpumask_of(cpu), c1e_promotion_disable, NULL, 1); break; @@ -1735,11 +1734,11 @@ static int cf_check mwait_idle_cpu_init( =20 dev->count =3D 1; =20 - for (cstate =3D 0; cpuidle_state_table[cstate].target_residency; ++cstate= ) { + for (cstate =3D 0; icpu.state_table[cstate].target_residency; ++cstate) { unsigned int num_substates, hint, state; struct acpi_processor_cx *cx; =20 - hint =3D flg2MWAIT(cpuidle_state_table[cstate].flags); + hint =3D flg2MWAIT(icpu.state_table[cstate].flags); state =3D MWAIT_HINT2CSTATE(hint) + 1; =20 if (state > max_cstate) { @@ -1755,10 +1754,10 @@ static int cf_check mwait_idle_cpu_init( continue; =20 /* if state marked as disabled, skip it */ - if (cpuidle_state_table[cstate].flags & + if (icpu.state_table[cstate].flags & CPUIDLE_FLAG_DISABLED) { printk(XENLOG_DEBUG PREFIX "state %s is disabled\n", - cpuidle_state_table[cstate].name); + icpu.state_table[cstate].name); continue; } =20 @@ -1776,15 +1775,15 @@ static int cf_check mwait_idle_cpu_init( cx->type =3D state; cx->address =3D hint; cx->entry_method =3D ACPI_CSTATE_EM_FFH; - cx->latency =3D cpuidle_state_table[cstate].exit_latency; + cx->latency =3D icpu.state_table[cstate].exit_latency; cx->target_residency =3D - cpuidle_state_table[cstate].target_residency; - if ((cpuidle_state_table[cstate].flags & + icpu.state_table[cstate].target_residency; + if ((icpu.state_table[cstate].flags & CPUIDLE_FLAG_IRQ_ENABLE) && /* cstate_restore_tsc() needs to be a no-op */ boot_cpu_has(X86_FEATURE_NONSTOP_TSC)) cx->irq_enable_early =3D true; - if (cpuidle_state_table[cstate].flags & CPUIDLE_FLAG_IBRS) + if (icpu.state_table[cstate].flags & CPUIDLE_FLAG_IBRS) cx->ibrs_disable =3D true; =20 dev->count++; @@ -1825,7 +1824,7 @@ int __init mwait_idle_init(struct notifi =20 void mwait_idle_resume(void) { - if (!icpu) + if (!icpu.state_table) return; =20 mwait_idle_cpu_tweak(smp_processor_id(), true); From nobody Mon Mar 23 19:51:59 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1773334569; cv=none; d=zohomail.com; s=zohoarc; b=TwEcU5b2r5yxVa1Ae6WYvtcqCPLej1totg0UjQGQjQsoC7bXPHd2EjRgSRjNBTgKpLK2KrE9HxagyXJKkCMOHj+RKwQIy65F6GPsr7qUELXL1ysBSgbsIsb5j0g4NRpT51a3yGXOln/2+BBYIYsytka8fyiqkq02IXGODxNczLg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773334569; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Zqpvz5INomrf1w7sEL/xZCVv7pCruy4Bd5QH3mgXqjc=; b=iZnjbGaOUxZhfQwroKN6qrRXglYXg+mXzXIU3Tg1DImub77tZIXbCcovAOSodywlI1HT555pjeXe7uQV1dFh4xiJI5FCfbP8rEu5BbeTjNsoGGUOftFEk4xNkWy71q7jvW/wzmr8IsHVJv32HejDd6k+XlbDbhK7ylhtr86ADFw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1773334569006950.0678346703673; Thu, 12 Mar 2026 09:56:09 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1252772.1549334 (Exim 4.92) (envelope-from ) id 1w0jKF-0000vb-Pr; Thu, 12 Mar 2026 16:55:55 +0000 Received: by outflank-mailman (output) from mailman id 1252772.1549334; Thu, 12 Mar 2026 16:55:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w0jKF-0000vU-Lo; Thu, 12 Mar 2026 16:55:55 +0000 Received: by outflank-mailman (input) for mailman id 1252772; Thu, 12 Mar 2026 16:55:54 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w0jKE-0000EC-1y for xen-devel@lists.xenproject.org; Thu, 12 Mar 2026 16:55:54 +0000 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [2a00:1450:4864:20::335]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 547a5fb3-1e34-11f1-b164-2bf370ae4941; Thu, 12 Mar 2026 17:55:53 +0100 (CET) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4853510b4f3so16238635e9.0 for ; Thu, 12 Mar 2026 09:55:53 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48541aa73dasm693358825e9.2.2026.03.12.09.55.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Mar 2026 09:55:51 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 547a5fb3-1e34-11f1-b164-2bf370ae4941 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1773334552; x=1773939352; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=Zqpvz5INomrf1w7sEL/xZCVv7pCruy4Bd5QH3mgXqjc=; b=GdJFuQ08B6/lyk/mNyxz+jG/rxUGjossdmGtp8RVU/aJqMRlL9daUTcGUMl1I8PVsz yQx8gJY/wirGaE5dGJrEuio7+kY9j6khIv4PRaxgYS4cXDJS9ZlfmjnmUxr16DNzo8lI /zReHFS0k3UPaSjKQbL4XgKZfFa44CaYRV94p0pg4Ox+yZJ4WaJpqT+Da14VrnVbGVqQ w98a/ZKVgxWlViAwrP7Z5pOv/Mc/m54rLvwdub/2hQFmxgQfYfTyy8vQC9qVkihZZUaB FfY7l9eoY9N4jABB5tCYtthHsQk85EI/6+HxEDVYlWEQ3x+Yzp5fPjAGR8Pjdtrzqoln FaUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773334552; x=1773939352; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Zqpvz5INomrf1w7sEL/xZCVv7pCruy4Bd5QH3mgXqjc=; b=OPmyZbPOoDtQLXw3T/TFgYlBGf7tx9o2P01gDkYMmEksawsi1YVBdTDLq4D45eJc4P FOL5FZgkv4/rlRJ0Cyj5hIZA/gYhtcgQEPXdeqQB59ouovpxyRDiKUDHwGEAGpybIIHs /fHS1me2P86NVxArr0SIoCk9CT7rSaUENChxi51sTI0ZwDgAfCnH2NJeGJ80alYTOnJZ sQrBH7h2MQzd7MyUaRFNHKD2h6aA6h8zrUxZSi4Ve6SvhNoOLwhNnsLvfAwOWgrlSwlP 2IILiMpYGkyJOuC/3TlT9oJFiOU7N3y0ajCOPUHU74rbOGPXPfHZy9mLhxOZIPseEwz7 NwMA== X-Gm-Message-State: AOJu0YwF8FwYrgkJQBG8Hb2ti+LRR1x37kfSCn2NyJDLS5dwNKEyS4XC dFvtG9ke92CfWc+YubRqqUpjdxM15cBCUSQ8vcRI9klgE0dr0QV7kBDDNM7QaRvNGhl+Bl7AL6r xueE= X-Gm-Gg: ATEYQzxCNydjNg+bti+Qk2I55imkp0Gu5UPTNr1ajy49RDK7CYFRygr0tGqbvYhr9+T Dt8cGCUT0Yl2WLrK8i4XanMkUz0AJdZTEse8XrFvni3NE+1Uwp0xg/Fe5d7DOWAxiQQk+FUpFJF ImewlFlWgxbznK9RtLIWxAWVnrj+rP9tPJJi80xG3FAgcMqahle/n0SRauDz1ORIAbjbNg9BHL8 MhoeYa/2tUhKhrARpmm60cFm3wHMOyIjaju6fsCoFemzmbHKI1d/ZoocY7x/AEyXo0gVyMJmH+i LvU1HmZ+TR8t/j3T4Non+P6mRrD72sWuUUCeKXNMFbkVVh9Y/ufrUqhRg441SHLp/kJORzlYmEJ swH6uT+tB8cGw9SB63LSYb9O9U/kbLdmQPAE3pDBJiBV/hbHaxo7ljTe24Kuok0rIu+Iwq1xq54 a1M7GsJV9NDw3go2MB1q3F5J/GxhjEDU2k3ji6LD1JG2YPgqtsfHsexlEqKlNIiNw6Z45tHNZyQ f4uRKXlw8U16w8= X-Received: by 2002:a05:600c:4fc6:b0:477:5b0a:e616 with SMTP id 5b1f17b1804b1-485566d2f96mr272825e9.5.1773334552485; Thu, 12 Mar 2026 09:55:52 -0700 (PDT) Message-ID: <797f444b-886f-46ed-9672-a0f302d47336@suse.com> Date: Thu, 12 Mar 2026 17:55:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 4/9] x86/mwait-idle: move pre-initialized struct idle_cpu instances From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= References: <7b7a677e-a5b9-42c8-beec-3c506b4eac52@suse.com> Content-Language: en-US Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <7b7a677e-a5b9-42c8-beec-3c506b4eac52@suse.com> Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1773334570918154100 Content-Type: text/plain; charset="utf-8" Now that they're not referenced anymore post-init, they can themselves move into .init.rodata. (idle_cpu_adl{,_l} can also become const in the first place.) Signed-off-by: Jan Beulich --- a/xen/arch/x86/cpu/mwait-idle.c +++ b/xen/arch/x86/cpu/mwait-idle.c @@ -1167,132 +1167,132 @@ static void cf_check c1e_promotion_disab wrmsrl(MSR_IA32_POWER_CTL, msr_bits); } =20 -static const struct idle_cpu idle_cpu_nehalem =3D { +static const struct idle_cpu __initconstrel idle_cpu_nehalem =3D { .state_table =3D nehalem_cstates, .auto_demotion_disable_flags =3D NHM_C1_AUTO_DEMOTE | NHM_C3_AUTO_DEMOTE, .c1e_promotion =3D C1E_PROMOTION_DISABLE, }; =20 -static const struct idle_cpu idle_cpu_atom =3D { +static const struct idle_cpu __initconstrel idle_cpu_atom =3D { .state_table =3D atom_cstates, }; =20 -static const struct idle_cpu idle_cpu_tangier =3D { +static const struct idle_cpu __initconstrel idle_cpu_tangier =3D { .state_table =3D tangier_cstates, }; =20 -static const struct idle_cpu idle_cpu_lincroft =3D { +static const struct idle_cpu __initconstrel idle_cpu_lincroft =3D { .state_table =3D atom_cstates, .auto_demotion_disable_flags =3D ATM_LNC_C6_AUTO_DEMOTE, }; =20 -static const struct idle_cpu idle_cpu_snb =3D { +static const struct idle_cpu __initconstrel idle_cpu_snb =3D { .state_table =3D snb_cstates, .c1e_promotion =3D C1E_PROMOTION_DISABLE, }; =20 -static const struct idle_cpu idle_cpu_byt =3D { +static const struct idle_cpu __initconstrel idle_cpu_byt =3D { .state_table =3D byt_cstates, .c1e_promotion =3D C1E_PROMOTION_DISABLE, }; =20 -static const struct idle_cpu idle_cpu_cht =3D { +static const struct idle_cpu __initconstrel idle_cpu_cht =3D { .state_table =3D cht_cstates, .c1e_promotion =3D C1E_PROMOTION_DISABLE, }; =20 -static const struct idle_cpu idle_cpu_ivb =3D { +static const struct idle_cpu __initconstrel idle_cpu_ivb =3D { .state_table =3D ivb_cstates, .c1e_promotion =3D C1E_PROMOTION_DISABLE, }; =20 -static const struct idle_cpu idle_cpu_ivt =3D { +static const struct idle_cpu __initconstrel idle_cpu_ivt =3D { .state_table =3D ivt_cstates, .c1e_promotion =3D C1E_PROMOTION_DISABLE, }; =20 -static const struct idle_cpu idle_cpu_hsw =3D { +static const struct idle_cpu __initconstrel idle_cpu_hsw =3D { .state_table =3D hsw_cstates, .c1e_promotion =3D C1E_PROMOTION_DISABLE, }; =20 -static const struct idle_cpu idle_cpu_bdw =3D { +static const struct idle_cpu __initconstrel idle_cpu_bdw =3D { .state_table =3D bdw_cstates, .c1e_promotion =3D C1E_PROMOTION_DISABLE, }; =20 -static const struct idle_cpu idle_cpu_skl =3D { +static const struct idle_cpu __initconstrel idle_cpu_skl =3D { .state_table =3D skl_cstates, .c1e_promotion =3D C1E_PROMOTION_DISABLE, }; =20 -static const struct idle_cpu idle_cpu_skx =3D { +static const struct idle_cpu __initconstrel idle_cpu_skx =3D { .state_table =3D skx_cstates, .c1e_promotion =3D C1E_PROMOTION_DISABLE, }; =20 -static const struct idle_cpu idle_cpu_icx =3D { +static const struct idle_cpu __initconstrel idle_cpu_icx =3D { .state_table =3D icx_cstates, .c1e_promotion =3D C1E_PROMOTION_DISABLE, }; =20 -static struct idle_cpu __ro_after_init idle_cpu_adl =3D { +static const struct idle_cpu __initconstrel idle_cpu_adl =3D { .state_table =3D adl_cstates, }; =20 -static struct idle_cpu __ro_after_init idle_cpu_adl_l =3D { +static const struct idle_cpu __initconstrel idle_cpu_adl_l =3D { .state_table =3D adl_l_cstates, }; =20 -static const struct idle_cpu idle_cpu_mtl_l =3D { +static const struct idle_cpu __initconstrel idle_cpu_mtl_l =3D { .state_table =3D mtl_l_cstates, }; =20 -static const struct idle_cpu idle_cpu_gmt =3D { +static const struct idle_cpu __initconstrel idle_cpu_gmt =3D { .state_table =3D gmt_cstates, }; =20 -static const struct idle_cpu idle_cpu_spr =3D { +static const struct idle_cpu __initconstrel idle_cpu_spr =3D { .state_table =3D spr_cstates, .c1e_promotion =3D C1E_PROMOTION_DISABLE, }; =20 -static const struct idle_cpu idle_cpu_gnr =3D { +static const struct idle_cpu __initconstrel idle_cpu_gnr =3D { .state_table =3D gnr_cstates, .c1e_promotion =3D C1E_PROMOTION_DISABLE, }; =20 -static const struct idle_cpu idle_cpu_gnrd =3D { +static const struct idle_cpu __initconstrel idle_cpu_gnrd =3D { .state_table =3D gnrd_cstates, .c1e_promotion =3D C1E_PROMOTION_DISABLE, }; =20 -static const struct idle_cpu idle_cpu_avn =3D { +static const struct idle_cpu __initconstrel idle_cpu_avn =3D { .state_table =3D avn_cstates, .c1e_promotion =3D C1E_PROMOTION_DISABLE, }; =20 -static const struct idle_cpu idle_cpu_bxt =3D { +static const struct idle_cpu __initconstrel idle_cpu_bxt =3D { .state_table =3D bxt_cstates, .c1e_promotion =3D C1E_PROMOTION_DISABLE, }; =20 -static const struct idle_cpu idle_cpu_dnv =3D { +static const struct idle_cpu __initconstrel idle_cpu_dnv =3D { .state_table =3D dnv_cstates, .c1e_promotion =3D C1E_PROMOTION_DISABLE, }; =20 -static const struct idle_cpu idle_cpu_snr =3D { +static const struct idle_cpu __initconstrel idle_cpu_snr =3D { .state_table =3D snr_cstates, .c1e_promotion =3D C1E_PROMOTION_DISABLE, }; =20 -static const struct idle_cpu idle_cpu_grr =3D { +static const struct idle_cpu __initconstrel idle_cpu_grr =3D { .state_table =3D grr_cstates, .c1e_promotion =3D C1E_PROMOTION_DISABLE, }; =20 -static const struct idle_cpu idle_cpu_srf =3D { +static const struct idle_cpu __initconstrel idle_cpu_srf =3D { .state_table =3D srf_cstates, .c1e_promotion =3D C1E_PROMOTION_DISABLE, }; From nobody Mon Mar 23 19:51:59 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1773334745; cv=none; d=zohomail.com; s=zohoarc; b=CtfLh6ratkk8ndhb2q7kvk08aJe+5ktdMGRlgibPi4S3d8JlI09qPGweqCvk6tjQKj5JH/DG1o6tnD/oqpRtiIR+ZMFa6uf80MP+FMrMNkyx5ySpfcZOLZTNDImTX5QF2rvGctHWDbq1I+H3gzwEfYkKnxBqjKJFxVEax3BZ14Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773334745; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=RnDXh0w+MBk68hIH+3zSVNLZToon9goIJ9Tbk6Ty0ts=; b=gzwArxCqQ9x+dtL3U+O5LhWYzQKRsuf4FhdB8CwXkGF5bE2byGg6J/20C5OVwRivc2V4qkjWP4/Pn0I8VcOpsOZ65bi1jBNnjtYBN06xrWYfBPlIs3nCImBO9Lpil3mDt4Jx+jGBW+zq/JMTefTy397yPMeyJqx/EbgCUX+ocME= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1773334745176268.6307630834875; Thu, 12 Mar 2026 09:59:05 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1252822.1549379 (Exim 4.92) (envelope-from ) id 1w0jN3-0003ej-22; Thu, 12 Mar 2026 16:58:49 +0000 Received: by outflank-mailman (output) from mailman id 1252822.1549379; Thu, 12 Mar 2026 16:58:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w0jN2-0003eY-VX; Thu, 12 Mar 2026 16:58:48 +0000 Received: by outflank-mailman (input) for mailman id 1252822; Thu, 12 Mar 2026 16:58:47 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w0jKn-0000EC-KQ for xen-devel@lists.xenproject.org; Thu, 12 Mar 2026 16:56:29 +0000 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [2a00:1450:4864:20::334]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 69d59ee0-1e34-11f1-b164-2bf370ae4941; Thu, 12 Mar 2026 17:56:28 +0100 (CET) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-48540d21f7dso14833185e9.0 for ; Thu, 12 Mar 2026 09:56:28 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48556404816sm1338845e9.5.2026.03.12.09.56.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Mar 2026 09:56:26 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 69d59ee0-1e34-11f1-b164-2bf370ae4941 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1773334588; x=1773939388; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=RnDXh0w+MBk68hIH+3zSVNLZToon9goIJ9Tbk6Ty0ts=; b=RB4J0TxoDLh/Z4N0wxOPqeEgmu5X23KqamBAxE0hlbl80fGLv32EonezrZpLahdT4Y HJ9Al4IcGpnsUURAykMvYTdv5Ieu4C8GODtt5tWkxAPk7jlmgCbK6UHJJTvDLEYjroc6 b1mSntfLghobuA7sxnFq74qvHXQ86/K4Vw8h0TfsynJjIWsTb6ONPLPcrlx1aisRNP3m lbF3Y/u8gqP3u/6P8mR4Sbelh0UuulU5/1+dgISM/w6aEg0MlqdKFfrTAP2FImSFiOQ1 By40xI/o/JqGGFYDcX6TAEn8msr3WrnWaDMjlYn7pLXk0qlEoUZOCG+Me1bC1Q8w26Et RSJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773334588; x=1773939388; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=RnDXh0w+MBk68hIH+3zSVNLZToon9goIJ9Tbk6Ty0ts=; b=NhzyLDN3h1/wdF+1Qn0/xd8Z9POLCX5dbhpt8qyWL/OGEUuEJkw5ne8VLv4J9ONnZP TkeuKrgB6dhpQ/ohzPVdrXHBBGgdArG+POxY0l9rXdNciLcbw5itiHI8U6URk/tstnaP 3zR8frc7XtTLMXnLJxhAGWIiCm6FreAsoG0yR9qNIsjUyhK8PLTng0lk0qKJUZ0tus6d XcLPCE33JKN3sWzeTRiVRqUQPWXHSbQyNE7vNNXPheHkCFZde996S+6kEVdY6QSiOk6h qRdZx45z4pI0NWXJ9hhB0iUFmkRT001mKNhhnH4K+Pw25TDI8hDt6M5DRCHD8ofJdPpl sJlg== X-Gm-Message-State: AOJu0Yw5THFJF04C1dt4tj/xKrGv+4AuqD0afQE3ijQI2hLTmutO5E+w +LntvUObp4UC9cq4baGeHGLbM5aD2widLo+aVN+qZXY5owpsNVu9qGdMu+BdIV03CRg59pU2HN8 eDqE= X-Gm-Gg: ATEYQzz71ODKRJK4BhdpgRlFhBWQruuTXE03EIo1+LYT3j6NaGSyz2Locs4GpF+aghu tcy8g1jiank6ptlU5zFZmV9bGua5aYt23yiw//hX+23CAZXrItArSUrkum9TYrk/mVdfK8aD8PE JY/w5NO+ATe5eo3zVDDTBon32S7J8YyKA2FMUUTTwpFwyRriY32CrVPhavBI3WE4VKI+4byy0hY zaDMgNptr3eFoYEWFMd8LoezkwfiNlP8V2VhgmIk/3XZQ3OYDmGsYwrsxRPwrmLH/bhDFAzjH4V u3t+ciGkpgmw/l82wpQiQhCSnCIyX/QjVxBBqnC2GWQvvExD41XtqNdl/KG3f6SoZdoyWK6VWLG LjvlZ8ByrnwUTB48kAUiXjvH4Q876+guIjEHw/4i8CDROMP9r+WdEGIVAWiThIosLLWiO002JSL I3Rp93+D0AwIrOAYRIpz2pdwt3zOLx3Ux0tTjUAxM9prlb7GnhEuae5BteBjqEROZOlqOqJYnkN jQr6ainhzxBbLk= X-Received: by 2002:a05:600c:8b65:b0:483:6d42:25c6 with SMTP id 5b1f17b1804b1-4854b10f1ffmr122762335e9.23.1773334588272; Thu, 12 Mar 2026 09:56:28 -0700 (PDT) Message-ID: Date: Thu, 12 Mar 2026 17:56:24 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 5/9] x86/mwait-idle: Remove unused driver version constant From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= References: <7b7a677e-a5b9-42c8-beec-3c506b4eac52@suse.com> Content-Language: en-US Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <7b7a677e-a5b9-42c8-beec-3c506b4eac52@suse.com> Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1773334746790158500 Content-Type: text/plain; charset="utf-8" From: Artem Bityutskiy The MWAIT_IDLE_VERSION constant has not been updated since 2016 and serves no useful purpose. The driver version is implicitly defined by the hypervisor version, making this constant redundant. Remove the constant to eliminate potential confusion about version tracking. Signed-off-by: Artem Bityutskiy Reviewed-by: Andy Shevchenko Link: https://patch.msgid.link/20251215111229.132705-1-dedekind1@gmail.com Signed-off-by: Rafael J. Wysocki Origin: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 25= ff69011ddf Adjust description to fit our code base. Signed-off-by: Jan Beulich --- a/xen/arch/x86/cpu/mwait-idle.c +++ b/xen/arch/x86/cpu/mwait-idle.c @@ -58,7 +58,6 @@ =20 #include =20 -#define MWAIT_IDLE_VERSION "0.4.1" #undef PREFIX #define PREFIX "mwait-idle: " =20 @@ -1632,9 +1631,6 @@ static int __init mwait_idle_probe(void) if (boot_cpu_has(X86_FEATURE_XEN_ARAT)) lapic_timer_reliable_states =3D LAPIC_TIMER_ALWAYS_RELIABLE; =20 - pr_debug(PREFIX "v" MWAIT_IDLE_VERSION " model %#x\n", - boot_cpu_data.x86_model); - pr_debug(PREFIX "lapic_timer_reliable_states %#x\n", lapic_timer_reliable_states); From nobody Mon Mar 23 19:51:59 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1773334728; cv=none; d=zohomail.com; s=zohoarc; b=MSaepqWjVhsD40ZeLPB6F8D4SjdxFoqOCUbLDeC4v5x2MmS8FtpRpKSrSij/MLWqgeAnQUrU1swdJE81V/c87+iwP7UVtQCNqSaC5AsbzHPnDEKAq67mCb8m2Qap2HbcT5w+r8rzQch7QTu16UvptIxOhSPI3W2pL2Ji/lZz7Hs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773334728; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4O5ib0lx1V0XU83S5mr85hWtGtQTwPLl/vPSyc15n5c=; b=NsL+kQ+cSZjues7m02MVsmGY8tHpd29Zb/diAEPFExudtwXvA6xRVYmVAXd52vWm+I2ra9EC8JRrc+XC36bPwcDlJBxizV6PB3rICSHxPQp69v/i+D8SGLSu0h8jMJn0IWRzAVjzUnsJsshB4eqURacymI1w5dZ5zfprfQ9iMMM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 177333472851866.40257274017836; Thu, 12 Mar 2026 09:58:48 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1252815.1549370 (Exim 4.92) (envelope-from ) id 1w0jMr-0003B0-Rr; Thu, 12 Mar 2026 16:58:37 +0000 Received: by outflank-mailman (output) from mailman id 1252815.1549370; Thu, 12 Mar 2026 16:58:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w0jMr-0003At-Oq; Thu, 12 Mar 2026 16:58:37 +0000 Received: by outflank-mailman (input) for mailman id 1252815; Thu, 12 Mar 2026 16:58:36 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w0jLH-0000EC-Dk for xen-devel@lists.xenproject.org; Thu, 12 Mar 2026 16:56:59 +0000 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [2a00:1450:4864:20::42e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 7b72d5c6-1e34-11f1-b164-2bf370ae4941; Thu, 12 Mar 2026 17:56:58 +0100 (CET) Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-439bcec8613so1030894f8f.3 for ; Thu, 12 Mar 2026 09:56:58 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-439fe22529csm9002078f8f.31.2026.03.12.09.56.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Mar 2026 09:56:56 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 7b72d5c6-1e34-11f1-b164-2bf370ae4941 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1773334618; x=1773939418; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=4O5ib0lx1V0XU83S5mr85hWtGtQTwPLl/vPSyc15n5c=; b=fL1NxqKmO58LBqrG7Lzs744fEAmR/LX8aG1J2QpcX0+9R/fwwhWl4pkbBLQoCc/WQI ZZL98FRev1asaKcToPiRLC/FPRumF4KK86cu7zKtA8w7ioYagfdMCPW6FhJO7aZ1Cb1B 9DxAnZTZgLOvx7i0JynvicsfcgsjNzGSDksUF68qfd7LY/i1M4QMyOfB++hdXXTI9g0x Oib4xiur/evG7M2/CVV7q+9Vphtw6UBNPhRVPW8gAuawrlAKPUjODRYVkEGueT7v5dZ+ XN+fi2Qh8b2O93azIYNeq/YW160HmGNkwZ/woLu2yAD1d85BYdoCLXG5cRgbPQczDYXV Gn1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773334618; x=1773939418; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=4O5ib0lx1V0XU83S5mr85hWtGtQTwPLl/vPSyc15n5c=; b=w1j3fIcysj3ej/frRYNibT3G7VB3n1CXZCVY2J8BrpiRQOoVTuw/vC+am40ujCRpne SHnB9cwmFaXUl3GZOOtnwV7ROP/OinoEb+JJoLA2V2d6kZR6/xk5E7CdfUOXnF2gSg0y 5iZVVeoGdpeSY1zuOAsj49BQIOb/MJu0AOAf5FN4c6LyCaGplmQJCweWUgXjAFAnyvZP wrlIOZ5lM7NV1tj0eapjmm2ljc17HrWU8XD6FD4jHI9sryvOeiIETjw6+JqS958yYj9e RWS6x3EjRmvInRpwgbWjHVqwixVAOdjdZ6P56V/OCKkDCxUEEYLvGFPdS6oZ8CEXc7TY UNrA== X-Gm-Message-State: AOJu0YzgySWnPd17+LMcA8AvrnbRNmSgqYZJVkt35Zao3x5lqQmWovc3 c28CmQk5VbtCEGfwuUoKuIzAU8qagOiIDB+yRUCnMTGzkNxGNm2CQ9mZJBvseD1pYODhKpgxD8D QxL0= X-Gm-Gg: ATEYQzyuk+UJcIY1nf5TOfucFAW2OWimIRPQoCNk77Z5CqmBsOz2k+8FjMr/wusDpgN UFhAbRf8RtXUHMkI+LNZlpIMi7e9076wewoPFR1c0tRfJZLeD/bI1+CPDeNbhiI3oRCF886r3ys VHb3/rpo1G3yrgwIAl+6u6FvHunyzbVRxyxo+aEJUx4oQQ7ZM3QwESJRXXQApfIMPdnFBzLY6CX wbwSqfHn7N91ox64w7aVJTkWfWBek2EN+z+n+Hv0O71F+h0x3ouqDcDhwTh0sRwLVsmD/AtT7lI 7hD7wIl+veGJFmDapmpqduTSEA5R21i4/n5CcmjwAK315PW/NJISqadbhWlNFuoJmhYQf5qja+7 7kv7oOuZvOTCC+p9UcdH4opkVQTzz0hQVbhIg5EgbEpi47TfrI/8iYrV6hcnsaiOqB3hlIWeWJz decrO9zxuEItknP3mKo3csjOxo15RRjCFTTtvzwZ+/JjCKCdRWyQJgpDpdHOtPJUvJfuSWWjW7q j9CgCI6BtUMpMY= X-Received: by 2002:a05:6000:2003:b0:439:ca85:8848 with SMTP id ffacd0b85a97d-43a04d895ecmr837918f8f.16.1773334617801; Thu, 12 Mar 2026 09:56:57 -0700 (PDT) Message-ID: <62702a0e-a43f-4a15-90c7-e5778bbefb4f@suse.com> Date: Thu, 12 Mar 2026 17:56:55 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 6/9] x86/mwait-idle: Remove the 'preferred_cstates' parameter From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= References: <7b7a677e-a5b9-42c8-beec-3c506b4eac52@suse.com> Content-Language: en-US Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <7b7a677e-a5b9-42c8-beec-3c506b4eac52@suse.com> Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1773334731651154100 Content-Type: text/plain; charset="utf-8" From: Artem Bityutskiy Remove the 'preferred_cstates' module parameter as it is not really useful. The parameter currently only affects Alder Lake, where it controls C1/C1E preference, with C1E being the default. The parameter does not support any other platform. For example, Meteor Lake has a similar C1/C1E limitation, but the parameter does not support Meteor Lake. This indicates that the parameter is not very useful. Generally, independent C1 and C1E are important for server platforms where low latency is key. However, they are not as important for client platforms, like Alder Lake, where C1E providing better energy savings is generally preferred. The parameter was originally introduced for Sapphire Rapids Xeon: da0e58c038e6 intel_idle: add 'preferred_cstates' module argument Later it was added to Alder Lake: d1cf8bbfed1ed ("intel_idle: Add AlderLake support") But it was removed from Sapphire Rapids when firmware fixed the C1/C1E limitation: 1548fac47a114 ("intel_idle: make SPR C1 and C1E be independent") So Alder Lake is the only platform left where this parameter has any effect. Remove this parameter to simplify the driver and reduce maintenance burden. Signed-off-by: Artem Bityutskiy Link: https://patch.msgid.link/20251215111300.132803-1-dedekind1@gmail.com Signed-off-by: Rafael J. Wysocki Origin: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git a3= 6dc37b5672 Signed-off-by: Jan Beulich --- a/docs/misc/xen-command-line.pandoc +++ b/docs/misc/xen-command-line.pandoc @@ -2083,12 +2083,6 @@ compression is selected at build time fr ### ple_window (Intel) > `=3D ` =20 -### preferred-cstates (x86) -> `=3D ( | List of ( C1 | C1E | C2 | ... )` - -This is a mask of C-states which are to be used preferably. This option is -applicable only on hardware were certain C-states are exclusive of one ano= ther. - ### probe-port-aliases (x86) > `=3D ` =20 --- a/xen/arch/x86/cpu/mwait-idle.c +++ b/xen/arch/x86/cpu/mwait-idle.c @@ -72,19 +72,6 @@ boolean_param("mwait-idle", opt_mwait_id =20 static unsigned int mwait_substates; =20 -/* - * Some platforms come with mutually exclusive C-states, so that if one is - * enabled, the other C-states must not be used. Example: C1 and C1E on - * Sapphire Rapids platform. This parameter allows for selecting the - * preferred C-states among the groups of mutually exclusive C-states - the - * selected C-states will be registered, the other C-states from the mutua= lly - * exclusive group won't be registered. If the platform has no mutually - * exclusive C-states, this parameter has no effect. - */ -static unsigned int __ro_after_init preferred_states_mask; -static char __initdata preferred_states[64]; -string_param("preferred-cstates", preferred_states); - #define LAPIC_TIMER_ALWAYS_RELIABLE 0xFFFFFFFF /* Reliable LAPIC Timer States, bit 1 for C1 etc. Default to only C1. */ static unsigned int lapic_timer_reliable_states =3D (1 << 1); @@ -1511,28 +1498,6 @@ static void __init skx_idle_state_table_ } =20 /* - * adl_idle_state_table_update - Adjust AlderLake idle states table. - */ -static void __init adl_idle_state_table_update(void) -{ - /* Check if user prefers C1 over C1E. */ - if ((preferred_states_mask & BIT(1, U)) && - !(preferred_states_mask & BIT(2, U))) { - adl_cstates[0].flags &=3D ~CPUIDLE_FLAG_DISABLED; - adl_cstates[1].flags |=3D CPUIDLE_FLAG_DISABLED; - adl_l_cstates[0].flags &=3D ~CPUIDLE_FLAG_DISABLED; - adl_l_cstates[1].flags |=3D CPUIDLE_FLAG_DISABLED; - - /* Disable C1E by clearing the "C1E promotion" bit. */ - icpu.c1e_promotion =3D C1E_PROMOTION_DISABLE; - return; - } - - /* Make sure C1E is enabled by default */ - icpu.c1e_promotion =3D C1E_PROMOTION_ENABLE; -} - -/* * spr_idle_state_table_update - Adjust Sapphire Rapids idle states table. */ static void __init spr_idle_state_table_update(void) @@ -1578,11 +1543,6 @@ static void __init mwait_idle_state_tabl case INTEL_EMERALDRAPIDS_X: spr_idle_state_table_update(); break; - case INTEL_ALDERLAKE: - case INTEL_ALDERLAKE_L: - case INTEL_ATOM_GRACEMONT: - adl_idle_state_table_update(); - break; } } =20 @@ -1591,7 +1551,6 @@ static int __init mwait_idle_probe(void) unsigned int eax, ebx, ecx; const struct x86_cpu_id *id; const struct idle_cpu *idle_cpu; - const char *str; =20 if (boot_cpu_data.vendor !=3D X86_VENDOR_INTEL) return -ENODEV; @@ -1634,39 +1593,6 @@ static int __init mwait_idle_probe(void) pr_debug(PREFIX "lapic_timer_reliable_states %#x\n", lapic_timer_reliable_states); =20 - str =3D preferred_states; - if (isdigit(str[0])) - preferred_states_mask =3D simple_strtoul(str, &str, 0); - else if (str[0]) - { - const char *ss; - - do { - const struct cpuidle_state *state =3D idle_cpu->state_table; - unsigned int bit =3D 1; - - ss =3D strchr(str, ','); - if (!ss) - ss =3D strchr(str, '\0'); - - for (; state->name[0]; ++state) { - bit <<=3D 1; - if (!cmdline_strcmp(str, state->name)) { - preferred_states_mask |=3D bit; - break; - } - } - if (!state->name[0]) - break; - - str =3D ss + 1; - } while (*ss); - - str -=3D str =3D=3D ss + 1; - } - if (str[0]) - printk("unrecognized \"preferred-cstates=3D%s\"\n", str); - mwait_idle_state_table_update(); =20 return 0; From nobody Mon Mar 23 19:51:59 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1773334661; cv=none; d=zohomail.com; s=zohoarc; b=njYXMLbXet84NZ0580lSSIe91L/9bcP66yWF9kqBct61vWZIGkcukRzatGmRrSWxoJAdVK1y7yps5Y3QblXivS2cmvUt1pFGZlEcrsUKX2yJHH8wVkJ0zcsfDeyetqsqs6GjdPubqm7s1vPl1GUEkMGMh5zmnYCUnPnEhchNarY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773334661; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=W72JevWeU/QiLig4xhCD0an3/J6aVnjef/9hQUIbYAo=; b=nRyxqkKc81Gj+lOsKo1Pef70whrCtV4utqqflPFiHUwsZxjvKf+uiYm6lP+B8leL47wqIUnrTZJpfbC9mALkOJfcQBzqcj5LcQDrsUuiD0g1fOHgteSz/qoOVJ7AP4c/EjldyeNxJgtlTY+JPkAKu3SMQ6VTDUx1UbkDgATP0io= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1773334661812984.4361403141888; Thu, 12 Mar 2026 09:57:41 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1252785.1549343 (Exim 4.92) (envelope-from ) id 1w0jLi-0001fk-2Y; Thu, 12 Mar 2026 16:57:26 +0000 Received: by outflank-mailman (output) from mailman id 1252785.1549343; Thu, 12 Mar 2026 16:57:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w0jLh-0001fd-Vz; Thu, 12 Mar 2026 16:57:25 +0000 Received: by outflank-mailman (input) for mailman id 1252785; Thu, 12 Mar 2026 16:57:24 +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 1w0jLg-0001fS-0j for xen-devel@lists.xenproject.org; Thu, 12 Mar 2026 16:57:24 +0000 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [2a00:1450:4864:20::32c]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 8921ff55-1e34-11f1-9ccf-f158ae23cfc8; Thu, 12 Mar 2026 17:57:21 +0100 (CET) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4852b81c73aso10860795e9.3 for ; Thu, 12 Mar 2026 09:57:21 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48541ab9f9esm251451895e9.4.2026.03.12.09.57.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Mar 2026 09:57:19 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 8921ff55-1e34-11f1-9ccf-f158ae23cfc8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1773334641; x=1773939441; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=W72JevWeU/QiLig4xhCD0an3/J6aVnjef/9hQUIbYAo=; b=XLkxS1d44mJSLviwzmOXRgoPggmonBVEb+WZ781Gg9CNNbGickzQuc2ghHZYYRNpJ+ HD+Qw6xrXrhEOcvN1mYWne7HT8BkW7OXAq0O9sj3YuINWYzePGVRJ+cIrzQ/QLTwgOu2 GKm93RPvx9PwBlUsZTyBSTxBNk0qdkbSOmNaAlfA+r1+Tte/jbHqWvLNAFZPDl9hbjW2 fxvzXMmx/GKYFTUoJ8EOK0YAw3Uspa1+yZ4nG/nvbCmxAfdHZcBi8o/3SWwApSfFy+Db V6WqtlNoQLIxIzGKipJI5RM9RFopNDS2HyPusSNNT2eqPwyFBXxuE1UyLMMWEOe5WJnE 1Qfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773334641; x=1773939441; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=W72JevWeU/QiLig4xhCD0an3/J6aVnjef/9hQUIbYAo=; b=DElH9eVI6EB2nxtvBl0GYe9BSvUhAJXcJovYgkYZ6hNeELtjaQ0IvD8zDJH7KYNA8F Np3x0brAvXdKCH/6t7nQEECAPyeJLAeX3lmW0FU3ZeUw6HGAfqL7vWFK5kPsry0V/9VQ 1clzLrTujU0TRv+dFdlPvpJU3ZC93DqT1ZEA+hTCNv4zVIVDormjOII1yxdtn8ITHIHp 6kJMUg7JwlUK6uommgeNv/m40GV72HxGyOg5Ajfu7DXadi73NkYcms266I2MmzngsiY1 741Pe2tFsPrSFmXpcho8B835Idp4x/ahV15EqysCxCLCDOibkk1m9sCq44ueqrHrKmfb eVTg== X-Gm-Message-State: AOJu0YzP1fnwzbuISScefD825KGPN2MQc+D/LKIneevxD6ib2jHq0CuW Kq68AvEOTtDAfKtoL+cQD1bs3M3fuc3CF1VHkWyF4oJEAYEnJvueId9p++NqC6Q0s3SGLCyQvRR z0dk= X-Gm-Gg: ATEYQzwnvXZzBK4U6mwmrRP8SpYYnQGLXUAAnXe2Hdf2vZjq+ikv6xJ5kTGyiFpzshm EjYnegOqr5MdTd6Rmn3ssaEazh9dG0LGqxks1i9W+idrXseRJovzKerTRHVBaBwZtqwCIVoBOUV Ty4kd+Y4USdnNhGVWF8M9jznybQDYtC9pu9p1mRh73sEkyFdgYVQmcWjNBnzAAnqx1zA/V14moJ YHf+6IvhPgAWBSsdyAD6vwt4hPKMaldLX/0GSVnfrSrwP4Rbimt5BPbpqyprpQOKsevOUVfAs3Z sE5djI+oiHlKLAHL7m/lwlAKG3Bgy+zUEz6KByy5lQGSLu1fP5HB4+nbncw3Y/rk4LCEWMRvYR0 1YNm+64jBguodd8DeW4EhBPYf9TBVhOcTbT5yJ0GB+B2BiwtKUTiaWUlNLFO0J260Sg5A8M9Ucw HYeAYL8m/MQBGb8P1eDvCBP3ytFrRoG1pc3FBmKkV0QZIwfh43qStJew5B3GrQetfvAMmieXi1i 7IdQiEOuNUfQT0= X-Received: by 2002:a05:600c:8714:b0:485:389b:ee5f with SMTP id 5b1f17b1804b1-485566cf89fmr386065e9.2.1773334640845; Thu, 12 Mar 2026 09:57:20 -0700 (PDT) Message-ID: <5516d0a1-8fac-48ff-bbe1-85726b730e94@suse.com> Date: Thu, 12 Mar 2026 17:57:18 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 7/9] x86/mwait-idle: drop const from struct cpuidle_state arrays From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= References: <7b7a677e-a5b9-42c8-beec-3c506b4eac52@suse.com> Content-Language: en-US Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <7b7a677e-a5b9-42c8-beec-3c506b4eac52@suse.com> Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1773334662190158500 Content-Type: text/plain; charset="utf-8" A subsequent change will want to be able to alter them based on a new command line option. (Note that some were __ro_after_init already.) Signed-off-by: Jan Beulich --- a/xen/arch/x86/cpu/mwait-idle.c +++ b/xen/arch/x86/cpu/mwait-idle.c @@ -83,7 +83,7 @@ enum c1e_promotion { }; =20 struct idle_cpu { - const struct cpuidle_state *state_table; + struct cpuidle_state *state_table; =20 /* * Hardware C-state auto-demotion may not always be optimal. @@ -139,7 +139,7 @@ struct cpuidle_state { * which is also the index into the MWAIT hint array. * Thus C0 is a dummy. */ -static const struct cpuidle_state nehalem_cstates[] =3D { +static struct cpuidle_state __ro_after_init nehalem_cstates[] =3D { { .name =3D "C1", .flags =3D MWAIT2flg(0x00), @@ -167,7 +167,7 @@ static const struct cpuidle_state nehale {} }; =20 -static const struct cpuidle_state snb_cstates[] =3D { +static struct cpuidle_state __ro_after_init snb_cstates[] =3D { { .name =3D "C1", .flags =3D MWAIT2flg(0x00), @@ -201,7 +201,7 @@ static const struct cpuidle_state snb_cs {} }; =20 -static const struct cpuidle_state byt_cstates[] =3D { +static struct cpuidle_state __ro_after_init byt_cstates[] =3D { { .name =3D "C1", .flags =3D MWAIT2flg(0x00), @@ -235,7 +235,7 @@ static const struct cpuidle_state byt_cs {} }; =20 -static const struct cpuidle_state cht_cstates[] =3D { +static struct cpuidle_state __ro_after_init cht_cstates[] =3D { { .name =3D "C1", .flags =3D MWAIT2flg(0x00), @@ -269,7 +269,7 @@ static const struct cpuidle_state cht_cs {} }; =20 -static const struct cpuidle_state ivb_cstates[] =3D { +static struct cpuidle_state __ro_after_init ivb_cstates[] =3D { { .name =3D "C1", .flags =3D MWAIT2flg(0x00), @@ -303,7 +303,7 @@ static const struct cpuidle_state ivb_cs {} }; =20 -static const struct cpuidle_state ivt_cstates[] =3D { +static struct cpuidle_state __ro_after_init ivt_cstates[] =3D { { .name =3D "C1", .flags =3D MWAIT2flg(0x00), @@ -331,7 +331,7 @@ static const struct cpuidle_state ivt_cs {} }; =20 -static const struct cpuidle_state ivt_cstates_4s[] =3D { +static struct cpuidle_state __ro_after_init ivt_cstates_4s[] =3D { { .name =3D "C1", .flags =3D MWAIT2flg(0x00), @@ -359,7 +359,7 @@ static const struct cpuidle_state ivt_cs {} }; =20 -static const struct cpuidle_state ivt_cstates_8s[] =3D { +static struct cpuidle_state __ro_after_init ivt_cstates_8s[] =3D { { .name =3D "C1", .flags =3D MWAIT2flg(0x00), @@ -387,7 +387,7 @@ static const struct cpuidle_state ivt_cs {} }; =20 -static const struct cpuidle_state hsw_cstates[] =3D { +static struct cpuidle_state __ro_after_init hsw_cstates[] =3D { { .name =3D "C1", .flags =3D MWAIT2flg(0x00), @@ -439,7 +439,7 @@ static const struct cpuidle_state hsw_cs {} }; =20 -static const struct cpuidle_state bdw_cstates[] =3D { +static struct cpuidle_state __ro_after_init bdw_cstates[] =3D { { .name =3D "C1", .flags =3D MWAIT2flg(0x00), @@ -565,7 +565,7 @@ static struct cpuidle_state __ro_after_i {} }; =20 -static const struct cpuidle_state icx_cstates[] =3D { +static struct cpuidle_state __ro_after_init icx_cstates[] =3D { { .name =3D "C1", .flags =3D MWAIT2flg(0x00) | CPUIDLE_FLAG_IRQ_ENABLE, @@ -665,7 +665,7 @@ static struct cpuidle_state __ro_after_i {} }; =20 -static const struct cpuidle_state mtl_l_cstates[] =3D { +static struct cpuidle_state __ro_after_init mtl_l_cstates[] =3D { { .name =3D "C1E", .flags =3D MWAIT2flg(0x01), @@ -687,7 +687,7 @@ static const struct cpuidle_state mtl_l_ {} }; =20 -static const struct cpuidle_state gmt_cstates[] =3D { +static struct cpuidle_state __ro_after_init gmt_cstates[] =3D { { .name =3D "C1", .flags =3D MWAIT2flg(0x00) | CPUIDLE_FLAG_DISABLED, @@ -743,7 +743,7 @@ static struct cpuidle_state __ro_after_i {} }; =20 -static const struct cpuidle_state gnr_cstates[] =3D { +static struct cpuidle_state __ro_after_init gnr_cstates[] =3D { { .name =3D "C1", .flags =3D MWAIT2flg(0x00), @@ -771,7 +771,7 @@ static const struct cpuidle_state gnr_cs {} }; =20 -static const struct cpuidle_state gnrd_cstates[] =3D { +static struct cpuidle_state __ro_after_init gnrd_cstates[] =3D { { .name =3D "C1", .flags =3D MWAIT2flg(0x00), @@ -799,7 +799,7 @@ static const struct cpuidle_state gnrd_c {} }; =20 -static const struct cpuidle_state atom_cstates[] =3D { +static struct cpuidle_state __ro_after_init atom_cstates[] =3D { { .name =3D "C1E", .flags =3D MWAIT2flg(0x00), @@ -827,7 +827,7 @@ static const struct cpuidle_state atom_c {} }; =20 -static const struct cpuidle_state tangier_cstates[] =3D { +static struct cpuidle_state __ro_after_init tangier_cstates[] =3D { { .name =3D "C1", .flags =3D MWAIT2flg(0x00), @@ -861,7 +861,7 @@ static const struct cpuidle_state tangie {} }; =20 -static const struct cpuidle_state avn_cstates[] =3D { +static struct cpuidle_state __ro_after_init avn_cstates[] =3D { { .name =3D "C1", .flags =3D MWAIT2flg(0x00), @@ -923,7 +923,7 @@ static struct cpuidle_state __ro_after_i {} }; =20 -static const struct cpuidle_state dnv_cstates[] =3D { +static struct cpuidle_state __ro_after_init dnv_cstates[] =3D { { .name =3D "C1", .flags =3D MWAIT2flg(0x00), @@ -949,7 +949,7 @@ static const struct cpuidle_state dnv_cs * Note, depending on HW and FW revision, SnowRidge SoC may or may not sup= port * C6, and this is indicated in the CPUID mwait leaf. */ -static const struct cpuidle_state snr_cstates[] =3D { +static struct cpuidle_state __ro_after_init snr_cstates[] =3D { { .name =3D "C1", .flags =3D MWAIT2flg(0x00), @@ -971,7 +971,7 @@ static const struct cpuidle_state snr_cs {} }; =20 -static const struct cpuidle_state grr_cstates[] =3D { +static struct cpuidle_state __ro_after_init grr_cstates[] =3D { { .name =3D "C1", .flags =3D MWAIT2flg(0x00), @@ -993,7 +993,7 @@ static const struct cpuidle_state grr_cs {} }; =20 -static const struct cpuidle_state srf_cstates[] =3D { +static struct cpuidle_state __ro_after_init srf_cstates[] =3D { { .name =3D "C1", .flags =3D MWAIT2flg(0x00), From nobody Mon Mar 23 19:51:59 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1773334693; cv=none; d=zohomail.com; s=zohoarc; b=SA2I1oGvLGJs2S7J2YjVZisldDtmGWFCOl8fc3I4goEQgqQZ7UketIRnLci1QHAT3NCkpjJiKQ9MiJP+Ei65pcBiwQznHoryiHgXH7fulisW6wEPuHUaJSbaQDEblsoEVxgcnW/x4B+tPDafBPyCWm8UgB+wnpV0+fPJUm2TWpY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773334693; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qOP/T1HJZb7a2znFHzhzofDtcxTuReCcTpVKKooOuJM=; b=d8tB5yQXYlesRPGl3Cb/lbGBbS2pnA9AvXnRwjoD+ZgrfP6KuQ9V4x+eekg9TMy5fborerALx0lQxj2T460I9MAmb1CjJ3QPN9093IxDZoCwR8HQeliVaOyZIPszBi8Otwhli6XhXbAWPQRtRC1cpPupalp2hlC66DBe9SQDcZU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1773334693277129.12253146193825; Thu, 12 Mar 2026 09:58:13 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1252793.1549351 (Exim 4.92) (envelope-from ) id 1w0jMG-0002CN-AL; Thu, 12 Mar 2026 16:58:00 +0000 Received: by outflank-mailman (output) from mailman id 1252793.1549351; Thu, 12 Mar 2026 16:58:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w0jMG-0002CG-7I; Thu, 12 Mar 2026 16:58:00 +0000 Received: by outflank-mailman (input) for mailman id 1252793; Thu, 12 Mar 2026 16:57:58 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w0jME-0001v3-AX for xen-devel@lists.xenproject.org; Thu, 12 Mar 2026 16:57:58 +0000 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [2a00:1450:4864:20::336]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 9e78f7eb-1e34-11f1-b164-2bf370ae4941; Thu, 12 Mar 2026 17:57:57 +0100 (CET) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4853e1ce427so14010975e9.3 for ; Thu, 12 Mar 2026 09:57:57 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4854e2537c3sm131081495e9.15.2026.03.12.09.57.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Mar 2026 09:57:55 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 9e78f7eb-1e34-11f1-b164-2bf370ae4941 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1773334677; x=1773939477; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=qOP/T1HJZb7a2znFHzhzofDtcxTuReCcTpVKKooOuJM=; b=YpdDVmHrUl1fnaN0b7UEfpc2B69zzq4PDWMIVLkSH/OE8f+KUyAoAWj5qwOmxHKOXO WIQPbOdi464bN8i5u/QnVdhMxRITYuJiCKC2ZVa2qWepZrhOWDfUUrij873xQx+B2AL0 HZX5uJkOL2HSjq8gMZedlpPboKvx22K3KzD9a7mZhBHoaArriFUCMNfjgYNWnHyIjszF eG178JYq08MK63n1rAQSW4bQSPOOLNystY4V8MAfcB4Ymq8Pl/YZzI6iGVd9LkaW3bLq VxB9VdQK4z/tI4eRiP5z5ievC3Ifnj1dl6BdAmV5c1Sx+jXTyaXIWYqXIGeIsgnAQLQN /Iww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773334677; x=1773939477; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=qOP/T1HJZb7a2znFHzhzofDtcxTuReCcTpVKKooOuJM=; b=owYw5N7z1YdrYAU7hCeVr+JKRWOOy+EWA6p/RI6UqF3FQlZKlUhCJKZRih66Lolg74 Pv4M04ZMIbRQj0541XGOu5RCT4wrIZ9Qrj4sBp3HOxyJ2QeNcSlS6g7WHh7nmhwHONLY padvp1EwQeWHdaQJGIP7+lEa0MChQKZ0wtPRHDH0ZNqVJFgaeievXi5ex3Km0SnWg48P zQXnZbczz8g1+z3V6cko3x1HrMjDihBYINaPOY8BY7+6HHh3MNqgrL1fXs/RCA11Iz+A 3BV+6bXyVQ3itgUkw4NfQ7J5V4rHTZOzoEZIBBCzfwXiwGHGt6j/ZOKbctVe3A9mzGP8 AZtQ== X-Gm-Message-State: AOJu0Yy8ixg6R3HxrvIFNl6ITUpP6fRdrxOyoAdmADQtb7pVWLzPMpAK qw3ahf/5xRs+FEWh+NI2MLZvFCJdE6Hi3dAqMjbuM71lHlTBsqvWdTFvf0v2yVJojKw7prP4uM6 Ob3Q= X-Gm-Gg: ATEYQzz57WU74fMJ3As8n1t4tvM61WWSqgsxrFRLNH+CARShxddczd6oJK53xY4yhbr Awh7pj/nNYeYLrqc7ypBPJVTdfOosPmz7qEQrPlBFcZXIxL5E2I3YhpnF5JzCYs8niNJzG7lr6v nfnjUOaEJvqqjur+WUAinOLRT+ZUaz2mJw8PlTuEV+O5KnAnahQ6Sz18YXETDUFNmr+PPLa2zDZ iQnaYommdv6UAqJUQHtgTDmkqfYuo0XeTAia1/XkSu+kMJrPSxVJzyAtMEf3lQNKPZ8x54MoHAx 00jbE0IOEO73BRRwIjEvW9Z44LC1aHuXRWwDploxmjH0cxDlVsixmJ/uyNcRnOL2lieZ8lS/9BC mP7ya6NaWOG3IhRnAhwU5YG9ZqqrQVR9pjkJi2eKjaadr+9K5M1ANgHfzH12tNRfKbEzqgy/v5G Gf71TTbD8G+WR1ynJov9r6pJdYqq7/qkdHFJdMp6krrbdFU7nvr43WcbiaONmk4RRpr2y/5py8t wyJNMNsyxhaKuM= X-Received: by 2002:a05:600c:3490:b0:477:9b4a:a82 with SMTP id 5b1f17b1804b1-4854b13e5d7mr112510495e9.35.1773334676486; Thu, 12 Mar 2026 09:57:56 -0700 (PDT) Message-ID: Date: Thu, 12 Mar 2026 17:57:53 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 8/9] x86/mwait-idle: Add cmdline option to adjust C-states table From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= References: <7b7a677e-a5b9-42c8-beec-3c506b4eac52@suse.com> Content-Language: en-US Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <7b7a677e-a5b9-42c8-beec-3c506b4eac52@suse.com> Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1773334695068154100 Content-Type: text/plain; charset="utf-8" From: Artem Bityutskiy Add a new module parameter that allows adjusting the C-states table used by the driver. Currently, the C-states table is hardcoded in the driver based on the CPU model. The goal is to have good enough defaults for most users. However, C-state characteristics, such as exit latency and residency, can vary between different variants of the same CPU model and BIOS settings. Moreover, different platform usage models and user preferences may benefit from different C-state target_residency values. Provide a way for users to adjust the C-states table via a module parameter "table". The general format is: "state1:latency1:target_residency1,state2:latency2:target_residency2,..." In other words, represent each C-state by its name, exit latency (in microseconds), and target residency (in microseconds), separated by colons. Separate multiple C-states by commas. For example, suppose a CPU has 3 C-states with the following characteristics: C1: exit_latency=3D1, target_residency=3D2 C1E: exit_latency=3D10, target_residency=3D10 C6: exit_latency=3D100, target_residency=3D500 Users can specify a custom C-states table as follows: 1. intel_idle.table=3D"C1:2:2,C1E:5:20,C6:150:600" Result: C1: exit_latency=3D2, target_residency=3D2 C1E: exit_latency=3D5, target_residency=3D20 C6: exit_latency=3D150, target_residency=3D600 2. intel_idle.table=3D"C6::400" Result: C1: exit_latency=3D1, target_residency=3D2 (unchanged) C1E: exit_latency=3D10, target_residency=3D10 (unchanged) C6: exit_latency=3D100, target_residency=3D400 (only target_residency changed) Signed-off-by: Artem Bityutskiy Link: https://patch.msgid.link/20251216080402.156988-3-dedekind1@gmail.com Signed-off-by: Rafael J. Wysocki Origin: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 11= 1f77a23348 Add __init to get_cmdline_field(). Put cmdline_table_str[] in .init.data. Other adjustments to fit our env. Signed-off-by: Jan Beulich --- For the initial attempt, I've left the new option as a standalone one. It may be worth integrating with "mwait-idle", but I think much of the parsing would then want doing differently. It'll then likely be much harder to apply future Linux changes there. --- a/docs/misc/xen-command-line.pandoc +++ b/docs/misc/xen-command-line.pandoc @@ -1928,6 +1928,23 @@ Print boot time MTRR state. Use the MWAIT idle driver (with model specific C-state knowledge) instead of the ACPI based one. =20 +### mwait-idle.table (x86) +> `=3D ` + + Define the C-states table from a user input string. Expected format is + 'name:latency:residency', where: + - name: The C-state name. + - latency: The C-state exit latency in us. + - residency: The C-state target residency in us. + + Multiple C-states can be defined by separating them with commas: + 'name1:latency1:residency1,name2:latency2:residency2' + + Example: intel_idle.table=3DC1:1:1,C1E:5:10,C6:100:600 + + To leave latency or residency unchanged, use an empty field, for example: + 'C1:1:1,C1E::10' - leaves C1E latency unchanged. + ### nmi (x86) > `=3D ignore | dom0 | fatal` =20 --- a/xen/arch/x86/cpu/mwait-idle.c +++ b/xen/arch/x86/cpu/mwait-idle.c @@ -70,6 +70,11 @@ static __initdata bool opt_mwait_idle =3D true; boolean_param("mwait-idle", opt_mwait_idle); =20 +/* The maximum allowed length for the 'table' module parameter */ +#define MAX_CMDLINE_TABLE_LEN 256 +static char cmdline_table_str[MAX_CMDLINE_TABLE_LEN] __initdata; +string_param("mwait-idle.table", cmdline_table_str); + static unsigned int mwait_substates; =20 #define LAPIC_TIMER_ALWAYS_RELIABLE 0xFFFFFFFF @@ -122,6 +127,9 @@ struct cpuidle_state { */ #define CPUIDLE_FLAG_IBRS 0x20000 =20 +/* C-states data from the 'mwait-idle.table' cmdline parameter */ +static struct cpuidle_state cmdline_states[ACPI_PROCESSOR_MAX_POWER] __ini= tdata; + /* * MWAIT takes an 8-bit "hint" in EAX "suggesting" * the C-state (top nibble) and sub-state (bottom nibble) @@ -1546,6 +1554,161 @@ static void __init mwait_idle_state_tabl } } =20 + /** + * get_cmdline_field - Get the current field from a cmdline string. + * @args: The cmdline string to get the current field from. + * @field: Pointer to the current field upon return. + * @sep: The fields separator character. + * + * Examples: + * Input: args=3D"C1:1:1,C1E:2:10", sep=3D':' + * Output: field=3D"C1", return "1:1,C1E:2:10" + * Input: args=3D"C1:1:1,C1E:2:10", sep=3D',' + * Output: field=3D"C1:1:1", return "C1E:2:10" + * Ipnut: args=3D"::", sep=3D':' + * Output: field=3D"", return ":" + * + * Return: The continuation of the cmdline string after the field or NULL. + */ +static char *__init get_cmdline_field(char *args, char **field, char sep) +{ + unsigned int i; + + for (i =3D 0; args[i] && !isspace(args[i]); i++) { + if (args[i] =3D=3D sep) + break; + } + + *field =3D args; + + if (args[i] !=3D sep) + return NULL; + + args[i] =3D '\0'; + return args + i + 1; +} + +/** + * cmdline_table_adjust - Adjust the C-states table with data from cmdline. + * + * Adjust the C-states table with data from the 'mwait-idle.table' paramet= er + * (if specified). + */ +static void __init cmdline_table_adjust(void) +{ + char *args =3D cmdline_table_str; + struct cpuidle_state *state; + unsigned int i, state_count; + + if (args[0] =3D=3D '\0') + /* The 'mwait-idle.table' module parameter was not specified */ + return; + + /* Create a copy of the C-states table */ + for (i =3D 0; + i < ARRAY_SIZE(cmdline_states) && icpu.state_table[i].name[0]; + i++) + cmdline_states[i] =3D icpu.state_table[i]; + + state_count =3D i; + + /* + * Adjust the C-states table copy with data from the 'mwait-idle.table' + * module parameter. + */ + while (args) { + char *fields, *name, *val; + + /* + * Get the next C-state definition, which is expected to be + * '::'. Treat "empty" + * fields as unchanged. For example, + * '::' leaves the latency unchanged. + */ + args =3D get_cmdline_field(args, &fields, ','); + + /* name */ + fields =3D get_cmdline_field(fields, &name, ':'); + if (!fields) + goto error; + + /* Find the C-state by its name */ + state =3D NULL; + for (i =3D 0; i < state_count; i++) { + if (!strcmp(name, cmdline_states[i].name)) { + state =3D &cmdline_states[i]; + break; + } + } + + if (!state) { + printk(XENLOG_ERR PREFIX "C-state '%s' was not found\n", + name); + continue; + } + + /* Latency */ + fields =3D get_cmdline_field(fields, &val, ':'); + if (!fields) + goto error; + + if (*val) { + const char *end; + unsigned long n =3D simple_strtoul(val, &end, 0); + + state->exit_latency =3D n; + if (*end || state->exit_latency !=3D n) + goto error; + } + + /* Target residency */ + fields =3D get_cmdline_field(fields, &val, ':'); + + if (*val) { + const char *end; + unsigned long n =3D simple_strtoul(val, &end, 0); + + state->target_residency =3D n; + if (*end || state->target_residency !=3D n) + goto error; + } + + /* + * Allow for 3 more fields, but ignore them. Helps to make + * possible future extensions of the cmdline format backward + * compatible. + */ + for (i =3D 0; fields && i < 3; i++) { + fields =3D get_cmdline_field(fields, &val, ':'); + if (!fields) + break; + } + + if (fields) { + printk(XENLOG_ERR PREFIX + "Too many fields for C-state '%s'\n", + state->name); + goto error; + } + + printk(XENLOG_INFO PREFIX + "C-state from cmdline: name=3D%s, latency=3D%u, residency=3D%u\n", + state->name, state->exit_latency, state->target_residency); + } + + /* Copy the adjusted C-states table back */ + for (i =3D 0; i < state_count; i++) + icpu.state_table[i] =3D cmdline_states[i]; + + printk(XENLOG_INFO PREFIX + "Adjusted C-states with data from 'mwait-idle.table'\n"); + return; + + error: + printk(PREFIX + "Failed to adjust C-states with data from 'mwait-idle.table'\n"); +} + static int __init mwait_idle_probe(void) { unsigned int eax, ebx, ecx; @@ -1595,6 +1758,8 @@ static int __init mwait_idle_probe(void) =20 mwait_idle_state_table_update(); =20 + cmdline_table_adjust(); + return 0; } From nobody Mon Mar 23 19:51:59 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1773334726; cv=none; d=zohomail.com; s=zohoarc; b=GG32o23k3P85/7J/g2juGR3Hg2f8LBrxZh9/CAfohV1OROrd3fNOq/hRAOiHOKQI8dLqqz1v9tlvUuFPeQNM3q8DloWgFgz5genwhAmfH2qhNDqs3GltzR6d1RDnSWEBvQyc+yLDV+1rVhcAYs1sl8SkGqxe6D2OtnM8PmRsTLU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773334726; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=vVYFfqfJHLEO9z5Th4OdzRW5ThSuFwagPEe2uUt1u9I=; b=P8rTDZrS+nvAOB82NkVIh7CWNab447h2bsiePmKLjlm4ip8ho23DYF0iyJ1PyUdcaVs5hUkvEaxBg2YMzRBAlLoSsRnHwDvVBO9QJMka0pUYIHHYDGJ+1fK5zUhqpgg4QD80MtxbZXyrinneQ2LvZGTRFmlEdXOXw0sk1DESw4c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 177333472661411.630722555099169; Thu, 12 Mar 2026 09:58:46 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1252806.1549361 (Exim 4.92) (envelope-from ) id 1w0jMh-0002oz-Lf; Thu, 12 Mar 2026 16:58:27 +0000 Received: by outflank-mailman (output) from mailman id 1252806.1549361; Thu, 12 Mar 2026 16:58:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w0jMh-0002os-Hw; Thu, 12 Mar 2026 16:58:27 +0000 Received: by outflank-mailman (input) for mailman id 1252806; Thu, 12 Mar 2026 16:58:26 +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 1w0jMg-0002Yf-51 for xen-devel@lists.xenproject.org; Thu, 12 Mar 2026 16:58:26 +0000 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [2a00:1450:4864:20::32a]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id ae87bdf4-1e34-11f1-9ccf-f158ae23cfc8; Thu, 12 Mar 2026 17:58:24 +0100 (CET) Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4853e1ce427so14015765e9.3 for ; Thu, 12 Mar 2026 09:58:24 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48541b6f708sm342809325e9.11.2026.03.12.09.58.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Mar 2026 09:58:22 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: ae87bdf4-1e34-11f1-9ccf-f158ae23cfc8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1773334703; x=1773939503; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=vVYFfqfJHLEO9z5Th4OdzRW5ThSuFwagPEe2uUt1u9I=; b=fckAaDC8XWNt1oby6kWMJtv+EKjtz+eyidP04x5bb2UEKsn/FkFjYl73bYkt1SbSvQ MO5nQ0vC2GDGUqe0emxCs6ZMictVbTfPozj7Fsi4YgKlOPeOOw8mWYjcekyTfD8/8rIn nfzzydd/CmI0CNVdFJWyBpssc12i6GZUvA8ZY8YV+xSPW9aHg+DQCrmrmmZZETsDNiWb Y0DNDBs27YAqvwaAm248gD0v0xQfc/3/lEXm1aHVQRy4koSXUk/qQDv/be/VyERHOh3S MbokkLPbqV2xamUjJNHj1+fmtfDOBNr8L9hV/NxGGZiDb+KOzFdCb0dm9TJeb6bi+eC2 lq3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773334703; x=1773939503; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=vVYFfqfJHLEO9z5Th4OdzRW5ThSuFwagPEe2uUt1u9I=; b=C0Na1srSV5OvY5KhHfbWrK2ya91fRo3MjfnWUKVYXHZ2xfBDgJaiP3KgGOMygiDnOm BXfyZufDAAn0iUDWpBNyFDAHRoFD0rCMZYhcIFzJvzU5ZJ6LZchNL0dX60+5tWaQVICz 6xHtGTZ6yZWCQbrLSjzarF2DJXx+ocgxlGG1b7tzbr3Zypl2G4jqM2nULqvOd3TS+eX2 UfVQEvbhm/KrtQRFpGbiVjYbd5l8+Q8pAdeBq+U2EyHHSmoXePR12knaLx+wflramjzk y4lSzRm1/AzE0GXYDeREJ6GmTb7D9qZ0KSeGRoIuj++FBhw6CTUFPyv8kDo+1PpP8gGM rAPA== X-Gm-Message-State: AOJu0YygwCO7PZDcs7QBckNRN22VsOYbVHK6JQq9fBCV0zAgOdHlGUce Bg0h1cHC429BxOwex8fgqH9At6AWjDJN/fzD/IqhdyzsgmZBkz73lFSF7EH7A3wAxi73pJWXjye yKvQ= X-Gm-Gg: ATEYQzzDT8IvxpjBSBOZIqowFjGgoL8Zp7wY0ATmSOJMpWlkZ6fScYsZaGLkEth0MQT yKXw3MEI9+Dky4WmYK5Gk4E5rRglYtPDpqFYEv2T8GzONSr+bE0kGsNLBENsnJVP+gD2259ixRe jlulxCzn5fm7rENxt/1EB7kn49jEj76dkOtas7i6ldfN0dLHXTCRiccwVTpvekhmVqOLsvfD4xe 3ikycEGnaH7SfLXyFFEIzHzUfy90kieEHjw6IgzbhYcEjpSWrwKZ5lgdIesCUA7n/TGkQ9HeNTP A0OxQCmQ3CmaOgYxayaPJ3X9/k1oqbE3thacXlxY042241JAe4lAKUru5M14zb8cbq+5kM1ZFae r3EqQOEAa+guUMnBWmHjPWoorl64RJD4+FcWEFtUG/ELqRxBI4TeaBJU5tEHiqhsE/0QOnBafG4 y0Ea8Kxy7NNhps0jTe8bNHtYr+BOX34QQH7v4A1b45vCplRWLUWujye5RKb2ME3AxgiZ92P0SYZ iEYjZUAkF2Q1Eg= X-Received: by 2002:a05:600c:c3cc:10b0:485:54cc:2e7c with SMTP id 5b1f17b1804b1-48554cc2e8cmr25076595e9.24.1773334703593; Thu, 12 Mar 2026 09:58:23 -0700 (PDT) Message-ID: Date: Thu, 12 Mar 2026 17:58:21 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 9/9] x86/mwait-idle: Add C-states validation From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= References: <7b7a677e-a5b9-42c8-beec-3c506b4eac52@suse.com> Content-Language: en-US Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <7b7a677e-a5b9-42c8-beec-3c506b4eac52@suse.com> Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1773334728460158500 Content-Type: text/plain; charset="utf-8" From: Artem Bityutskiy Add validation for C-states specified via the "table=3D" module parameter. Treat this module parameter as untrusted input and validate it thoroughly. Signed-off-by: Artem Bityutskiy Link: https://patch.msgid.link/20251216080402.156988-4-dedekind1@gmail.com Signed-off-by: Rafael J. Wysocki Origin: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git be= 6a150829b3 Add __init to validate_cmdline_cstate(). Other adjustments to fit our env. Signed-off-by: Jan Beulich --- a/xen/arch/x86/cpu/mwait-idle.c +++ b/xen/arch/x86/cpu/mwait-idle.c @@ -72,6 +72,11 @@ boolean_param("mwait-idle", opt_mwait_id =20 /* The maximum allowed length for the 'table' module parameter */ #define MAX_CMDLINE_TABLE_LEN 256 +/* Maximum allowed C-state latency */ +#define MAX_CMDLINE_LATENCY_US (5 * 1000 /* USEC_PER_MSEC */) +/* Maximum allowed C-state target residency */ +#define MAX_CMDLINE_RESIDENCY_US (100 * 1000 /* USEC_PER_MSEC */) + static char cmdline_table_str[MAX_CMDLINE_TABLE_LEN] __initdata; string_param("mwait-idle.table", cmdline_table_str); =20 @@ -1589,6 +1594,41 @@ static char *__init get_cmdline_field(ch } =20 /** + * validate_cmdline_cstate - Validate a C-state from cmdline. + * @state: The C-state to validate. + * @prev_state: The previous C-state in the table or NULL. + * + * Return: 0 if the C-state is valid or -EINVAL otherwise. + */ +static int __init validate_cmdline_cstate(struct cpuidle_state *state, + struct cpuidle_state *prev_state) +{ + if (state->exit_latency =3D=3D 0) + /* Exit latency 0 can only be used for the POLL state */ + return -EINVAL; + + if (state->exit_latency > MAX_CMDLINE_LATENCY_US) + return -EINVAL; + + if (state->target_residency > MAX_CMDLINE_RESIDENCY_US) + return -EINVAL; + + if (state->target_residency < state->exit_latency) + return -EINVAL; + + if (!prev_state) + return 0; + + if (state->exit_latency <=3D prev_state->exit_latency) + return -EINVAL; + + if (state->target_residency <=3D prev_state->target_residency) + return -EINVAL; + + return 0; +} + +/** * cmdline_table_adjust - Adjust the C-states table with data from cmdline. * * Adjust the C-states table with data from the 'mwait-idle.table' paramet= er @@ -1696,6 +1736,21 @@ static void __init cmdline_table_adjust( state->name, state->exit_latency, state->target_residency); } =20 + /* Validate the adjusted C-states */ + for (i =3D 0; i < state_count; i++) { + struct cpuidle_state *prev_state; + + state =3D &cmdline_states[i]; + prev_state =3D i ? &cmdline_states[i - 1] : NULL; + + if (validate_cmdline_cstate(state, prev_state)) { + printk(XENLOG_ERR PREFIX + "C-state '%s' validation failed\n", + state->name); + goto error; + } + } + /* Copy the adjusted C-states table back */ for (i =3D 0; i < state_count; i++) icpu.state_table[i] =3D cmdline_states[i];