* [PATCH] FRV: ip_fast_csum() requires a memory clobber on its inline asm
@ 2008-06-05 16:07 David Howells
2008-06-05 18:57 ` Matthew Wilcox
0 siblings, 1 reply; 2+ messages in thread
From: David Howells @ 2008-06-05 16:07 UTC (permalink / raw)
To: torvalds, akpm; +Cc: dhowells, matthew, linux-kernel
ip_fast_csum() requires a memory clobber on its inline asm as it accesses
memory in a fashion that gcc can't predict.
The GCC manual says:
If your assembler instructions access memory in an unpredictable
fashion, add `memory' to the list of clobbered registers. This will
cause GCC to not keep memory values cached in registers across the
assembler instruction and not optimize stores or loads to that memory.
The bug hasn't been noticed in FRV, but it has been seen in PA-RISC.
Signed-off-by: David Howells <dhowells@redhat.com>
---
include/asm-frv/checksum.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/asm-frv/checksum.h b/include/asm-frv/checksum.h
index 9b16898..269da09 100644
--- a/include/asm-frv/checksum.h
+++ b/include/asm-frv/checksum.h
@@ -75,7 +75,7 @@ __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
: "=r" (sum), "=r" (iph), "=r" (ihl), "=r" (inc), "=&r"(tmp)
: "0" (sum), "1" (iph), "2" (ihl), "3" (4),
"m"(*(volatile struct { int _[100]; } *)iph)
- : "icc0", "icc1"
+ : "icc0", "icc1", "memory"
);
return (__force __sum16)~sum;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] FRV: ip_fast_csum() requires a memory clobber on its inline asm
2008-06-05 16:07 [PATCH] FRV: ip_fast_csum() requires a memory clobber on its inline asm David Howells
@ 2008-06-05 18:57 ` Matthew Wilcox
0 siblings, 0 replies; 2+ messages in thread
From: Matthew Wilcox @ 2008-06-05 18:57 UTC (permalink / raw)
To: David Howells; +Cc: torvalds, akpm, linux-kernel
On Thu, Jun 05, 2008 at 05:07:35PM +0100, David Howells wrote:
> : "=r" (sum), "=r" (iph), "=r" (ihl), "=r" (inc), "=&r"(tmp)
> : "0" (sum), "1" (iph), "2" (ihl), "3" (4),
> "m"(*(volatile struct { int _[100]; } *)iph)
Do you still need the input "m" constraint?
> - : "icc0", "icc1"
> + : "icc0", "icc1", "memory"
> );
>
> return (__force __sum16)~sum;
--
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-06-05 18:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-05 16:07 [PATCH] FRV: ip_fast_csum() requires a memory clobber on its inline asm David Howells
2008-06-05 18:57 ` Matthew Wilcox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox