Re: Kernel Thread and Kernel Module

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

 



>I dont think you should be doing this. Is your kernel
>compiled for SMP? If it is not SMP then the spinlocks
>are just empty loops. If yes then it is exported see
>(for i386)

Strange, I have compiled kernel with SMP support
enabled.  Could not understand why I am getting that
error. Anyways thanks to all of you who have taken
their precious time to guide me. I am working on
Kernel-2.4.20. In my config file, I have CONFIG_SMP=y.


Regards
Dinesh 
--- Manish Regmi <regmi.manish@xxxxxxxxx> wrote:

> On 8/13/06, Dinesh Ahuja <mdlinux7@xxxxxxxxxxx>
> wrote:
> > Hi Manish,
> >
> > It is just a macro that expands to  a for loop. It
> is
> > deffined in
> > sched.h
> >
> > #define for_each_process(p) \
> >      for (p = &init_task ; (p = next_task(p)) !=
> > &init_task ; )
> >
> > Right this is a macro. On further investigation, I
> > found that init_task access init_task_union.task
> > {defined in include/asm-i386/processor.h} and
> > next_task is again a macro defined as
> > #define next_task(p)   
> list_entry((p)->tasks.next,
> > struct task_struct, tasks)
> >
> > list_entry is again a macro defined in
> > {include/linux/list.h} as
> > #define list_entry(ptr, type, member) \
> >         ((type *)((char *)(ptr)-(unsigned
> > long)(&((type *)0)->member)))
> >
> > In this case, macro uses a init_task_union which
> is
> > exported by kernel and that should be sufficient
> for
> > module to iterate over list. But if macro is using
> an
> > kernel symbol i.e function or a global variable,
> then
> > these symbols should be exported otherwise use of
> > macro will give unresolved symbols. Please verfiy
> my
> > understanding.
> 
> correct.
> 
> > I am trying to use read lock before iterating a
> task
> > list.
> >
> >          read_lock(&tasklist_lock);
> >          for_each_process(p) {
> >                         printk ("<1> Iterating
> Task
> > List" );
> >          }
> >          read_unlock(&tasklist_lock);
> >
> > But getting following error:
> >  unresolved symbol __read_lock_failed
> 
> 
> The tasklist_lock is a rw spinlock. It is again a
> macro defined in
> <linux/spinlock.h>
> 
> regards
> Manish Regmi
> 



		
__________________________________________________________
Yahoo! India Answers: Share what you know. Learn something new
http://in.answers.yahoo.com/

--
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