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

Re: [PATCH v2] x86/apic: Avoid infinite loop in io_apic_level_ack_pending()


  • To: Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Wed, 15 Oct 2025 13:14:20 -0400
  • 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=q+fHBwsUsHRxHxzb+whFumPY0A6HjUkQ3B5uEWEf6E4=; b=l+6l5DsDoQARh3TUZWMs7Ta21IQCzvkJwrF+aMTDDbYXNPGnRApT9nYa8/4jrEgVKHiwD6a8hhyKLGAioVLJB5YNTp+eVDdprBPBvy7MAUivwwhfaSsq1s3IwUIcsSm7VicmtNtueBz+bYRMHPJmtvvrPi9lfYHMUr6bMUHW3yB5bnR1NoDrNzGnddeuNY6DgyEIY7E+SaVzHJDALPSMm4tdSPzxJO3WdQq9SO6uLR1JL7uQvRYvDMJs3L/69YTCghUjXO3RAGInAM6s71E0edWa3h64v0W/gaya/a9o88sYF5S33bqh/ouYoacr6oN5GFsYcrepFBjhwqRuRMHdfQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xzWRwPC31Si1FPMxD0WZUC0EF2Wc26USVs0+kYAq/95fjX/d5+697QqAtnp74j2pUfSRahz3isOEFfgwOBdUrti9Uo9Sn0Qd7RxxWW4sD8RmyUz8ZX9kANrmJPUS0pmalAcXyb8L1HFs3oyuf/d38ywQkeIiOqgS1ozTXOuRfCocPjfRgwA6HgrE9pqHJkUWRgKjMU2q/0/cUuaVtQ4DOTpQACp1nRqbqvpbofh1733ZO9uqum6IyL3wR0NihD6r+hjZ4EzNN+TqQ/lOPrgW9nNzVcbY6VILS/i2/TADtTpJmDcqLXvvMY+jYOkqW4DCI7CFDTa09cWG6OYKOC/Mew==
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Wed, 15 Oct 2025 17:14:39 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2025-10-15 08:59, Jan Beulich wrote:
On 14.10.2025 09:37, Roger Pau Monné wrote:
On Mon, Oct 13, 2025 at 05:11:06PM -0400, Jason Andryuk wrote:
io_apic_level_ack_pending() will end up in an infinite loop if
entry->pin == -1.  entry does not change, so it will keep reading -1.

Do you know how you end up with an entry with pin == -1 on the
irq_pin_list? Are there systems with gaps in the GSI space between
IO-APICs?  So far everything I saw had the IO-APIC in contiguous GSI
space.

Convert to a proper for loop so that continue works.  Add a new helper,
next_entry(), to handle advancing to the next irq_pin_list entry.

Fixes: f821102450a1 ("x86: IRQ Migration logic enhancement.")
Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
---
v2:
continue (not break) for pin == -1.

I added the next_entry() helper since putting the expression in the for
loop is a little cluttered.  The helper can also be re-used for other
instances within the file.

Would this intention ...

--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -1586,14 +1586,21 @@ static int __init cf_check setup_ioapic_ack(const char 
*s)
  }
  custom_param("ioapic_ack", setup_ioapic_ack);
+static struct irq_pin_list *next_entry(struct irq_pin_list *entry)

I think you can make the entry parameter const?

... possibly conflict with such a change?

I changed only the parameter to const, and the return value is still non-const. So I think that will be re-usable.

I placed next_entry() immediately before its use in io_apic_level_ack_pending(). It would need to be earlier in the file to be used more. Should I move its addition earlier?

And another Minor question. Roger asked for ~Linux style in the for loop. But in next_entry() I have Xen style:
    if ( !entry->next )

Should I switch to:
    if (!entry->next)

?

Thanks,
Jason



 


Rackspace

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