On Fri, May 1, 2015 at 3:02 AM, Trevor Cordes <tre...@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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/