linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Baron <jbaron@redhat.com>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu,
	mathieu.desnoyers@polymtl.ca, hpa@zytor.com, tglx@linutronix.de,
	rostedt@goodmis.org, andi@firstfloor.org, roland@redhat.com,
	rth@redhat.com, mhiramat@redhat.com, avi@redhat.com,
	davem@davemloft.net, vgoyal@redhat.com, sam@ravnborg.org
Subject: Re: [PATCH 02/13] jump label v9: base patch
Date: Thu, 10 Jun 2010 11:44:52 -0400	[thread overview]
Message-ID: <20100610154451.GC3923@redhat.com> (raw)
In-Reply-To: <20100609223548.GB12752@nowhere>

On Thu, Jun 10, 2010 at 12:35:49AM +0200, Frederic Weisbecker wrote:
> On Wed, Jun 09, 2010 at 05:38:57PM -0400, Jason Baron wrote:
> > +static int build_jump_label_hashtable(struct jump_entry *start, struct jump_entry *stop)
> > +{
> > +	struct jump_entry *iter, *iter_begin;
> > +	struct jump_label_entry *entry;
> > +	int count;
> > +
> > +	sort_jump_label_entries(start, stop);
> > +	iter = start;
> > +	while (iter < stop) {
> > +		entry = get_jump_label_entry((char *)iter->name);
> > +		if (!entry) {
> > +			iter_begin = iter;
> > +			count = 0;
> > +			while ((iter < stop) &&
> > +				(strcmp((char *)iter->name,
> > +					(char *)iter_begin->name) == 0)) {
> > +				iter++;
> > +				count++;
> > +			}
> 
> 
> 
> 
> So, you can have multiple entries with the same name? How can that happen
> in fact?
> 
> 

this is the case where a single tracepoint such as kmalloc(), is used in
all over the kernel. So, there is one name or key value associated with
a kmalloc tracepoint. however, we have to patch the jump or nop into a
bunch of places in the kernel text.

> 
> 
> > +			entry = add_jump_label_entry((char *)iter_begin->name,
> > +							count, iter_begin);
> > +			if (IS_ERR(entry))
> > +				return PTR_ERR(entry);
> > +			continue;
> > +		}
> > +		WARN(1, KERN_ERR "build_jump_hashtable: unexpected entry!\n");
> 
> 
> 
> It seems you are going to endless loop in this fail case.
> 

agreed. I need to stick that 'WARN' into the else clause of "if
(!entry)" and return an error.

> 
> 
> > +	}
> > +	return 0;
> > +}
> > +
> > +/***
> > + * jump_label_update - update jump label text
> > + * @name - name of the jump label
> > + * @type - enum set to JUMP_LABEL_ENABLE or JUMP_LABEL_DISABLE
> > + *
> > + * Will enable/disable the jump for jump label @name, depending on the
> > + * value of @type.
> > + *
> > + */
> > +
> > +void jump_label_update(const char *name, enum jump_label_type type)
> > +{
> > +	struct jump_entry *iter;
> > +	struct jump_label_entry *entry;
> > +	struct hlist_node *module_node;
> > +	struct jump_label_module_entry *e_module;
> > +	int count;
> > +
> > +	mutex_lock(&jump_label_mutex);
> > +	entry = get_jump_label_entry(name);
> > +	if (entry) {
> > +		count = entry->nr_entries;
> > +		iter = entry->table;
> > +		while (count--) {
> > +			if (kernel_text_address(iter->code))
> > +				arch_jump_label_transform(iter, type);
> > +			iter++;
> > +		}
> 
> 
> 
> So, this is going to patch multiple times the same value on the
> same address in case you have multiple entries for the same name?
> 
> That look weird.

no. as mentioned before, there are multiple text addresses potentially
associated with a single jump label conditional variable. So we need to
patch all of them.

> 
> BTW, if you can't find the entry, you should perhaps propagate an error.
> 
> 
> 
> > +	}
> > +	mutex_unlock(&jump_label_mutex);
> > +}
> > +
> > +static int init_jump_label(void)
> 
> 
> 
> This can be __init.
>

ok.

thanks for the review.

-Jason 

  reply	other threads:[~2010-06-10 15:45 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-09 21:38 [PATCH 00/13] jump label v9 Jason Baron
2010-06-09 21:38 ` [PATCH 01/13] jump label v9: notifier atomic call chain notrace Jason Baron
2010-06-09 21:58   ` Frederic Weisbecker
2010-06-10 15:34     ` Jason Baron
2010-06-09 21:38 ` [PATCH 02/13] jump label v9: base patch Jason Baron
2010-06-09 22:35   ` Frederic Weisbecker
2010-06-10 15:44     ` Jason Baron [this message]
2010-06-10 16:22       ` Ingo Molnar
2010-06-10 17:11       ` Frederic Weisbecker
2010-06-09 22:36   ` Frederic Weisbecker
2010-06-10 12:06   ` Peter Zijlstra
2010-06-10 12:18   ` Peter Zijlstra
2010-06-09 21:39 ` [PATCH 03/13] jump label v9: x86 support Jason Baron
2010-06-10 12:12   ` Peter Zijlstra
2010-06-10 12:14     ` Ingo Molnar
2010-06-10 13:26       ` Andi Kleen
2010-06-10 14:12         ` Peter Zijlstra
2010-06-10 14:28           ` Andi Kleen
2010-06-10 15:37         ` Ingo Molnar
2010-06-10 16:24           ` Andi Kleen
2010-06-11  8:12             ` Ingo Molnar
2010-06-11  8:30               ` Andi Kleen
2010-06-10 16:29         ` Steven Rostedt
2010-06-10 15:04       ` Jason Baron
2010-06-10 16:13         ` Mathieu Desnoyers
2010-06-11  0:52           ` Jason Baron
2010-06-11  6:18       ` H. Peter Anvin
2010-06-11  7:58         ` Ingo Molnar
2010-06-10 12:15   ` Peter Zijlstra
2010-06-10 12:33   ` Peter Zijlstra
2010-06-09 21:39 ` [PATCH 04/13] jump label v9: tracepoint support Jason Baron
2010-06-10 12:22   ` Peter Zijlstra
2010-06-09 21:39 ` [PATCH 05/13] jump label v9: add module support Jason Baron
2010-06-09 21:39 ` [PATCH 06/13] jump label v9: move ftrace_dyn_arch_init to common code Jason Baron
2010-06-19  3:24   ` Steven Rostedt
2010-06-09 21:39 ` [PATCH 07/13] jump label v9: sort jump table at build-time Jason Baron
2010-06-09 21:39 ` [PATCH 08/13] jump label v9: initialize workqueue tracepoints *before* they are registered Jason Baron
2010-06-09 21:39 ` [PATCH 09/13] jump label v9: jump_label_text_reserved() to reserve our jump points Jason Baron
2010-06-09 21:39 ` [PATCH 10/13] jump label v9: convert jump label to use a key Jason Baron
2010-06-10 12:38   ` Peter Zijlstra
2010-06-10 12:43   ` Peter Zijlstra
2010-06-10 13:57     ` Jason Baron
2010-06-10 14:46       ` Peter Zijlstra
2010-06-09 21:39 ` [PATCH 11/13] jump label v9: convert dynamic debug to use jump labels Jason Baron
2010-06-09 21:39 ` [PATCH 12/13] jump label v9: sparc64 add jump_label support Jason Baron
2010-06-09 21:39 ` [PATCH 13/13] jump label v9: add docs Jason Baron
2010-06-10 12:49   ` Peter Zijlstra
2010-06-15  3:47 ` [PATCH 00/13] jump label v9 David Miller
2010-06-15 14:28   ` Jason Baron
2010-06-15 15:44     ` Mathieu Desnoyers
2010-06-18  3:45       ` Tony Breeds
2010-06-18 15:18         ` Mathieu Desnoyers
2010-06-15 17:13     ` David Miller
2010-06-15 17:28       ` H. Peter Anvin

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=20100610154451.GC3923@redhat.com \
    --to=jbaron@redhat.com \
    --cc=andi@firstfloor.org \
    --cc=avi@redhat.com \
    --cc=davem@davemloft.net \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=mhiramat@redhat.com \
    --cc=mingo@elte.hu \
    --cc=roland@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=rth@redhat.com \
    --cc=sam@ravnborg.org \
    --cc=tglx@linutronix.de \
    --cc=vgoyal@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).