Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1279338

Re: [PATCH 22/71] ncr5380: Eliminate selecting state

From Geert Uytterhoeven <geert@linux-m68k.org>
Newsgroups linux.kernel
Subject Re: [PATCH 22/71] ncr5380: Eliminate selecting state
Date 2015-11-29 15:00 +0100
Message-ID <qAaGe-6R8-1@gated-at.bofh.it> (permalink)
References (2 earlier) <qz1Yl-3Qr-1@gated-at.bofh.it> <qzayB-ZY-3@gated-at.bofh.it> <qzdmO-2Nc-15@gated-at.bofh.it> <qA6sW-4nz-7@gated-at.bofh.it> <qA7p0-4Xu-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Finn,

On Sun, Nov 29, 2015 at 11:25 AM, Finn Thain <fthain@telegraphics.com.au> wrote:
> On Sun, 29 Nov 2015, Geert Uytterhoeven wrote:
>> This still heavily depends on the processing time spent in
>> NCR5380_read(). You should never use a value derived from
>> loops_per_jiffy for a non-empty loop,
>
> Sure but the time-out condition isn't supposed to be precise.
> Plus/minus a jiffy is no problem. Plus/minus a second is no good.

If an ISA access takes 8 µs, while the CPU runs at 1 GHz, i.e. 500M loops/s,
the difference will be huge.

>> as it may take much longer. Always compare with an maximum end time
>> instead.
>
> That can't work with interrupts disabled, which was the problem I was
> trying to solve by use of loops_per_jiffy.

Then you indeed can't use jiffies.
Perhaps you can calibrate an NCR5380_read() loop at driver init time,
and use the calibration value later?

> NCR5380_poll_politely() in mainline doesn't work with interrupts disabled
> either, hence patch 21.
>
>> E.g.:
>>
>>         end = jiffies + 2;        /* 1 jiffie + 1 safeguard */
>>         do {
>>                  if ((NCR5380_read(reg1) & bit1) == val1)
>>                          return 0;
>>                  cpu_relax();
>>         } while (time_before(jiffies, end);
>>
>> And a similar loop for "Busy-wait for up to 20 ms".
>
> Interrupts may be disabled during that loop also. Please refer to (and/or
> respond to) patch 21, "ncr5380: Sleep when polling, if possible", in which
> these changes were made.

So the above loop may never terminate. Oops...

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 22/71] ncr5380: Eliminate selecting state Finn Thain <fthain@telegraphics.com.au> - 2015-11-18 10:10 +0100
  Re: [PATCH 22/71] ncr5380: Eliminate selecting state Ondrej Zary <linux@rainbow-software.org> - 2015-11-24 20:10 +0100
    Re: [PATCH 22/71] ncr5380: Eliminate selecting state Finn Thain <fthain@telegraphics.com.au> - 2015-11-25 04:20 +0100
      Re: [PATCH 22/71] ncr5380: Eliminate selecting state Ondrej Zary <linux@rainbow-software.org> - 2015-11-25 23:00 +0100
        Re: [PATCH 22/71] ncr5380: Eliminate selecting state Finn Thain <fthain@telegraphics.com.au> - 2015-11-26 11:30 +0100
          Re: [PATCH 22/71] ncr5380: Eliminate selecting state Ondrej Zary <linux@rainbow-software.org> - 2015-11-26 20:40 +0100
            Re: [PATCH 22/71] ncr5380: Eliminate selecting state Finn Thain <fthain@telegraphics.com.au> - 2015-11-26 23:40 +0100
              Re: [PATCH 22/71] ncr5380: Eliminate selecting state Ondrej Zary <linux@rainbow-software.org> - 2015-11-29 00:20 +0100
                Re: [PATCH 22/71] ncr5380: Eliminate selecting state Finn Thain <fthain@telegraphics.com.au> - 2015-11-29 01:50 +0100
                Re: [PATCH 22/71] ncr5380: Eliminate selecting state Ondrej Zary <linux@rainbow-software.org> - 2015-11-29 10:20 +0100
              Re: [PATCH 22/71] ncr5380: Eliminate selecting state Geert Uytterhoeven <geert@linux-m68k.org> - 2015-11-29 10:30 +0100
                Re: [PATCH 22/71] ncr5380: Eliminate selecting state Finn Thain <fthain@telegraphics.com.au> - 2015-11-29 11:30 +0100
                Re: [PATCH 22/71] ncr5380: Eliminate selecting state Geert Uytterhoeven <geert@linux-m68k.org> - 2015-11-29 15:00 +0100
                Re: [PATCH 22/71] ncr5380: Eliminate selecting state Finn Thain <fthain@telegraphics.com.au> - 2015-11-30 03:20 +0100

csiph-web