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

Re: [PATCH 05/12] x86/io-apic: purge usage of logical mode


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Thu, 20 Nov 2025 18:30:50 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • 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=cBxSC6UCsEsioV2QWg0TKmfWGZelgz0jipyCXdGpmas=; b=lDvBwsbGb0Q+izIpAb8rUCL+PIy5ylxzOBD1blJK0HdWOfruv78X+Gg+xxYOAPnHyfoE1gU6Lmn2ALhnWGudbmycebe9TL38Vz9FUKa9AVJkEn5uFxjpZESXtBiB0ZQr5Ky70jeoswOwF6EjNUrfFxdrqSdnJVbCF4Vmbq7Z7Q7U8LSvSAa4b63JO8x7fMlUIvep7Pbo9Adj9L7EDY7aKFrHIjSJad02GYG0X9R9EN9p1r+ZKvB7jeDDrMU1Yqz0wNM50beZYdroN8GcxH34fj3d+SsVEzvpWih1Vcj6j3cmt13ZdpMFv/We1drI0uHwBIbwPhlLouyt8meUI7A2fQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aLnTWkVkAfrlT4ONx75bEKaLlVXqYm2kNp9r3BttY8PNNfqwkjC1V3/ALmWvuy89LvzXO/n/adlmXb2yD2JXdJwR7n7KNIXWDgYSWGsbu62bLiBgtXwSwkBEraFA0dz7U81RHJT3SpVVPCJRVB2szN3GlKzlbpzkp7MdS7qehYAFgWgEZ0HVz7X3QaeleP2HKevrg5EqhU/NWHvR7eikR4xglsy6jgc1t9xmUhTzLmZt5Pi8VmjrVJnbjuuPwoo3CQai+cFJ9CizuG6TiA1F5sBEeNjjt20oCO4ZJSErwGStipTcnw9VxP5Bt0J2S2wyhPwzMjJJJa5BC8li6cmE5w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 20 Nov 2025 18:31:14 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 20/11/2025 2:27 pm, Jan Beulich wrote:
> On 20.11.2025 14:18, Andrew Cooper wrote:
>> On 20/11/2025 9:06 am, Roger Pau Monne wrote:
>>> The IO-APIC RTEs are unconditionally programmed with physical destination
>>> mode, and hence the field to set in the RTE is always physical_dest.
>>>
>>> Remove the mode parameter from SET_DEST() and take the opportunity to
>>> convert it into a function, there's no need for it to be a macro.
>>>
>>> This is a benign fix, because due to the endianness of x86 the start of the
>>> physical_dest and logical_dest fields on the RTE overlap.
>> RTEs do not have overlapping fields; it's Xen's abstraction of the
>> IO-APIC which is buggy.
> I wouldn't put it this negatively. In the old days, ...
>
>> For starters, Xen's IO_APIC_route_entry still only has a 4-bit
>> physical_dest field which hasn't been true since the Pentium 4 days. 
>> This might explain some of the interrupt bugs we see.
> ... as you mention here, the two fields were distinct (and hence overlapping).

Since when?

Even in the oldest manuals I can find, it's a single field called
destination, and who's contents is interpreted differently depending on
the logical mode bit.

>From a hardware point of view, there will either be 4 or 8 bits of
storage, and it will have nothing to do with the lower bits.

> In a number of places we passed "logical" to SET_DEST() as the middle 
> argument,
> thus covering for the too narrow field width of physical_dest. Dropping that
> parameter and always using physical_dest requires that field to be widened,
> though (or else we'll end up chopping off the top 4 bits, as we already do in
> disable_IO_APIC() and unlock_ExtINT_logic() - both benign as long as the CPU
> used always has APIC ID 0, which will at least typically be the case, I 
> think).

Latent or not, it's still in need of fixing.

It looks like the code Xen inherited was added to Linux in e1d919786
(Jan 2008, even then only x86_32) and deleted by d83e94acd957 (August 2008).

It looks like we're 17 years late undoing this...

~Andrew



 


Rackspace

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