linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Baron <jbaron@redhat.com>
To: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: David Miller <davem@davemloft.net>,
	linux-kernel@vger.kernel.org, mingo@elte.hu, hpa@zytor.com,
	tglx@linutronix.de, rostedt@goodmis.org, andi@firstfloor.org,
	roland@redhat.com, rth@redhat.com, mhiramat@redhat.com,
	fweisbec@gmail.com, avi@redhat.com, vgoyal@redhat.com
Subject: Re: [PATCH 07/13] jump label v8: sort jump table at build-time
Date: Mon, 24 May 2010 16:14:58 -0400	[thread overview]
Message-ID: <20100524201458.GC2720@redhat.com> (raw)
In-Reply-To: <20100520213216.GB14957@Krystal>

On Thu, May 20, 2010 at 05:32:16PM -0400, Mathieu Desnoyers wrote:
> * Jason Baron (jbaron@redhat.com) wrote:
> > On Wed, May 19, 2010 at 03:36:34PM -0700, David Miller wrote:
> > > > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> > > > index 2092361..fe6f8be 100644
> > > > --- a/scripts/mod/modpost.c
> > > > +++ b/scripts/mod/modpost.c
> > > > @@ -17,6 +17,8 @@
> > > >  #include "modpost.h"
> > > >  #include "../../include/generated/autoconf.h"
> > > >  #include "../../include/linux/license.h"
> > > > +#include <linux/types.h>
> > > > +#include "jump_entry.h"
> > > >  
> > > 
> > > This breaks the build on non-jump_label-supporting architectures
> > > because only they will have the jump_entry.h header file.
> > > 
> > > I'm really getting tired trying to test your changes and every single
> > > time as I go through doing very basic build testing I always hit one
> > > patch that assumes jump label support exists, or assumes some x86'ism.
> > 
> > sorry about that. I mis-tested it. anyways here's the interdiff to this
> > patch to fix. btw, how do the sparc bits look?
> > 
> > thanks,
> > 
> > -Jason
> > 
> > 
> > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> > index fe6f8be..cc87012 100644
> > --- a/scripts/mod/modpost.c
> > +++ b/scripts/mod/modpost.c
> > @@ -18,7 +18,9 @@
> >  #include "../../include/generated/autoconf.h"
> >  #include "../../include/linux/license.h"
> >  #include <linux/types.h>
> > -#include "jump_entry.h"
> 
> includes with "" is a bit unexpected in kernel code. Any reason for this ?
> Is jump_entry.h shipped in scripts/mod/ ?
> 

The jump_entry.h is per arch found in:
arch/<arch>/include/asm/jump_entry.

Its being found in modpost.c, via:

HOST_EXTRACFLAGS += -iquote "$(srctree)/arch/$(hdr-arch)/include/asm"

in scripts/mod/Makefile

I used the quotes so that its less likely to conflict with any other
include.

> > +#ifdef CONFIG_HAVE_ARCH_JUMP_LABEL
> 
> ifdefs everywhere cripples the code and make it unreadable. You might
> want to try to find another way to deal with the problem. E.g.
> 
> create linux/jump_entry.h
> which contains 
> 
> #ifdef CONFIG_HAVE_ARCH_JUMP_LABEL
> #include <asm/jump_entry.h>
> #else
> 
> define some empty static inlines, and use them in the .c files.
> 
> e.g. 
> 
> static inline void sort_jump_label_table(struct elf_info *info, Elf_Ehdr *hdr)
> {
> }
> 
> #endif
> 

right. i have that defined already as include/linux/jump_label.h. Which
is the include file that kernel code uses. However, I can't use it in
the modpost.c code, since there are a number of kernel specific
references. (I probably could simplify things a bit using #ifdef
KERNEL).

> > + #include "jump_entry.h"
> > +#endif
> >  
> >  /* Some toolchains use a `_' prefix for all user symbols. */
> >  #ifdef CONFIG_SYMBOL_PREFIX
> > @@ -377,6 +379,8 @@ void release_file(void *file, unsigned long size)
> >  	munmap(file, size);
> >  }
> >  
> > +#ifdef CONFIG_HAVE_ARCH_JUMP_LABEL
> > +
> >  static void swap_jump_label_entries(struct jump_entry *previous, struct jump_entry *next)
> >  {
> >  	struct jump_entry tmp;
> > @@ -421,6 +425,8 @@ static void sort_jump_label_table(struct elf_info *info, Elf_Ehdr *hdr)
> >  	} while (swapped == 1);
> >  }
> >  
> > +#endif
> > +
> >  static int parse_elf(struct elf_info *info, const char *filename)
> >  {
> >  	unsigned int i;
> > @@ -539,8 +545,10 @@ static int parse_elf(struct elf_info *info, const char *filename)
> >  		sym->st_size  = TO_NATIVE(sym->st_size);
> >  	}
> >  
> > +#ifdef CONFIG_HAVE_ARCH_JUMP_LABEL
> >  	if (enable_jump_label)
> >  		sort_jump_label_table(info, hdr);
> > +#endif
> 
> And remove this ifdef.
> 
> Thanks,
> 
> Mathieu
> 

agreed. I'll clean this up in the next iteration.

thanks,

-jason

  reply	other threads:[~2010-05-24 20:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-19 16:21 [PATCH 00/13] jump label v8 Jason Baron
2010-05-19 16:21 ` [PATCH 01/13] jump label v8: notifier atomic call chain notrace Jason Baron
2010-05-19 16:21 ` [PATCH 02/13] jump label v8: base patch Jason Baron
2010-05-19 16:21 ` [PATCH 03/13] jump label v8: x86 support Jason Baron
2010-05-19 16:22 ` [PATCH 04/13] jump label v8: tracepoint support Jason Baron
2010-05-19 16:22 ` [PATCH 05/13] jump label v8: add module support Jason Baron
2010-05-19 16:22 ` [PATCH 06/13] jump label v8: move ftrace_dyn_arch_init to common code Jason Baron
2010-05-19 16:22 ` [PATCH 07/13] jump label v8: sort jump table at build-time Jason Baron
2010-05-19 22:36   ` David Miller
2010-05-20 20:17     ` Jason Baron
2010-05-20 21:32       ` Mathieu Desnoyers
2010-05-24 20:14         ` Jason Baron [this message]
2010-05-20 22:24       ` David Miller
2010-05-19 16:22 ` [PATCH 08/13] jump label v8: initialize workqueue tracepoints *before* they are registered Jason Baron
2010-05-19 16:22 ` [PATCH 09/13] jump label v8: jump_label_text_reserved() to reserve our jump points Jason Baron
2010-05-19 16:22 ` [PATCH 10/13] jump label v8: add docs Jason Baron
2010-05-19 16:22 ` [PATCH 11/13] jump label v8: convert jump label to use a key Jason Baron
2010-05-19 16:22 ` [PATCH 12/13] jump label v8: convert dynamic debug to use jump labels Jason Baron
2010-05-19 16:22 ` [PATCH 13/13] jump label v8: sparc64 add jump_label support Jason Baron

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=20100524201458.GC2720@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=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).