Linux PARISC architecture development
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: Kyle McMartin <kyle@mcmartin.ca>
Cc: Carlos O'Donell <carlos@systemhalted.org>,
	John David Anglin <dave@hiauly1.hia.nrc.ca>,
	linux-parisc@vger.kernel.org
Subject: Re: [bug] gcc-4.3 miscompiling causing networking to bugger up
Date: Sat, 31 May 2008 04:58:58 -0600	[thread overview]
Message-ID: <20080531105858.GD28074@parisc-linux.org> (raw)
In-Reply-To: <20080531041010.GA27970@phobos.i.cabal.ca>

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@vger.kernel.org
> 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."

  reply	other threads:[~2008-05-31 10:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-28 19:09 [bug] gcc-4.[23] miscompiling causing networking to bugger up Kyle McMartin
2008-05-28 20:00 ` Kyle McMartin
2008-05-28 22:55   ` Carlos O'Donell
2008-05-28 23:00     ` Kyle McMartin
2008-05-28 23:37       ` Carlos O'Donell
2008-05-28 23:41         ` Kyle McMartin
2008-05-29  0:00           ` John David Anglin
2008-05-29  0:02             ` Kyle McMartin
2008-05-29  0:07               ` Carlos O'Donell
2008-05-29  0:15                 ` Kyle McMartin
2008-05-31  4:10                 ` [bug] gcc-4.3 " Kyle McMartin
2008-05-31 10:58                   ` Matthew Wilcox [this message]
2008-06-01  1:37                     ` Grant Grundler
2008-05-31 14:43                   ` Carlos O'Donell
2008-05-29  1:11               ` [bug] gcc-4.[23] " John David Anglin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080531105858.GD28074@parisc-linux.org \
    --to=matthew@wil.cx \
    --cc=carlos@systemhalted.org \
    --cc=dave@hiauly1.hia.nrc.ca \
    --cc=kyle@mcmartin.ca \
    --cc=linux-parisc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox