2010-04-26 09:26:55

by Jan Beulich

[permalink] [raw]
Subject: intel_i830_chipset_flush(): local clflush() vs. global wbinvd()

Eric, Brice,

what is the point of issuing wbinvd() on all CPUs here if clflush isn't
available, but using clflush() (if available) only on the current CPU?

Thanks, Jan


2010-04-27 23:00:47

by Eric Anholt

[permalink] [raw]
Subject: Re: intel_i830_chipset_flush(): local clflush() vs. global wbinvd()

On Mon, 26 Apr 2010 10:26:52 +0100, "Jan Beulich" <[email protected]> wrote:
> Eric, Brice,
>
> what is the point of issuing wbinvd() on all CPUs here if clflush isn't
> available, but using clflush() (if available) only on the current CPU?

From the IA-32 architecture manuals:

WBINVD: "Writes back all modified cache lines in the processor’s
internal cache to main memory and invalidates (flushes) the
internal caches. The instruction then issues a special-
function bus cycle that directs external caches to also write
back modified data and another bus cycle to indicate that the
external caches should be invalidated.

CLFLUSH: "Invalidates the cache line that contains the linear address
specified with the source operand from all levels of the
processor cache hierarchy (data and instruction). The
invalidation is broadcast throughout the cache coherence
domain. If, at any level of the cache hierarchy, the line is
inconsistent with memory (dirty) it is written to memory
before invalidation. The source operand is a byte memory
location.

My reading of these two is that wbinvd affects this processor's cache
lines, while clflush affects the cacheline regardless of which CPU owns
it since they all share the same coherence domain.

Given that on many systems without CLFLUSH (8xx chipsets), we have
issues with getting coherence to external memory successfully (note how
neither of those instructions provide that!), I'm not sure it's a good
time to be worrying about how to improve cache flushing performance on them!


Attachments:
(No filename) (197.00 B)

2010-04-28 11:47:35

by Jan Beulich

[permalink] [raw]
Subject: Re: intel_i830_chipset_flush(): local clflush() vs. global wbinvd()

>>> Eric Anholt <[email protected]> 28.04.10 01:00 >>>
>On Mon, 26 Apr 2010 10:26:52 +0100, "Jan Beulich" <[email protected]> wrote:
>> Eric, Brice,
>>
>> what is the point of issuing wbinvd() on all CPUs here if clflush isn't
>> available, but using clflush() (if available) only on the current CPU?
>
>My reading of these two is that wbinvd affects this processor's cache
>lines, while clflush affects the cacheline regardless of which CPU owns
>it since they all share the same coherence domain.

Indeed, one can read it that way, although it seems unlikely to me that
it really means it (namely in large configurations the need to behave
that way may make clflush less preferable over wbinvd in some
situations). I'm trying to clarify this with Intel.

>Given that on many systems without CLFLUSH (8xx chipsets), we have
>issues with getting coherence to external memory successfully (note how
>neither of those instructions provide that!), I'm not sure it's a good
>time to be worrying about how to improve cache flushing performance on them!

No, the purpose of the question was not to hint at elimination of
the global wbinvd (which nevertheless could be reduced in scope),
but rather to find out why the same isn't needed on the clflush
path.

Jan