From: Brice Goglin <brice@myri.com>
To: Michael Buesch <mb@bu3sch.de>
Cc: Jeff Garzik <jeff@garzik.org>, netdev@vger.kernel.org
Subject: Re: [patch 2/2] myri10ge - Write the firmware in 256-bytes chunks
Date: Fri, 21 Jul 2006 22:42:30 -0400 [thread overview]
Message-ID: <44C19096.40204@myri.com> (raw)
In-Reply-To: <200607212211.21043.mb@bu3sch.de>
Michael Buesch wrote:
> On Friday 21 July 2006 21:49, Brice Goglin wrote:
>
>> + myri10ge_pio_copy(mgp->sram + MYRI10GE_FW_OFFSET + i,
>> + fw->data + i,
>> + min(256U, (unsigned)(fw->size - i)));
>> + mb();
>> + readb(mgp->sram);
>> + mb();
>>
>
> Why two mb() here?
> I would say actually none is needed.
> The readb fully synchronizes the previous writes on bus level
> (and so on CPU level, too)
At least on i386 and x86-64, readb does not pass an explicit memory
barrier to the processor. We use a "weak-ordering" write-combining
mapping, so the previous PIO-write accesses and the readb are not
automatically serialized. So in absence of the first mb(), and because
"WC" read can definitely pass "WC" write, the readb (whose purpose is to
guarantee the previous write is finished) could actually be complete
long before those have even started (especially because WC buffers can
stay in the processor a long time before being flushed in absence of
synchronization instructions).
The second mb() is indeed probably superfluous and could be removed. The
WC semantics are not weak enough to allow WC writes to pass WC read
(given it was only one instruction in init code, we did the lazy thing).
Brice
prev parent reply other threads:[~2006-07-22 2:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <44C12D14.7050509@myri.com>
2006-07-21 19:49 ` [patch 1/2] myri10ge - Always do a dummy RDMA after loading the firmware Brice Goglin
2006-07-21 19:49 ` [patch 2/2] myri10ge - Write the firmware in 256-bytes chunks Brice Goglin
2006-07-21 20:11 ` Michael Buesch
2006-07-22 2:42 ` Brice Goglin [this message]
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=44C19096.40204@myri.com \
--to=brice@myri.com \
--cc=jeff@garzik.org \
--cc=mb@bu3sch.de \
--cc=netdev@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;
as well as URLs for NNTP newsgroup(s).