linux-parisc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Guenter Roeck <linux@roeck-us.net>,
	Andreas Koensgen <ajk@comnets.uni-bremen.de>
Cc: Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Matt Turner <mattst88@gmail.com>,
	"James E . J . Bottomley" <James.Bottomley@hansenpartnership.com>,
	Helge Deller <deller@gmx.de>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	alpha <linux-alpha@vger.kernel.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-parisc@vger.kernel.org, Netdev <netdev@vger.kernel.org>,
	Sparse Mailing-list <linux-sparse@vger.kernel.org>
Subject: Re: [PATCH v2 0/4] Introduce and use absolute_pointer macro
Date: Thu, 16 Sep 2021 12:47:01 -0700	[thread overview]
Message-ID: <CAHk-=wiQPjD_XKhVLyB4w2O6Rsi8mq256qVuhR8jMTSwrMPDqg@mail.gmail.com> (raw)
In-Reply-To: <20210915223342.GA1556394@roeck-us.net>

On Wed, Sep 15, 2021 at 3:33 PM Guenter Roeck <linux@roeck-us.net> wrote:
>
> drivers/net/hamradio/6pack.c: In function 'sixpack_open':
> drivers/net/hamradio/6pack.c:71:41: error:
>         unsigned conversion from 'int' to 'unsigned char' changes value from '256' to '0'
>
> patch:
>         https://lore.kernel.org/lkml/20210909035743.1247042-1-linux@roeck-us.net/
> David says it is wrong, and I don't know the code well enough
> to feel comfortable touching that code. That may be a lost cause.
> "depends on BROKEN if ALPHA" may be appropriate here.

David is wrong.

The code here is bogus, and the docs clearly state that the transmit
data is in units of "10ms":

    https://www.linux-ax25.org/wiki/6PACK

and that

    #define SIXP_TXDELAY                    (HZ/4)  /* in 1 s */

is just wrong, and the actual *uses* of that TX timeout seems correct
for that 10ms value:

        mod_timer(&sp->tx_t, jiffies + ((when + 1) * HZ) / 100);

ie that "when" is clearly given in 100ths of a second, aka 10ms (ok,
that's mainly SIXP_SLOTTIME, with SIXP_TXDELAY being used mainly to
transfer the data to the other side).

So from everything I can see, your patch is correct.

Of course, to make things more confusing, the RESYNC_TIMEOUTs are
indeed given in ticks.

I spent too much time looking at this, but I'm going to apply that
patch. I suspect either nobody uses that driver any more, or the
TXDELAY values don't actually much matter, since they have clearly
been wrong and depended on random kernel configs for a long long time.

I think the most common HZ value on x86 tends to be the modern default
of 250Hz, so the old "HZ/4" means that most people got a TXDELAY of
620ms, rather than the traditional expected 250ms.

The fact that this shows up as an actual compile error on alpha is
just random luck, since alpha uses a 1024Hz clock. CONFIG_HZ_1000
isn't impossible on other platforms either, which happens to compile
cleanly, but causes that TXDELAY byte to sent out as 250, for a 2.5Hz
TX delay.

Of course, it is possible that it's the documentation that is wrong,
but considering that the documentation matches the code (see above on
that "((when + 1) * HZ)/100"), and matches the "it doesn't cause
compiler warnings", I think it's pretty clear that your patch is the
correct fix.

           Linus

  parent reply	other threads:[~2021-09-16 19:47 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-15  3:52 [PATCH v2 0/4] Introduce and use absolute_pointer macro Guenter Roeck
2021-09-15  3:52 ` [PATCH v2 1/4] compiler.h: Introduce " Guenter Roeck
2021-09-15  7:07   ` Geert Uytterhoeven
2021-09-15  7:13   ` Geert Uytterhoeven
2021-09-15 14:03     ` Guenter Roeck
2021-09-15  3:52 ` [PATCH v2 2/4] net: i825xx: Use absolute_pointer for memcpy from fixed memory location Guenter Roeck
2021-09-15  7:08   ` Geert Uytterhoeven
2021-09-15  3:52 ` [PATCH v2 3/4] alpha: Move setup.h out of uapi Guenter Roeck
2021-09-15  3:52 ` [PATCH v2 4/4] alpha: Use absolute_pointer to define COMMAND_LINE Guenter Roeck
2021-09-15 19:18 ` [PATCH v2 0/4] Introduce and use absolute_pointer macro Linus Torvalds
2021-09-15 19:35   ` Guenter Roeck
2021-09-15 19:47     ` Linus Torvalds
2021-09-15 19:50       ` Linus Torvalds
2021-09-15 21:19         ` Linus Torvalds
2021-09-16  7:02           ` Anders Larsen
2021-09-16 16:25             ` Linus Torvalds
2021-09-15 20:30       ` Helge Deller
2021-09-15 22:33       ` Guenter Roeck
2021-09-16 18:35         ` Linus Torvalds
2021-09-18  9:51           ` Michael Cree
2021-09-18 13:11             ` Ulrich Teichert
2021-09-18 17:04               ` Linus Torvalds
2021-09-18 17:17                 ` Thorsten Glaser
2021-09-18 17:21                   ` Linus Torvalds
2021-09-18 17:28                 ` Linus Torvalds
2021-09-18 20:26                 ` Ulrich Teichert
2021-09-18 20:46                   ` Linus Torvalds
2021-09-18 21:12                     ` Linus Torvalds
2021-09-18 22:09                   ` Linus Torvalds
2021-09-19 15:13                     ` Dave Taht
2021-09-20 18:25                     ` Ulrich Teichert
2021-09-20 18:46                       ` Linus Torvalds
2021-09-20 18:59                         ` Matt Turner
2021-09-20 19:45                           ` Linus Torvalds
2021-09-21 19:13                         ` Ulrich Teichert
2021-09-21 20:42                           ` Linus Torvalds
2021-09-21 21:39                           ` Linus Torvalds
2021-09-22 20:50                             ` Ulrich Teichert
2021-09-16 19:47         ` Linus Torvalds [this message]
2021-09-16  0:34   ` Michael Cree

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHk-=wiQPjD_XKhVLyB4w2O6Rsi8mq256qVuhR8jMTSwrMPDqg@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=ajk@comnets.uni-bremen.de \
    --cc=davem@davemloft.net \
    --cc=deller@gmx.de \
    --cc=geert@linux-m68k.org \
    --cc=ink@jurassic.park.msu.ru \
    --cc=kuba@kernel.org \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mattst88@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).