On Fri, 5 Apr 2019, Maciej W. Rozycki wrote:

> On Fri, 5 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.
> 
>  Obviously you do need that `mb' before `__ioread' in the second case, 
> just like in the first one, because otherwise the read bus access issued 
> by `__ioread' can be reordered ahead of the write bus access issued by the 
> preceding `__iowrite'.

So, take my patch that adds the "mb()" there:
https://www.spinics.net/lists/linux-alpha/msg05007.html

This bug can be fixed by adding "mb()", by adding udelay() or by adding a 
dummy read of port 0x80.

So, choose one of these ways to fix it and commit it to the kernel.

Mikulas

Reply via email to