From: jeffy <jeffy.chen@rock-chips.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org, briannorris@chromium.org,
dianders@chromium.org, tfiga@chromium.org
Subject: Re: [RFC PATCH] genirq: Avoid unnecessary low level irq function calls
Date: Mon, 26 Jun 2017 17:57:38 +0800 [thread overview]
Message-ID: <5950DA92.5050709@rock-chips.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1706261011540.2425@nanos>
Hi Thomas,
thanx for your comments.
On 06/26/2017 04:20 PM, Thomas Gleixner wrote:
> Jeffy,
>
> On Mon, 26 Jun 2017, Jeffy Chen wrote:
>> void irq_enable(struct irq_desc *desc)
>> {
>> - irq_state_clr_disabled(desc);
>> - if (desc->irq_data.chip->irq_enable)
>> - desc->irq_data.chip->irq_enable(&desc->irq_data);
>> - else
>> - desc->irq_data.chip->irq_unmask(&desc->irq_data);
>> - irq_state_clr_masked(desc);
>> + if (irqd_is_started(&desc->irq_data) &&
>> + !irqd_irq_disabled(&desc->irq_data)) {
>> + unmask_irq(desc);
>
> I'm having a hard time to understand the logic here.
>
> if (started && !disabled)
> unmask()
>
> That does not make any sense. If you need that to work around a state
> inconsistency then it needs to be addressed there and not worked around
> here.
right, we already set disabled state in desc_set_defaults, so the
disabled state should be consistency here. so just
if(!disabled)
unmask()
else
enable()
?
and i saw we didn't set masked state in desc_set_defaults, i'll send a
patch for that, and remove unmask_irq's started check too.
>
>> + } else {
>> + irq_state_clr_disabled(desc);
>> + if (desc->irq_data.chip->irq_enable) {
>> + desc->irq_data.chip->irq_enable(&desc->irq_data);
>> + irq_state_clr_masked(desc);
>> + } else {
>> + unmask_irq(desc);
>> + }
>> + }
>> }
>>
>> static void __irq_disable(struct irq_desc *desc, bool mask)
>> {
>> - irq_state_set_disabled(desc);
>> - if (desc->irq_data.chip->irq_disable) {
>> - desc->irq_data.chip->irq_disable(&desc->irq_data);
>> - irq_state_set_masked(desc);
>> - } else if (mask) {
>> - mask_irq(desc);
>> + if (irqd_irq_disabled(&desc->irq_data)) {
>> + if (mask)
>> + mask_irq(desc);
>> + } else {
>> + irq_state_set_disabled(desc);
>> + if (desc->irq_data.chip->irq_disable) {
>> + desc->irq_data.chip->irq_disable(&desc->irq_data);
>> + irq_state_set_masked(desc);
>> + } else if (mask) {
>> + mask_irq(desc);
>> + }
>> }
>> }
>>
>> @@ -311,18 +322,21 @@ void irq_percpu_disable(struct irq_desc *desc, unsigned int cpu)
>>
>> static inline void mask_ack_irq(struct irq_desc *desc)
>> {
>> - if (desc->irq_data.chip->irq_mask_ack)
>> + if (desc->irq_data.chip->irq_mask_ack) {
>> desc->irq_data.chip->irq_mask_ack(&desc->irq_data);
>> - else {
>> - desc->irq_data.chip->irq_mask(&desc->irq_data);
>> + irq_state_set_masked(desc);
>> + } else {
>> + mask_irq(desc);
>> if (desc->irq_data.chip->irq_ack)
>> desc->irq_data.chip->irq_ack(&desc->irq_data);
>> }
>> - irq_state_set_masked(desc);
>> }
>>
>> void mask_irq(struct irq_desc *desc)
>> {
>> + if (irqd_irq_masked(&desc->irq_data))
>> + return;
>> +
>> if (desc->irq_data.chip->irq_mask) {
>> desc->irq_data.chip->irq_mask(&desc->irq_data);
>> irq_state_set_masked(desc);
>> @@ -331,6 +345,10 @@ void mask_irq(struct irq_desc *desc)
>>
>> void unmask_irq(struct irq_desc *desc)
>> {
>> + if (irqd_is_started(&desc->irq_data) &&
>> + !irqd_irq_masked(&desc->irq_data))
>> + return;
>
> Ditto.
>
> Thanks,
>
> tglx
>
>
>
prev parent reply other threads:[~2017-06-26 9:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-26 6:12 [RFC PATCH] genirq: Avoid unnecessary low level irq function calls Jeffy Chen
2017-06-26 8:20 ` Thomas Gleixner
2017-06-26 9:57 ` jeffy [this message]
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=5950DA92.5050709@rock-chips.com \
--to=jeffy.chen@rock-chips.com \
--cc=briannorris@chromium.org \
--cc=dianders@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tfiga@chromium.org \
--cc=tglx@linutronix.de \
/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.