Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3447736pxb; Mon, 4 Apr 2022 17:17:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGRTHzAj6XPgFuxXCJJJJqqo+QDIIU1KA7IEwWqQgr9LK70Zbz9BhBpg4uF5LNi/vcCGd/ X-Received: by 2002:a17:903:4052:b0:155:fc0b:48fb with SMTP id n18-20020a170903405200b00155fc0b48fbmr778680pla.27.1649117827834; Mon, 04 Apr 2022 17:17:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649117827; cv=none; d=google.com; s=arc-20160816; b=biT5UA51OWDFqmND1Ajzjw8sGWr/UfwkbSA5/3USf6TLVkspwgxjE5CnrqA77jdO2T krxYlUuYc9nvpujryVRyeCgFsksu4Wtm8p7H3AXVPNnaRu3tffbco12xYq7pH4e07iSg rDbOOLCPdwJmMhfwd8l2hbxrrQT4ikRvvmPi8SQpA66LEq7M8POtkaaeSqrJBmXQSWje Wdzq4nVxnWZYsaG3aJt1NN6IB/NUl94snstmNF/lGZz5ZCW0sXQEvlcyrsC4OdKRCJIH XzUJWCXSxgSR3q96ZnIthMaNihb5+6aPOz67fIuFFqi4mErcWYG1s+LCSrN4EJokbuhH wuLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=1A6lCTEsUjFcpHGOtwRNck1KGF0Efo/Uou800fr0e80=; b=Zf/b5qeY830zN0QACMmNWB4n6sQXIW5sESXX0zkZqXm1cFY9P1OTz062i/FQWuhQc5 fyO9Mp5Epud13Hw4B5pJ6vNMgB1rTTgqSJvIieLYGkaHbKZ9g7qeuVbU7mP6Q6rUnj0R htJctf5sHEo6eEZZf+EeShmEj8LZDe7QhRHGyb3hizKeMnrsPUM8iyi+DmxCw1NN80i3 UrD4eVbY3C1vWtdA22BCkyoyKNj/hdt8wNYfFmVHzc58r+wL3JBUQK2mLuIvVL8z4FCm M61J75/G7+/p+aqdRVynrt0IFUPdYAcy4LYH5tYkiUDze/vJufPt0AAj1MqeXNxogDrK TVCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=lLpiD5ju; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id g15-20020a056a001a0f00b004fa3a8e0013si12362913pfv.202.2022.04.04.17.17.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 17:17:07 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=lLpiD5ju; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6FB2F4505F; Mon, 4 Apr 2022 16:44:50 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359644AbiDCRVR (ORCPT + 99 others); Sun, 3 Apr 2022 13:21:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243742AbiDCRVQ (ORCPT ); Sun, 3 Apr 2022 13:21:16 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B87F25E9F for ; Sun, 3 Apr 2022 10:19:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=1A6lCTEsUjFcpHGOtwRNck1KGF0Efo/Uou800fr0e80=; t=1649006361; x=1650215961; b=lLpiD5jusalnv662Rqkb9Rn/24xAz/4a/R0dFYvtScSnxvs +f8LBqquOSeuZhmg/JUw2Ph5aH8LwfkSH7ljgueFWWJPa9Im2z8akA54All5aUbJCsppVAHhuNjiP 8hPjQZsPIuAH4w4oTfYzUjk7zLZ91RYxDnMIHxjyJrMAjeROKpFwX6jnzKMpcECy3iG+2esllSIp0 u1F+pDEVtbuuL7u+oWa60caKrIUiokD94raQ1M1Dfkev8VAfQDlGPOH2kZQf9sh5ALhf/I1I/l/Q8 YnuQrwpPfH2MAHpST5vxowwKTgwZ2sp/idC6soQy0BQl9s7Au3d7o75118sshbhw==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.95) (envelope-from ) id 1nb3sk-004Ngx-2d; Sun, 03 Apr 2022 19:19:18 +0200 Message-ID: <43785c9c6ee74a995963144946c67893ebbf8852.camel@sipsolutions.net> Subject: Re: UML time-travel warning from __run_timers From: Johannes Berg To: Thomas Gleixner , Vincent Whitchurch Cc: linux-um@lists.infradead.org, linux-kernel@vger.kernel.org, Anna-Maria Gleixner , Frederic Weisbecker Date: Sun, 03 Apr 2022 19:19:17 +0200 In-Reply-To: <32423b7c0e3a490093ceaca750e8669ac67902c6.camel@sipsolutions.net> References: <20220330110156.GA9250@axis.com> <84f9d627092660c38400b607198c3b83f795be7f.camel@sipsolutions.net> <877d86m978.ffs@tglx> <32423b7c0e3a490093ceaca750e8669ac67902c6.camel@sipsolutions.net> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 (3.42.4-1.fc35) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-malware-bazaar: not-scanned X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2022-04-03 at 19:13 +0200, Johannes Berg wrote: > On Sun, 2022-04-03 at 18:18 +0200, Thomas Gleixner wrote: > > On Sat, Apr 02 2022 at 16:09, Johannes Berg wrote: > > > At init, we get > > > > > > init_timer_cpu(0) base 0 clk=0xffff8ad0, next_expiry=0x13fff8acf > > > init_timer_cpu(0) base 1 clk=0xffff8ad0, next_expiry=0x13fff8acf > > > > > > which makes sense, jiffies is set up to wrap very quickly after boot. > > > > > > The warning triggers when we have jiffies=0x13fff9600, so it's just > > > after the "next_expiry", so in this code: > > > > which does not make sense. > > If you say so, I have no idea :) > > > If next_expiry is 0x13fff8acf and jiffies > > advanced to 0x13fff9600 when the warning triggered, then either it > > missed to expire the timer at 0x13fff8acf or it failed to recalculate > > next_expiry. > > There was no timer. If there's ever a timer on this base (BASE_DEF) then > this doesn't happen. > > So it has to be the latter, but I'm trying to understand in the code > where it would*ever* recalculate next_expiry if it in fact never > expires? > Actually, in a sense, this *is* the case of (just) recalculating next_expiry, no? We just never set next_expiry_recalc since there was never any timer on this? So actually this also makes the warning go away: --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1729,6 +1733,7 @@ static inline void __run_timers(struct timer_base *base) WARN_ON_ONCE(!levels && !base->next_expiry_recalc); base->clk++; base->next_expiry = __next_timer_interrupt(base); + base->next_expiry_recalc = !levels; while (levels--) expire_timers(base, heads + levels); @@ -2005,6 +2010,7 @@ static void __init init_timer_cpu(int cpu) raw_spin_lock_init(&base->lock); base->clk = jiffies; base->next_expiry = base->clk + NEXT_TIMER_MAX_DELTA; + base->next_expiry_recalc = true; timer_base_init_expiry_lock(base); } } johannes