2004-11-08 18:50:00

by Arun Srinivas

[permalink] [raw]
Subject: problem with printk-- somebody please help

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 main
schedule() function.

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.

Thanks
Arun

_________________________________________________________________
The all-new MSN Search. Get fast and precise results.
http://search.msn.co.in Try it now!


2004-11-08 19:15:18

by linux-os

[permalink] [raw]
Subject: Re: problem with printk-- somebody please help

On Tue, 9 Nov 2004, Arun Srinivas wrote:

> 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 main
> schedule() function.
>
> 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.
>
> Thanks
> Arun

Maybe it's not called. The task may get put into the run-queue
using resched_task() and __activate_task() as well.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.9 on an i686 machine (5537.79 BogoMips).
Notice : All mail here is now cached for review by John Ashcroft.
98.36% of all statistics are fiction.

2004-11-08 19:48:48

by Mike Waychison

[permalink] [raw]
Subject: Re: problem with printk-- somebody please help

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Arun Srinivas wrote:
> 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 main
> schedule() function.
>
> 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_task is called with the given cpu's runqueue locked. printk
eventually calls release_console_sem, which will wake_up_interruptible,
which will eventually call try_to_wake_up which 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

iD8DBQFBj81vdQs4kOxk3/MRAlJGAKCIYIgXCkaSXpwGLdsj/WK1BhPOlwCeK6s0
1pc0XbERKlQKpLIBpObhwZA=
=2DSX
-----END PGP SIGNATURE-----