From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751478AbdFZIpf (ORCPT ); Mon, 26 Jun 2017 04:45:35 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:38805 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751302AbdFZIpd (ORCPT ); Mon, 26 Jun 2017 04:45:33 -0400 Date: Mon, 26 Jun 2017 10:45:24 +0200 (CEST) From: Thomas Gleixner To: Thierry Reding cc: Mariusz Skamra , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] ktime: Simplify ktime_compare implementation In-Reply-To: <20170626065204.GA31609@ulmo.fritz.box> Message-ID: References: <1495803647-9504-1-git-send-email-mariuszx.skamra@intel.com> <20170626065204.GA31609@ulmo.fritz.box> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 26 Jun 2017, Thierry Reding wrote: > On Fri, May 26, 2017 at 03:00:47PM +0200, Mariusz Skamra wrote: > > ktime_sub can be used here instread of two conditional checks. > > Boot is broken on Tegra186 on next-20170623. Bisection points at this > commit and I've confirmed that reverting it also fixes the problem. > > Another fix is to change the return value of ktime_compare() to ktime_t, > though I'm not sure that'd be a good alternative because it breaks with > the traditional return type of int (-1, 0, +1) for comparison functions. > > It looks like the issue is with the truncation from s64 to int, as > demonstrated by this minimal test case: You are right. And I should have seen it when merging that patch. Looking deeper, the patch is pointless, because the compiler will optimize the checks away and use the proper CMP instruction to figure it out. It's reverted now. Thanks, tglx