All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Finn Thain <fthain@telegraphics.com.au>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: "Linux/m68k" <linux-m68k@vger.kernel.org>, linux-kernel@vger.kernel.org
Subject: Re: m68k: [v5] Convert to genirq (WIP)
Date: Fri, 2 Sep 2011 20:24:25 +0200	[thread overview]
Message-ID: <CAMuHMdXj-YDFPcsQFdaWzMU8w=2VQkpBpJGmjxsXT1Y+55W43g@mail.gmail.com> (raw)
In-Reply-To: <CAMuHMdVmNAOSK+M9z-ySOR-oA4LwuS_N0SZ8XxzQ9_pYqM_vdQ@mail.gmail.com>

On Fri, Sep 2, 2011 at 19:24, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Fri, Sep 2, 2011 at 14:14, Finn Thain <fthain@telegraphics.com.au> wrote:
>> On Sun, 28 Aug 2011, I wrote:
>> However, I found another problem. pmac_zilog oopses when its TTY is closed
>> (see below). And macsonic does the same when the NIC is closed. The trace
>> says that irq_shutdown() died trying to call the chip irq_mask routine,
>> when desc->irq_data.chip (in a0) was NULL. Any ideas?
>
>> Unable to handle kernel NULL pointer dereference at virtual address   (null)
>> Oops: 00000000
>> Modules linked in:
>> PC: [<00000000>]   (null)
>
> No, it calls a function pointer that's NULL.
>
> void irq_shutdown(struct irq_desc *desc)
> {
>        irq_state_set_disabled(desc);
>        desc->depth = 1;
>        if (desc->irq_data.chip->irq_shutdown)
>                desc->irq_data.chip->irq_shutdown(&desc->irq_data);
>        if (desc->irq_data.chip->irq_disable)
>                desc->irq_data.chip->irq_disable(&desc->irq_data);
>        else
>                desc->irq_data.chip->irq_mask(&desc->irq_data);
>        irq_state_set_masked(desc);
> }
>
> Oops, seems I misread the code and assumed the second "if" was an "else if",
> as I wrote down in my notes that it calls only one of the 3 functions :-(
> But it does need either .irq_disable() or .irq_mask().

However, include/linux/irq.h says:

 * @irq_shutdown:       shut down the interrupt (defaults to ->disable if NULL)

which gives me the impression the original intention was to have an "else if",
and don't require .irq_disable() or .irq_mask() if .irq_shutdown() is available.

That's also what  __free_irq() used to do, cfr.
3b56f0585fd4c02d047dc406668cb40159b2d340

"genirq: Remove bogus conditional

 The if (chip->irq_shutdown) check will always evaluate to true, as we
 fill in chip->irq_shutdown with default_shutdown in
 irq_chip_set_defaults() if the chip does not provide its own function."

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 33a6ee0..30bc8de 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1057,10 +1057,7 @@ static struct irqaction *__free_irq(unsigned int irq, voi
        /* If this was the last handler, shut down the IRQ line: */
        if (!desc->action) {
                desc->status |= IRQ_DISABLED;
-               if (desc->irq_data.chip->irq_shutdown)
-                       desc->irq_data.chip->irq_shutdown(&desc->irq_data);
-               else
-                       desc->irq_data.chip->irq_disable(&desc->irq_data);
+               desc->irq_data.chip->irq_shutdown(&desc->irq_data);
        }

 #ifdef CONFIG_SMP

(at that time the check had become bogus, as .irq_shutdown() was always set to
.irq_disable() if it was NULL).

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply	other threads:[~2011-09-02 18:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-26 20:34 m68k: [v5] Convert to genirq (WIP) Geert Uytterhoeven
2011-08-28  2:08 ` Finn Thain
2011-08-28  7:53   ` Geert Uytterhoeven
2011-08-29  7:36     ` Geert Uytterhoeven
2011-09-02 12:14   ` Finn Thain
2011-09-02 17:24     ` Geert Uytterhoeven
2011-09-02 18:24       ` Geert Uytterhoeven [this message]
     [not found]         ` <4E63291D.5050801@gmail.com>
     [not found]           ` <CAMuHMdXB5nBRVvUmqake-kV1mbWq+k8vOGHPOSL+2ix6PJW80w@mail.gmail.com>
     [not found]             ` <CAOmrzkKCGhL2GfDTC_gqKtKfU2vKeqDh1CMZ+BdUCtLEufQhqw@mail.gmail.com>
     [not found]               ` <4E647F80.8050903@gmail.com>
2011-09-05 20:18                 ` Michael Schmitz
2011-09-02 19:53       ` Thomas Gleixner
2011-09-03  2:40       ` Finn Thain

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='CAMuHMdXj-YDFPcsQFdaWzMU8w=2VQkpBpJGmjxsXT1Y+55W43g@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=fthain@telegraphics.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.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.