Pietro Descombes
|
instrumented kernel TraceEvent(_NTO_TRACE_ALLOCBUFFER...)
|
Pietro Descombes
04/08/2009 4:22 AM
post26311
|
instrumented kernel TraceEvent(_NTO_TRACE_ALLOCBUFFER...)
Hi evryone,
I can't find the code that's executed when calling
"TraceEvent(_NTO_TRACE_ALLOCBUFFER, nbufs, *paddr)" (this is called from
get_paddr_from_kernel of the tracelogger). In "nano_trace.c",
"trace_event()" doesn't have a "case
_TRACE_GET_FLAG(_NTO_TRACE_ALLOCBUFFER)". The only one I found is in
"ker_trace_event.c" in function "ker_trace_event()", but arguments don't
seem to match. Where does the "SYSPAGE_ENTRY(callin)->trace_event" point
to exactly (what function is addressed by the struct callin_entry 's
trace_event field), and where's the buffer allocation code?
thanks for any help.
Pietro
using X68, Momentics 6.4.0, source code from
http://community.qnx.com/svn/repos/coreos_pub
|
|
|
Colin Burgess(deleted)
|
Re: instrumented kernel TraceEvent(_NTO_TRACE_ALLOCBUFFER...)
|
Colin Burgess(deleted)
04/08/2009 9:31 AM
post26354
|
Re: instrumented kernel TraceEvent(_NTO_TRACE_ALLOCBUFFER...)
ker/_main.c sets the trace_event callin to outside_trace_event
This is so that you can call TraceEvent within an interrupt handler.
Normally it would still enter through the kernel.
The _NTO_TRACE_ALLOCBUFFER case is implemented in ker/ker_trace.c
Regards,
Colin
Pietro Descombes wrote:
> Hi evryone,
>
> I can't find the code that's executed when calling
> "TraceEvent(_NTO_TRACE_ALLOCBUFFER, nbufs, *paddr)" (this is called from
> get_paddr_from_kernel of the tracelogger). In "nano_trace.c",
> "trace_event()" doesn't have a "case
> _TRACE_GET_FLAG(_NTO_TRACE_ALLOCBUFFER)". The only one I found is in
> "ker_trace_event.c" in function "ker_trace_event()", but arguments don't
> seem to match. Where does the "SYSPAGE_ENTRY(callin)->trace_event" point
> to exactly (what function is addressed by the struct callin_entry 's
> trace_event field), and where's the buffer allocation code?
>
> thanks for any help.
>
> Pietro
>
>
> using X68, Momentics 6.4.0, source code from
> http://community.qnx.com/svn/repos/coreos_pub
>
>
>
> _______________________________________________
> OSTech
> http://community.qnx.com/sf/go/post26311
>
--
cburgess@qnx.com
|
|
|
Pietro Descombes
|
Re: instrumented kernel TraceEvent(_NTO_TRACE_ALLOCBUFFER...)
|
Pietro Descombes
04/24/2009 5:17 AM
post27962
|
Re: instrumented kernel TraceEvent(_NTO_TRACE_ALLOCBUFFER...)
Hi Colin,
Thanks a lot. I can see now how it works!. When calling TraceEvent from userspace, it reaches ker_trace_event, and
original arguments are retrieved incrementing the c_p pointer.
I've got a few more questions now:
I've been unsuccessfully trying to use a semaphore to synchronize userspace from kernel. Is it possible to use a shared
semaphore in kernel (I've got a shared memory like in tracelogger, and I've tried both to put one in it, or using a
named semaphore) ?
In tracelogger, documentation says a signal is used for that purpose. Just calling kill() or SigKill() from kernel makes
also a crash* at runtime ("Crash[0,0] at nano_signal line 1066"). Could you please tell me where is the instrumented
kernel's code that sends a signal to the tracelogger to tell him to start logging ?
best regards,
Pietro
|
|
|
Colin Burgess(deleted)
|
Re: instrumented kernel TraceEvent(_NTO_TRACE_ALLOCBUFFER...)
|
Colin Burgess(deleted)
04/24/2009 10:01 AM
post27998
|
Re: instrumented kernel TraceEvent(_NTO_TRACE_ALLOCBUFFER...)
Pietro Descombes wrote:
> Hi Colin,
>
> Thanks a lot. I can see now how it works!. When calling TraceEvent from userspace, it reaches ker_trace_event, and
original arguments are retrieved incrementing the c_p pointer.
>
>
> I've got a few more questions now:
>
> I've been unsuccessfully trying to use a semaphore to synchronize userspace from kernel. Is it possible to use a
shared semaphore in kernel
> (I've got a shared memory like in tracelogger, and I've tried both to put one in it, or using a named semaphore) ?
No, you can't call synchronisation kernel calls within a kernel call.
> In tracelogger, documentation says a signal is used for that purpose. Just calling kill() or SigKill() from kernel
> makes also a crash* at runtime ("Crash[0,0] at nano_signal line 1066"). Could you please tell me where is the
> instrumented kernel's code that sends a signal to the tracelogger to tell him to start logging ?
The kernel calls a specialised interrupt handler (in em_event() - nano_trace.c) which was registered with
InterruptHookTrace().
This can return a sigevent to have it delivered to tracelogger.
Returning a sigevent is the only way for an interrupt handler cause a thread to be scheduled.
Cheers,
Colin
--
cburgess@qnx.com
|
|
|
Pietro Descombes
|
Re: instrumented kernel TraceEvent(_NTO_TRACE_ALLOCBUFFER...)
|
Pietro Descombes
05/05/2009 7:46 AM
post28677
|
Re: instrumented kernel TraceEvent(_NTO_TRACE_ALLOCBUFFER...)
Hi Collin,
it works ;-)), I just implemented my own em_event and hook function. The pseudo-handler looks quite limited though: I
can for sure interact with user-space global variables, but no I/O, semaphores (makes a crash), signals or anything.
This looks strange to me: ok, it's called by the kernel but should behave as a userspace function.
I've bin looking through the tracelogger code, and it seems to me that copying a tracebuffer from kernel to a kevfile
buffer is as far as it goes (besides spinlock control). I guess there is no way to asynchronously copy data from kernel
to a file (I mean, activated from kernel).
Can you confirm that ? Or is there a way I could do a sem_post() from the pseudo-handler function ?
best regards
Pietro
|
|
|
Colin Burgess(deleted)
|
Re: instrumented kernel TraceEvent(_NTO_TRACE_ALLOCBUFFER...)
|
Colin Burgess(deleted)
05/05/2009 9:22 AM
post28687
|
Re: instrumented kernel TraceEvent(_NTO_TRACE_ALLOCBUFFER...)
No, you cannot call any kernel calls while in an interrupt handler (there are a few special exceptions, such
as TraceEvent())
That is why tracelogger has to copy things out and do the transfer in the user-mode daemon.
Can you share what you are trying to do?
Cheers,
Colin
Pietro Descombes wrote:
> Hi Collin,
>
> it works ;-)), I just implemented my own em_event and hook function. The pseudo-handler looks quite limited though: I
can for sure interact with user-space global variables, but no I/O, semaphores (makes a crash), signals or anything.
This looks strange to me: ok, it's called by the kernel but should behave as a userspace function.
>
> I've bin looking through the tracelogger code, and it seems to me that copying a tracebuffer from kernel to a kevfile
buffer is as far as it goes (besides spinlock control). I guess there is no way to asynchronously copy data from kernel
to a file (I mean, activated from kernel).
>
> Can you confirm that ? Or is there a way I could do a sem_post() from the pseudo-handler function ?
>
> best regards
> Pietro
>
> _______________________________________________
> OSTech
> http://community.qnx.com/sf/go/post28677
>
--
cburgess@qnx.com
|
|
|
Pietro Descombes
|
Re: instrumented kernel TraceEvent(_NTO_TRACE_ALLOCBUFFER...)
|
Pietro Descombes
05/05/2009 6:07 PM
post28751
|
Re: instrumented kernel TraceEvent(_NTO_TRACE_ALLOCBUFFER...)
Ok, thanks for your information :-)
Colin Burgess wrote:
> No, you cannot call any kernel calls while in an interrupt handler (there are a few special exceptions, such
> as TraceEvent())
>
> That is why tracelogger has to copy things out and do the transfer in the user-mode daemon.
>
> Can you share what you are trying to do?
>
Sure. I'm implementing an other tracer. It is based on LTTng, and it's
purpose is real-time applications monitoring.
(I was hoping I could log traces into a file according to the system's
load, but I'll have to do things just the way you guys did it ;-) )
Cheers Colin,
Pietro
> Cheers,
>
> Colin
>
> Pietro Descombes wrote:
>
>> Hi Colin,
>>
>> it works ;-)), I just implemented my own em_event and hook function. The pseudo-handler looks quite limited though: I
can for sure interact with user-space global variables, but no I/O, semaphores (makes a crash), signals or anything.
This looks strange to me: ok, it's called by the kernel but should behave as a userspace function.
>>
>> I've bin looking through the tracelogger code, and it seems to me that copying a tracebuffer from kernel to a kevfile
buffer is as far as it goes (besides spinlock control). I guess there is no way to asynchronously copy data from kernel
to a file (I mean, activated from kernel).
>>
>> Can you confirm that ? Or is there a way I could do a sem_post() from the pseudo-handler function ?
>>
>> best regards
>> Pietro
>>
>> _______________________________________________
>> OSTech
>> http://community.qnx.com/sf/go/post28677
>>
>>
>
>
|
|
|
|