Relation IRQF_ONESHOT compared to IRQF_NO_THREAD and forced threading setting.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have a question regarding the IRQF_ONESHOT setting to always be
enabled by default on preempt-RT in relation to forced threading

Let's consider the following:
1) I have a driver that subscribes its interrupt handlers with:
request_threaded_irq(irq, handler, thread_fn, IRQF_SHARED, "blah", dev_id);

Both handler AND thread_fn are nonzero and valid pointers.

2) request_thread_irq continues and calls __setup_irq()
3) eventually it comes here:
        if (nested) {
                     ...........
        } else {
                if (irq_settings_can_thread(desc))
                        irq_setup_forced_threading(new);
        }

4) we enter the function: irq_setup_forced_threading():
Data is still:
        new->handler = handler;
        new->thread_fn = thread_fn;

static void irq_setup_forced_threading(struct irqaction *new)
{
        if (!force_irqthreads)
                return;
        if (new->flags & (IRQF_NO_THREAD | IRQF_PERCPU | IRQF_ONESHOT))
                return;

        new->flags |= IRQF_ONESHOT;

        if (!new->thread_fn) {
                set_bit(IRQTF_FORCED_THREAD, &new->thread_flags);
                new->thread_fn = new->handler;
                new->handler = irq_default_primary_handler;
        }
}

On preempt-RT: force_irqthreads = nonzero

As I see it there are now 2 options:
* I want IRQF_ONESHOT: In that case the flags are allowed to be
IRQF_SHARED (default)
* I do NOT want IRQF_ONESHOT: I have to set IRQF_NO_THREAD | IRQF_SHARED.

So, if I do not want ONESHOT to be set, I have to pass NO_THREAD, I
cannot prevent it otherwise to be set. There is an implicit relation
between both flags where the default behavior of ONESHOT is influenced
by the NO_THREAD flag.
This feels weird, since I have called request_threaded_irq() with a
handler AND a thread-function (I have a thread, so why do I need to
specify NO_THREAD?, according to interrupt.h: "IRQF_NO_THREAD -
Interrupt cannot be threaded").

Can you please explain to me what the reasoning behind this is, since
it feels to me that specifying NO_THREAD in my driver now works by
accident...
(Would a flag name 'IRQF_NO_ONESHOT', or 'IRQF_NO_FORCED_THREAD' not
be more logical in this case?)

Furthermore, what if I call request_threaded_irq() without a thread
function, since I wanted to install the handler only as hard-irq? In
that case I MUST explicitly specify NO_THREAD as well, otherwise it
would force it to go threaded and in ONESHOT mode. Should the call to
request_thread_irq() without thread function pointer not imply this
NO_THREAD?

Kind regards,

Remy
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux