Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3875496rwb; Tue, 8 Nov 2022 09:18:15 -0800 (PST) X-Google-Smtp-Source: AMsMyM7BxQRxPMSzJoao1yl0HjTHbizhbrLGnnQU8q3qa3OiUBrRVdpf00C0MIJR02+8M84g0PZW X-Received: by 2002:a17:90b:4d90:b0:213:687d:c0f0 with SMTP id oj16-20020a17090b4d9000b00213687dc0f0mr59062303pjb.212.1667927895309; Tue, 08 Nov 2022 09:18:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667927895; cv=none; d=google.com; s=arc-20160816; b=IzXp0x7lciFLPkeh7bmgx2/JNSmVSBrHZzTUulLo1ztjD7HmmsLpRsQiSYsqWGpO/q JGJXeV/WiJrzhgqWuendY4gtXFubrKvYDTObzvygX6SEfrXiQ0poNgrJ7nz/AJ10bI2X imMLYeT83wczFpfO8jNYfwPFSYxWUVFUdJ4DPGcFZBrI4s6dK4HdwNj4DkVwTErsJoF7 XUr1ZruOwRonulzVJE+A/83BNgMlaTiAsf8Wa8/K+siXzQp6ioQPFLx7dloTvvPehH3q /7gr3mxRYANSnPv/czYAjIm3M4H9+ODDo0QES3i2th/msnNj+g3Md4lJ2BgebYyPFbKS CeGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:dkim-signature:dkim-signature:date; bh=Y/ltunOlWhT9qoWXICQY0xwWTfJd8Uki4/DwJbamrBE=; b=e3N887q9Ls/Z+qtZYb64Hjm1CeSTeLLG6Q4PlySCUTQgD5yvStcsz5V+FRMmPiIqtG BsjSMufwGVPeZoaL2ia9Y5QKrA666hi75oJVjU38x1Nb6GakXqDHOZauD1VbPKIXON4c mt5j6H2D3Vzno/mlfMuvQub2/Ib5kM3icUCg0Pkk5qT89gsDAAwQ40Hk4iEfznw56oUE a3v1tXxZeKNQg+c4o+CU+s095t1Pd50CNSk0mkbhWeWsMIuLbllF8JYZOqs197FLUkKS zYZD2eWo1SJvp06L49G0LQk9iOAMqrsvQLWRHdMWBNFOi15BSF8z40MXED/ox1Jx0ZGV oj8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="qxOu//IU"; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h4-20020a170902b94400b0016cca53817dsi13701995pls.341.2022.11.08.09.18.03; Tue, 08 Nov 2022 09:18:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="qxOu//IU"; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234538AbiKHQQR (ORCPT + 91 others); Tue, 8 Nov 2022 11:16:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233665AbiKHQQP (ORCPT ); Tue, 8 Nov 2022 11:16:15 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 506F34FFB1 for ; Tue, 8 Nov 2022 08:16:14 -0800 (PST) Date: Tue, 8 Nov 2022 17:16:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1667924171; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Y/ltunOlWhT9qoWXICQY0xwWTfJd8Uki4/DwJbamrBE=; b=qxOu//IU8dpyp2QX83G/PvnanL7DYdvtvd46g+6Ih75xGWFSlYF7HBkZ9KU3g1OXhimwgd neh2drKoXa3yuVAqSf/eQWJNH+tfBA96rSS2FDcK1UEllJCQnuRoZknxBpMuGSqQNMxTyY j3DM1EslEXgw7T7e9KKOMQGNI34SRIcGrXqE42M03b+wvr4MIcHhW1/WK/JKahhOeNSelz Xb/5BFRd9B3ucE2IVv2N4PKYoTmhbDaqRAdM2Pb6EEUYCr8qGl1hpg95lCQ7NVDMEYZlc7 nNh7Cdn6ygx+LiKJfTd3FRCr1tJ8Uqh6j6F2GhDrlAxj34zghqCKwLHj8wGS3Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1667924171; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Y/ltunOlWhT9qoWXICQY0xwWTfJd8Uki4/DwJbamrBE=; b=HYCtGka5HQFmG0JjqSK60wBA6ad7vpK/y8RBW9RodlclYKKJOat+rX3lJpN8l60VD9MNyX j9emKErcpbSC7LBg== From: Anna-Maria Behnsen To: Frederic Weisbecker cc: linux-kernel@vger.kernel.org, Peter Zijlstra , John Stultz , Thomas Gleixner , Eric Dumazet , "Rafael J . Wysocki" , Arjan van de Ven , "Paul E . McKenney" , Frederic Weisbecker , Rik van Riel Subject: Re: [PATCH v4 14/16] timer: Implement the hierarchical pull model In-Reply-To: <20221107220727.GA10939@lothringen> Message-ID: References: <20221104145737.71236-1-anna-maria@linutronix.de> <20221104145737.71236-15-anna-maria@linutronix.de> <20221107220727.GA10939@lothringen> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham 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 Mon, 7 Nov 2022, Frederic Weisbecker wrote: > On Fri, Nov 04, 2022 at 03:57:35PM +0100, Anna-Maria Behnsen wrote: > > @@ -1859,6 +1863,36 @@ void forward_and_idle_timer_bases(unsigned long basej, u64 basem, > > */ > > is_idle = time_after(nextevt, basej + 1); > > > > + if (is_idle) { > > + u64 next_tmigr; > > + > > + next_tmigr = tmigr_cpu_deactivate(tevt->global); > > + > > + tevt->global = KTIME_MAX; > > + > > + /* > > + * If CPU is the last going idle in timer migration > > + * hierarchy, make sure CPU will wake up in time to handle > > + * remote timers. next_tmigr == KTIME_MAX if other CPUs are > > + * still active. > > + */ > > + if (next_tmigr < tevt->local) { > > + u64 tmp; > > + > > + /* If we missed a tick already, force 0 delta */ > > + if (next_tmigr < basem) > > + next_tmigr = basem; > > + > > + tmp = div_u64(next_tmigr - basem, TICK_NSEC); > > + > > + nextevt = basej + (unsigned long)tmp; > > + tevt->local = next_tmigr; > > + is_idle = time_after(nextevt, basej + 1); > > + } else { > > + nextevt = nextevt_local; > > That else part look unecessary. Yes, you are right. I will add a comment instead. Maybe someone wants to improve it and then requires the proper nextevt... > > + } > > + } > > + > > /* We need to mark both bases in sync */ > > base_local->is_idle = base_global->is_idle = is_idle; > > Do we still need to maintain base_global->is_idle ? is_idle information is required in trigger_dyntick_cpu(). I made a mistake with the hunk in trigger_dyntick_cpu() introduced in this patch. Because after this patch, global timers are still enqueued on any CPU because crystallball still exists. trigger_dyntick_cpu() is also required for non pinned timers. I need to move the hunk of trigger_dyntick_cpu() into the last patch of the queue where crystallball is removed during enqueue and there update also this line. Then I will drop the update of base_global->is_idle in timer_clear_idle() as well. Sorry. This went wrong during splitting and folding the queue back and forwards... > (I'm going to do daily reviews on this patch because it's quite dense :) Thanks! I try to answer your questions fast. Let me know when you are done or when you need an updated version for further review :) Thanks, Anna-Maria