Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp566605pxb; Fri, 13 Aug 2021 01:02:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzV4jqpveFKD17EQgmf1mTNteX6T0rtnjkkxHmb0elOVvJ3orMHp5+7A5L9Hli8PWTPRpsn X-Received: by 2002:a02:cc21:: with SMTP id o1mr1123433jap.114.1628841749901; Fri, 13 Aug 2021 01:02:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628841749; cv=none; d=google.com; s=arc-20160816; b=Xc3+1l0Y5xgxkH+ogYUTqI6YB53WGmMhSTPotUqlY6vEjmUo6rPkioyllMlBe1uZx9 WRasf9GDc5AscRIoxPpp2N9yopIQpXTAWoh2swcGCffmtsbDFIreCrp1c2zglUS0i8RK mpbuVny6UZG6XJdziOB1hL9abN2XTry29akbOuzwvK0Axrq6cNJA/P7rWifrp0fSKNwo T2le+Tj5ugp97PekU+jM5+2I7T45vv0C0RB3ASUj6qwSDXTqB/vhGxUu3qej6C/MMPvN rsfcaBL3yWaaIrnPUWOSWgbECvmvpX/r9QrWG3e7tK83HBlLSXPAf6E+ipClPm6e29ip Tieg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=4SzenS3v0C8mKzBqnFz4wtCWqUZ8Hxyl8xs0PNOkCDM=; b=JKvr/8cYEYkIuLA0VU7aat5SQxg++FC5PoEthI1qnKzHZUO3cVNVG8dYt4iBx4xxO+ 3dYWvMBHxE0EWRUefVeXE8/diLvK9gaEhriNZN3/InO5CsGfakkd2wh5EmaLXlUZcman ELRUDz4SqsE0pDOuOiiq3LSqZNMK/pqgcegHVftozKAYl+SdSIgB+h7L67SnpwjzDZQy FaSzcoUVbJlXzQ4QIRsz1z06hZewYi+5Rzx/rD6olxoeIrb2LV0K/3nH1xDK+NYfP2Sf +mEjvj9VSmzNK3nLVGxM+5eVJf1egANeO6FIYpnYuAyV61Z1aOTglfn9mm7Ia0Z2o2+w SeAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=L9LbdNDQ; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e128si847512jac.31.2021.08.13.01.02.18; Fri, 13 Aug 2021 01:02:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=L9LbdNDQ; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S239548AbhHMH7Y (ORCPT + 99 others); Fri, 13 Aug 2021 03:59:24 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:35352 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234844AbhHMH7Y (ORCPT ); Fri, 13 Aug 2021 03:59:24 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1628841536; 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=4SzenS3v0C8mKzBqnFz4wtCWqUZ8Hxyl8xs0PNOkCDM=; b=L9LbdNDQYHpl4ube54bWMV93zLc1O98rtxT34P8capeHCXV5dNg9206/c90rv0Qc2jelcI M9ZULsdGMKPShL6Ba+aXz8WbJhmq1uBQAk40dgxf0b3peHQfRE4xVW5acfhwesSdV/vzop cT8oR7j6Ii+eJ3w984Czsg04EO9AY29fUiA6rRdBhqKdVsNd0SQe2yl/ym2BCqSAbJ+N/6 03ERz4mQrpK45LFML+5bNXuQ9z74LhrDrcbuyHsPnH0ezZt9z+ZB1NEXufOV95Y+neH1Ax RGgQTgz/j73qBjmFpgDtCf1kc73caT5ypNCxV9GP3DcFdGPMQkwxi7mo0od5Qw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1628841536; 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=4SzenS3v0C8mKzBqnFz4wtCWqUZ8Hxyl8xs0PNOkCDM=; b=fdXtnLamNiTpGGar32U33o9zINXDrO9RLBvBA2K92xJAIKG1NLcvAv4OZqTZcQXKs2Va8l XD3+v18BiUD1MqAA== To: Mike Galbraith , linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org Cc: Peter Zijlstra , x86@kernel.org Subject: Re: [PATCH] hrtimer: Unbreak hrtimer_force_reprogram() In-Reply-To: <8735recskh.ffs@tglx> References: <20210713135158.054424875@linutronix.de> <162861133759.395.7795246170325882103.tip-bot2@tip-bot2> <7dfb3b15af67400227e7fa9e1916c8add0374ba9.camel@gmx.de> <87a6lmiwi0.ffs@tglx> <877dgqivhy.ffs@tglx> <8735recskh.ffs@tglx> Date: Fri, 13 Aug 2021 09:58:55 +0200 Message-ID: <87zgtlbwsg.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 12 2021 at 22:32, Thomas Gleixner wrote: > Since the recent consoliation of reprogramming functions, > hrtimer_force_reprogram() is affected by a check whether the new expiry > time is past the current expiry time. > > This breaks the NOHZ logic as that relies on the fact that the tick hrtimer > is moved into the future. That means cpu_base->expires_next becomes stale > and subsequent reprogramming attempts fail as well until the situation is > cleaned up by an hrtimer interrupts. > > For some yet unknown reason this leads to a complete stall, so for now > partially revert the offending commit to a known working state. The root > cause for the stall is still investigated and will be fixed in a subsequent > commit. So with brain more awake I actually managed to decode the problem. It's definitely the expires > cpu_base->expires_next check. It not only prevents the NOHZ idle case from moving the next timer interrupt into the future, it also causes the stall when switching into high resolution / NOHZ mode. At that point the initial base value can be smaller than the next event which prevents reprogramming and as the base value stays stale it prevents any further reprogramming unless there is a full update of the base which makes the problem go away. TBH, that optimization logic to prevent reprogramming the timer hardware for nothing is a bit fragile and non-obvious. I'll have a look to make this more robust and less obscure. Thanks, tglx