Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp65736lqg; Wed, 10 Apr 2024 15:50:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU6p54w4V7ZHn0mZm57wmYfeH9wQnpgEMBhLk24HCpOPy2mhQkhlIwWBJLKIoExQifD60nkhjluvoEt08bHC0WaTi1JknTnd8kKk2oWMw== X-Google-Smtp-Source: AGHT+IHF4dLi5/M0Bxur1kxyaTKr1IJQbycqEntpatCFgEUotBlLIPRvak6gcVsVR8Vi+I4pZFZs X-Received: by 2002:ae9:e418:0:b0:78d:40df:9a58 with SMTP id q24-20020ae9e418000000b0078d40df9a58mr4485261qkc.50.1712789440912; Wed, 10 Apr 2024 15:50:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712789440; cv=pass; d=google.com; s=arc-20160816; b=yecoYQexcazPuVjKnYIbLSZ+Vtw9Nej1MRCDhIRChxv33gKbvoD3tpcUJPAE2oFZp9 j0yumtCzV/vMRyt9+nGQ6a+Nx0SXAHZTvEx6u52nsO0fm4UyDLvb0U7iPJ/znNbzdhZH ab3t4szD8bRT3JYXMe0ruxeTlPrxGCIJK6+PR8AjRuiZSY0xL5raliZvt6kESkrXdWlo SdNblPEjKtwGUkfZ+pnmUsd9wtiKdwLVYpa94Me0FkOlS67M+xEz1ImRGshEuS3dsGox BXlum7bAyG/Vw7BebJkqrNz90EOi14ejraJuuy3/4OMcRDgM3+oqvE5D3XNSspimlZql i7Wg== 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:references:subject:cc:to:from:dkim-signature :dkim-signature:message-id; bh=ftWWtT5tkPA9yVyOVqrZETMprBLvt80uYl9BSpWJ448=; fh=joBs/8L+orz77ylyCy6wqNwwi35f7sYhLR+/TQjQjhI=; b=CNrBNlBthdgx0RZt8niDFtdpz5uELR6v+3UAFLsqHMRzu8Qk0DJidPIYNdZ8BT4zLn UVIP6HSLcxUETqo1ICoNWcY/FaIRb9WjbOZzLCqS4zgg3WWz/OIJLYy1Qeq2ws+gvf8S vtcZLTpmpp1dQ7gBdE+Ux3OMLuBVshWLvdKClmfjs5CSN0Mrl01ynmlGdFVTYZHV0kuf fHQJpu5ddVsRAoZb+HOzIJlwKMpkdej7RxPyQudEozBKR4kD1rrlCFQDAs2/+iXZt/b2 Bj2rckUDrofDiGUNppFJbGC100ounL59RLdFXvmudB43hFFUsJezQHKQ7f38+8pM+5dz 3GYA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=n0xnL1QA; 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-139474-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139474-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 h3-20020a05620a21c300b0078d6461cf25si251152qka.409.2024.04.10.15.50.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 15:50:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139474-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=n0xnL1QA; 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-139474-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139474-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 A24561C21807 for ; Wed, 10 Apr 2024 22:50:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9D78C535D2; Wed, 10 Apr 2024 22:46:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="n0xnL1QA"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="TvDSjwNs" 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 6AD4C524D6 for ; Wed, 10 Apr 2024 22:46:51 +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=1712789212; cv=none; b=Ipfu1oikJaUUR7VK5iDd+pEvgWs8fR5mhPP+QmI5d9a36L5R3F7jXx5kOEX5tuV2mfVJIJwbVYf2acV4LxRNdZfR/98Dcb+sgVxlmC2GuADkCo6ZotgyigG4LPagrte7s/Lj59C9Gx3F8sGhdcg+kYF2Gyt4VCQ3mRRIpY2QmQs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712789212; c=relaxed/simple; bh=vhFqJQGzuzFxet5n8aXmRbKfqxdROxlKhbpES6yLgrw=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=En8uITqZj243jotODJpxZ1f9h8NacWV6Jl6IMO63BSPJ0aSk9b3lG2C/206NvH0KrLmyguAWIMn7OuFe3xr0gk6lZbOltzEOJ0wD8t3T6pQOrhBKo3B7+CKpZbx8M1yaYVZq3e25kIFYaPQar9wOZwyQkSryZXygHkzpgOZMzXk= 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=n0xnL1QA; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=TvDSjwNs; 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 Message-ID: <20240410165552.256162566@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1712789209; 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: references:references; bh=ftWWtT5tkPA9yVyOVqrZETMprBLvt80uYl9BSpWJ448=; b=n0xnL1QAZmGNIlBKmm5arU5JQ8EByh6Z8pzopn+PzlDB8DVN/rrHfFRVhysvd3GxxbZAOF yfK/BhFt9b8C0VR8XMhL5i6uwoMEpvIIh+Bb3tuW5jUeqpKkIjzU6JKcCUAsJ5+n6++sqZ 01KSkyzPWn8mQsUi422bDWabuYRfnQOXPQUhnWl2PvzAVUbEc+k9f0MA/1RgZkPdUkg4m1 gRzapxLU7BkbhRgPEuNlotXHQIkaa5iLw/2zrAFMBGlSkF6CMm/7SOwrCxx+yXk2m1PXVL GklRu8d5SMDPqWULVvkYK3Z/OqpBffflp4xnDVlRFqCZL5m8KMUJjcxqfY2AXg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1712789209; 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: references:references; bh=ftWWtT5tkPA9yVyOVqrZETMprBLvt80uYl9BSpWJ448=; b=TvDSjwNsrAIUqpDrYI/G4XS8W+WaEhBJ0yKCEifTAo82F9+E+09y1F0LfrSlpfEEwxAgrz w9ByE4gpnpXu9eDg== From: Thomas Gleixner To: LKML Cc: Anna-Maria Behnsen , Frederic Weisbecker , John Stultz , Peter Zijlstra , Ingo Molnar , Stephen Boyd , Eric Biederman , Oleg Nesterov Subject: [patch V2 21/50] posix-cpu-timers: Make k_itimer::it_active consistent References: <20240410164558.316665885@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=UTF-8 Date: Thu, 11 Apr 2024 00:46:49 +0200 (CEST) Posix CPU timers are not updating k_itimer::it_active which makes it impossible to base decisions in the common posix timer code on it. Update it when queueing or dequeueing posix CPU timers. Signed-off-by: Thomas Gleixner --- V2: Move the clearing to cpu_timer_fire() - Frederic --- kernel/time/posix-cpu-timers.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/kernel/time/posix-cpu-timers.c +++ b/kernel/time/posix-cpu-timers.c @@ -453,6 +453,7 @@ static void disarm_timer(struct k_itimer struct cpu_timer *ctmr = &timer->it.cpu; struct posix_cputimer_base *base; + timer->it_active = 0; if (!cpu_timer_dequeue(ctmr)) return; @@ -559,6 +560,7 @@ static void arm_timer(struct k_itimer *t struct cpu_timer *ctmr = &timer->it.cpu; u64 newexp = cpu_timer_getexpires(ctmr); + timer->it_active = 1; if (!cpu_timer_enqueue(&base->tqhead, ctmr)) return; @@ -584,6 +586,7 @@ static void cpu_timer_fire(struct k_itim { struct cpu_timer *ctmr = &timer->it.cpu; + timer->it_active = 0; if (unlikely(timer->sigq == NULL)) { /* * This a special case for clock_nanosleep, @@ -668,6 +671,7 @@ static int posix_cpu_timer_set(struct k_ ret = TIMER_RETRY; } else { cpu_timer_dequeue(ctmr); + timer->it_active = 0; } /*