Re: [PATCH 5/7] xen/events: drop xen_allocate_irqs_dynamic()

From: Juergen Gross
Date: Tue Nov 14 2023 - 03:35:53 EST


On 14.11.23 09:20, Oleksandr Tyshchenko wrote:


On 16.10.23 09:28, Juergen Gross wrote:


Hello Juergen

Instead of having a common function for allocating a single IRQ or a
consecutive number of IRQs, split up the functionality into the callers
of xen_allocate_irqs_dynamic().

This allows to handle any allocation error in xen_irq_init() gracefully
instead of panicing the system. Let xen_irq_init() return the irq_info
pointer or NULL in case of an allocation error.

Additionally set the IRQ into irq_info already at allocation time, as
otherwise the IRQ would be '0' (which is a valid IRQ number) until
being set.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
drivers/xen/events/events_base.c | 74 +++++++++++++++++++-------------
1 file changed, 44 insertions(+), 30 deletions(-)


[snip]

@@ -1725,6 +1738,7 @@ void rebind_evtchn_irq(evtchn_port_t evtchn, int irq)
so there should be a proper type */
BUG_ON(info->type == IRQT_UNBOUND);
+ info->irq = irq;


I failed to understand why this is added here. Doesn't irq remain the
same, and info->irq remains valid? Could you please clarify.

The IRQ remains the same, but the event channel could change.

This setting of info->irq compensates for the related removal in
xen_irq_info_common_setup().


Other changes lgtm.


Juergen

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature