Hi Mykyta,
On 12/11/2025 10:51, Mykyta Poturai wrote:
> Currently on Arm the desc->affinity mask of an irq is never updated,
> which makes it hard to know the actual affinity of an interrupt.
>
> Fix this by updating the field in irq_set_affinity.
>
> Signed-off-by: Mykyta Poturai <mykyta_poturai@epam.com>
>
> v3->v4:
> * patch introduced
> ---
> xen/arch/arm/irq.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
> index 73e58a5108..28b40331f7 100644
> --- a/xen/arch/arm/irq.c
> +++ b/xen/arch/arm/irq.c
> @@ -219,7 +219,10 @@ static inline struct domain *irq_get_domain(struct irq_desc *desc)
> void irq_set_affinity(struct irq_desc *desc, const cpumask_t *mask)
> {
> if ( desc != NULL )
> + {
> + cpumask_copy(desc->affinity, mask);
irq_set_affinity() doesn't always seems to be called with ``desc->lock``
taken (see vgic_migrate_irq(), arch_move_irqs()). So I am not sure this
is safe. You probably need to update the callers as well to always take
the lock. irq_set_affinity() probably want to gain an
ASSERT(spin_is_locked()) with some documentation on top of the function.
> desc->handler->set_affinity(desc, mask);
> + }
NIT: As there are multiple lines in the ``if``, I would consider
reworking the logic so we return early when desc is NULL.
> }
>
> int request_irq(unsigned int irq, unsigned int irqflags,
Cheers,
--
Julien Grall