[newbie question] addresses of loaded programs/functions

2001-06-01 Thread Collins, Tom

Hello

I am writing a profiling tool for a project I am working on,
and I need to know how to map addresses of calling functions
to the appropriate human-readable name.  Is there a data structure
in the kernel that I can access to achieve this?  Or can I reference
a load map (in days gone by, I used to refer to this as a link-edit
map) given the load address of the program?  Where can I find the
load address of the program?

Thanks

Tom Collins
-
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/



[newbie question] addresses of loaded programs/functions

2001-06-01 Thread Collins, Tom

Hello

I am writing a profiling tool for a project I am working on,
and I need to know how to map addresses of calling functions
to the appropriate human-readable name.  Is there a data structure
in the kernel that I can access to achieve this?  Or can I reference
a load map (in days gone by, I used to refer to this as a link-edit
map) given the load address of the program?  Where can I find the
load address of the program?

Thanks

Tom Collins
-
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/



processor time, process time, idle time, etc

2001-03-09 Thread Collins, Tom

Hello...

I am wondering is there is a way to obtain resource usage 
from the kernel w/o doing a kernel call from a program
(can I get this from /proc/??  ?).

For example, I am interested in discriminating between
processor idle time, time spent in processes, etc.

Is this possible, or will I have to get this accounting
information from the kernel via a module/system call?

Thanks

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



processor time, process time, idle time, etc

2001-03-09 Thread Collins, Tom

Hello...

I am wondering is there is a way to obtain resource usage 
from the kernel w/o doing a kernel call from a program
(can I get this from /proc/??  ?).

For example, I am interested in discriminating between
processor idle time, time spent in processes, etc.

Is this possible, or will I have to get this accounting
information from the kernel via a module/system call?

Thanks

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



RE: Multiple file module build problems

2001-02-28 Thread Collins, Tom

Well, I tried ld -r -o scharmod.o schar.o procschar.o
and it still seems to be trying to build an exectuable...the
output is the same as before...

Thanks

Tom
-Original Message-
From: Lee Ho [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 28, 2001 12:00 PM
To: [EMAIL PROTECTED]
Cc: Collins, Tom
Subject: Re: Multiple file module build problems



It seems that linker tried to build executable file.
When building multiple module source into one module object file,
ld with '-r' option is used. 

ld -r -o scharmod.o schar.o procschar.o 

*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
Lee, Ho. Software Engineer, Embedded Linux Dep, LinuxOne 
Mail : [EMAIL PROTECTED] (work), [EMAIL PROTECTED] (personal)
Homepage : http://flyduck.com, http://linuxkernel.to

Collins, Tom Wrote:


I am trying to build a multiple-file kernel module, and am
having some difficulty.  It seems that the linker is trying
to build and executable.

The link command is:

ld -m elf_i386 -o scharmod.o schar.o procschar.o


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



Multiple file module build problems

2001-02-28 Thread Collins, Tom

Hello...

I am trying to build a multiple-file kernel module, and am
having some difficulty.  It seems that the linker is trying
to build and executable.

The paradigm I am using is from
http://www.linuxdoc.org/LDP/lkmpg/node13.html.
I compile two source files with the following gcc command:

gcc -c -D__KERNEL__ -I/usr/src/linux/include -DMODULE -Wall -O2 -DLINUX
schar.c
gcc -c -D__KERNEL__ -I/usr/src/linux/include -DMODULE -Wall -O2 -DLINUX
procschar.c
/usr/src/linux/include/linux/mount.h: In function `mntput':
In file included from /usr/src/linux/include/linux/dcache.h:7,
 from /usr/src/linux/include/linux/fs.h:19,
 from procschar.c:25:
/usr/src/linux/include/linux/mount.h:46: warning: implicit declaration of
function `printk_Rsmp_1b7d4074'
procschar.c: At top level:
procschar.c:41: warning: `schar_mmap' defined but not used

I have the statement: #define __NO_VERSION__
in procschar.c, but not in schar.c.

The link command is:

ld -m elf_i386 -o scharmod.o schar.o procschar.o

At this point I get reams of output such as:

ld: warning: cannot find entry symbol _start; defaulting to 08048080
schar.o: In function `schar_timer_handler':
schar.o(.text+0x21): undefined reference to `jiffies_Rsmp_0da02d67'
schar.o(.text+0x40): undefined reference to `add_timer_Rsmp_a19eacf8'
schar.o(.text+0x5c): undefined reference to `printk_Rsmp_1b7d4074'
schar.o(.text+0x65): undefined reference to `__this_module'
schar.o(.text+0x6d): undefined reference to `__this_module'
schar.o(.text+0x81): undefined reference to `__this_module'
schar.o(.text+0xa2): undefined reference to `__wake_up_Rsmp_b173f14c'
schar.o(.text+0xb6): undefined reference to `__wake_up_Rsmp_b173f14c'
schar.o: In function `schar_ioctl':
schar.o(.text+0x262): undefined reference to `__get_user_4'
schar.o(.text+0x2a9): undefined reference to `__get_user_4'
schar.o(.text+0x2e9): undefined reference to `__get_user_4'
schar.o(.text+0x33f): undefined reference to `printk_Rsmp_1b7d4074'
schar.o(.text+0x34c): undefined reference to `printk_Rsmp_1b7d4074'
schar.o: In function `schar_read_proc':
schar.o(.text+0x390): undefined reference to `printk_Rsmp_1b7d4074'
schar.o(.text+0x3a1): undefined reference to `get_zeroed_page_Rsmp_6807e076'
schar.o(.text+0x3b8): undefined reference to `printk_Rsmp_1b7d4074'
schar.o(.text+0x3cb): undefined reference to
`__generic_copy_from_user_Rsmp_116166aa
schar.o(.text+0x3e6): undefined reference to `printk_Rsmp_1b7d4074'
schar.o(.text+0x3f5): undefined reference to `free_pages_Rsmp_234535e0'
schar.o(.text+0x41b): undefined reference to `sprintf_Rsmp_3c2c5af5'
schar.o(.text+0x435): undefined reference to `sprintf_Rsmp_3c2c5af5'
schar.o(.text+0x44f): undefined reference to `sprintf_Rsmp_3c2c5af5'
schar.o(.text+0x46c): undefined reference to `sprintf_Rsmp_3c2c5af5'
schar.o(.text+0x486): undefined reference to `sprintf_Rsmp_3c2c5af5'
schar.o(.text+0x49a): more undefined references to `sprintf_Rsmp_3c2c5af5'
follow
schar.o: In function `schar_read_proc':
schar.o(.text+0x52e): undefined reference to `proc_dostring_Rsmp_3954dab5'
schar.o: In function `schar_read':
schar.o(.text+0x563): undefined reference to `printk_Rsmp_1b7d4074'
schar.o(.text+0x59b): undefined reference to
`__generic_copy_to_user_Rsmp_d523fdd3'
schar.o(.text+0x5e9): undefined reference to `printk_Rsmp_1b7d4074'
schar.o(.text+0x5f6): undefined reference to
`interruptible_sleep_on_Rsmp_8c23e4cb'
schar.o(.text+0x612): undefined reference to `printk_Rsmp_1b7d4074'
schar.o(.text+0x639): undefined reference to
`__generic_copy_to_user_Rsmp_d523fdd3'
schar.o(.text+0x673): undefined reference to `printk_Rsmp_1b7d4074'
schar.o: In function `schar_write':
schar.o(.text+0x6b0): undefined reference to
`__generic_copy_from_user_Rsmp_116166aa
schar.o(.text+0x6db): undefined reference to `__wake_up_Rsmp_b173f14c'
schar.o(.text+0x6ef): undefined reference to `__wake_up_Rsmp_b173f14c'
schar.o(.text+0x709): undefined reference to `printk_Rsmp_1b7d4074'
schar.o: In function `schar_poll':

My guess is that I need to explicitly link with some kernel
objects? Can anyone point me in the right direction?

Thanks

Tom

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 28, 2001 11:07 AM
To: [EMAIL PROTECTED]
Subject: drivers/block/rd.c under 2.2.16



I am attempting to get something figured out dealing with the ramdisk
under Linux 2.2.16.  I am trying to figure out whether you can use the
ramdisk to act as a RAM filesystem doing normal file creations and
deletion.  I noticed that within the code it makes comments about not
having to free stuff up.  Does that mean you can't delete things off the
ramdisk filesystem?  I have created a ramdisk, formatted ext2, and mounted
it.  When I create stuff on there, and then I delete it, I notice that if
I do a df, the size doesn't go back down after I have deleted the file.  
I am trying to figure out if that is how it was intended to happen, or
whether I have just done 

Multiple file module build problems

2001-02-28 Thread Collins, Tom

Hello...

I am trying to build a multiple-file kernel module, and am
having some difficulty.  It seems that the linker is trying
to build and executable.

The paradigm I am using is from
http://www.linuxdoc.org/LDP/lkmpg/node13.html.
I compile two source files with the following gcc command:

gcc -c -D__KERNEL__ -I/usr/src/linux/include -DMODULE -Wall -O2 -DLINUX
schar.c
gcc -c -D__KERNEL__ -I/usr/src/linux/include -DMODULE -Wall -O2 -DLINUX
procschar.c
/usr/src/linux/include/linux/mount.h: In function `mntput':
In file included from /usr/src/linux/include/linux/dcache.h:7,
 from /usr/src/linux/include/linux/fs.h:19,
 from procschar.c:25:
/usr/src/linux/include/linux/mount.h:46: warning: implicit declaration of
function `printk_Rsmp_1b7d4074'
procschar.c: At top level:
procschar.c:41: warning: `schar_mmap' defined but not used

I have the statement: #define __NO_VERSION__
in procschar.c, but not in schar.c.

The link command is:

ld -m elf_i386 -o scharmod.o schar.o procschar.o

At this point I get reams of output such as:

ld: warning: cannot find entry symbol _start; defaulting to 08048080
schar.o: In function `schar_timer_handler':
schar.o(.text+0x21): undefined reference to `jiffies_Rsmp_0da02d67'
schar.o(.text+0x40): undefined reference to `add_timer_Rsmp_a19eacf8'
schar.o(.text+0x5c): undefined reference to `printk_Rsmp_1b7d4074'
schar.o(.text+0x65): undefined reference to `__this_module'
schar.o(.text+0x6d): undefined reference to `__this_module'
schar.o(.text+0x81): undefined reference to `__this_module'
schar.o(.text+0xa2): undefined reference to `__wake_up_Rsmp_b173f14c'
schar.o(.text+0xb6): undefined reference to `__wake_up_Rsmp_b173f14c'
schar.o: In function `schar_ioctl':
schar.o(.text+0x262): undefined reference to `__get_user_4'
schar.o(.text+0x2a9): undefined reference to `__get_user_4'
schar.o(.text+0x2e9): undefined reference to `__get_user_4'
schar.o(.text+0x33f): undefined reference to `printk_Rsmp_1b7d4074'
schar.o(.text+0x34c): undefined reference to `printk_Rsmp_1b7d4074'
schar.o: In function `schar_read_proc':
schar.o(.text+0x390): undefined reference to `printk_Rsmp_1b7d4074'
schar.o(.text+0x3a1): undefined reference to `get_zeroed_page_Rsmp_6807e076'
schar.o(.text+0x3b8): undefined reference to `printk_Rsmp_1b7d4074'
schar.o(.text+0x3cb): undefined reference to
`__generic_copy_from_user_Rsmp_116166aa
schar.o(.text+0x3e6): undefined reference to `printk_Rsmp_1b7d4074'
schar.o(.text+0x3f5): undefined reference to `free_pages_Rsmp_234535e0'
schar.o(.text+0x41b): undefined reference to `sprintf_Rsmp_3c2c5af5'
schar.o(.text+0x435): undefined reference to `sprintf_Rsmp_3c2c5af5'
schar.o(.text+0x44f): undefined reference to `sprintf_Rsmp_3c2c5af5'
schar.o(.text+0x46c): undefined reference to `sprintf_Rsmp_3c2c5af5'
schar.o(.text+0x486): undefined reference to `sprintf_Rsmp_3c2c5af5'
schar.o(.text+0x49a): more undefined references to `sprintf_Rsmp_3c2c5af5'
follow
schar.o: In function `schar_read_proc':
schar.o(.text+0x52e): undefined reference to `proc_dostring_Rsmp_3954dab5'
schar.o: In function `schar_read':
schar.o(.text+0x563): undefined reference to `printk_Rsmp_1b7d4074'
schar.o(.text+0x59b): undefined reference to
`__generic_copy_to_user_Rsmp_d523fdd3'
schar.o(.text+0x5e9): undefined reference to `printk_Rsmp_1b7d4074'
schar.o(.text+0x5f6): undefined reference to
`interruptible_sleep_on_Rsmp_8c23e4cb'
schar.o(.text+0x612): undefined reference to `printk_Rsmp_1b7d4074'
schar.o(.text+0x639): undefined reference to
`__generic_copy_to_user_Rsmp_d523fdd3'
schar.o(.text+0x673): undefined reference to `printk_Rsmp_1b7d4074'
schar.o: In function `schar_write':
schar.o(.text+0x6b0): undefined reference to
`__generic_copy_from_user_Rsmp_116166aa
schar.o(.text+0x6db): undefined reference to `__wake_up_Rsmp_b173f14c'
schar.o(.text+0x6ef): undefined reference to `__wake_up_Rsmp_b173f14c'
schar.o(.text+0x709): undefined reference to `printk_Rsmp_1b7d4074'
schar.o: In function `schar_poll':

My guess is that I need to explicitly link with some kernel
objects? Can anyone point me in the right direction?

Thanks

Tom

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 28, 2001 11:07 AM
To: [EMAIL PROTECTED]
Subject: drivers/block/rd.c under 2.2.16



I am attempting to get something figured out dealing with the ramdisk
under Linux 2.2.16.  I am trying to figure out whether you can use the
ramdisk to act as a RAM filesystem doing normal file creations and
deletion.  I noticed that within the code it makes comments about not
having to free stuff up.  Does that mean you can't delete things off the
ramdisk filesystem?  I have created a ramdisk, formatted ext2, and mounted
it.  When I create stuff on there, and then I delete it, I notice that if
I do a df, the size doesn't go back down after I have deleted the file.  
I am trying to figure out if that is how it was intended to happen, or
whether I have just done 

RE: Multiple file module build problems

2001-02-28 Thread Collins, Tom

Well, I tried ld -r -o scharmod.o schar.o procschar.o
and it still seems to be trying to build an exectuable...the
output is the same as before...

Thanks

Tom
-Original Message-
From: Lee Ho [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 28, 2001 12:00 PM
To: [EMAIL PROTECTED]
Cc: Collins, Tom
Subject: Re: Multiple file module build problems



It seems that linker tried to build executable file.
When building multiple module source into one module object file,
ld with '-r' option is used. 

ld -r -o scharmod.o schar.o procschar.o 

*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
Lee, Ho. Software Engineer, Embedded Linux Dep, LinuxOne 
Mail : [EMAIL PROTECTED] (work), [EMAIL PROTECTED] (personal)
Homepage : http://flyduck.com, http://linuxkernel.to

Collins, Tom Wrote:


I am trying to build a multiple-file kernel module, and am
having some difficulty.  It seems that the linker is trying
to build and executable.

The link command is:

ld -m elf_i386 -o scharmod.o schar.o procschar.o


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



RE: Dynamically altering code segments

2001-02-27 Thread Collins, Tom

Hey...thank you ... I have looked at the Linux Trace Toolkit
and was wondering if such a thing could be done.  I also
have visited the dprobes web site and that looked like
it had the mechanisms I was looking for.

Will the updated version appear next week at the dprobes 
web site?  I assume that it will.

I have one more question:  My trace code is currently 
implemented as a kernel loadable module.  Would I need
to change that so that it is built as part of the kernel,
or can I keep it as a loadable module?  If I can keep it
as a module, I would ensure that the module would be the 
only place that would enable/disable the trace, (don't
want the kernel jumping to a nonexistant address :O  ..)

Thanks again...will be looking for the upgrade next week...

Tom
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 27, 2001 12:15 PM
To: Andreas Dilger
Cc: Collins, Tom; [EMAIL PROTECTED]
Subject: Re: Dynamically altering code segments




Dprobes is one mechanism for doing what you want. It works the same way
OS/2 dynamic trace did. Another mecnahism, also available from the dprobes
web page is the GKHI (generalised kernel hooks interface). If you know you
want tracepoints in permanently assigned locations then you could code a
gkhi hook in the kernel which is essentially two jmps. When the hook is
inactive the first jmp bypasses the second, which jumps to the hook exit
dispatcher routine. When active the first jmp uses a zero offset. If you
use the gkhi you'll need to write you own hook exits, which presumably will
trace data and drop it into a trace buffer of your own making. Again if you
do decide to use ghki, please wait for 1.0 to be dropped next week
sometime.

If you go down the dprobes route you'll see that it inter-operates with
Linux Trace Toolkit to give you a dynamic tracing capability for Linux
(user and kernel space).  We're currently working on custom formatting for
raw trace data events created by dprobes. If you're familiar with os/2 then
TRCUST might mean something to you in connection with custom formatting.


Richard Moore -  RAS Project Lead - Linux Technology Centre (PISC).

http://oss.software.ibm.com/developerworks/opensource/linux
Office: (+44) (0)1962-817072, Mobile: (+44) (0)7768-298183
IBM UK Ltd,  MP135 Galileo Centre, Hursley Park, Winchester, SO21 2JN, UK


Andreas Dilger <[EMAIL PROTECTED]> on 27/02/2001 17:05:37

Please respond to Andreas Dilger <[EMAIL PROTECTED]>

To:   "Collins, Tom" <[EMAIL PROTECTED]>
cc:   [EMAIL PROTECTED]
Subject:  Re: Dynamically altering code segments




Tom Collins writes:
> I am wanting to dynamically modify the kernel in specific places to
> implement a custom kernel trace mechanism.  The general idea is that,
> when the "trace" is off, there are NOP instruction sequences at various
> places in the kernel.  When the "trace" is turned on, those same NOPs
> are replaced by JMPs to code that implements the trace (such as logging
> events, using the MSR and PMC's etc..).
>
> This was a trick that was done in my old days of OS/2 performance tools
> developement to get trace information from the running kernel.
>
> Is it possible to do the same thing in Linux?

See IBM "dprobes" project.  It is basically what you are describing
(AFAIK).  It makes sense, because a lot of the OS/2 folks are now working
on Linux.

Cheers, Andreas
--
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/   -- Dogbert
-
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/


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



Dynamically altering code segments

2001-02-27 Thread Collins, Tom

Hi...

This is my first post, so if this is off topic for this list, please direct
me
to another one that is more appropriate.  Thanks

That said, I am wanting to dynamically modify the kernel in specific places
to
implement a custom kernel trace mechanism.  The general idea is that, when
the
"trace" is off, there are NOP instruction sequences at various places in the
kernel.  When the "trace" is turned on, those same NOPs are replaced by JMPs
to code that implements the trace (such as logging events, using the MSR and
PMC's etc..).

This was a trick that was done in my old days of OS/2 performance tools 
developement to get trace information from the running kernel.  In that
case, 
we simply remapped the appropriate code segments to data segments (I think
back then it was called 'aliasing code segments') and used that segment to 
make changes to the kernel code on the fly.

Is it possible to do the same thing in Linux?

Thanks

Tom


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



Dynamically altering code segments

2001-02-27 Thread Collins, Tom

Hi...

This is my first post, so if this is off topic for this list, please direct
me
to another one that is more appropriate.  Thanks

That said, I am wanting to dynamically modify the kernel in specific places
to
implement a custom kernel trace mechanism.  The general idea is that, when
the
"trace" is off, there are NOP instruction sequences at various places in the
kernel.  When the "trace" is turned on, those same NOPs are replaced by JMPs
to code that implements the trace (such as logging events, using the MSR and
PMC's etc..).

This was a trick that was done in my old days of OS/2 performance tools 
developement to get trace information from the running kernel.  In that
case, 
we simply remapped the appropriate code segments to data segments (I think
back then it was called 'aliasing code segments') and used that segment to 
make changes to the kernel code on the fly.

Is it possible to do the same thing in Linux?

Thanks

Tom


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



RE: Dynamically altering code segments

2001-02-27 Thread Collins, Tom

Hey...thank you ... I have looked at the Linux Trace Toolkit
and was wondering if such a thing could be done.  I also
have visited the dprobes web site and that looked like
it had the mechanisms I was looking for.

Will the updated version appear next week at the dprobes 
web site?  I assume that it will.

I have one more question:  My trace code is currently 
implemented as a kernel loadable module.  Would I need
to change that so that it is built as part of the kernel,
or can I keep it as a loadable module?  If I can keep it
as a module, I would ensure that the module would be the 
only place that would enable/disable the trace, (don't
want the kernel jumping to a nonexistant address :O  ..)

Thanks again...will be looking for the upgrade next week...

Tom
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 27, 2001 12:15 PM
To: Andreas Dilger
Cc: Collins, Tom; [EMAIL PROTECTED]
Subject: Re: Dynamically altering code segments




Dprobes is one mechanism for doing what you want. It works the same way
OS/2 dynamic trace did. Another mecnahism, also available from the dprobes
web page is the GKHI (generalised kernel hooks interface). If you know you
want tracepoints in permanently assigned locations then you could code a
gkhi hook in the kernel which is essentially two jmps. When the hook is
inactive the first jmp bypasses the second, which jumps to the hook exit
dispatcher routine. When active the first jmp uses a zero offset. If you
use the gkhi you'll need to write you own hook exits, which presumably will
trace data and drop it into a trace buffer of your own making. Again if you
do decide to use ghki, please wait for 1.0 to be dropped next week
sometime.

If you go down the dprobes route you'll see that it inter-operates with
Linux Trace Toolkit to give you a dynamic tracing capability for Linux
(user and kernel space).  We're currently working on custom formatting for
raw trace data events created by dprobes. If you're familiar with os/2 then
TRCUST might mean something to you in connection with custom formatting.


Richard Moore -  RAS Project Lead - Linux Technology Centre (PISC).

http://oss.software.ibm.com/developerworks/opensource/linux
Office: (+44) (0)1962-817072, Mobile: (+44) (0)7768-298183
IBM UK Ltd,  MP135 Galileo Centre, Hursley Park, Winchester, SO21 2JN, UK


Andreas Dilger [EMAIL PROTECTED] on 27/02/2001 17:05:37

Please respond to Andreas Dilger [EMAIL PROTECTED]

To:   "Collins, Tom" [EMAIL PROTECTED]
cc:   [EMAIL PROTECTED]
Subject:  Re: Dynamically altering code segments




Tom Collins writes:
 I am wanting to dynamically modify the kernel in specific places to
 implement a custom kernel trace mechanism.  The general idea is that,
 when the "trace" is off, there are NOP instruction sequences at various
 places in the kernel.  When the "trace" is turned on, those same NOPs
 are replaced by JMPs to code that implements the trace (such as logging
 events, using the MSR and PMC's etc..).

 This was a trick that was done in my old days of OS/2 performance tools
 developement to get trace information from the running kernel.

 Is it possible to do the same thing in Linux?

See IBM "dprobes" project.  It is basically what you are describing
(AFAIK).  It makes sense, because a lot of the OS/2 folks are now working
on Linux.

Cheers, Andreas
--
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/   -- Dogbert
-
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/


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