linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* help with ppc sections?
@ 2007-07-26 19:12 Chris Friesen
  2007-07-26 19:55 ` Grant Likely
  2007-08-08 16:24 ` help with ppc sections -- no luck, any ideas? Chris Friesen
  0 siblings, 2 replies; 5+ messages in thread
From: Chris Friesen @ 2007-07-26 19:12 UTC (permalink / raw)
  To: linuxppc-dev


Hi all,

I'm porting kprobes to 2.6.14, and I think I've got it mostly done.  The 
last thing that I want to do is to mark flush_icache_range() as part of 
the .kprobes.text section so that we don't accidently try to probe it.

On ppc64 this was done by duplicating the _GLOBAL macro and just 
modifying the ".section" line.

Unfortunately for me, ppc doesn't have a ".section" line in that macro, 
so I'm at a bit of a loss.

Anyone got any suggestions, or pointers on where I could read up on it?

Chris

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: help with ppc sections?
  2007-07-26 19:12 help with ppc sections? Chris Friesen
@ 2007-07-26 19:55 ` Grant Likely
  2007-07-27 18:55   ` Chris Friesen
  2007-08-08 16:24 ` help with ppc sections -- no luck, any ideas? Chris Friesen
  1 sibling, 1 reply; 5+ messages in thread
From: Grant Likely @ 2007-07-26 19:55 UTC (permalink / raw)
  To: Chris Friesen; +Cc: linuxppc-dev

On 7/26/07, Chris Friesen <cfriesen@nortel.com> wrote:
>
> Hi all,
>
> I'm porting kprobes to 2.6.14, and I think I've got it mostly done.  The
> last thing that I want to do is to mark flush_icache_range() as part of
> the .kprobes.text section so that we don't accidently try to probe it.

Hey Chris,

Mild question; What the *@*#^$! are you doing trying to backport to a
2 year old kernel?!?  :-)


>
> On ppc64 this was done by duplicating the _GLOBAL macro and just
> modifying the ".section" line.
>
> Unfortunately for me, ppc doesn't have a ".section" line in that macro,
> so I'm at a bit of a loss.

Just add the section.  Should be trivial to do.  You might have to add
it to the linker script as well.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: help with ppc sections?
  2007-07-26 19:55 ` Grant Likely
@ 2007-07-27 18:55   ` Chris Friesen
  2007-07-31 16:38     ` Segher Boessenkool
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Friesen @ 2007-07-27 18:55 UTC (permalink / raw)
  To: Grant Likely; +Cc: linuxppc-dev

Grant Likely wrote:

> Mild question; What the *@*#^$! are you doing trying to backport to a
> 2 year old kernel?!?  :-)

That's what happens in the embedded space.  It's the current version 
from our distro vendor.  It's also the version that all our different 
board suppliers could agree to provide support for.

Of course, it's also a royal pain.

>> Unfortunately for me, ppc doesn't have a ".section" line in that macro,
>> so I'm at a bit of a loss.

> Just add the section.  Should be trivial to do.  You might have to add
> it to the linker script as well.

I've done the linker script part already.  As for the processor.h bit, 
does this seem reasonable?  It seems to do the trick based on the 
function addresses, but I may be missing something and I haven't 
actually booted it yet.

The ppc64 version appends ',"a"' to the kprobes.text section line.  Is 
this needed here as well?  Could someone elaborate on exactly what its 
purpose is?

Thanks,

Chris


Index: linux-ias/include/asm-ppc/processor.h
===================================================================
--- linux-ias.orig/include/asm-ppc/processor.h
+++ linux-ias/include/asm-ppc/processor.h
@@ -38,6 +38,13 @@

  #define _GLOBAL(n)\
  	.stabs __stringify(n:F-1),N_FUN,0,0,n;\
+	.section ".text"; \
+	.globl n;\
+n:
+
+#define _KPROBE(n)\
+	.stabs __stringify(n:F-1),N_FUN,0,0,n;\
+	.section ".kprobes.text","a"; \
  	.globl n;\
  n:

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: help with ppc sections?
  2007-07-27 18:55   ` Chris Friesen
@ 2007-07-31 16:38     ` Segher Boessenkool
  0 siblings, 0 replies; 5+ messages in thread
From: Segher Boessenkool @ 2007-07-31 16:38 UTC (permalink / raw)
  To: Chris Friesen; +Cc: linuxppc-dev

> The ppc64 version appends ',"a"' to the kprobes.text section line.  Is
> this needed here as well?  Could someone elaborate on exactly what its
> purpose is?

It's the (ELF) section attributes for the section.  If this
is executable code, it should be "ax"; if it's writable, it
should be "wa"; if it's not initialised, it should be "".

If the section name followed the normal naming conventions,
(newer) GCC could figure out the section attributes itself;
but then, ".text.kprobes" would imply executable, maybe the
section is really misnamed?  Or maybe you need the "ax"
flags :-)


Segher

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: help with ppc sections -- no luck, any ideas?
  2007-07-26 19:12 help with ppc sections? Chris Friesen
  2007-07-26 19:55 ` Grant Likely
@ 2007-08-08 16:24 ` Chris Friesen
  1 sibling, 0 replies; 5+ messages in thread
From: Chris Friesen @ 2007-08-08 16:24 UTC (permalink / raw)
  To: linuxppc-dev


Well, I've played around with the sections a bit more, and just can't 
seem to get it to work.  As soon as I apply the following, the kernel 
refuses to boot.  (And if I remove the changes to _GLOBAL, then it 
refuses to boot if I enable CONFIG_KPROBES.)


Index: linux/include/asm-ppc/processor.h
===================================================================
--- linux.orig/include/asm-ppc/processor.h	2007-08-02 16:12:16.000000000 
-0600
+++ linux/include/asm-ppc/processor.h	2007-08-02 16:26:06.000000000 -0600
@@ -38,9 +38,20 @@

  #define _GLOBAL(n)\
  	.stabs __stringify(n:F-1),N_FUN,0,0,n;\
+	.section ".text"; \
  	.globl n;\
  n:

+#ifdef CONFIG_KPROBES
+#define _KPROBE(n)\
+	.stabs __stringify(n:F-1),N_FUN,0,0,n;\
+	.section ".kprobes.text","a"; \
+	.globl n;\
+n:
+#else
+#define _KPROBE(n) _GLOBAL(n)
+#endif
+
  /*
   * this is the minimum allowable io space due to the location
   * of the io areas on prep (first one at 0x80000000) but
Index: linux/arch/ppc/kernel/misc.S
===================================================================
--- linux.orig/arch/ppc/kernel/misc.S	2007-08-02 16:12:16.000000000 -0600
+++ linux/arch/ppc/kernel/misc.S	2007-08-02 16:24:43.000000000 -0600
@@ -624,7 +624,7 @@
   *
   * flush_icache_range(unsigned long start, unsigned long stop)
   */
-_GLOBAL(flush_icache_range)
+_KPROBE(flush_icache_range)
  BEGIN_FTR_SECTION
  	blr				/* for 601, do nothing */
  END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE)





Based on Segher's comments I tried changing it to:

+	.section ".text","ax"; \


but that didn't work either.


Anyone else got any suggestions on how I might force 
flush_icache_range() into a ".kprobes.text" section?

Chris

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-08-08 16:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-26 19:12 help with ppc sections? Chris Friesen
2007-07-26 19:55 ` Grant Likely
2007-07-27 18:55   ` Chris Friesen
2007-07-31 16:38     ` Segher Boessenkool
2007-08-08 16:24 ` help with ppc sections -- no luck, any ideas? Chris Friesen

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).