* [PATCH] kernel/irq: Make irq_set_affinity_hint return the real return value
@ 2021-09-06 8:20 Hao Peng
2021-09-06 9:50 ` Thomas Gleixner
0 siblings, 1 reply; 2+ messages in thread
From: Hao Peng @ 2021-09-06 8:20 UTC (permalink / raw)
To: tglx; +Cc: linux-kernel
irq_set_affinity_hint does not return the return value of
__irq_set_affinity, which makes the state of functions dependent
on the return value of irq_set_affinity_hint inconsistent.
Signed-off-by: Peng Hao <flyingpeng@tencent.com>
---
kernel/irq/manage.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index ef30b4762947..86196fb826d6 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -490,6 +490,7 @@ EXPORT_SYMBOL_GPL(irq_force_affinity);
int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m)
{
unsigned long flags;
+ int ret = 0;
struct irq_desc *desc = irq_get_desc_lock(irq, &flags,
IRQ_GET_DESC_CHECK_GLOBAL);
if (!desc)
@@ -498,8 +499,8 @@ int irq_set_affinity_hint(unsigned int irq, const
struct cpumask *m)
irq_put_desc_unlock(desc, flags);
/* set the initial affinity to prevent every interrupt being on CPU0 */
if (m)
- __irq_set_affinity(irq, m, false);
- return 0;
+ ret = __irq_set_affinity(irq, m, false);
+ return ret;
}
EXPORT_SYMBOL_GPL(irq_set_affinity_hint);
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] kernel/irq: Make irq_set_affinity_hint return the real return value
2021-09-06 8:20 [PATCH] kernel/irq: Make irq_set_affinity_hint return the real return value Hao Peng
@ 2021-09-06 9:50 ` Thomas Gleixner
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Gleixner @ 2021-09-06 9:50 UTC (permalink / raw)
To: Hao Peng; +Cc: linux-kernel
On Mon, Sep 06 2021 at 16:20, Hao Peng wrote:
> irq_set_affinity_hint does not return the return value of
> __irq_set_affinity, which makes the state of functions dependent
> on the return value of irq_set_affinity_hint inconsistent.
No, it does not. The affinity hint has been installed even in the case
that __irq_set_affinity() fails.
Setting the affinity in that function is a best effort operation without
any guarantees and in hindsight this should have never been added to
this function.
Thanks,
tglx
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-09-06 9:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-06 8:20 [PATCH] kernel/irq: Make irq_set_affinity_hint return the real return value Hao Peng
2021-09-06 9:50 ` Thomas Gleixner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).