Re: [PATCH] alpha: add udelay to io port paths

From: Mikulas Patocka (mpatocka@xxxxxxxxxx)
Date: Fri Apr 05 2019 - 07:05:38 EST




On Thu, 4 Apr 2019, Maciej W. Rozycki wrote:

> On Wed, 3 Apr 2019, Mikulas Patocka wrote:
>
> > I did some more testing and it turns out that mb() is not entirely
> > sufficient to prevent the boot hang. mb()'s latecy varies, sometimes it is
> > sufficient, sometimes not.
> >
> > So, I submit this patch that adds 1us delay between any I/O accesses
> > directed at the ISA bus. This patch makes my machine boot. 1us seems to be
> > minimal acceptable value, with 800ns I still get hangs.
>
> Why wasn't the delay needed then before commit cd0e00c10672 ("alpha: io:
> reorder barriers to guarantee writeX() and iowriteX() ordering"), which
> only moved `mb' around?
>
> Maciej

Suppose that someone does
outl(123, INDEX); x = inl(DATA);

Before the patch cd0e00c10672, the kernel would do
__iowrite(123, INDEX);
mb();
x = __ioread(DATA);
mb();

After the patch cd0e00c10672, the kernel would do
mb();
__iowrite(123, INDEX);
x = __ioread(DATA);
mb();

The patch changes the timing between the write and the read and the
hardware doesn't like it.

Mikulas