Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp296200rdb; Thu, 1 Feb 2024 08:44:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IGFVjmm+zSOIkTIdyfZ1nQXTjqXE9Nf7qHfk1GUv99+Ij8pZNUEosMmR3zmvwHXr6Y0/KmH X-Received: by 2002:a05:6a00:391b:b0:6dd:8738:2c8d with SMTP id fh27-20020a056a00391b00b006dd87382c8dmr6822417pfb.26.1706805859672; Thu, 01 Feb 2024 08:44:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706805859; cv=pass; d=google.com; s=arc-20160816; b=I7JSNedwPp2fN/x7g4qKDqrWpIvtCTRqIcWTdr6rq2UO+kYGoYs+IQn93YL/tTjRle IwKc4rEcvAf6R8YuCTW8AfRcFTpZtjXoSa7ivDk1yDNM9XvpNXKf6ZUp7UhMxJ1kwa1m YWX6+Ncr8cVtX6QY2nkTLq47vpahbyM7BDziaL71cyHQMaQdav3xqVCIRw+OmS/XSOdS r6TaHBlClZmOOfCN0wC/YPqnKi5PUBLv6mOyZvQcTGrjU6CdF4l/imT7NQoQ0nzc3CVE ixChwwBiZzdF+UVto1y6TM8p9Ze9Cq8qnxyLKa19sevrz7ILzT+E8775IBu34UD/+P0s 6s0Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=eK80wbix2gT7A77OJAZaIg0Cdtc0xX7hxnR5jipSYU8=; fh=LXNE0kRczOowDze1nY9Ul9ttlSTK17j9sBJILVngplA=; b=Dyf8Ok5lAektQSNI1geEg9sgWVa/fDP4DxaPCPvPcYzIIFEsWc3hYPVqHcXsVEJ8kJ zzymy8w8X9mIfP27MmmJN9Ns1Bl71D3vpwizYkzVj+1FTH2ghqEMrtiUIqw8Ed/59hyp 6MJWJxgVhs0/oSPMxmZ+shscJOnPoCL329DnKMKSIAbok79PY0lZLKFc4vA7V6/aroEi crL6lbAjcTDzI8hCt5cTzIZaxVCUaDy+Hqdgz4pe6l4YHpH4nhJBkziOg21LqicYW2Jy 2H/B6usgZPazfH03zH1+eNshkflnE+iMer04p6ApNFiwjo/UtuzGepoTlLvo2sMosfgD 6pWw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nw9t4vA1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-48536-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48536-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCU5DfZXzRgKoJ5NwRUsGtyeFoVXjdZZUoNCGkmuxvVuJylNaoYNpccfcztUDe4GjmrNqaSuxnHCanW+st5bYp4DQxqfNVwHLbj6LMvNyw== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b4-20020a056a000a8400b006ddc80e5366si12713107pfl.86.2024.02.01.08.44.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 08:44:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48536-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nw9t4vA1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-48536-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48536-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 036D72836BC for ; Thu, 1 Feb 2024 16:33:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1D43F2C687; Thu, 1 Feb 2024 16:33:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nw9t4vA1" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 42E6F2C1AE for ; Thu, 1 Feb 2024 16:33:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706805184; cv=none; b=OkdHncSAPiZqmWxC+pmeaxUPo2t+hNNABzh/cMGx/RJzCg5y0FjAPS5b+cj9kr4Gb8qJmgwiY5bqVg4dUoMp499gtUZpSvIV5rEqyRxEcVnBAvF/8BpP0z9Rn7pvCt4i5shWkAXzfZlNyiu3n0LBrMjA/Sc9KmZmY+jRMCyPXTw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706805184; c=relaxed/simple; bh=Qbj8bC/1djsl/mFIrDJjtIIWu8Mt7SSW3NUMv5sfBBY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dYNXhPW0g3TvXdtAK68p7wG5A5a2N65kXyWgWgpBca5eRcO/wqctsn4UWN9qbsEEIfUgibTWu1i6V1sSj1cqt1jzpWr/Kdc4OAvRKrhZbXQTor9dCEebJMS8DzJbFCpzYoU5qWBfx9TaxUfa64M32HYjH3CDkUHDV8jpB1Dfpu8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nw9t4vA1; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 375D4C433C7; Thu, 1 Feb 2024 16:33:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706805183; bh=Qbj8bC/1djsl/mFIrDJjtIIWu8Mt7SSW3NUMv5sfBBY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nw9t4vA1lCCoPasrABF2ca+EBAhDPTCM5PPgXWU7bJ1ID0s940UZkOJ2eyGo7qBsw HlaRBoPen+OlTnJKjWTZ5e+I0+ttu7PQf5gGZatGGHAt0bUDrBkIKjLcHwu4/8WaK4 GTh/Ts9Fbs/MzYL/EBpNmnnZyi6PSbXUxn1CbE2zd3yyApkHSGigR/6BQLlFRWtVyq QPSI/kHTwFuD3F13O7+/RbWe+5dZQ62r3KsRSTLdMQ5RzZQ0AcfMYMWsRHtjTDDzYv XNY5Oksxi4He9wvMsQXiy92VRXaw/AYE454DuSsb0o1dIRuSVXiq4YPaI3YqwpcDVY HL5zCzwBY+QBw== Date: Thu, 1 Feb 2024 17:33:00 +0100 From: Frederic Weisbecker 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" , Rik van Riel , Steven Rostedt , Sebastian Siewior , Giovanni Gherdovich , Lukasz Luba , "Gautham R . Shenoy" , Srinivas Pandruvada , K Prateek Nayak Subject: Re: [PATCH v10 18/20] timers: Implement the hierarchical pull model Message-ID: References: <20240115143743.27827-1-anna-maria@linutronix.de> <20240115143743.27827-19-anna-maria@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240115143743.27827-19-anna-maria@linutronix.de> Le Mon, Jan 15, 2024 at 03:37:41PM +0100, Anna-Maria Behnsen a ?crit : > +static bool tmigr_handle_remote_up(struct tmigr_group *group, > + struct tmigr_group *child, > + void *ptr) > +{ > + struct tmigr_remote_data *data = ptr; > + u64 now, next = KTIME_MAX; > + struct tmigr_event *evt; > + unsigned long jif; > + u8 childmask; > + > + jif = data->basej; > + now = data->now; > + > + childmask = data->childmask; > + > +again: > + /* > + * Handle the group only if @childmask is the migrator or if the > + * group has no migrator. Otherwise the group is active and is > + * handled by its own migrator. > + */ > + if (!tmigr_check_migrator(group, childmask)) > + return true; > + > + raw_spin_lock_irq(&group->lock); > + > + evt = tmigr_next_expired_groupevt(group, now); > + > + if (evt) { > + unsigned int remote_cpu = evt->cpu; > + > + raw_spin_unlock_irq(&group->lock); > + > + next = tmigr_handle_remote_cpu(remote_cpu, now, jif); > + > + /* check if there is another event, that needs to be handled */ > + goto again; > + } else { > + raw_spin_unlock_irq(&group->lock); > + } > + > + /* > + * Update of childmask for the next level and keep track of the expiry > + * of the first event that needs to be handled > + */ > + data->childmask = group->childmask; > + data->firstexp = next; So assume we have: [GRP1:0] migrator = [GRP0:0] active = [GRP0:0] nextevt = TIMER3 / \ [GRP0:0] [GRP0:1] migrator = CPU0 migrator = NONE active = CPU0 active = NONE nextevt = KTIME_MAX nextevt = TIMER3 / \ / \ 0 1 2 3 idle idle idle idle (TIMER3) Then CPU 0 goes idle: [GRP1:0] migrator = NONE active = NONE nextevt = TIMER3 / \ [GRP0:0] [GRP0:1] migrator = NONE migrator = NONE active = NONE active = NONE nextevt = KTIME_MAX nextevt = TIMER3 / \ / \ 0 1 2 3 idle idle idle idle (TIMER3) CPU 0 is the idle migrator and its tmc->wakeup is TIMER3. But CPU 0 has a local timer that expires before TIMER3. When that timer interrupt fires, it raises the softirq, which executes on IRQ tail. So CPU0 eventually calls tmigr_handle_remote() before TIMER3 has expired. This leads to tmigr_next_expired_groupevt() to return NULL and then data->firstexp = KTIME_MAX and then tmc->wakeup = KTIME_MAX. Later on, tmigr_new_timer() is called with a KTIME_MAX global event and so tmc->wakeup stays with KTIME_MAX, ignoring TIMER3. It looks like you need to handle the tmigr_next_expired_groupevt() case returning NULL. Thanks.