From: John Stultz <john.stultz@linaro.org>
To: Trevor Cordes <trevor@tecnopolis.ca>
Cc: lkml <linux-kernel@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Josh Boyer <jwboyer@redhat.com>,
One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Subject: Re: regression in ktime.h circa 3.16.0-rc5+ breaks lirc irsend, bad commit 166afb64511
Date: Fri, 1 May 2015 10:31:58 -0700 [thread overview]
Message-ID: <CALAqxLUueBnz2o2nO7mU+pAOQD94xgyx8+xcARehf0HOnySing@mail.gmail.com> (raw)
In-Reply-To: <20150501050225.4c0ac17c@pog.tecnopolis.ca>
On Fri, May 1, 2015 at 3:02 AM, Trevor Cordes <trevor@tecnopolis.ca> wrote:
> May 1 04:46:12 piles kernel: [ 356.838029] JDB: ktime_to_us: -20157485 -> divns 18446744073689394 != old method: -20158
>
> The last 2-3 or 3 groups of output I could produce on demand by stopping mythbackend and running:
> systemctl restart lircd.service ; irsend SEND_ONCE dct700 info
>
> Subsequent irsends don't trigger the bug, since (as I found out a
> while ago) by that point lircd is "hung", at least for a long while.
> Hey! Maybe lircd is then hung for 18446744073689394 us or ns :-)
> If this result is used as a delay timer, the negative would produce
> 0 delay, and the + number the "hang". I calculate that hang is 584
> years? :-)
>
> So it looks like maybe my theory wasn't so wacky: we're dealing
> with a caller passing negative numbers (or 32/64 weirdness). Very
> strange as it seems the caller *wants* (or is happy with) negative
> numbers!
So yea. I see the issue now. The ktime_divns() function uses do_div
which is an unsigned divide. So negative numbers look like large
numbers, and it doesn't do sign-extension, so when it divides we lose
the sign bit.
ktimes are normally positive values, so this probably isn't something
its run-across often, thus why you've just noticed. It does make me
suspicious that the driver is doing something funny still, but I've
gone ahead and written up a patch to fix this since this is clearly an
issue here.
I'll send it out here shortly. If you could give it a spin at your
leisure, and if it works give me a Tested-by: tag I'd appreciate it!
Great work again on chasing this down, and thanks for helping with
debugging and validating the fix!
-john
next prev parent reply other threads:[~2015-05-01 17:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-23 16:57 regression in ktime.h circa 3.16.0-rc5+ breaks lirc irsend, bad commit 166afb64511 Trevor Cordes
2015-04-30 4:27 ` Trevor Cordes
2015-04-30 10:53 ` One Thousand Gnomes
2015-04-30 16:35 ` John Stultz
2015-05-01 10:02 ` Trevor Cordes
2015-05-01 17:31 ` John Stultz [this message]
2015-05-01 18:29 ` Nicolas Pitre
2015-05-01 18:51 ` John Stultz
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=CALAqxLUueBnz2o2nO7mU+pAOQD94xgyx8+xcARehf0HOnySing@mail.gmail.com \
--to=john.stultz@linaro.org \
--cc=gnomes@lxorguk.ukuu.org.uk \
--cc=jwboyer@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=trevor@tecnopolis.ca \
/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).