Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EC9CBCF2592 for ; Wed, 19 Nov 2025 07:41:08 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1165570.1492278 (Exim 4.92) (envelope-from ) id 1vLcnv-0005qh-Qh; Wed, 19 Nov 2025 07:40:39 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1165570.1492278; Wed, 19 Nov 2025 07:40:39 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vLcnv-0005qa-MY; Wed, 19 Nov 2025 07:40:39 +0000 Received: by outflank-mailman (input) for mailman id 1165570; Wed, 19 Nov 2025 07:40:38 +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 1vLcnu-0005qE-Mt for xen-devel@lists.xenproject.org; Wed, 19 Nov 2025 07:40:38 +0000 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [2a00:1450:4864:20::52d]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 08e52d80-c51b-11f0-980a-7dc792cee155; Wed, 19 Nov 2025 08:40:35 +0100 (CET) Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-64162c04f90so10127714a12.0 for ; Tue, 18 Nov 2025 23:40:35 -0800 (PST) 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 4fb4d7f45d1cf-6433a3d82cfsm14462110a12.2.2025.11.18.23.40.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 18 Nov 2025 23:40:33 -0800 (PST) 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: 08e52d80-c51b-11f0-980a-7dc792cee155 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1763538035; x=1764142835; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=qfyLvtK0+cQEh3RVeWZ+tqWHVoNUyoODHiQvDK/+9Ew=; b=NKIZOe7SBVsPyi5OOdqKaWN/7IXEKeilZjN2FJ8fwTzJ4JQwSs1VXD+FGNK2U+Xrek jDLiT/j17JsxKVxzF37rHxCfrEy0Ye5FMFCenGUX3jIkP4ftiiNAfFy0ov40DD6nlVmV V6mKIB60KdNt/8SML14oAi1cOrbamLv+7t2Cahm6GbkisU8DxukV9L58zul5nmdrs/7O 7KMbght0X3VWcuWDa9ylExxD7V2MVuYm4c34xvKLXE9jeLqdQrK129Joo1o0Az0M+FN6 Map82+/0/AOSAl9FnM4g/p7W/LxYXs1k4yzMFnuGeVVQlBPYCWpQKvB/wTLmp77+pglH s06Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763538035; x=1764142835; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to: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=qfyLvtK0+cQEh3RVeWZ+tqWHVoNUyoODHiQvDK/+9Ew=; b=U7AmW6NwZOSOj0NbugYt2kHsXK3nrs1JG55jw8y/4qtPsJti4l1x6FWzyI2FTFS0A0 bZWrPR1oM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vcqpgODeTpg gbWzVFJYZLF2w== X-Google-Smtp-Source: AGHT+IGFDyXTLdOwndlGsdT6ZFt6tI4wcuy5rmQH+R44R1KL38m2RoBfJ3IKVP/UZ/4s2mFZZAqwKA== X-Received: by 2002:a05:6402:278f:b0:62f:8274:d6bd with SMTP id 4fb4d7f45d1cf-64350dee90emr17673898a12.8.1763538034681; Tue, 18 Nov 2025 23:40:34 -0800 (PST) Message-ID: Date: Wed, 19 Nov 2025 08:40:31 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 6/8] x86/Intel: use host CPU policy for ARAT checking To: Andrew Cooper Cc: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= , "xen-devel@lists.xenproject.org" References: <53ef6c9a-1115-4bb4-bb7f-e2595ab9d0b6@suse.com> <65cb802c-922d-4bee-9dee-566367bec6ed@suse.com> <15a614d7-1646-4ad7-a298-edb77baae279@citrix.com> Content-Language: en-US From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+S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; charset=UTF-8 Content-Transfer-Encoding: 8bit On 18.11.2025 20:42, Andrew Cooper wrote: > On 18/11/2025 3:08 pm, Jan Beulich wrote: >> There's no need to invoke CPUID yet another time. However, as the host CPU >> policy is set up only shortly after init_intel() ran on the BSP, defer the >> logic to a pre-SMP initcall. This can't be (a new) one in cpu/intel.c >> though, as that's linked after acpi/cpu_idle.c (which is where we already >> need the feature set). Since opt_arat is local to the cpu/ subtree, >> introduce a new Intel-specific helper to hold the code needed. >> >> Further, as we assume symmetry anyway, use setup_force_cpu_cap() and hence >> limit the checking to the boot CPU. >> >> Signed-off-by: Jan Beulich >> --- >> The need to move where cpu_has_arat is checked would go away if we did >> away with opt_arat (as mentioned in the previous patch), and hence could >> use cpu_has_arat directly where right now XEN_ARAT is checked. >> >> --- a/xen/arch/x86/acpi/cpu_idle.c >> +++ b/xen/arch/x86/acpi/cpu_idle.c >> @@ -1666,6 +1666,9 @@ static int __init cf_check cpuidle_presm >> { >> void *cpu = (void *)(long)smp_processor_id(); >> >> + if ( boot_cpu_data.vendor == X86_VENDOR_INTEL ) >> + intel_init_arat(); > > I really would prefer to avoid the need for this. So would I, but ... > Now that microcode loading has moved to the start of day, we can drop > most of the order-of-init complexity for CPUID/etc, and I expect that > problems like this will cease to exist as a result. > > Notably, we've now got no relevant difference between early_init() and > regular init().  That was a complexity we inherited from Linux. ... I don't see how this leads to any concrete suggestion as to better arrangements. With cpu_has_arat using the host policy now, setup_force_cpu_cap(X86_FEATURE_XEN_ARAT) being conditional upon that has to run _after_ calculate_host_policy(), which in turn runs after intel_init(). We could add a .c_late_init hook to struct cpu_dev, but doing so felt like overkill for the purpose here. Plus it feels like that wouldn't really address your concern either. Jan