From 0f4c0879ab97e7bb08f43a933fe2bb89e6f85d17 Mon Sep 17 00:00:00 2001 From: Neeraj Upadhyay Date: Wed, 5 May 2021 15:10:27 +0530 Subject: [PATCH] ANDROID: irq: manage: Export irq_do_set_affinity symbol Vendor kernel modules may implement irq balancers, which could take irq desc lock of an irq and then based on current affinity mask or affinity hint, reconfigure the affinity of that irq. For example : For an irq, for which affinity is broken i.e. all the cpus in its affinity mask have gone offline. For such irqs, we might want to reset the affinity, when the original set of affined cpus, come back online. desc->affinity_hint can be used for figuring out the original affinity. So, the sequence for doing this becomes: desc = irq_to_desc(i); raw_spin_lock(&desc->lock); affinity = desc->affinity_hint; raw_spin_unlock(&desc->lock); irq_set_affinity_hint(i, affinity); Here, we need to release the desc lock before calling the exported api irq_set_affinity_hint(). This creates a window where, after unlocking desc lock and before calling irq_set_affinity_hint(), where this setting can race with other irq_set_affinity_hint() callers. So, export irq_do_set_affinity() symbol to provide an api, which can be called with desc lock held. Bug: 187157600 Change-Id: Ifad88bfaa1e7eec09c3fe5a9dd7d1d421362b41e Signed-off-by: Neeraj Upadhyay (cherry picked from commit 9f7014a6d21b6f650df4ba43869649ff37aa8c75) Signed-off-by: Guru Das Srinagesh --- kernel/irq/manage.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index f0803d6bd296..7b3690266d32 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -292,6 +292,7 @@ int irq_do_set_affinity(struct irq_data *data, const struct cpumask *mask, return ret; } +EXPORT_SYMBOL_GPL(irq_do_set_affinity); #ifdef CONFIG_GENERIC_PENDING_IRQ static inline int irq_set_affinity_pending(struct irq_data *data,