Re: [bug] gcc-4.3 miscompiling causing networking to bugger up

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, May 31, 2008 at 12:10:10AM -0400, Kyle McMartin wrote:
> I've found the solution to the bug, it seems something is going wonky
> because of ip_fast_csum missing a "memory" clobber.
> 
> This should fix it, but I have no idea whether this is a legitimate bug,
> or masking a problem with gcc due to too much inlining.

*veeery* interesting.  It's entirely possible that this is the correct
fix:

 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.

So if GCC has something in a register, it might not bother to write it
back to ram before this asm if we don't have the memory clobber.

Fantastic work, Kyle.  Thanks for spending so much time on this.

> diff --git a/include/asm-parisc/checksum.h b/include/asm-parisc/checksum.h
> index cc3ec1b..1916ebe 100644
> --- a/include/asm-parisc/checksum.h
> +++ b/include/asm-parisc/checksum.h
> @@ -65,7 +65,7 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
>  "2:\n"
>  	: "=r" (sum), "=r" (iph), "=r" (ihl)
>  	: "1" (iph), "2" (ihl)
> -	: "r19", "r20", "r21" );
> +	: "r19", "r20", "r21", "memory" );
>  
>  	return (__force __sum16)sum;
>  }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
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."
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux SoC]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux