* [PATCH] x86_64 prefetchw() function can take into account CONFIG_MK8 / CONFIG_MPSC
[not found] ` <20050622231300.GC14251@wotan.suse.de>
@ 2005-06-23 9:32 ` Eric Dumazet
2005-06-23 9:37 ` Eric Dumazet
2005-06-23 11:31 ` Andi Kleen
0 siblings, 2 replies; 5+ messages in thread
From: Eric Dumazet @ 2005-06-23 9:32 UTC (permalink / raw)
To: Andi Kleen; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 155 bytes --]
If we build a x86_64 kernel for an AMD64 or for an Intel EMT64, no need to use alternative_input.
Reserve alternative_input only for a generic kernel.
[-- Attachment #2: patch.2 --]
[-- Type: text/plain, Size: 1075 bytes --]
diff -Nru linux-2.6.12/include/asm-x86_64/processor.h linux-2.6.12-orig/include/asm-x86_64/processor.h
--- linux-2.6.12-orig/include/asm-x86_64/processor.h 2005-06-17 21:48:29.000000000 +0200
+++ linux-2.6.12/include/asm-x86_64/processor.h 2005-06-23 11:20:08.000000000 +0200
@@ -389,10 +389,21 @@
#define ARCH_HAS_PREFETCHW 1
static inline void prefetchw(void *x)
{
+#if defined(CONFIG_MK8)
+ /* AMD64 / MK8 has 3DNOW, we can emit a true prefetchw, using a "m" in the asm input */
+ asm volatile("prefetchw %0" :: "m" (*(unsigned long *)x));
+#elif defined(CONFIG_MPSC)
+ /* Intel EMT64 does not have 3DNOW, no prefetchw instruction */
+#else
+ /* If we build a generic X86_64 kernel,
+ * we must use alternative_input() and a "r" asm constraint to make sure
+ * the size of the instruction will be <= 5
+ */
alternative_input(ASM_NOP5,
"prefetchw (%1)",
X86_FEATURE_3DNOW,
"r" (x));
+#endif
}
#define ARCH_HAS_SPINLOCK_PREFETCH 1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] x86_64 prefetchw() function can take into account CONFIG_MK8 / CONFIG_MPSC
2005-06-23 9:32 ` [PATCH] x86_64 prefetchw() function can take into account CONFIG_MK8 / CONFIG_MPSC Eric Dumazet
@ 2005-06-23 9:37 ` Eric Dumazet
2005-06-23 11:31 ` Andi Kleen
1 sibling, 0 replies; 5+ messages in thread
From: Eric Dumazet @ 2005-06-23 9:37 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Andi Kleen, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 228 bytes --]
If we build a x86_64 kernel for an AMD64 or for an Intel EMT64, no need to use alternative_input.
Reserve alternative_input only for a generic kernel.
Thank you
Eric Dumazet
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
[-- Attachment #2: patch.2 --]
[-- Type: text/plain, Size: 1075 bytes --]
diff -Nru linux-2.6.12/include/asm-x86_64/processor.h linux-2.6.12-orig/include/asm-x86_64/processor.h
--- linux-2.6.12-orig/include/asm-x86_64/processor.h 2005-06-17 21:48:29.000000000 +0200
+++ linux-2.6.12/include/asm-x86_64/processor.h 2005-06-23 11:20:08.000000000 +0200
@@ -389,10 +389,21 @@
#define ARCH_HAS_PREFETCHW 1
static inline void prefetchw(void *x)
{
+#if defined(CONFIG_MK8)
+ /* AMD64 / MK8 has 3DNOW, we can emit a true prefetchw, using a "m" in the asm input */
+ asm volatile("prefetchw %0" :: "m" (*(unsigned long *)x));
+#elif defined(CONFIG_MPSC)
+ /* Intel EMT64 does not have 3DNOW, no prefetchw instruction */
+#else
+ /* If we build a generic X86_64 kernel,
+ * we must use alternative_input() and a "r" asm constraint to make sure
+ * the size of the instruction will be <= 5
+ */
alternative_input(ASM_NOP5,
"prefetchw (%1)",
X86_FEATURE_3DNOW,
"r" (x));
+#endif
}
#define ARCH_HAS_SPINLOCK_PREFETCH 1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86_64 prefetchw() function can take into account CONFIG_MK8 / CONFIG_MPSC
2005-06-23 9:32 ` [PATCH] x86_64 prefetchw() function can take into account CONFIG_MK8 / CONFIG_MPSC Eric Dumazet
2005-06-23 9:37 ` Eric Dumazet
@ 2005-06-23 11:31 ` Andi Kleen
2005-06-23 12:53 ` Eric Dumazet
1 sibling, 1 reply; 5+ messages in thread
From: Andi Kleen @ 2005-06-23 11:31 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Andi Kleen, linux-kernel
On Thu, Jun 23, 2005 at 11:32:34AM +0200, Eric Dumazet wrote:
> If we build a x86_64 kernel for an AMD64 or for an Intel EMT64, no need to
> use alternative_input.
> Reserve alternative_input only for a generic kernel.
An EM64T kernel should still boot on AMD64 and vice versa. Rejected.
-Andi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86_64 prefetchw() function can take into account CONFIG_MK8 / CONFIG_MPSC
2005-06-23 11:31 ` Andi Kleen
@ 2005-06-23 12:53 ` Eric Dumazet
2005-06-23 13:10 ` Andi Kleen
0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2005-06-23 12:53 UTC (permalink / raw)
To: Andi Kleen; +Cc: linux-kernel
Andi Kleen a écrit :
> On Thu, Jun 23, 2005 at 11:32:34AM +0200, Eric Dumazet wrote:
>
>>If we build a x86_64 kernel for an AMD64 or for an Intel EMT64, no need to
>>use alternative_input.
>>Reserve alternative_input only for a generic kernel.
>
>
> An EM64T kernel should still boot on AMD64 and vice versa. Rejected.
>
> -Andi
>
>
OK, I wrongly assumed the 'MK8' or 'MPSC' choices were like x86 choices :
A kernel compiled for a Pentium-4 will not run on a i486.
But then what is the meaning of the choice "Generic-x86-64" in the "Processor family" menu ?
The Help message is : CONFIG_GENERIC_CPU: Generic x86-64 CPU.
Eric
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86_64 prefetchw() function can take into account CONFIG_MK8 / CONFIG_MPSC
2005-06-23 12:53 ` Eric Dumazet
@ 2005-06-23 13:10 ` Andi Kleen
0 siblings, 0 replies; 5+ messages in thread
From: Andi Kleen @ 2005-06-23 13:10 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Andi Kleen, linux-kernel, jh
On Thu, Jun 23, 2005 at 02:53:14PM +0200, Eric Dumazet wrote:
> Andi Kleen a ?crit :
> >On Thu, Jun 23, 2005 at 11:32:34AM +0200, Eric Dumazet wrote:
> >
> >>If we build a x86_64 kernel for an AMD64 or for an Intel EMT64, no need
> >>to use alternative_input.
> >>Reserve alternative_input only for a generic kernel.
> >
> >
> >An EM64T kernel should still boot on AMD64 and vice versa. Rejected.
> >
> >-Andi
> >
> >
>
> OK, I wrongly assumed the 'MK8' or 'MPSC' choices were like x86 choices :
>
> A kernel compiled for a Pentium-4 will not run on a i486.
>
> But then what is the meaning of the choice "Generic-x86-64" in the
> "Processor family" menu ?
> The Help message is : CONFIG_GENERIC_CPU: Generic x86-64 CPU.
Optimize for both. It's a catch all setting for future changes
and does not do too much right now.
It also won't pass any -mcpu=... arguments to gcc. This currently
doesn't make any difference (gcc x86-64 default is to optimize
for K8), but I assume it might at some point when gcc gets
a "combined" mode that optimizes for both Intel and AMD CPUs.
-Andi
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-06-23 13:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20050622.132241.21929037.davem@davemloft.net>
[not found] ` <200506222242.j5MMgbxS009935@guinness.s2io.com>
[not found] ` <20050622231300.GC14251@wotan.suse.de>
2005-06-23 9:32 ` [PATCH] x86_64 prefetchw() function can take into account CONFIG_MK8 / CONFIG_MPSC Eric Dumazet
2005-06-23 9:37 ` Eric Dumazet
2005-06-23 11:31 ` Andi Kleen
2005-06-23 12:53 ` Eric Dumazet
2005-06-23 13:10 ` Andi Kleen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®