From: psodagud@codeaurora.org (Sodagudi Prasad)
To: linux-arm-kernel@lists.infradead.org
Subject: Schedule affinity_notify work while migrating IRQs during hot plug
Date: Mon, 13 Mar 2017 12:43:53 -0700 [thread overview]
Message-ID: <36fe90bcca0a9c6283c4012412ed2924@codeaurora.org> (raw)
In-Reply-To: <alpine.DEB.2.20.1702271818370.4732@nanos>
On 2017-02-27 09:21, Thomas Gleixner wrote:
> On Mon, 27 Feb 2017, Sodagudi Prasad wrote:
>> So I am thinking that, adding following sched_work() would notify
>> clients.
>
> And break the world and some more.
>
>> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
>> index 6b66959..5e4766b 100644
>> --- a/kernel/irq/manage.c
>> +++ b/kernel/irq/manage.c
>> @@ -207,6 +207,7 @@ int irq_do_set_affinity(struct irq_data *data,
>> const
>> struct cpumask *mask,
>> case IRQ_SET_MASK_OK_DONE:
>> cpumask_copy(desc->irq_common_data.affinity, mask);
>> case IRQ_SET_MASK_OK_NOCOPY:
>> + schedule_work(&desc->affinity_notify->work);
>> irq_set_thread_affinity(desc);
>> ret = 0;
>
> You cannot do that unconditionally and just slap that schedule_work()
> call
> into the code. Aside of that schedule_work() would be invoked twice for
> all
> calls which come via irq_set_affinity_locked() ....
Hi Tglx,
Yes. I agree with you, schedule_work() gets invoked twice with previous
change.
How about calling irq_set_notify_locked() instead of
irq_do_set_notify()?
diff --git a/kernel/irq/cpuhotplug.c b/kernel/irq/cpuhotplug.c
index 011f8c4..e8ce0db 100644
--- a/kernel/irq/cpuhotplug.c
+++ b/kernel/irq/cpuhotplug.c
@@ -18,8 +18,8 @@ static bool migrate_one_irq(struct irq_desc *desc)
{
struct irq_data *d = irq_desc_get_irq_data(desc);
const struct cpumask *affinity = d->common->affinity;
- struct irq_chip *c;
bool ret = false;
+ int r;
/*
* If this is a per-CPU interrupt, or the affinity does not
@@ -34,15 +34,10 @@ static bool migrate_one_irq(struct irq_desc *desc)
ret = true;
}
- c = irq_data_get_irq_chip(d);
- if (!c->irq_set_affinity) {
- pr_debug("IRQ%u: unable to set affinity\n", d->irq);
- } else {
- int r = irq_do_set_affinity(d, affinity, false);
- if (r)
- pr_warn_ratelimited("IRQ%u: set affinity
failed(%d).\n",
+ r = irq_set_affinity_locked(d, affinity, false);
+ if (r)
+ pr_warn_ratelimited("IRQ%u: set affinity failed(%d).\n",
d->irq, r);
- }
return ret;
-Thanks, Prasad
>
> Thanks,
>
> tglx
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
Forum,
Linux Foundation Collaborative Project
WARNING: multiple messages have this Message-ID (diff)
From: Sodagudi Prasad <psodagud@codeaurora.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, james.morse@arm.com,
will.deacon@arm.com, catalin.marinas@arm.com
Subject: Re: Schedule affinity_notify work while migrating IRQs during hot plug
Date: Mon, 13 Mar 2017 12:43:53 -0700 [thread overview]
Message-ID: <36fe90bcca0a9c6283c4012412ed2924@codeaurora.org> (raw)
In-Reply-To: <alpine.DEB.2.20.1702271818370.4732@nanos>
On 2017-02-27 09:21, Thomas Gleixner wrote:
> On Mon, 27 Feb 2017, Sodagudi Prasad wrote:
>> So I am thinking that, adding following sched_work() would notify
>> clients.
>
> And break the world and some more.
>
>> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
>> index 6b66959..5e4766b 100644
>> --- a/kernel/irq/manage.c
>> +++ b/kernel/irq/manage.c
>> @@ -207,6 +207,7 @@ int irq_do_set_affinity(struct irq_data *data,
>> const
>> struct cpumask *mask,
>> case IRQ_SET_MASK_OK_DONE:
>> cpumask_copy(desc->irq_common_data.affinity, mask);
>> case IRQ_SET_MASK_OK_NOCOPY:
>> + schedule_work(&desc->affinity_notify->work);
>> irq_set_thread_affinity(desc);
>> ret = 0;
>
> You cannot do that unconditionally and just slap that schedule_work()
> call
> into the code. Aside of that schedule_work() would be invoked twice for
> all
> calls which come via irq_set_affinity_locked() ....
Hi Tglx,
Yes. I agree with you, schedule_work() gets invoked twice with previous
change.
How about calling irq_set_notify_locked() instead of
irq_do_set_notify()?
diff --git a/kernel/irq/cpuhotplug.c b/kernel/irq/cpuhotplug.c
index 011f8c4..e8ce0db 100644
--- a/kernel/irq/cpuhotplug.c
+++ b/kernel/irq/cpuhotplug.c
@@ -18,8 +18,8 @@ static bool migrate_one_irq(struct irq_desc *desc)
{
struct irq_data *d = irq_desc_get_irq_data(desc);
const struct cpumask *affinity = d->common->affinity;
- struct irq_chip *c;
bool ret = false;
+ int r;
/*
* If this is a per-CPU interrupt, or the affinity does not
@@ -34,15 +34,10 @@ static bool migrate_one_irq(struct irq_desc *desc)
ret = true;
}
- c = irq_data_get_irq_chip(d);
- if (!c->irq_set_affinity) {
- pr_debug("IRQ%u: unable to set affinity\n", d->irq);
- } else {
- int r = irq_do_set_affinity(d, affinity, false);
- if (r)
- pr_warn_ratelimited("IRQ%u: set affinity
failed(%d).\n",
+ r = irq_set_affinity_locked(d, affinity, false);
+ if (r)
+ pr_warn_ratelimited("IRQ%u: set affinity failed(%d).\n",
d->irq, r);
- }
return ret;
-Thanks, Prasad
>
> Thanks,
>
> tglx
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
Forum,
Linux Foundation Collaborative Project
next prev parent reply other threads:[~2017-03-13 19:43 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-21 20:59 Schedule affinity_notify work while migrating IRQs during hot plug Sodagudi Prasad
2017-02-21 20:59 ` Sodagudi Prasad
2017-02-27 17:12 ` Sodagudi Prasad
2017-02-27 17:12 ` Sodagudi Prasad
2017-02-27 17:21 ` Thomas Gleixner
2017-02-27 17:21 ` Thomas Gleixner
2017-03-13 19:43 ` Sodagudi Prasad [this message]
2017-03-13 19:43 ` Sodagudi Prasad
2017-03-13 20:19 ` Thomas Gleixner
2017-03-13 20:19 ` Thomas Gleixner
2017-03-17 10:51 ` Sodagudi Prasad
2017-03-17 10:51 ` Sodagudi Prasad
2017-03-17 13:18 ` Thomas Gleixner
2017-03-17 13:18 ` Thomas Gleixner
2017-03-20 16:36 ` Prasad Sodagudi
2017-03-20 16:36 ` Prasad Sodagudi
2017-03-20 16:36 ` [PATCH] genirq: Notify clients whenever there is change in affinity Prasad Sodagudi
2017-03-20 16:36 ` Prasad Sodagudi
2017-03-23 2:33 ` kbuild test robot
2017-03-23 2:33 ` kbuild test robot
2017-03-23 6:18 ` kbuild test robot
2017-03-23 6:18 ` kbuild test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=36fe90bcca0a9c6283c4012412ed2924@codeaurora.org \
--to=psodagud@codeaurora.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.