public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Derek Smithies <derek@indranet.co.nz>
To: Pavel Roskin <proski@gnu.org>
Cc: Benoit Papillault <benoit.papillault@free.fr>,
	linux-wireless@vger.kernel.org, ath5k-devel@lists.ath5k.org,
	ath9k-devel@lists.ath5k.org
Subject: Re: [ath5k-devel] [PATCH] ath5k/ath9k: Fix 64 bits TSF reads
Date: Sun, 18 Apr 2010 09:33:24 +1200 (NZST)	[thread overview]
Message-ID: <alpine.DEB.2.00.1004180914300.4114@monster> (raw)
In-Reply-To: <1271452384.16507.16.camel@mj>

Hi,
  The original code was wrong, and there must have been occasions when the 
TSF was read incorrectly. Those occasions were infrequent, and would have 
show up in large networks that were operational on the month timescale.

Benoit's code tries 10 times to read the TSF, looking for when two 
consecutive upper TSF values that are the same. I can think of no physical 
scenario that would cause the 10 consecutive reads to not terminate.

If this fails to happen, then the TSF counter on the radio board is 
busted. If the TSF counter (or the reading of the TSF counter) is busted, 
then you have a bad situation, and something seriously wrong is happening.
We need to know about this - so the kernel warnings are good.

> The problem with overengineered code is that it doesn't break when it's
> better to break and expose the problem :-)
Yes, but the problem with underengineered code is that it doesn't break, 
and the users of the code are blissfully unaware of serious problems.

I would not call this overengineered. I would call this the appropriate 
level of peer review to get stable code that is acceptably reliable.

Benoit's patch is good.
ACK.

Derek.
========================================================================
On Fri, 16 Apr 2010, Pavel Roskin wrote:

> On Fri, 2010-04-16 at 00:07 +0200, Benoit Papillault wrote:
>
>> It follows the logic mentionned by Derek, with only 2 register reads
>> needed at each additional steps instead of 3 (the minimum number of
>> register reads is still 3).
>
> I would prefer an approach whereas tsf_upper2 or tsf_upper1 is chosen
> based on whether tsf_lower is more or less than 0x80000000 if
> (tsf_upper2 - tsf_upper1) is 1.  If the difference is not 0 or 1, either
> the hardware is broken or the kernel was stuck for so long (71 minutes!)
> that getting the exact tsf should be the least worry.  That's when
> WARN_ON would be appropriate.
>
> The problem with overengineered code is that it doesn't break when it's
> better to break and expose the problem :-)
>
> But it's just a suggestion, not a NACK.  It's better to have some fix
> than no fix at all.
>
>

-- 
Derek Smithies Ph.D.
IndraNet Technologies Ltd.
Email: derek@indranet.co.nz
ph +64 3 365 6485
Web: http://www.indranet-technologies.com/


      parent reply	other threads:[~2010-04-17 21:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-15 22:07 [PATCH] ath5k/ath9k: Fix 64 bits TSF reads Benoit Papillault
2010-04-16 21:13 ` [ath5k-devel] " Pavel Roskin
2010-04-17 13:27   ` Benoit PAPILLAULT
2010-04-17 23:02     ` Pavel Roskin
2010-04-17 21:33   ` Derek Smithies [this message]

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=alpine.DEB.2.00.1004180914300.4114@monster \
    --to=derek@indranet.co.nz \
    --cc=ath5k-devel@lists.ath5k.org \
    --cc=ath9k-devel@lists.ath5k.org \
    --cc=benoit.papillault@free.fr \
    --cc=linux-wireless@vger.kernel.org \
    --cc=proski@gnu.org \
    /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