All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Vara Prasad <prasadav@us.ibm.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	"Frank Ch. Eigler" <fche@redhat.com>, Ingo Molnar <mingo@elte.hu>,
	Paul Mundt <lethal@linux-sh.org>,
	Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Jes Sorensen <jes@sgi.com>, Andrew Morton <akpm@osdl.org>,
	Tom Zanussi <zanussi@us.ibm.com>,
	Richard J Moore <richardj_moore@uk.ibm.com>,
	Michel Dagenais <michel.dagenais@polymtl.ca>,
	Christoph Hellwig <hch@infradead.org>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	William Cohen <wcohen@redhat.com>,
	"Martin J. Bligh" <mbligh@mbligh.org>,
	systemtap <systemtap@sourceware.org>
Subject: Re: tracepoint maintainance models
Date: Fri, 06 Oct 2006 01:33:11 -0400	[thread overview]
Message-ID: <1160112791.30146.12.camel@localhost.localdomain> (raw)
In-Reply-To: <450F0180.1040606@us.ibm.com>

Coming into this really late, and I'm still behind in reading this and
related threads, but I want to throw this idea out, and it's getting
late.

On Mon, 2006-09-18 at 13:28 -0700, Vara Prasad wrote:
> Alan Cox wrote:
> 
> >
> >>This still doesn't solve the problem of compiler optimizing such that a 
> >>variable i would like to read in my probe not being available at the 
> >>probe point.
> >>    
> >>
> >
> >Then what we really need by the sound of it is enough gcc smarts to do
> >something of the form
> >
> >	.section "debugbits"
> >	
> >	.asciiz 'hook_sched'
> >	.dword l1	# Address to probe
> >	.word 1		# Argument count
> >	.dword gcc_magic_whatregister("next"); [ reg num or memory ]
> >	.dword gcc_magic_whataddress("next"); [ address if exists]
> >
> >
> >Can gcc do any of that for us today ?
> >
> >  
> >
> No, gcc doesn't do that today.
> 
> 


---- cut here ----
#include <stdio.h>

#define MARK(label, var)			\
	asm ("debug_" #label ":\n"		\
	     ".section .data\n"			\
	     #label "_" #var ": xor %0,%0\n"	\
	     ".previous" : : "r"(var))


static int func(int a)
{
	int y;
	int z;

	y = a;
	MARK(func, y);
	z = y+2;

	return z;

}



static void read_label(void)
{
	extern unsigned short regA;
	unsigned short *r = &regA;
	char *regs[] = {
		"A", "B", "C", "D", "DI", "BP", "SP", "CH"
	};
	int i;
	extern unsigned short func_y;
	extern unsigned long debug_func;

	asm (".section .data\n"
	     "regA: xor %eax,%eax\n"
	     "regB: xor %ebx,%ebx\n"
	     "regC: xor %ecx,%ecx\n"
	     "regD: xor %edx,%edx\n"
	     "regDI: xor %edi,%edi\n"
	     "regBP: xor %ebp,%ebp\n"
	     "regSP: xor %esp,%esp\n"
	     ".previous");

	for (i=0; i < 7; i++) {
		if (r[i] == func_y)
			break;
	}
	if (i < 7)
		printf("func y is in reg %s at %p\n",
		       regs[i],
		       &debug_func);
	else
		printf("func y not found!\n");
}

int main (int argc, char **argv)
{
	int g;
	g = func(argc);
	read_label();
	return g;
}
---- end cut ----

$ gcc -O2 -o mark mark.c
$ ./mark
func y is in reg B at 0x80483ce



Now the question is, isn't MARK() in this code a non intrusive marker?

So couldn't a kprobe be set at "debug_func" and we can find what
register "y" is without adding any overhead to the code being marked?

Obviously, this would need to be done special for each arch.

-- Steve



  reply	other threads:[~2006-10-06  5:33 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-17  9:40 The emperor is naked: why *comprehensive* static markup belongs in mainline Karim Yaghmour
2006-09-17 11:21 ` Paul Mundt
2006-09-17 14:36   ` tracepoint maintainance models Ingo Molnar
2006-09-17 15:02     ` Roman Zippel
2006-09-17 15:09       ` Ingo Molnar
2006-09-17 17:18         ` Roman Zippel
2006-09-17 23:27           ` Ingo Molnar
2006-09-17 23:41           ` Ingo Molnar
2006-09-18  0:17             ` Roman Zippel
2006-09-18  9:01               ` Jes Sorensen
2006-09-17 20:37         ` Roman Zippel
2006-09-17 22:34           ` Ingo Molnar
2006-09-17 15:36     ` Mathieu Desnoyers
2006-09-18  0:07       ` Ingo Molnar
2006-09-18  1:12         ` Karim Yaghmour
2006-09-18  1:13           ` Ingo Molnar
2006-09-18  2:32             ` Karim Yaghmour
2006-09-18  2:57               ` Ingo Molnar
2006-09-18  3:54                 ` Karim Yaghmour
2006-09-18  4:09                   ` Ingo Molnar
2006-09-18  4:43                     ` Karim Yaghmour
2006-09-18  2:43             ` Mathieu Desnoyers
2006-09-18  3:21               ` Ingo Molnar
2006-09-18  4:26                 ` Mathieu Desnoyers
2006-09-18  5:08                   ` Ingo Molnar
2006-09-18 12:25             ` Frank Ch. Eigler
2006-09-18 15:02               ` Ingo Molnar
2006-09-18 15:45                 ` Mathieu Desnoyers
2006-09-18 15:48                 ` Alan Cox
2006-09-18 15:22                   ` Ingo Molnar
2006-09-18 16:19                     ` Alan Cox
2006-09-18 16:15                       ` Ingo Molnar
2006-09-18 17:02                         ` Alan Cox
2006-09-18 16:15                       ` Frank Ch. Eigler
2006-09-18 17:02                         ` Alan Cox
2006-09-18 17:27                           ` Frank Ch. Eigler
2006-09-18 18:04                             ` Alan Cox
2006-09-18 17:54                               ` Martin Bligh
2006-09-18 18:05                               ` Frank Ch. Eigler
2006-09-18 19:10                           ` Vara Prasad
2006-09-18 19:49                             ` Alan Cox
2006-09-18 19:39                               ` Frank Ch. Eigler
2006-09-18 20:28                               ` Vara Prasad
2006-10-06  5:33                                 ` Steven Rostedt [this message]
2006-10-06 13:01                                   ` Frank Ch. Eigler
2006-10-06 14:23                                     ` Steven Rostedt
2006-10-06 23:17                                   ` Jeremy Fitzhardinge
2006-09-18 15:47                   ` Frank Ch. Eigler
2006-09-18 15:42                     ` Ingo Molnar
2006-09-18 16:30                 ` MARKER mechanism, try 2 Mathieu Desnoyers
2006-09-18 16:28                   ` Ingo Molnar
2006-09-18 17:47                     ` Mathieu Desnoyers
2006-09-18 19:39                       ` Alan Cox
2006-09-17 20:19     ` tracepoint maintainance models Nicholas Miell
2006-09-17 23:06       ` Ingo Molnar
2006-09-18  0:05         ` Roman Zippel
2006-09-18  1:52           ` Theodore Tso
2006-09-19 12:58           ` tracing - consensus building insteat of dogfights Christoph Hellwig
2006-09-19 13:25             ` Roman Zippel
2006-09-19 13:45             ` Karim Yaghmour
2006-09-19 14:25               ` Karim Yaghmour
2006-09-18  0:10         ` tracepoint maintainance models Nicholas Miell
2006-09-18  0:43           ` Roman Zippel
2006-09-18  0:56         ` Karim Yaghmour
2006-09-18  0:56           ` Ingo Molnar
2006-09-18  2:09             ` Karim Yaghmour
2006-09-18  3:30               ` Ingo Molnar
2006-09-18  3:52                 ` Theodore Tso
2006-09-18  4:11                   ` Ingo Molnar
2006-09-18  4:24                   ` Karim Yaghmour
2006-09-18  4:32                     ` Ingo Molnar
2006-09-18  5:03                       ` LTTng and SystemTAP (Everyone who is scared to read this huge thread, skip to here) Mathieu Desnoyers
2006-09-18 15:11                         ` Ingo Molnar
2006-09-23 15:50                           ` Mathieu Desnoyers
2006-09-18  5:37                       ` tracepoint maintainance models Karim Yaghmour
2006-09-18 20:12                   ` Michel Dagenais
2006-09-18  4:14                 ` Karim Yaghmour
2006-09-18  4:09                   ` Ingo Molnar
2006-09-18  4:57                     ` Karim Yaghmour
2006-09-18  1:03   ` The emperor is naked: why *comprehensive* static markup belongs in mainline Karim Yaghmour
2006-09-18 15:53 ` Jose R. Santos
2006-09-18 17:28   ` Karim Yaghmour

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1160112791.30146.12.camel@localhost.localdomain \
    --to=rostedt@goodmis.org \
    --cc=akpm@osdl.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=fche@redhat.com \
    --cc=gregkh@suse.de \
    --cc=hch@infradead.org \
    --cc=jes@sgi.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=mbligh@mbligh.org \
    --cc=michel.dagenais@polymtl.ca \
    --cc=mingo@elte.hu \
    --cc=prasadav@us.ibm.com \
    --cc=richardj_moore@uk.ibm.com \
    --cc=systemtap@sourceware.org \
    --cc=tglx@linutronix.de \
    --cc=wcohen@redhat.com \
    --cc=zanussi@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.