Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8639452imu; Tue, 4 Dec 2018 11:36:15 -0800 (PST) X-Google-Smtp-Source: AFSGD/VkzP0elHuCDHGRiNzO5qk31WYV/qpuYfFzQ8s+UZO5jdq342B0ZPaahFK4wrLBi5BMGvQV X-Received: by 2002:a62:7687:: with SMTP id r129mr21118333pfc.17.1543952175772; Tue, 04 Dec 2018 11:36:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543952175; cv=none; d=google.com; s=arc-20160816; b=g0VsOSoVx59hu5QVliGbf6JTfgLMRplZg6n+2L3/Jtwm2zrpXh77mJ1HDRr3ImD7i/ kjgaaKqYVAjULWjyjMIdVadU5AzDrDmf9c7JT7lGsa/fsRJs4na3YVKdFYup7B4Qzu1R HquUEtLOTa0Iepw59y5YbilS0V3v9e4yDahrqRziCqWcR1RqUwf5Syxpapj66w7mWWdU /Q+fWcZvcCoiHS0luHkUBB6FGEVqucUEoOlVF15kKAmCkSRJH/1EJT6e9/psMqfgYjDE Bp1pIxs/NIO+KcmZlhXT2xHhRsvB+xHVOEGVctKs0fG+/fsp89mqAB9N1GlsbsXNKU57 yN7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=0v1PwKxmmsTkB8PjeALCaZBS0XNbiV4V2qeuZmJerjs=; b=vGx7mco1OGwHUo+3JghbMuuoEjfPQGWdqpyWDL+AxYRRtkUlAnlqC19BxtSnw/MQID jC8thGZATW62EKTENR5elZcQL2svlLXVV9WNhWDKiPOfAt6KIZxrafDvo5tRHZYtWBVN AfCJkJwpz+e3TS9kci+gVuxAtpO1cSIhdrfxJPbSZ/Bm3NuKUaz1jk5uHsaUN9BNMvD/ jds9nSXfLS5TILYv2QZlAz0HENwMAHL9Tzdxne0a5z8oA0BVGoBt5iXrajA91nZkwbpC xKQxk72Mk53sADDCyaI2X6fGsReCLntNCX7FrHT9CJfpnEJGKlZl4ovxAVfCEBRVvegB aYSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@purestorage.com header.s=google header.b=IeON+W7j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=purestorage.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 189si18051078pfd.142.2018.12.04.11.36.00; Tue, 04 Dec 2018 11:36:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@purestorage.com header.s=google header.b=IeON+W7j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=purestorage.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726134AbeLDTd6 (ORCPT + 99 others); Tue, 4 Dec 2018 14:33:58 -0500 Received: from mail-lj1-f172.google.com ([209.85.208.172]:34748 "EHLO mail-lj1-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725831AbeLDTd5 (ORCPT ); Tue, 4 Dec 2018 14:33:57 -0500 Received: by mail-lj1-f172.google.com with SMTP id u6-v6so16037528ljd.1 for ; Tue, 04 Dec 2018 11:33:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0v1PwKxmmsTkB8PjeALCaZBS0XNbiV4V2qeuZmJerjs=; b=IeON+W7jCdYuUXnDE0SU5AmweOANdxgDFSNoGU3gJ/BxMk7YxV8fbPE/CcEzXtaJ8Q dX75XmBHdTlPKtytVWCgzGrs2A/MMDUOwqLOe+3JQzAqAdoxk8xupa0fa6/yeeBNz6hi GB6Mv7MS4UQacr0iwerEeL9y4dMLqF/2BnzAU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0v1PwKxmmsTkB8PjeALCaZBS0XNbiV4V2qeuZmJerjs=; b=k8V4pJhjQduPLgLpa2surbcthMJrLxgM6c0P5+KzWneB4Ep3RAzDqpQPf7rpkCyOnx cGzWT7Cdjw5p1hf4reQ7WQuDyHo3JdEJB61tANNJF+3HlaQAyltEZjxOyO80KQ5JaO1t bvE+IU/8raSTN7aRbU1M36xouFSGx6DPbOT4/nNbOyasduWjtnTAJZFRruMWmVT3FLcO Ll7CwtIa/5/vKW7GW7iHGoK4fhAsKxpZ+z2Is9pBMIc04B/mS4ehLkNYdtEg7sIis/nc lEkEqfGCMzKlF1FB3cLazoxyrd7l3MhVjd9N9+1FbXvIjJM4YmYJfNGE/KBSzTtsKupk RQYw== X-Gm-Message-State: AA+aEWaA0HLpF4xRnXkMmx8XEYihFEq7guYMaSQPqSz1x88OWMSHWEsE EkR26J5KJa5Eltqo6qo17JSOBQT+k5f0hNk4SkprJw== X-Received: by 2002:a2e:5d12:: with SMTP id r18-v6mr15100382ljb.89.1543952035629; Tue, 04 Dec 2018 11:33:55 -0800 (PST) MIME-Version: 1.0 References: <20181130211750.5571-1-roland@purestorage.com> In-Reply-To: From: Roland Dreier Date: Tue, 4 Dec 2018 11:33:43 -0800 Message-ID: Subject: Re: [PATCH] clocksource: Add heuristics to avoid switching away from TSC due to timer delay To: Thomas Gleixner Cc: john.stultz@linaro.org, sboyd@kernel.org, LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > /* > * Proper multiline comments look like this not like > * the above. > */ Got it, will fix next time around. > That aside. Why are you trying to do heuristics on the delta? > > We have way better information than that. The watchdog timer expiry time is > known and we can determine the exact delay of the timer. > > The watchdog clocksource provides the maximum 'idle' time, i.e. the time > between two reads, in clocksource::max_idle_ns. That value is filled in > when the clocksource is configured. > > So without doing speculation we can make an informed decision: > > elapsed = jiffies_to_nsec(jiffies - watchdog_timer->expires) + > WATCHDOG_INTERVAL_NS; > > if (elapsed > wdcs->max_idle_ns) { > Skip ...... > } Yes, that makes more sense than what I was doing, although I'm not sure on the details. Just missed that idea. Why are you adding the watchdog interval to the calculated elapsed time? It seems we have an issue exactly if jiffies - watchdog_timer->expires is too big, without adding the interval we tried to wait in on top. Also I think we might want to be careful that jiffies is >= the expires time - or is it not possible that a timer fires one jiffy early? Also for full generality it seems we should check against the clocksource max_idle_ns as well - for x86 TSC is wider than HPET but there may be other architectures that could hit the same problem, just with the clocksource being checked wrapping around instead of the watchdog clocksource. Right? Thanks! Roland