2006-03-09 23:13:27

by Roland Dreier

[permalink] [raw]
Subject: Re: [PATCH 7 of 20] ipath - misc driver support code

> +/**
> + * ipath_unordered_wc - indicate whether write combining is ordered
> + *
> + * Because our performance depends on our ability to do write combining mmio
> + * writes in the most efficient way, we need to know if we are on an Intel
> + * or AMD x86_64 processor. AMD x86_64 processors flush WC buffers out in
> + * the order completed, and so no special flushing is required to get
> + * correct ordering. Intel processors, however, will flush write buffers
> + * out in "random" orders, and so explict ordering is needed at times.
> + */
> +int ipath_unordered_wc(void)
> +{
> + return boot_cpu_data.x86_vendor == X86_VENDOR_INTEL;
> +}

This is kind of theoritical, but it seems to me that it would be safer
to write this as

int ipath_unordered_wc(void)
{
return boot_cpu_data.x86_vendor != X86_VENDOR_AMD;
}

after all, Via is probably going to have an x86-64 CPU one of these
days, and I doubt you've checked that their WC flush is ordered.

- R.


2006-03-09 23:29:05

by Bryan O'Sullivan

[permalink] [raw]
Subject: Re: [PATCH 7 of 20] ipath - misc driver support code

On Thu, 2006-03-09 at 15:13 -0800, Roland Dreier wrote:

> This is kind of theoritical, but it seems to me that it would be safer
> to write this as
>
> int ipath_unordered_wc(void)
> {
> return boot_cpu_data.x86_vendor != X86_VENDOR_AMD;
> }
>
> after all, Via is probably going to have an x86-64 CPU one of these
> days, and I doubt you've checked that their WC flush is ordered.

It's purely a performance optimisation. Since we tune very closely to
each CPU, there's no point right now in sort-of-tuning for a CPU that
doesn't yet exist :-)

<b

2006-03-09 23:36:39

by Roland Dreier

[permalink] [raw]
Subject: Re: [PATCH 7 of 20] ipath - misc driver support code

Bryan> It's purely a performance optimisation. Since we tune very
Bryan> closely to each CPU, there's no point right now in
Bryan> sort-of-tuning for a CPU that doesn't yet exist :-)

I thought that if ipath_unordered_wc() returns false then you assume
the writes through a WC mapping go in order. If Via behaves like
Intel and reorders writes, but ipath_unordered_wc() returns false,
then won't your driver break in a subtle way?

- R.

2006-03-10 19:23:33

by Bryan O'Sullivan

[permalink] [raw]
Subject: Re: [PATCH 7 of 20] ipath - misc driver support code

On Thu, 2006-03-09 at 15:36 -0800, Roland Dreier wrote:

> If Via behaves like
> Intel and reorders writes, but ipath_unordered_wc() returns false,
> then won't your driver break in a subtle way?

No, it'll issue lots of error messages, because the chip will detect the
bad access patterns and interrupt us.

<b