Messages in this thread Patch in this message | | | Date | Thu, 10 Mar 2011 14:53:44 -0500 | From | Jason Baron <> | Subject | Re: [PATCH 0/2] jump label: update for .39 |
| |
On Thu, Mar 10, 2011 at 02:45:29PM -0500, Steven Rostedt wrote: > On Thu, 2011-03-10 at 14:25 -0500, Steven Rostedt wrote: > > On Thu, 2011-03-10 at 10:57 -0800, David Daney wrote: > > > On 03/10/2011 10:53 AM, Steven Rostedt wrote: > > > > On Thu, 2011-03-10 at 10:47 -0800, David Daney wrote: > > > > > > > >> The alignment requested by the assembler will have to satisfy *all* the > > > >> requested alignments, so manually forcing everything to .align 8 (or > > > >> .align 4 for 32-bit) should ensure that the linker doesn't put in any holes. > > > > > > > > I would agree with the assessment although, I don't know that it is > > > > documented anywhere that this is what happens. As the previous "bug" > > > > with the trace_events was solved by me adding .align(4) everywhere, I > > > > would think that .align(sizeof(long)) would work here too. > > > > > > > > It may be a good ideal to force this alignment, and not add wasted > > > > space. If anything, if this (hypothetical) bug appears, it will most > > > > likely show up as a crash on boot up. I'm not too concerned about it. > > > > > > > > > > If the linker put in gratuitous holes, things like __ex_table would > > > break too. > > > > Again, as I have said (although I said extable not __ex_table), there > > seems to be no problem when the data is of a power of 2 as well. As > > __ex_table size is a power of 2. We just don't know if the linker will > > add holes when the size is something other than power of 2. > > Anyway, I think the best thing for now is to have Jason add > the .align(sizeof(long)) in the inline assembly for all locations and be > done with it. >
agreed. something like the following is all that's needed for x86. Sparc already has this, so mips just needs something similar. Steve, should I re-post the entire series. Or can I just post this patch separately?
thanks,
-Jason
diff --git a/arch/x86/include/asm/jump_label.h b/arch/x86/include/asm/jump_label.h index f217cee..57f31ff 100644 --- a/arch/x86/include/asm/jump_label.h +++ b/arch/x86/include/asm/jump_label.h @@ -8,6 +8,7 @@ #include <asm/asm.h> #define JUMP_LABEL_NOP_SIZE 5 +#define BYTES_PER_LONG (BITS_PER_LONG / 8) #define JUMP_LABEL_INITIAL_NOP ".byte 0xe9 \n\t .long 0\n\t" @@ -16,9 +17,10 @@ static __always_inline bool arch_static_branch(struct jump_label_key *key) asm goto("1:" JUMP_LABEL_INITIAL_NOP ".pushsection __jump_table, \"aw\" \n\t" - _ASM_PTR "1b, %l[l_yes], %c0 \n\t" + ".align %c0\n\t" + _ASM_PTR "1b, %l[l_yes], %c1 \n\t" ".popsection \n\t" - : : "i" (key) : : l_yes); + : : "i" BYTES_PER_LONG, "i" (key) : : l_yes); return false; l_yes: return true;
| |