Re: Question about multiple modules talking to one adapter

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

 



Jim Cromie wrote:

allow me to rephrase:
You have A,B,C, all of which want to own X
you suggest 3 alternatives:

(I answer in parens)

1. A,B,C are all independent.
this is inefficient cuz each has to look in detail at the card state to determine
whether it should act upon the interrupt.

(IIUC, this is not interrupt-sharing per-se, but something else or is it?)

No, it would be bona fide interrupt sharing. Each driver would register an ISR with the same IRQ, and then whenever that IRQ is posted, the kernel would call each ISR in turn until one handled it.

2. create P (parent), on which A,B,C are dependent
P has ISR code in it, A,B,C use that.
IOW, P export_symbols a register_isr_callback of some flavor,
A,B,C call it from their module_init()s  (this is *the* dependency)

(this seems best. code is minimal, loaded footprint is probly also close to minimal,

Yes, this seems to be the consensus.

if only P+A are loaded, having P linked in statically is probly smaller.
One difficulty here is compiled-in vs loadable-module.
It seems simple to have them all the same - ie all modules, or all built-in.
I dont know how to do that with Kconfig depends statements.
having A be compiled, but B,C be loadable, makes for interesting handling of P)

That's a good point. If Kconfig doesn't allow it, then we'll either have to tell the user what configurations work, or force A, B, C to be loadable only, and P can be either static or loadable.

<related Q>
Is module loading/initialization safely serialized ?

It should be, but I don't know enough yet about how the kernel knows which modules to load when.

if A, B are independent, and are simultaneously modprobed by 2 different
user-procs, is there locking to insure that one finishes before the other is allowed to start ?

The only thing I was planning on having are semaphores to serialize two modules that attempt to register their ISR callbacks simultaneously.

Assuming 2: given dependencies, P will load 1st, presumably 2nd modprobe will never try loading P, either cuz its locked out, or cuz it sees P inprogress.

Yes, that's a requirement.

--
Timur Tabi
Staff Software Engineer
timur.tabi@xxxxxxxxxxx

One thing a Southern boy will never say is,
"I don't think duct tape will fix it."
     -- Ed Smylie, NASA engineer for Apollo 13

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux