Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [Patch] Fix lookup_dcookie for MIPS o32
@ 2005-10-17 21:44 David Daney
  2005-10-18 11:45 ` Ralf Baechle
       [not found] ` <20051018115155.GD2656@linux-mips.org>
  0 siblings, 2 replies; 11+ messages in thread
From: David Daney @ 2005-10-17 21:44 UTC (permalink / raw)
  To: oprofile-list; +Cc: linux-mips


This patch fixes the lookup_dcookie for the MIPS o32 ABI.  Although I
only tested with little-endian, the big-endian case needed fixing as
well but is untested (but what are the chances that this is not the
correct fix?).

This is the only patch I needed to get the user space oprofile
programs to work for mipsel-linux.

I am CCing the linux-mips list as this may be of interest there as well.

David Daney.


2005-10-17  David Daney  <ddaney@avtrex.com>

	* daemon/opd_cookie.c (lookup_dcookie): Handle MIPS o32 for both big
	and little endian.

Index: oprofile/daemon/opd_cookie.c
===================================================================
RCS file: /cvsroot/oprofile/oprofile/daemon/opd_cookie.c,v
retrieving revision 1.19
diff -p -a -u -r1.19 opd_cookie.c
--- oprofile/daemon/opd_cookie.c	26 May 2005 00:00:02 -0000	1.19
+++ oprofile/daemon/opd_cookie.c	17 Oct 2005 21:29:13 -0000
@@ -60,12 +60,21 @@
 #endif /* __NR_lookup_dcookie */
 
 #if (defined(__powerpc__) && !defined(__powerpc64__)) || defined(__hppa__)\
-	|| (defined(__s390__) && !defined(__s390x__))
+	|| (defined(__s390__) && !defined(__s390x__)) \
+	|| (defined(__mips__) && (_MIPS_SIM == _MIPS_SIM_ABI32) \
+	    && defined(_MIPSEB))
 static inline int lookup_dcookie(cookie_t cookie, char * buf, size_t size)
 {
 	return syscall(__NR_lookup_dcookie, (unsigned long)(cookie >> 32),
 		       (unsigned long)(cookie & 0xffffffff), buf, size);
 }
+#elif (defined(__mips__) && (_MIPS_SIM == _MIPS_SIM_ABI32)) /*_MIPSEL */
+static inline int lookup_dcookie(cookie_t cookie, char * buf, size_t size)
+{
+	return syscall(__NR_lookup_dcookie,
+		       (unsigned long)(cookie & 0xffffffff),
+		       (unsigned long)(cookie >> 32), buf, size);
+}
 #else
 static inline int lookup_dcookie(cookie_t cookie, char * buf, size_t size)
 {

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

* Re: [Patch] Fix lookup_dcookie for MIPS o32
  2005-10-17 21:44 [Patch] Fix lookup_dcookie for MIPS o32 David Daney
@ 2005-10-18 11:45 ` Ralf Baechle
  2005-10-18 23:24   ` John Levon
  2005-10-19 15:48   ` Thiemo Seufer
       [not found] ` <20051018115155.GD2656@linux-mips.org>
  1 sibling, 2 replies; 11+ messages in thread
From: Ralf Baechle @ 2005-10-18 11:45 UTC (permalink / raw)
  To: David Daney; +Cc: oprofile-list, linux-mips

On Mon, Oct 17, 2005 at 02:44:07PM -0700, David Daney wrote:

> This patch fixes the lookup_dcookie for the MIPS o32 ABI.  Although I
> only tested with little-endian, the big-endian case needed fixing as
> well but is untested (but what are the chances that this is not the
> correct fix?).
> 
> This is the only patch I needed to get the user space oprofile
> programs to work for mipsel-linux.
> 
> I am CCing the linux-mips list as this may be of interest there as well.

Good catch.

> 2005-10-17  David Daney  <ddaney@avtrex.com>
> 
> 	* daemon/opd_cookie.c (lookup_dcookie): Handle MIPS o32 for both big
> 	and little endian.
> 
> Index: oprofile/daemon/opd_cookie.c
> ===================================================================
> RCS file: /cvsroot/oprofile/oprofile/daemon/opd_cookie.c,v
> retrieving revision 1.19
> diff -p -a -u -r1.19 opd_cookie.c
> --- oprofile/daemon/opd_cookie.c	26 May 2005 00:00:02 -0000	1.19
> +++ oprofile/daemon/opd_cookie.c	17 Oct 2005 21:29:13 -0000
> @@ -60,12 +60,21 @@
>  #endif /* __NR_lookup_dcookie */
>  
>  #if (defined(__powerpc__) && !defined(__powerpc64__)) || defined(__hppa__)\
> -	|| (defined(__s390__) && !defined(__s390x__))
> +	|| (defined(__s390__) && !defined(__s390x__)) \
> +	|| (defined(__mips__) && (_MIPS_SIM == _MIPS_SIM_ABI32) \
> +	    && defined(_MIPSEB))

Small nit - please use __MIPSEB__ rsp. __MIPSEL__; I think there are
some compilers floating around that don't define the single underscore
variant.

Thanks,

  Ralf

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

* Re: [Patch] Fix lookup_dcookie for MIPS o32
  2005-10-18 11:45 ` Ralf Baechle
@ 2005-10-18 23:24   ` John Levon
  2005-10-18 23:35     ` David Daney
  2005-10-19 15:48   ` Thiemo Seufer
  1 sibling, 1 reply; 11+ messages in thread
From: John Levon @ 2005-10-18 23:24 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: David Daney, oprofile-list, linux-mips

On Tue, Oct 18, 2005 at 12:45:26PM +0100, Ralf Baechle wrote:

> > +	    && defined(_MIPSEB))
> 
> Small nit - please use __MIPSEB__ rsp. __MIPSEL__; I think there are

I made it so; David, please check.

thanks
john

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

* Re: [Patch] Fix lookup_dcookie for MIPS o32
  2005-10-18 23:24   ` John Levon
@ 2005-10-18 23:35     ` David Daney
  2005-10-18 23:36       ` John Levon
  0 siblings, 1 reply; 11+ messages in thread
From: David Daney @ 2005-10-18 23:35 UTC (permalink / raw)
  To: John Levon; +Cc: Ralf Baechle, oprofile-list, linux-mips

John Levon wrote:
> On Tue, Oct 18, 2005 at 12:45:26PM +0100, Ralf Baechle wrote:
> 
> 
>>>+	    && defined(_MIPSEB))
>>
>>Small nit - please use __MIPSEB__ rsp. __MIPSEL__; I think there are
> 
> 
> I made it so; David, please check.
> 

I just did a cvs update and see no change.  Perhaps I misunderstand. 
Would you like me to make and test a patch?  I could...

David Daney

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

* Re: [Patch] Fix lookup_dcookie for MIPS o32
  2005-10-18 23:35     ` David Daney
@ 2005-10-18 23:36       ` John Levon
  2005-10-19  9:07         ` Geert Uytterhoeven
  0 siblings, 1 reply; 11+ messages in thread
From: John Levon @ 2005-10-18 23:36 UTC (permalink / raw)
  To: David Daney; +Cc: Ralf Baechle, oprofile-list, linux-mips

On Tue, Oct 18, 2005 at 04:35:52PM -0700, David Daney wrote:

> I just did a cvs update and see no change.  Perhaps I misunderstand. 
> Would you like me to make and test a patch?  I could...

anoncvs takes a while to update I think.

john

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

* Re: [Patch] Fix lookup_dcookie for MIPS o32
  2005-10-18 23:36       ` John Levon
@ 2005-10-19  9:07         ` Geert Uytterhoeven
  2005-10-19 10:40           ` Ralf Baechle
  0 siblings, 1 reply; 11+ messages in thread
From: Geert Uytterhoeven @ 2005-10-19  9:07 UTC (permalink / raw)
  To: John Levon
  Cc: David Daney, Ralf Baechle, oprofile-list, Linux/MIPS Development

On Wed, 19 Oct 2005, John Levon wrote:
> On Tue, Oct 18, 2005 at 04:35:52PM -0700, David Daney wrote:
> > I just did a cvs update and see no change.  Perhaps I misunderstand. 
> > Would you like me to make and test a patch?  I could...
> 
> anoncvs takes a while to update I think.

AFAIK, it's no longer updated. Use git.

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* Re: [Patch] Fix lookup_dcookie for MIPS o32
  2005-10-19  9:07         ` Geert Uytterhoeven
@ 2005-10-19 10:40           ` Ralf Baechle
  2005-10-19 11:21             ` Geert Uytterhoeven
  0 siblings, 1 reply; 11+ messages in thread
From: Ralf Baechle @ 2005-10-19 10:40 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: John Levon, David Daney, oprofile-list, Linux/MIPS Development

On Wed, Oct 19, 2005 at 11:07:55AM +0200, Geert Uytterhoeven wrote:

> On Wed, 19 Oct 2005, John Levon wrote:
> > On Tue, Oct 18, 2005 at 04:35:52PM -0700, David Daney wrote:
> > > I just did a cvs update and see no change.  Perhaps I misunderstand. 
> > > Would you like me to make and test a patch?  I could...
> > 
> > anoncvs takes a while to update I think.
> 
> AFAIK, it's no longer updated. Use git.

This is the userspace oprofile tools, not the kernel.  Last I checked
Sourceforge was still on the cvs.

  Ralf

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

* Re: [Patch] Fix lookup_dcookie for MIPS o32
  2005-10-19 10:40           ` Ralf Baechle
@ 2005-10-19 11:21             ` Geert Uytterhoeven
  0 siblings, 0 replies; 11+ messages in thread
From: Geert Uytterhoeven @ 2005-10-19 11:21 UTC (permalink / raw)
  To: Ralf Baechle
  Cc: John Levon, David Daney, oprofile-list, Linux/MIPS Development

On Wed, 19 Oct 2005, Ralf Baechle wrote:
> On Wed, Oct 19, 2005 at 11:07:55AM +0200, Geert Uytterhoeven wrote:
> > On Wed, 19 Oct 2005, John Levon wrote:
> > > On Tue, Oct 18, 2005 at 04:35:52PM -0700, David Daney wrote:
> > > > I just did a cvs update and see no change.  Perhaps I misunderstand. 
> > > > Would you like me to make and test a patch?  I could...
> > > 
> > > anoncvs takes a while to update I think.
> > 
> > AFAIK, it's no longer updated. Use git.
> 
> This is the userspace oprofile tools, not the kernel.  Last I checked
> Sourceforge was still on the cvs.

I stand corrected :-)

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* Re: [Patch] Fix lookup_dcookie for MIPS o32
  2005-10-18 11:45 ` Ralf Baechle
  2005-10-18 23:24   ` John Levon
@ 2005-10-19 15:48   ` Thiemo Seufer
  2005-10-19 15:55     ` Ralf Baechle
  1 sibling, 1 reply; 11+ messages in thread
From: Thiemo Seufer @ 2005-10-19 15:48 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: David Daney, oprofile-list, linux-mips

Ralf Baechle wrote:
> On Mon, Oct 17, 2005 at 02:44:07PM -0700, David Daney wrote:
> 
> > This patch fixes the lookup_dcookie for the MIPS o32 ABI.  Although I
> > only tested with little-endian, the big-endian case needed fixing as
> > well but is untested (but what are the chances that this is not the
> > correct fix?).
> > 
> > This is the only patch I needed to get the user space oprofile
> > programs to work for mipsel-linux.
> > 
> > I am CCing the linux-mips list as this may be of interest there as well.
> 
> Good catch.
> 
> > 2005-10-17  David Daney  <ddaney@avtrex.com>
> > 
> > 	* daemon/opd_cookie.c (lookup_dcookie): Handle MIPS o32 for both big
> > 	and little endian.
> > 
> > Index: oprofile/daemon/opd_cookie.c
> > ===================================================================
> > RCS file: /cvsroot/oprofile/oprofile/daemon/opd_cookie.c,v
> > retrieving revision 1.19
> > diff -p -a -u -r1.19 opd_cookie.c
> > --- oprofile/daemon/opd_cookie.c	26 May 2005 00:00:02 -0000	1.19
> > +++ oprofile/daemon/opd_cookie.c	17 Oct 2005 21:29:13 -0000
> > @@ -60,12 +60,21 @@
> >  #endif /* __NR_lookup_dcookie */
> >  
> >  #if (defined(__powerpc__) && !defined(__powerpc64__)) || defined(__hppa__)\
> > -	|| (defined(__s390__) && !defined(__s390x__))
> > +	|| (defined(__s390__) && !defined(__s390x__)) \
> > +	|| (defined(__mips__) && (_MIPS_SIM == _MIPS_SIM_ABI32) \
> > +	    && defined(_MIPSEB))
> 
> Small nit - please use __MIPSEB__ rsp. __MIPSEL__; I think there are
> some compilers floating around that don't define the single underscore
> variant.

AFAIR it's the other way, some compilers fail to define __MIPSEB__ and/or
__MIPSEB but all have _MIPSEB.


Thiemo

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

* Re: [Patch] Fix lookup_dcookie for MIPS o32
  2005-10-19 15:48   ` Thiemo Seufer
@ 2005-10-19 15:55     ` Ralf Baechle
  0 siblings, 0 replies; 11+ messages in thread
From: Ralf Baechle @ 2005-10-19 15:55 UTC (permalink / raw)
  To: Thiemo Seufer; +Cc: David Daney, oprofile-list, linux-mips

On Wed, Oct 19, 2005 at 05:48:43PM +0200, Thiemo Seufer wrote:
> Date:	Wed, 19 Oct 2005 17:48:43 +0200
> To:	Ralf Baechle <ralf@linux-mips.org>
> Cc:	David Daney <ddaney@avtrex.com>,
> 	oprofile-list@lists.sourceforge.net, linux-mips@linux-mips.org
> Subject: Re: [Patch] Fix lookup_dcookie for MIPS o32
> Content-Type: text/plain; charset=us-ascii
> From:	Thiemo Seufer <ths@networkno.de>
> 
> Ralf Baechle wrote:
> > On Mon, Oct 17, 2005 at 02:44:07PM -0700, David Daney wrote:
> > 
> > > This patch fixes the lookup_dcookie for the MIPS o32 ABI.  Although I
> > > only tested with little-endian, the big-endian case needed fixing as
> > > well but is untested (but what are the chances that this is not the
> > > correct fix?).
> > > 
> > > This is the only patch I needed to get the user space oprofile
> > > programs to work for mipsel-linux.
> > > 
> > > I am CCing the linux-mips list as this may be of interest there as well.
> > 
> > Good catch.
> > 
> > > 2005-10-17  David Daney  <ddaney@avtrex.com>
> > > 
> > > 	* daemon/opd_cookie.c (lookup_dcookie): Handle MIPS o32 for both big
> > > 	and little endian.
> > > 
> > > Index: oprofile/daemon/opd_cookie.c
> > > ===================================================================
> > > RCS file: /cvsroot/oprofile/oprofile/daemon/opd_cookie.c,v
> > > retrieving revision 1.19
> > > diff -p -a -u -r1.19 opd_cookie.c
> > > --- oprofile/daemon/opd_cookie.c	26 May 2005 00:00:02 -0000	1.19
> > > +++ oprofile/daemon/opd_cookie.c	17 Oct 2005 21:29:13 -0000
> > > @@ -60,12 +60,21 @@
> > >  #endif /* __NR_lookup_dcookie */
> > >  
> > >  #if (defined(__powerpc__) && !defined(__powerpc64__)) || defined(__hppa__)\
> > > -	|| (defined(__s390__) && !defined(__s390x__))
> > > +	|| (defined(__s390__) && !defined(__s390x__)) \
> > > +	|| (defined(__mips__) && (_MIPS_SIM == _MIPS_SIM_ABI32) \
> > > +	    && defined(_MIPSEB))
> > 
> > Small nit - please use __MIPSEB__ rsp. __MIPSEL__; I think there are
> > some compilers floating around that don't define the single underscore
> > variant.
> 
> AFAIR it's the other way, some compilers fail to define __MIPSEB__ and/or
> __MIPSEB but all have _MIPSEB.

None of these compilers would _ever_ have been able to compile a kernel
without the __*__ variant.

  Ralf

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

* Re: [Patch] Fix lookup_dcookie for MIPS o32
       [not found]     ` <20051018202654.GB2659@linux-mips.org>
@ 2005-10-19 16:13       ` David Daney
  0 siblings, 0 replies; 11+ messages in thread
From: David Daney @ 2005-10-19 16:13 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: MIPS Linux List

Ralf Baechle wrote:
> On Tue, Oct 18, 2005 at 09:04:49AM -0700, David Daney wrote:
> 
> 
>>The CPU has performance counters, but they cannot trigger interrupts, so 
>>I am just using it in 'timer' mode right now.  I am wondering what would 
>>happen if I added all counter samples at each clock tick.  That is 
>>something I might try when I have a little free time.
> 
> 
> Now that's truly a strange processor - what CPU are you using?
> 

ATI Xilleon X226-A12.  According to my data sheet, there are ten 
counters, but you can only use six at a time.  They are external to the 
4KEc core, and the only operations you can do to them are enable/disable 
counting, reset to zero and read the current values.

The counters count:
I cache hit/miss
D cache hit/miss
TLB hit/miss
JTLB hit/miss
Write merging/not merging

Perhaps I should not worry about them.  Probably hooking up one of the 
high resolution timers would yield more useful profiling information.


> 
>>I had one other problem with my cross built bash where the signal 
>>numbering of the build host was being used instead of the numbering for 
>>the target.  Once I fixed bash and the lookup_dcookie system call, it 
>>seems to work flawlessly.
> 
> 
> That bug is getting a classic.  I've fixed it in ash also - ages ago ...
> 
> I usually try to escape from the horrors of crosscompiling by using a
> decent GHz MIPS system.
> 

Yeah, In a perfect world I would have such a beast.

David Daney

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

end of thread, other threads:[~2005-10-19 16:13 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-17 21:44 [Patch] Fix lookup_dcookie for MIPS o32 David Daney
2005-10-18 11:45 ` Ralf Baechle
2005-10-18 23:24   ` John Levon
2005-10-18 23:35     ` David Daney
2005-10-18 23:36       ` John Levon
2005-10-19  9:07         ` Geert Uytterhoeven
2005-10-19 10:40           ` Ralf Baechle
2005-10-19 11:21             ` Geert Uytterhoeven
2005-10-19 15:48   ` Thiemo Seufer
2005-10-19 15:55     ` Ralf Baechle
     [not found] ` <20051018115155.GD2656@linux-mips.org>
     [not found]   ` <43551D21.3010500@avtrex.com>
     [not found]     ` <20051018202654.GB2659@linux-mips.org>
2005-10-19 16:13       ` David Daney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox