Prabhu nath | 11 Aug 08:07 2010
Picon

Problem with EXPORT_SYMBOL(irq_to_desc)

Hi,

        I am facing a peculiar behaviour on Kernel version 2.6.34.1 (http://lxr.linux.no/#linux+v2.6.34.1).
         
       For my experimentation I just wanted to use the following two kernel functions in my Kernel module

        1. find_task_by_vpid  (http://lxr.linux.no/#linux+v2.6.34.1/kernel/pid.c#L388)
        2. irq_to_desc  (
http://lxr.linux.no/#linux+v2.6.34.1/kernel/irq/handle.c#L138)

           Since these two functions are not exported by the Kernel, I exported these functions, built the kernel and used in my kernel module.
         When I compiled, I got a warning  "WARNING: "irq_to_desc" [/root/prabhu/KernelPrograms/irq/kmod.ko] undefined!"
         and when I inserted the module, I got error saying "kmod: Unknown symbol irq_to_desc"

         When I checked the object file pid.o, I found that find_task_by_vpid was placed in the Relocation section '.rel__ksymtab' and
         when I checked the object file handle.o I found that irq_to_desc was not placed in the Relocation section '.rel__ksymtab'.

        Please help me in resolving this problem.

Regards
Prabhu

        
Dave Hylands | 11 Aug 09:03 2010
Picon

Re: Problem with EXPORT_SYMBOL(irq_to_desc)

Hi Parbhu,

Sending to the list this time.

On Tue, Aug 10, 2010 at 11:07 PM, Prabhu nath <gprabhunath <at> gmail.com> wrote:
> Hi,
>
>         I am facing a peculiar behaviour on Kernel version 2.6.34.1
> (http://lxr.linux.no/#linux+v2.6.34.1).
>
>        For my experimentation I just wanted to use the following two kernel
> functions in my Kernel module
>
>         1. find_task_by_vpid
> (http://lxr.linux.no/#linux+v2.6.34.1/kernel/pid.c#L388)
>         2. irq_to_desc
> (http://lxr.linux.no/#linux+v2.6.34.1/kernel/irq/handle.c#L138)
>
>            Since these two functions are not exported by the Kernel, I
> exported these functions, built the kernel and used in my kernel module.
>          When I compiled, I got a warning  "WARNING: "irq_to_desc"
> [/root/prabhu/KernelPrograms/irq/kmod.ko] undefined!"
>          and when I inserted the module, I got error saying "kmod: Unknown
> symbol irq_to_desc"

irq_to_desc isn't a function, therefore it can't be exported. It's a macro.

--

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.DaveHylands.com/

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis <at> nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ

Prabhu nath | 11 Aug 10:32 2010
Picon

Re: Problem with EXPORT_SYMBOL(irq_to_desc)



On Wed, Aug 11, 2010 at 12:33 PM, Dave Hylands <dhylands <at> gmail.com> wrote:
Hi Parbhu,

Sending to the list this time.

On Tue, Aug 10, 2010 at 11:07 PM, Prabhu nath <gprabhunath <at> gmail.com> wrote:
> Hi,
>
>         I am facing a peculiar behaviour on Kernel version 2.6.34.1
> (http://lxr.linux.no/#linux+v2.6.34.1).
>
>        For my experimentation I just wanted to use the following two kernel
> functions in my Kernel module
>
>         1. find_task_by_vpid
> (http://lxr.linux.no/#linux+v2.6.34.1/kernel/pid.c#L388)
>         2. irq_to_desc
> (http://lxr.linux.no/#linux+v2.6.34.1/kernel/irq/handle.c#L138)
>
>            Since these two functions are not exported by the Kernel, I
> exported these functions, built the kernel and used in my kernel module.
>          When I compiled, I got a warning  "WARNING: "irq_to_desc"
> [/root/prabhu/KernelPrograms/irq/kmod.ko] undefined!"
>          and when I inserted the module, I got error saying "kmod: Unknown
> symbol irq_to_desc"

irq_to_desc isn't a function, therefore it can't be exported. It's a macro.

irq_to_desc should be a function. To verify this, we can look into the symbol table in handle.o which specifies this as a function. Here is a snippet of the symbol table.
     48: 0000024e    32 FUNC    GLOBAL DEFAULT    1 replace_irq_desc
    49: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND radix_tree_lookup_slot
    50: 0000026e    12 FUNC    GLOBAL DEFAULT    1 irq_to_desc
    51: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND radix_tree_lookup
    52: 00000413    31 FUNC    GLOBAL DEFAULT    1 kstat_irqs_cpu
    53: 00000432    40 FUNC    GLOBAL DEFAULT    1 early_init_irq_lock_class
    54: 00000032   298 FUNC    GLOBAL DEFAULT    9 irq_to_desc_alloc_node
    55: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND warn_slowpath_fmt
    56: 00000000     4 OBJECT  GLOBAL DEFAULT    5 sparse_irq_lock

-Prabhu




Mulyadi Santosa | 11 Aug 19:04 2010
Picon

Re: Problem with EXPORT_SYMBOL(irq_to_desc)

I don't exactly know the problem...but here's something to think...

On Wed, Aug 11, 2010 at 13:07, Prabhu nath <gprabhunath <at> gmail.com> wrote:
> Hi,
>
>         I am facing a peculiar behaviour on Kernel version 2.6.34.1
> (http://lxr.linux.no/#linux+v2.6.34.1).
>
>        For my experimentation I just wanted to use the following two kernel
> functions in my Kernel module
>
>         1. find_task_by_vpid
> (http://lxr.linux.no/#linux+v2.6.34.1/kernel/pid.c#L388)
>         2. irq_to_desc
> (http://lxr.linux.no/#linux+v2.6.34.1/kernel/irq/handle.c#L138)
>
>            Since these two functions are not exported by the Kernel, I
> exported these functions, built the kernel and used in my kernel module.

Seeing around handle.c, precisely lines surrounding the related
function, I see this:
endif /* !CONFIG_SPARSE_IRQ */

uhum...seems related to sparse IRQ handling..so basic question here:
which one did you export? the one in CONFIG_SPARSE_IRQ=y? or the other
one?

--

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis <at> nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ

Prabhu nath | 12 Aug 08:07 2010
Picon

Re: Problem with EXPORT_SYMBOL(irq_to_desc)

Thanks a lot. It was to do with CONFIG_SPARSE_IRQ. Just overshot my sight.
I had exported a wrong irq_to_desc() which is under the belt of CONFIG_SPARSE_IRQ which was not configured.
Its working now

Regards,
Prabhu


On Wed, Aug 11, 2010 at 10:34 PM, Mulyadi Santosa <mulyadi.santosa <at> gmail.com> wrote:
I don't exactly know the problem...but here's something to think...

On Wed, Aug 11, 2010 at 13:07, Prabhu nath <gprabhunath <at> gmail.com> wrote:
> Hi,
>
>         I am facing a peculiar behaviour on Kernel version 2.6.34.1
> (http://lxr.linux.no/#linux+v2.6.34.1).
>
>        For my experimentation I just wanted to use the following two kernel
> functions in my Kernel module
>
>         1. find_task_by_vpid
> (http://lxr.linux.no/#linux+v2.6.34.1/kernel/pid.c#L388)
>         2. irq_to_desc
> (http://lxr.linux.no/#linux+v2.6.34.1/kernel/irq/handle.c#L138)
>
>            Since these two functions are not exported by the Kernel, I
> exported these functions, built the kernel and used in my kernel module.

Seeing around handle.c, precisely lines surrounding the related
function, I see this:
endif /* !CONFIG_SPARSE_IRQ */

uhum...seems related to sparse IRQ handling..so basic question here:
which one did you export? the one in CONFIG_SPARSE_IRQ=y? or the other
one?


--
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com


Gmane