Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp1879471lqp; Sat, 23 Mar 2024 12:52:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUVuJXOihPBeY27jKzGzTMTHo+alpz+8QSDEc1aHpKKLHDXRiheFByTUdGjNKJcyES0+TCJ8mUo9I2kxeh4hqb4/qIvdrajt91T6ZYoXw== X-Google-Smtp-Source: AGHT+IEUnOScb9viHRi5+KnOHZZAQ9gegncqCZHGY7dodprMWs60dGcCeNA4J2TrhH6b6vG8lnK3 X-Received: by 2002:a05:6808:2005:b0:3c3:c97a:7f27 with SMTP id q5-20020a056808200500b003c3c97a7f27mr1011574oiw.8.1711223559013; Sat, 23 Mar 2024 12:52:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711223558; cv=pass; d=google.com; s=arc-20160816; b=xK9N2kldo2kx3Ge9WTsOgHNgDhd2K39mGlo0/Jyqe8YG94/0aKUDf1c/35b/0GiewE kYl0pOjUwjsfH2SY+McBwWDtgGfAHWE8GTV2h4yucUx8A09Oy9UvzmaEAfvqKnj35zc+ wtx6Q5kEftzfmTDqtZqP+7DwDsTGkHkyCjP1yflmj6gIYnrt10ZpfxXCB1r3nFxCmdOE xQeP9Sbr70sgExyOzfea3GOj4zF9AD9XpvSBDHwzOuH+OW8tcaI0PE8r6ZYs1o+stPsM Sp80hFWi1ciFx1gMnD0EDXs5LmliQ3ku++Fxfb/BGycRbF63kx72B47kRQ9R4bJ8Kkgm oV3w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=date:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:content-transfer-encoding:message-id:references:subject :cc:to:dkim-signature:dkim-signature:from; bh=uISftncO67WoLzla+p8VY4NBfhy2gZdxyOPNUQz2wWU=; fh=6LkEhNBL2mo5Mo+t6yemqdayPsF8SyUW68IBAGIUZAo=; b=0BExpTmlGBM1ZjkBVoiTSUBk/6lLyIZKoUj1zxtHPKUDM8dA0cnucW9tbKf9PMSe9S reYCnQaLltB9wODZ2zr6a7bmxI26VsXPONFEN/i4vDF9bZvj7OAI5wjp234i+n4+Nz+u FaIUyvCVanu9ycp58T+87RR8VVuoqso1KiAQi5LwdH8gnAfAVhqtqCFpijGMkWT+KAWF Xs0rLR9k1LDhfhdtEqxuE59QOMuQdpVUnyCNJRERH/Kb7CIWA56kpieV2Rvdp9MBGFud 2pGglp8El/zteL02M9pA20jSapeYbyalsr2h0/JtLo+znK2hG+lOYO1hlqPfBTAnhPrD oHfw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=iHJPLAG2; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-112469-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112469-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id u7-20020a05622a14c700b004313d2a1a2asi2114271qtx.770.2024.03.23.12.52.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Mar 2024 12:52:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-112469-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=iHJPLAG2; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-112469-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112469-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B696E1C20BE5 for ; Sat, 23 Mar 2024 19:52:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 119B95B666; Sat, 23 Mar 2024 19:52:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="iHJPLAG2"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="O/z/ck3P" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A11F65A10A for ; Sat, 23 Mar 2024 19:52:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711223528; cv=none; b=F/vEmgl0NbvI3i+TrrPZld+ez/dIMjhDjoh2tqm6KhXqHoZ36+4lUjWh2AFxM0ZYr7xtWSjiAfQfp756Myg01T5nEBuluBGaWK7jgD8LH2LdhrTe0gKm11ZsdpgMGYPgNqpaCqTJp11YY+ReXTL5cWzuzfxSLFuEmZSjwCii0LU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711223528; c=relaxed/simple; bh=NSCoOxI47MPHSdqcnwxqUyAs8NrmmH6uq2ngkSmUA6Q=; h=From:To:Cc:Subject:References:Message-ID:Content-Type: MIME-Version:Date; b=WtWHCxxKu6Jq3N4Fc9c6EDWrKBu0IZ2rfPgqvqdINN84xipzd1gxtjrlQ+1MioFfFybbsizKu9zI3KOfmWGZbXdspi14n8OCwbrb51VTZJR0phl+BX18Qt2H1VUnXadSxLQurS8U/5QxeBmxGUCQLqF2j/9fn7uqYX0/XlOXGOw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=iHJPLAG2; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=O/z/ck3P; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1711223524; 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: references:references; bh=uISftncO67WoLzla+p8VY4NBfhy2gZdxyOPNUQz2wWU=; b=iHJPLAG2GEaALt/nBYFq40KcGsCS39LgIICXkF4zwd2cdWo/LaVxuCSH0m+gY05nzSrqaL emc2ccnjIJB38zOT0lbX/QJAfwAN2ak5xkWq3j6CYxkai+By5F43RA+yN6H+PU6x0hPTrQ ihVouuLmFPu97mu5WQy2eIvsR8p7qQVc1Bu30+usdU5ozHyLWG0FaXWV6hxS+rICuyV94t Vwnjlj3kCwxsldoG/Bosa8Yg21FhQu8U9s2K6ysEtmbD+DBhCS0dE9bKXR0SGyqYdg8j96 e2gW5G4kmzrMHZngAZHLgKpsWk3m2qD0aZ3KVq9gdgcERjHrxr9htIXng46tGA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1711223524; 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: references:references; bh=uISftncO67WoLzla+p8VY4NBfhy2gZdxyOPNUQz2wWU=; b=O/z/ck3PGW1dROpeEnYJ2jxJ+khjsIYpHGe1XLVhLu/JwJ5LadvxH+Jx0I65Ehoa/Q3loa uW8awNY+JirXY0Cw== To: Linus Torvalds Cc: linux-kernel@vger.kernel.org, x86@kernel.org Subject: [GIT pull] timers/urgent for v6.9-rc1 References: <171122346785.2772088.10596056144848184713.tglx@xen13> Message-ID: <171122347264.2772088.18245020534552619618.tglx@xen13> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Sat, 23 Mar 2024 20:52:04 +0100 (CET) Linus, please pull the latest timers/urgent branch from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers-urgent-20= 24-03-23 up to: 03877039863b: timers: Fix removed self-IPI on global timer's enqueue = in nohz_full Two regression fixes for the timer and timer migration code: 1) Prevent endless timer requeuing which is caused by two CPUs racing out of idle. This happens when the last CPU goes idle and therefore has to ensure to expire the pending global timers and some other CPU come out of idle at the same time and the other CPU wins the race and expires the global queue. This causes the last CPU to chase ghost timers forever and reprogramming it's clockevent device endlessly. Cure this by re-evaluating the wakeup time unconditionally. 2) The split into local (pinned) and global timers in the timer wheel caused a regression for NOHZ full as it broke the idle tracking of global timers. On NOHZ full this prevents an self IPI being sent which in turn causes the timer to be not programmed and not being expired on time. Restore the idle tracking for the global timer base so that the self IPI condition for NOHZ full is working correctly again. Thanks, tglx ------------------> Frederic Weisbecker (2): timers/migration: Fix endless timer requeue after idle interrupts timers: Fix removed self-IPI on global timer's enqueue in nohz_full kernel/time/timer.c | 12 +++++++++++- kernel/time/timer_migration.c | 11 +++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index e69e75d3858c..dee29f1f5b75 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -642,7 +642,8 @@ trigger_dyntick_cpu(struct timer_base *base, struct timer= _list *timer) * the base lock: */ if (base->is_idle) { - WARN_ON_ONCE(!(timer->flags & TIMER_PINNED)); + WARN_ON_ONCE(!(timer->flags & TIMER_PINNED || + tick_nohz_full_cpu(base->cpu))); wake_up_nohz_cpu(base->cpu); } } @@ -2292,6 +2293,13 @@ static inline u64 __get_next_timer_interrupt(unsigned = long basej, u64 basem, */ if (!base_local->is_idle && time_after(nextevt, basej + 1)) { base_local->is_idle =3D true; + /* + * Global timers queued locally while running in a task + * in nohz_full mode need a self-IPI to kick reprogramming + * in IRQ tail. + */ + if (tick_nohz_full_cpu(base_local->cpu)) + base_global->is_idle =3D true; trace_timer_base_idle(true, base_local->cpu); } *idle =3D base_local->is_idle; @@ -2364,6 +2372,8 @@ void timer_clear_idle(void) * path. Required for BASE_LOCAL only. */ __this_cpu_write(timer_bases[BASE_LOCAL].is_idle, false); + if (tick_nohz_full_cpu(smp_processor_id())) + __this_cpu_write(timer_bases[BASE_GLOBAL].is_idle, false); trace_timer_base_idle(false, smp_processor_id()); =20 /* Activate without holding the timer_base->lock */ diff --git a/kernel/time/timer_migration.c b/kernel/time/timer_migration.c index 611cd904f035..c63a0afdcebe 100644 --- a/kernel/time/timer_migration.c +++ b/kernel/time/timer_migration.c @@ -1038,8 +1038,15 @@ void tmigr_handle_remote(void) * in tmigr_handle_remote_up() anyway. Keep this check to speed up the * return when nothing has to be done. */ - if (!tmigr_check_migrator(tmc->tmgroup, tmc->childmask)) - return; + if (!tmigr_check_migrator(tmc->tmgroup, tmc->childmask)) { + /* + * If this CPU was an idle migrator, make sure to clear its wakeup + * value so it won't chase timers that have already expired elsewhere. + * This avoids endless requeue from tmigr_new_timer(). + */ + if (READ_ONCE(tmc->wakeup) =3D=3D KTIME_MAX) + return; + } =20 data.now =3D get_jiffies_update(&data.basej); =20