[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4] xen/x86: On x2APIC mode, derive LDR from APIC ID
- To: Alejandro Vallejo <alejandro.vallejo@xxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Mon, 27 Nov 2023 09:40:41 +0100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=eKqgYgBZgxZzjwy0IBelXNH7KhvjD+C+mCZJjhqUUFo=; b=WeSsrAm6a/7fLAELfXV8DH7yd6t2kl25lv6dOeJ7ZVF/sx/sgi6SoaUoaM4aODc40s8rFcKJv72VGzLYq0WkHTmyY222gZD+T/1nWUHn8x8ThWawhJJ6D3T66neIyoChu/QRvG3urghWTkrbCdnWbiDdcmO0Um8caEXSJCGQB1yE/5dUdfKwoqTyrYyRChRAnuQ58a9dXmfMVMrbnx4QsKDFo1XmulW8kZ5xAzqE9e+HBGYALpxnUzWwcpVH7+KgPMM9hM3C/0xXqnSPIdp4zumERAQH5ps4u1Nf+IxEURiaO9TL+13atVzJjx3MK3VCOM/cXXSeM1ITnLVYq4qTNQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RJqmlL70zuv2tgzQEj9zwRucm8DfaZABbtiXSP5sGjf3ZLF2cH7KUPOGaLpDcmHGbzUCKzTGk4o1UHRXSn8CkMfuYev/v0Cizi8IfrrhWwzy5eZoDPhfHwxLNI/TqMlgTuyPgzTWriWf7Ig2TPaEn+/SgQHfTUwivQ/c7C4GtHCNNMyBDow4mCceQnUJ0g+2Vp4onzdTofclKH+bijrnim3amPEIje+Fc/JNLt5qkKKvnd465B6VcJFqboAZDN9cYwbJbh3s+j/CCrGSFk9aJScxnUgXh2eNQO9K81BELxxvyXyeYrc6l6BGj4o1H4lNxVdvFP0PZLGAIlB9gkMSUg==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Autocrypt: addr=jbeulich@xxxxxxxx; 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
- Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Mon, 27 Nov 2023 08:40:50 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 23.11.2023 18:30, Alejandro Vallejo wrote:
> @@ -1498,27 +1511,36 @@ static int cf_check lapic_save_regs(struct vcpu *v,
> hvm_domain_context_t *h)
> */
> static void lapic_load_fixup(struct vlapic *vlapic)
> {
> - uint32_t id = vlapic->loaded.id;
> + uint32_t good_ldr = x2apic_ldr_from_id(vlapic->loaded.id);
>
> - if ( vlapic_x2apic_mode(vlapic) && id && vlapic->loaded.ldr == 1 )
> - {
> + /* Skip fixups on xAPIC mode, or if the x2APIC LDR is already correct */
> + if ( !vlapic_x2apic_mode(vlapic) ||
> + (vlapic->loaded.ldr == good_ldr) )
> + return;
> +
> + if ( vlapic->loaded.ldr == 1 )
> + /*
> + * Xen <= 4.4 may have a bug by which all the APICs configured in
> + * x2APIC mode got LDR = 1. We can't leave it as-is because it
> + * assigned the same LDR to every CPU. We'll fix fix the bug now
> + * and assign an LDR value consistent with the APIC ID.
> + */
Just one comment on top of Andrew's: Is the double "fix" really intended
here? (I could see it might be, but then "fix the bug fix" would read
slightly more smoothly to me as a non-native speaker.)
Another aspect here is what exactly the comment states (and does not
state). Original comments made explicit that LDR == 1 contradicts ID == 0.
In the new comment you only emphasize that all CPUs cannot have that same
LDR. But the value of 1 being bogus in the first place doesn't become clear
anymore.
Jan
|