problem with printk on SMP-- somebody please help
hi
I really appreciate your suggestions and as a newcomer eager to learn more from you people.
As I said I was able to do printk anywhere in the sched.c (including _activate_task ) on a non-smp kernel and on a smp-kernel I can do it only on the main schedule() function.
Also, I would like to add that I am not able to do the macro rdtsc() for reading the timestamp counter in the same function.When I compile the kernel it dosent show any error, but just the printk's and rdtsc()'s get subdued!
Well, with reference to your reply, I have some basic questions:
1) on a non-smp kernel will the _activate_task not lock the given runqueue?
2) where is the best place I can do the rdtsc() and printk to read the value as to when a task is being scheduled for execution, on a SMP kernel?
Please help.
Thanks
Arun
Quoted 50 lines
From: Mike Waychison <[email protected]>
To: Arun Srinivas <[email protected]>
CC: [email protected]
Subject: Re: problem with printk-- somebody please help
Date: Mon, 08 Nov 2004 14:47:59 -0500-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 10 lines · Arun Srinivas
hi
I am new to the kernel world and would be very glad if somebody could help me with this problem.
I am unable to do printk or even a macro call like rdtsc()...(for reading the time stamp counter) from within the "
activate_task" function on a kernel with smp support.But these work under the mainschedule()function.Quoted 5 lines
I was able to do all these i.e., inside "
activate_task" on a kernel without smp support.Can anybody suggest a solution as to what could be the problem??somebody please help.
I seem to recall that doing so would deadlock your machine.
activate_taskis called with the given cpu's runqueue locked. printk eventually callsrelease_console_sem, which willwake_up_interruptible, which will eventually calltry_to_wake_upwhich grabs the same lock.I don't think I've ever seen printk work while task_rq_lock'ed.
Someone correct me if I'm wrong, this is the best I was able to figure out before giving up.
- --
Mike Waychison
Sun Microsystems, Inc.
1 (650) 352-5299 voice
1 (416) 202-8336 voice~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NOTICE: The opinions expressed in this email are held by me, and may not represent the views of Sun Microsystems, Inc.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
Quoted 4 lines
iD8DBQFBj81vdQs4kOxk3/MRAlJGAKCIYIgXCkaSXpwGLdsj/WK1BhPOlwCeK6s0 1pc0XbERKlQKpLIBpObhwZA=
=2DSX
-----END PGP SIGNATURE-----
_________________________________________________________________
Mergers, takeovers, buyouts. Get all the latest biz bytes. http://www.msn.co.in/business/ Tune in to MSN Business!
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 13 lines · Arun Srinivas
hi
I really appreciate your suggestions and as a newcomer eager to learn more from you people.
As I said I was able to do printk anywhere in the
sched.c(including_activate_task) on a non-smp kernel and on a smp-kernel I can do it only on the mainschedule()function.
Also, I would like to add that I am not able to do the macrordtsc()for reading the timestamp counter in the same function.When I compile the kernel it dosent show any error, but just the printk's and rdtsc()'s get subdued!
Quoted 2 lines
Well, with reference to your reply, I have some basic questions:
1) on a non-smp kernel will the_activate_tasknot lock the given runqueue?
The locking is done in schedule(). Read include/linux/spinlock.h to see how spinlocks differ in the SMP vs non-SMP case. In the latter case with spinlock debugging enabled, there is no lock bit and recursively grabbing a lock is possible (though still not allowed!).
Quoted 3 lines
2) where is the best place I can do the
rdtsc()and printk to read the value as to when a task is being scheduled for execution, on a SMP kernel?
No idea wrt to rdtsc.
HTH,
- --
Mike Waychison
Sun Microsystems, Inc.
1 (650) 352-5299 voice
1 (416) 202-8336 voice
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NOTICE: The opinions expressed in this email are held by me, and may not represent the views of Sun Microsystems, Inc.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFBkNpAdQs4kOxk3/MRAkCCAJ9IoN7VfyymTBuYn7R8//dbxLGwkACfUTQu l1BiHVTfZf6IvIT2+nqsiPE=
=loXh
-----END PGP SIGNATURE-----
Can I do a sched_clock() inside activate_task to record the time at which a task is ready for execution and then can read it by a prink in schedule()??
I think sched_clock() calls rdtsc() and converts it to nanosecond scale. or is there any other better way of reading the time at which a task is being executed?
Quoted 63 lines · Mike Waychison
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 13 lines · Arun Srinivas
hi
I really appreciate your suggestions and as a newcomer eager to learn more from you people.
As I said I was able to do printk anywhere in the
sched.c(including_activate_task) on a non-smp kernel and on a smp-kernel I can do it only on the mainschedule()function.
Also, I would like to add that I am not able to do the macrordtsc()for reading the timestamp counter in the same function.When I compile the kernel it dosent show any error, but just the printk's and rdtsc()'s get subdued!Quoted 2 lines
Well, with reference to your reply, I have some basic questions:
1) on a non-smp kernel will the_activate_tasknot lock the given runqueue?The locking is done in
schedule(). Readinclude/linux/spinlock.hto see how spinlocks differ in the SMP vs non-SMP case. In the latter case with spinlock debugging enabled, there is no lock bit and recursively grabbing a lock is possible (though still not allowed!).Quoted 3 lines
2) where is the best place I can do the
rdtsc()and printk to read the value as to when a task is being scheduled for execution, on a SMP kernel?No idea wrt to rdtsc.
HTH,
- --
Mike Waychison
Sun Microsystems, Inc.
1 (650) 352-5299 voice
1 (416) 202-8336 voice~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NOTICE: The opinions expressed in this email are held by me, and may not represent the views of Sun Microsystems, Inc.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.orgiD8DBQFBkNpAdQs4kOxk3/MRAkCCAJ9IoN7VfyymTBuYn7R8//dbxLGwkACfUTQu l1BiHVTfZf6IvIT2+nqsiPE=
=loXh
-----END PGP SIGNATURE------
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/