Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp874157rdb; Wed, 6 Dec 2023 02:21:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IEOPUwFp0Wfs/DKkAbqgj5XTrWBu9NTCWQOXk4zS6Fmpp+fTFPRwFA24el/hDidx+wsOCMm X-Received: by 2002:a05:6870:5ba6:b0:1fb:75b:1322 with SMTP id em38-20020a0568705ba600b001fb075b1322mr686254oab.116.1701858075002; Wed, 06 Dec 2023 02:21:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701858074; cv=none; d=google.com; s=arc-20160816; b=U78/O1t6L09vDaV0SG79hwMzhTVunTFYtTpOzQovBUHOsNyMQdGJbtSdtQR0mF53su C8yumr6QXMxQBZUmPiKJQJ8Pff/LwD+lR9NBzWiREVMfLGYs8bCcjHLpkWGZFfC19LLk Zy3fc9Nncq2Hzh/hK0tMQIvm0iZ96aWM2l94FxCMuHSKFiRzAvE8tLhDzgjDVJGIbnh4 jsoTnCeGNZGCKoUoiGcI18hOzMUXh7M1c0fsy75m4meuemIsKlP83S3Ea3maMIjXQbI5 jbkXtoAX7sw9YMAOyNJ0SWarx4szQP5yKxHqaOs3uBzUAA759j9j4T0EUzhQuP2jhI5i XfcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:dkim-signature:dkim-signature:date; bh=C45DOZNqHlf6CtGNEEnMCQuBPql4ZJgTYbpJ0anoEpc=; fh=5cMh8CKYPGN1F0fzuaj1xrlN5+dBfa6bPK4XIprQ5s0=; b=Lws1GtTQ4Y8Nrr1TEMBqDbbFQrHGziNSgh1vFhQLSYHWm5rGZGr40Htu7aQV0wFajp Y082XFcTsQwE9N+sUsH46klnnHrEYAGLdmIwEH4GM9Q+A6oIV/sJhwnPHRc7h2IpXBQK mR5pazlVz8160IU2FcNDvXPluBd4V2CSjGNx+Fmxeonc6N0atpv9MOoAytS8wdmoVKkV ISPtSdoRvzK0euxKGpjuGysEYOROpU2KQrpaMNolAVGIRL89s7Skxduyk9OFioKdYJsk OTlpQZvCbQjxCbInjU/fbmKkoqaNg2fM3D1mY+to8yobGR7exiCox+maTqx75vLXRRjU dysg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=kHZjeKMA; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id l70-20020a639149000000b005c662c8da8csi7050600pge.210.2023.12.06.02.21.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 02:21:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=kHZjeKMA; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id D0DA9805979F; Wed, 6 Dec 2023 02:21:11 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377525AbjLFKUz (ORCPT + 99 others); Wed, 6 Dec 2023 05:20:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377640AbjLFKUy (ORCPT ); Wed, 6 Dec 2023 05:20:54 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BF9B18F for ; Wed, 6 Dec 2023 02:21:00 -0800 (PST) Date: Wed, 6 Dec 2023 11:20:57 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1701858059; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C45DOZNqHlf6CtGNEEnMCQuBPql4ZJgTYbpJ0anoEpc=; b=kHZjeKMACP4LSXeNS373k9go61+HkPqpxnycDGNdTjvA0+Yc0fudud7Eg/vWERJhxwuATK KfYf2O//1XLTvTxC7aeb7hQj6fF9HwBzOzo6flb/nnrFzOnzJPB1IUIUuFAGzLy8BlqN84 y1rfr7XTUtPue9UAzu8vw92Dv5wu5QqjrO7jCFLzuH4Tsy8Q4BmMWjZ9mEEwsWHetavGTD gbi0werKZBx/po5EJpcdi3zu8gwd89px0MotAiR3/yRwz9OY/tbbbTyuEzJBKYTE8u3Pd9 HdT+LjM4DcLaUF9ApHzMt2V3VzI49+2lQblmAxlvjYlR0RgMW0qI4nDDRPuDng== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1701858059; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C45DOZNqHlf6CtGNEEnMCQuBPql4ZJgTYbpJ0anoEpc=; b=pJnDOB3fUSN2YgPfX8TmjKgkgMwZcCSWYofRXmuPgVHmKii9e6EQasbkqqfBpPQLAl+r6X ENLJJrIc5PN888Cg== From: Sebastian Siewior To: Anna-Maria Behnsen 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 , Steven Rostedt , Giovanni Gherdovich , Lukasz Luba , "Gautham R . Shenoy" , Srinivas Pandruvada , K Prateek Nayak Subject: Re: [PATCH v9 24/32] timers: Split out "get next timer interrupt" functionality Message-ID: <20231206102057.RrJjegFf@linutronix.de> References: <20231201092654.34614-1-anna-maria@linutronix.de> <20231201092654.34614-25-anna-maria@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20231201092654.34614-25-anna-maria@linutronix.de> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 06 Dec 2023 02:21:12 -0800 (PST) On 2023-12-01 10:26:46 [+0100], Anna-Maria Behnsen wrote: > diff --git a/kernel/time/timer.c b/kernel/time/timer.c > index 0d53d853ae22..fc376e06980e 100644 > --- a/kernel/time/timer.c > +++ b/kernel/time/timer.c =E2=80=A6 > +static inline u64 __get_next_timer_interrupt(unsigned long basej, u64 ba= sem, > + bool *idle) > +{ > + struct timer_events tevt =3D { .local =3D KTIME_MAX, .global =3D KTIME_= MAX }; > + struct timer_base *base_local, *base_global; > + unsigned long nextevt; > + u64 expires; > + > + /* > + * Pretend that there is no timer pending if the cpu is offline. > + * Possible pending timers will be migrated later to an active cpu. > + */ > + if (cpu_is_offline(smp_processor_id())) { > + if (idle) > + *idle =3D true; > + return tevt.local; > + } > + > + base_local =3D this_cpu_ptr(&timer_bases[BASE_LOCAL]); > + base_global =3D this_cpu_ptr(&timer_bases[BASE_GLOBAL]); > + > + raw_spin_lock(&base_local->lock); > + raw_spin_lock_nested(&base_global->lock, SINGLE_DEPTH_NESTING); > + > + nextevt =3D fetch_next_timer_interrupt(basej, basem, base_local, > + base_global, &tevt); Now you split it, move it and we have the __forward_timer_base() back in case of the shortcut which is now in fetch_next_timer_interrupt(). All good. > =20 > /* > * We have a fresh next event. Check whether we can forward the Sebastian