* Re: A new patch for hint_pause
@ 2003-07-29 22:51 Bjorn Helgaas
2003-07-30 0:11 ` Chris Wedgwood
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Bjorn Helgaas @ 2003-07-29 22:51 UTC (permalink / raw)
To: linux-ia64
On Wednesday 02 July 2003 7:04 pm, you wrote:
> Attached is a new patch that should work only if the correct version of
> binutil is installed. Let me know if you are okay with this.
I (finally) applied the attached patch for 2.4. It's slightly different
than what you sent me because I reworked the processor.h changes
slightly to reduce the diff with 2.5.
I don't think this patch went to linux-ia64 originally, so I'm copying it
just as a heads-up. (And to encourage people to copy the list so
we have a convenient archive).
Bjorn
#### AUTHOR rohit.seth@intel.com
#### COMMENT START
### Comments for ChangeSet
ia64: use "hint @pause" in cpu_relax() and spinlock contention.
### Comments for arch/ia64/scripts/make_gas_hint_test.c
Test case to determine whether gas supports "hint @pause".
### Comments for arch/ia64/scripts/make_gas_hint_test.c
BitKeeper file /home/helgaas/linux/testing/arch/ia64/scripts/make_gas_hint_test.c
### Comments for arch/ia64/Makefile
Check for binutils support of "hint @pause" and use -DGAS_HAS_HINT_INSN appropriately.
### Comments for arch/ia64/kernel/head.S
(ia64_spinlock_contention): Use "hint @pause".
### Comments for include/asm-ia64/processor.h
(cpu_relax): Use "hint @pause".
### Comments for include/asm-ia64/spinlock.h
(spin_lock, read_lock, write_lock): Use "hint @pause".
#### COMMENT END
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.1043 -> 1.1044
# arch/ia64/Makefile 1.9 -> 1.10
# include/asm-ia64/spinlock.h 1.6 -> 1.7
# include/asm-ia64/processor.h 1.20 -> 1.21
# arch/ia64/kernel/head.S 1.9 -> 1.10
# (new) -> 1.1 arch/ia64/scripts/make_gas_hint_test.c
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/07/29 bjorn.helgaas@hp.com 1.1044
# hint
# --------------------------------------------
#
diff -Nru a/arch/ia64/Makefile b/arch/ia64/Makefile
--- a/arch/ia64/Makefile Tue Jul 29 17:18:01 2003
+++ b/arch/ia64/Makefile Tue Jul 29 17:18:01 2003
@@ -24,6 +24,23 @@
GCC_VERSION=$(shell $(CC) -v 2>&1 | fgrep 'gcc version' | cut -f3 -d' ' | cut -f1 -d'.')
+CHECK_GAS_FOR_HINT=arch/ia64/scripts/check_gas_for_hint.o
+MAKE_GAS_HINT_TEST=arch/ia64/scripts/make_gas_hint_test
+
+ifneq (, $(shell ls $(CHECK_GAS_FOR_HINT)))
+$(shell rm $(CHECK_GAS_FOR_HINT))
+endif
+
+CHECK_GAS_CMD:=($(CC) $(MAKE_GAS_HINT_TEST).c -o $(MAKE_GAS_HINT_TEST) |$(AS) -o $(CHECK_GAS_FOR_HINT) -;rm $(MAKE_GAS_HINT_TEST))>&/dev/null
+$(shell $(CHECK_GAS_CMD))
+ifneq (, $(shell ls $(CHECK_GAS_FOR_HINT)))
+#Newer version of binutil is detected and "hint" instruction is in the kernel
+FLAGS := $(AFLAGS) -DGAS_HAS_HINT_INSN
+CFLAGS := $(CFLAGS) -DGAS_HAS_HINT_INSN
+else
+$(warning Warning: Please use binutil version 2.14.90.0.4.1 or higher to get the support of hint instruction in kernel.)
+endif
+
ifneq ($(GCC_VERSION),2)
CFLAGS += -frename-registers --param max-inline-insnsP00
endif
diff -Nru a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S
--- a/arch/ia64/kernel/head.S Tue Jul 29 17:18:01 2003
+++ b/arch/ia64/kernel/head.S Tue Jul 29 17:18:01 2003
@@ -782,6 +782,9 @@
;;
// delay a little...
.wait: sub tmp=tmp,timeout
+#ifdef GAS_HAS_HINT_INSN
+ hint @pause
+#endif
or delay=0xf,delay // make sure delay is non-zero (otherwise we get stuck with 0)
;;
cmp.lt p15,p0=tmp,r0
diff -Nru a/arch/ia64/scripts/make_gas_hint_test.c b/arch/ia64/scripts/make_gas_hint_test.c
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/arch/ia64/scripts/make_gas_hint_test.c Tue Jul 29 17:18:01 2003
@@ -0,0 +1,15 @@
+// The code generates a test case which is used
+// to detect whether Binutil supports hint
+// instruction correctly or not.
+#include <string.h>
+#include <stdio.h>
+
+int main()
+{
+ char str[32766];
+ memset(str,'\n',32765);
+ str[32765]=0;
+ printf("%s(p7) hint @pause\n",str);
+
+ return 0;
+}
diff -Nru a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h
--- a/include/asm-ia64/processor.h Tue Jul 29 17:18:01 2003
+++ b/include/asm-ia64/processor.h Tue Jul 29 17:18:01 2003
@@ -656,8 +656,18 @@
asm volatile ("mov cr.lrr0=%0;; srlz.d" :: "r"(val) : "memory");
}
-#define cpu_relax() do { } while (0)
+#ifdef GAS_HAS_HINT_INSN
+static inline void
+ia64_hint_pause (void)
+{
+ asm volatile ("hint @pause" ::: "memory");
+}
+#else
+#define ia64_hint_pause() do { } while (0)
+#endif
+
+#define cpu_relax() ia64_hint_pause()
static inline void
ia64_set_lrr1 (unsigned long val)
diff -Nru a/include/asm-ia64/spinlock.h b/include/asm-ia64/spinlock.h
--- a/include/asm-ia64/spinlock.h Tue Jul 29 17:18:01 2003
+++ b/include/asm-ia64/spinlock.h Tue Jul 29 17:18:01 2003
@@ -74,6 +74,12 @@
#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
#define spin_lock_init(x) ((x)->lock = 0)
+#ifdef GAS_HAS_HINT_INSN
+#define HINT_PAUSE ";; (p7) hint @pause\n"
+#else
+#define HINT_PAUSE
+#endif
+
/*
* Streamlined test_and_set_bit(0, (x)). We use test-and-test-and-set
* rather than a simple xchg to avoid writing the cache-line when
@@ -87,6 +93,7 @@
"ld4 r2 = [%0]\n" \
";;\n" \
"cmp4.eq p0,p7 = r0,r2\n" \
+ HINT_PAUSE \
"(p7) br.cond.spnt.few 1b \n" \
"cmpxchg4.acq r2 = [%0], r29, ar.ccv\n" \
";;\n" \
@@ -115,20 +122,21 @@
int tmp = 0; \
__asm__ __volatile__ ("1:\tfetchadd4.acq %0 = [%1], 1\n" \
";;\n" \
- "tbit.nz p6,p0 = %0, 31\n" \
- "(p6) br.cond.sptk.few 2f\n" \
+ "tbit.nz p7,p0 = %0, 31\n" \
+ "(p7) br.cond.sptk.few 2f\n" \
".section .text.lock,\"ax\"\n" \
"2:\tfetchadd4.rel %0 = [%1], -1\n" \
";;\n" \
"3:\tld4.acq %0 = [%1]\n" \
";;\n" \
- "tbit.nz p6,p0 = %0, 31\n" \
- "(p6) br.cond.sptk.few 3b\n" \
+ "tbit.nz p7,p0 = %0, 31\n" \
+ HINT_PAUSE \
+ "(p7) br.cond.sptk.few 3b\n" \
"br.cond.sptk.few 1b\n" \
";;\n" \
".previous\n" \
: "=&r" (tmp) \
- : "r" (rw) : "p6", "memory"); \
+ : "r" (rw) : "p7", "memory"); \
} while(0)
#define read_unlock(rw) \
@@ -150,6 +158,7 @@
"ld4 r2 = [%0]\n" \
";;\n" \
"cmp4.eq p0,p7 = r0,r2\n" \
+ HINT_PAUSE \
"(p7) br.cond.spnt.few 1b \n" \
"cmpxchg4.acq r2 = [%0], r29, ar.ccv\n" \
";;\n" \
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: A new patch for hint_pause
2003-07-29 22:51 A new patch for hint_pause Bjorn Helgaas
@ 2003-07-30 0:11 ` Chris Wedgwood
2003-07-30 1:31 ` Seth, Rohit
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Chris Wedgwood @ 2003-07-30 0:11 UTC (permalink / raw)
To: linux-ia64
On Tue, Jul 29, 2003 at 04:51:14PM -0600, Bjorn Helgaas wrote:
> +$(warning Warning: Please use binutil version 2.14.90.0.4.1 or higher to get the support of hint instruction in kernel.)
Making a new binutils a requirement would be considered too drastic?
--cw
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: A new patch for hint_pause
2003-07-29 22:51 A new patch for hint_pause Bjorn Helgaas
2003-07-30 0:11 ` Chris Wedgwood
@ 2003-07-30 1:31 ` Seth, Rohit
2003-07-30 15:31 ` Jesse Barnes
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Seth, Rohit @ 2003-07-30 1:31 UTC (permalink / raw)
To: linux-ia64
It is a requirement if the kernel wants to have the hint_pause
instruction. If the right version of binutil is not installed then
kernel will be built without this support.
rohit
> -----Original Message-----
> From: Chris Wedgwood [mailto:cw@f00f.org]
> Sent: Tuesday, July 29, 2003 5:12 PM
> To: Bjorn Helgaas
> Cc: Seth, Rohit; linux-ia64@vger.kernel.org
> Subject: Re: A new patch for hint_pause
>
>
> On Tue, Jul 29, 2003 at 04:51:14PM -0600, Bjorn Helgaas wrote:
>
> > +$(warning Warning: Please use binutil version
> 2.14.90.0.4.1 or higher
> > +to get the support of hint instruction in kernel.)
>
> Making a new binutils a requirement would be considered too drastic?
>
>
> --cw
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: A new patch for hint_pause
2003-07-29 22:51 A new patch for hint_pause Bjorn Helgaas
2003-07-30 0:11 ` Chris Wedgwood
2003-07-30 1:31 ` Seth, Rohit
@ 2003-07-30 15:31 ` Jesse Barnes
2003-07-30 15:51 ` H. J. Lu
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Jesse Barnes @ 2003-07-30 15:31 UTC (permalink / raw)
To: linux-ia64
So all of this is in the latest CVS version of binutils? Any idea when
a release version will support the new features?
Thanks,
Jesse
On Tue, Jul 29, 2003 at 06:31:32PM -0700, Seth, Rohit wrote:
> It is a requirement if the kernel wants to have the hint_pause
> instruction. If the right version of binutil is not installed then
> kernel will be built without this support.
>
> rohit
>
> > -----Original Message-----
> > From: Chris Wedgwood [mailto:cw@f00f.org]
> > Sent: Tuesday, July 29, 2003 5:12 PM
> > To: Bjorn Helgaas
> > Cc: Seth, Rohit; linux-ia64@vger.kernel.org
> > Subject: Re: A new patch for hint_pause
> >
> >
> > On Tue, Jul 29, 2003 at 04:51:14PM -0600, Bjorn Helgaas wrote:
> >
> > > +$(warning Warning: Please use binutil version
> > 2.14.90.0.4.1 or higher
> > > +to get the support of hint instruction in kernel.)
> >
> > Making a new binutils a requirement would be considered too drastic?
> >
> >
> > --cw
> >
> -
> To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: A new patch for hint_pause
2003-07-29 22:51 A new patch for hint_pause Bjorn Helgaas
` (2 preceding siblings ...)
2003-07-30 15:31 ` Jesse Barnes
@ 2003-07-30 15:51 ` H. J. Lu
2003-07-30 16:12 ` Jesse Barnes
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: H. J. Lu @ 2003-07-30 15:51 UTC (permalink / raw)
To: linux-ia64
On Wed, Jul 30, 2003 at 08:31:18AM -0700, Jesse Barnes wrote:
> So all of this is in the latest CVS version of binutils? Any idea when
> a release version will support the new features?
>
I released the Linux binutils 2.14.90.0.4.1 on 06/24/2003 and the
current one is 2.14.90.0.5 which was released on 07/22/2003.
H.J.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: A new patch for hint_pause
2003-07-29 22:51 A new patch for hint_pause Bjorn Helgaas
` (3 preceding siblings ...)
2003-07-30 15:51 ` H. J. Lu
@ 2003-07-30 16:12 ` Jesse Barnes
2003-07-30 16:14 ` Jesse Barnes
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Jesse Barnes @ 2003-07-30 16:12 UTC (permalink / raw)
To: linux-ia64
On Wed, Jul 30, 2003 at 08:51:37AM -0700, H. J. Lu wrote:
> On Wed, Jul 30, 2003 at 08:31:18AM -0700, Jesse Barnes wrote:
> > So all of this is in the latest CVS version of binutils? Any idea when
> > a release version will support the new features?
> >
>
> I released the Linux binutils 2.14.90.0.4.1 on 06/24/2003 and the
> current one is 2.14.90.0.5 which was released on 07/22/2003.
I see them now--at the redhat site, earlier I was looking at gnu.org.
Thanks,
Jesse
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: A new patch for hint_pause
2003-07-29 22:51 A new patch for hint_pause Bjorn Helgaas
` (4 preceding siblings ...)
2003-07-30 16:12 ` Jesse Barnes
@ 2003-07-30 16:14 ` Jesse Barnes
2003-07-30 16:15 ` H. J. Lu
2003-07-30 22:07 ` Bjorn Helgaas
7 siblings, 0 replies; 9+ messages in thread
From: Jesse Barnes @ 2003-07-30 16:14 UTC (permalink / raw)
To: linux-ia64
On Wed, Jul 30, 2003 at 09:12:03AM -0700, jbarnes wrote:
> On Wed, Jul 30, 2003 at 08:51:37AM -0700, H. J. Lu wrote:
> > On Wed, Jul 30, 2003 at 08:31:18AM -0700, Jesse Barnes wrote:
> > > So all of this is in the latest CVS version of binutils? Any idea when
> > > a release version will support the new features?
> > >
> >
> > I released the Linux binutils 2.14.90.0.4.1 on 06/24/2003 and the
> > current one is 2.14.90.0.5 which was released on 07/22/2003.
>
> I see them now--at the redhat site, earlier I was looking at gnu.org.
Err, I meant kernel.org. I'll give this release a try.
Thanks,
Jesse
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: A new patch for hint_pause
2003-07-29 22:51 A new patch for hint_pause Bjorn Helgaas
` (5 preceding siblings ...)
2003-07-30 16:14 ` Jesse Barnes
@ 2003-07-30 16:15 ` H. J. Lu
2003-07-30 22:07 ` Bjorn Helgaas
7 siblings, 0 replies; 9+ messages in thread
From: H. J. Lu @ 2003-07-30 16:15 UTC (permalink / raw)
To: linux-ia64
On Wed, Jul 30, 2003 at 09:12:03AM -0700, Jesse Barnes wrote:
> On Wed, Jul 30, 2003 at 08:51:37AM -0700, H. J. Lu wrote:
> > On Wed, Jul 30, 2003 at 08:31:18AM -0700, Jesse Barnes wrote:
> > > So all of this is in the latest CVS version of binutils? Any idea when
> > > a release version will support the new features?
> > >
> >
> > I released the Linux binutils 2.14.90.0.4.1 on 06/24/2003 and the
> > current one is 2.14.90.0.5 which was released on 07/22/2003.
>
> I see them now--at the redhat site, earlier I was looking at gnu.org.
>
FYI, the Linux binutils is available at
http://www.kernel.org/pub/linux/devel/binutils/
H.J.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: A new patch for hint_pause
2003-07-29 22:51 A new patch for hint_pause Bjorn Helgaas
` (6 preceding siblings ...)
2003-07-30 16:15 ` H. J. Lu
@ 2003-07-30 22:07 ` Bjorn Helgaas
7 siblings, 0 replies; 9+ messages in thread
From: Bjorn Helgaas @ 2003-07-30 22:07 UTC (permalink / raw)
To: linux-ia64
On Tuesday 29 July 2003 6:11 pm, Chris Wedgwood wrote:
> On Tue, Jul 29, 2003 at 04:51:14PM -0600, Bjorn Helgaas wrote:
>
> > +$(warning Warning: Please use binutil version 2.14.90.0.4.1 or higher to get the support of hint instruction in kernel.)
>
> Making a new binutils a requirement would be considered too drastic?
I think the new binutils is a requirement for 2.5/2.6, but I didn't want
to force that for 2.4.
Bjorn
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2003-07-30 22:07 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-29 22:51 A new patch for hint_pause Bjorn Helgaas
2003-07-30 0:11 ` Chris Wedgwood
2003-07-30 1:31 ` Seth, Rohit
2003-07-30 15:31 ` Jesse Barnes
2003-07-30 15:51 ` H. J. Lu
2003-07-30 16:12 ` Jesse Barnes
2003-07-30 16:14 ` Jesse Barnes
2003-07-30 16:15 ` H. J. Lu
2003-07-30 22:07 ` Bjorn Helgaas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox