[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 03/12] x86: Add cpu_vendor() as a wrapper for the host's CPU vendor


  • To: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
  • From: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
  • Date: Wed, 11 Feb 2026 18:57:40 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nWihIsOMir/QyGHelVxwovWm2/FXSR3+lVaRuDFLVjY=; b=jp+jujHeLRa4Yvrc3oNNotGNacWdVI3cBe6BiYS58NoaqRS+YvzuiYOTfmjcHqQ+NEJm94fNx7pXBsIOBSHhvbazdRQrffYky6xAc/9+kFsrWBbXczL+06Nvoev1dEjAIzUaY7jWiKySPDSSETH4H0ZAVOFzGYheNngLdU60LlbM5TAbkpNPPUh3Qykf+L8ZjbdzIHjgaG5Us+b8HK89fhzdhyM3+uZHDqK1SMRRmxjBL3vMqzWA6v0pNaRCUx4IpEgM5WlW9955HMp8wfwiZe3SYQFYVym5qoiutpm9M2ry2Xclz8YBWwqfyh6FuVJIL4M6uA7mM+asF/QTaKgmKg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=h291TU6/vOtrQC/eoLHSFaSpY7CLIxhx8IkG+ot7f4nZyrLgs62N0h56zMjvLDiwEVGleSI8NSNXu/xhNMtO4/hGM8zVujEnajCmwjM0DLadUTBbW9uYTOo7KYUmIuBOElX7y5LDbWHsgNPIfC8+q8gmqGFcqupPqvDOzk4aOyRsiGV6CwZ6B47OxpnE4LRLPycbJEBx2XsAqVHvpzv5IDChYFIqjKZhz/X0ogL69XAyNstZSgzVrxdA+Sz4RA656g720cVYpRJfuxuKh7V0tVqoxSUOuIP1EiqOAQdyIrU2ovG84vn5g0FlUZ3yEOofoTT80rIPliklCVawZ1C2Ig==
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Jason Andryuk <jason.andryuk@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Xen-devel <xen-devel-bounces@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 11 Feb 2026 17:58:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed Feb 11, 2026 at 6:35 PM CET, Alejandro Vallejo wrote:
> On Wed Feb 11, 2026 at 5:04 PM CET, Jan Beulich wrote:
>> On 06.02.2026 17:15, Alejandro Vallejo wrote:
>>> --- a/xen/arch/x86/cpu/common.c
>>> +++ b/xen/arch/x86/cpu/common.c
>>> @@ -328,7 +328,11 @@ void __init early_cpu_init(bool verbose)
>>>     *(u32 *)&c->x86_vendor_id[4] = edx;
>>>  
>>>     c->x86_vendor = x86_cpuid_lookup_vendor(ebx, ecx, edx);
>>> -   switch (c->x86_vendor) {
>>> +   if ( c->x86_vendor != cpu_vendor() )
>>
>> When we introduce new functions to Linux-style files, nowadays we take
>> the liberty and make them Xen-style right away. In entirely Linux-
>> style functions the style should remain consistently Linux'es, though.
>>
>
> Seeing how I added the tabs I did intend to do that.
>
> Muscle memory and all. Will correct on the next one.
>
>>> +           panic("CPU vendor not compiled-in: %s",
>>> +                 x86_cpuid_vendor_to_str(c->x86_vendor));
>>
>> This will be somewhat awkward when c->x86_vendor is UNKNOWN.
>
> Which only happens on virtualised or imaginary CPUs. In either case you know
> what you're running on and the information is not particularly useful. The
> important part is the "this hypervisor cannot run on your vendor. Enable it
> there".

Oh, wait. You meant when we run on an unknown CPU and the unknown path was
disabled? Yes, that's missing in the condition.

  if ((c->x86_vendor != cpu_vendor()) ||
      (!IS_ENABLED(CONFIG_UNKNOWN_CPU_VENDORS) && !c->x86_vendor))

A hunk got missed in refactors in the default case so that default_cpu got
dropped when the unknown vendor was missing. That was present originally in the
RFC.

Alejandro



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.