[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] x86/irq: do not release irq until all cleanup is done
- To: Roger Pau Monne <roger.pau@xxxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Thu, 17 Nov 2022 10:13:05 +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=pUSfZFcPU8crlb93Lfga+nPUB1wmyzPdS0J2wO3SQFE=; b=WcLu6jvvl/U0Ti6YGU9VcB6szuClJ7BJJbb8dMKrJ5OQ2ZGPoAfvEam7i1/JFevMP9ozD/4cllVtJTuvadQwOc7XUUOtubEkn0mltQEc9MCuxNVuFHskcuc/twVQK8+EevtynbnErGKw1DOpP9rv9PuxL5GgAGKNAqoe2f0+LZfaf3k2Na/5vyTVgnoqSWlRIEg3Fld3mV37g/3MVrAmaeP/HjSVJezF8+QMyKfoKICXKta12D++mHvxXjYrjsf+0swWeuob1f1NPGGxNsVAPZ+2UMZ6Oc0N866lXScoaVLnXMYdzN8PQijQu+wPv/sws63/cdDEhtbFSU/zTNOXZA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Eg7Uhtdk5SQMnBSaqv5ku6ZYEbmg3GKqL2kyKbcTjoBermrXMXr1PP1lj9kkEJlE4JJqkaPl5ZRZMEKcfUufBHR+7S07hRWd5eqGU5pLBC6dlsk1Gih+cuMe1u8GkPVVbhQZWzoWoOd0QJ3Wt2SpTcJx0iVoWGALtG9bPDKVscEEv+/AL25sk7CYvNIWTiZViuHerBhgzG01xfcNROuNQ2EJd29B34ysDmBM0rR0BKEAgnDaViW0dwsAFwz+okgAfhI3+rzPeuxGm5Kw+FngQ+gJizAjA/Z8+SXplRMVsMw2pLrTfu78PSKc0v3gwNtGabuXhmVg4b96RmZljQOVGQ==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Thu, 17 Nov 2022 09:13:21 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 16.11.2022 13:21, Roger Pau Monne wrote:
> Current code in _clear_irq_vector() will mark the irq as unused before
> doing the cleanup required when move_in_progress is true.
>
> This can lead to races in create_irq() if the function picks an irq
> desc that's been marked as unused but has move_in_progress set, as the
> call to assign_irq_vector() in that function can then fail with
> -EAGAIN.
>
> Prevent that by only marking irq descs as unused when all the cleanup
> has been done. While there also use write_atomic() when setting
> IRQ_UNUSED in _clear_irq_vector() and add a barrier in order to
> prevent the setting of IRQ_UNUSED getting reordered by the compiler.
>
> The check for move_in_progress cannot be removed from
> _assign_irq_vector(), as other users (io_apic_set_pci_routing() and
> ioapic_guest_write()) can still pass active irq descs to
> assign_irq_vector().
>
> Note the trace point is not moved and is now set before the irq is
> marked as unused. This is done so that the CPU mask provided in the
> trace point is the one belonging to the current vector, not the old
> one.
>
> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
|