All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
	Alejandro Vallejo <alejandro.vallejo@cloud.com>
Cc: "Roger Pau Monné" <roger.pau@citrix.com>, xen-devel@lists.xenproject.org
Subject: Re: [PATCH v7 02/10] xen/x86: Add initial x2APIC ID to the per-vLAPIC save area
Date: Wed, 30 Oct 2024 07:37:43 +0100	[thread overview]
Message-ID: <b143ada2-9719-4701-9a03-36ee8607958f@suse.com> (raw)
In-Reply-To: <974538f8-10b5-4fa3-9069-df6655a5d86d@citrix.com>

On 29.10.2024 21:30, Andrew Cooper wrote:
> On 21/10/2024 4:45 pm, Alejandro Vallejo wrote:
>> @@ -310,19 +309,16 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf,
>>          break;
>>  
>>      case 0xb:
>> -        /*
>> -         * In principle, this leaf is Intel-only.  In practice, it is tightly
>> -         * coupled with x2apic, and we offer an x2apic-capable APIC emulation
>> -         * to guests on AMD hardware as well.
>> -         *
>> -         * TODO: Rework topology logic.
>> -         */
>>          if ( p->basic.x2apic )
>>          {
>>              *(uint8_t *)&res->c = subleaf;
>>  
>> -            /* Fix the x2APIC identifier. */
>> -            res->d = v->vcpu_id * 2;
>> +            /*
>> +             * Fix the x2APIC identifier. The PV side is nonsensical, but
>> +             * we've always shown it like this so it's kept for compat.
>> +             */
> 
> In hindsight I should changed "Fix the x2APIC identifier." when I
> reworked this logic, but oh well - better late than never.
> 
> /* The x2APIC_ID is per-vCPU, and fixed irrespective of the requested
> subleaf. */

Can we perhaps avoid "fix" in this comment? "Adjusted", "overwritten", or
some such ought to do, without carrying a hint towards some bug somewhere.

>> --- a/xen/include/public/arch-x86/hvm/save.h
>> +++ b/xen/include/public/arch-x86/hvm/save.h
>> @@ -394,6 +394,8 @@ struct hvm_hw_lapic {
>>      uint32_t             disabled; /* VLAPIC_xx_DISABLED */
>>      uint32_t             timer_divisor;
>>      uint64_t             tdt_msr;
>> +    uint32_t             x2apic_id;
>> +    uint32_t             rsvd_zero;
> 
> ... we do normally spell it _rsvd; to make it extra extra clear that
> people shouldn't be doing anything with it.

Alternatively, to carry the "zero" in the name, how about _mbz?

Jan


  reply	other threads:[~2024-10-30  6:38 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-21 15:45 [PATCH v7 00/10] x86: Expose consistent topology to guests Alejandro Vallejo
2024-10-21 15:45 ` [PATCH v7 01/10] lib/x86: Bump max basic leaf in {pv,hvm}_max_policy Alejandro Vallejo
2024-10-29 17:57   ` Andrew Cooper
2024-10-21 15:45 ` [PATCH v7 02/10] xen/x86: Add initial x2APIC ID to the per-vLAPIC save area Alejandro Vallejo
2024-10-29 20:30   ` Andrew Cooper
2024-10-30  6:37     ` Jan Beulich [this message]
2024-10-30 12:03       ` Alejandro Vallejo
2024-10-30 12:05         ` Jan Beulich
2024-10-30 12:25       ` Andrew Cooper
2024-10-30 12:00     ` Alejandro Vallejo
2024-10-21 15:45 ` [PATCH v7 03/10] xen/x86: Add supporting code for uploading LAPIC contexts during domain create Alejandro Vallejo
2024-12-02  9:27   ` Jan Beulich
2024-10-21 15:45 ` [PATCH v7 04/10] tools/hvmloader: Retrieve (x2)APIC IDs from the APs themselves Alejandro Vallejo
2024-10-30 11:31   ` Andrew Cooper
2024-10-30 12:04     ` Jan Beulich
2024-11-11 11:20     ` Alejandro Vallejo
2024-11-11 12:07       ` Jan Beulich
2024-12-02  9:36   ` Jan Beulich
2024-10-21 15:45 ` [PATCH v7 05/10] tools/libacpi: Use LUT of APIC IDs rather than function pointer Alejandro Vallejo
2024-10-30 14:56   ` Andrew Cooper
2024-12-02  9:40   ` Jan Beulich
2024-10-21 15:45 ` [PATCH v7 06/10] tools/libguest: Always set vCPU context in vcpu_hvm() Alejandro Vallejo
2024-10-21 15:45 ` [PATCH v7 07/10] xen/lib: Add topology generator for x86 Alejandro Vallejo
2024-10-21 15:45 ` [PATCH v7 08/10] xen/x86: Derive topologically correct x2APIC IDs from the policy Alejandro Vallejo
2024-10-21 15:45 ` [PATCH v7 09/10] tools/libguest: Set distinct x2APIC IDs for each vCPU Alejandro Vallejo
2024-10-21 15:46 ` [PATCH v7 10/10] tools/x86: Synthesise domain topologies Alejandro Vallejo
2024-12-02  9:18   ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b143ada2-9719-4701-9a03-36ee8607958f@suse.com \
    --to=jbeulich@suse.com \
    --cc=alejandro.vallejo@cloud.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.