Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp506498lqp; Mon, 10 Jun 2024 10:23:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUVGz+LYS6KplgzuxajWm/5kWRBYyZHs1/+XSAxAKNecITW9ESfTvdg1D7BDSmR43sGSnL/FELZGGC19iIQa9XpqOz5gMmuW6kHseDL8w== X-Google-Smtp-Source: AGHT+IFCJ4yGZHp5tDtMlSgrMEp/0JAMOSAslXwCHvK0s7lpytqL+baaeVQ1o8tg5MJy08dYJbQN X-Received: by 2002:a05:6a21:3384:b0:1b6:dc09:45b8 with SMTP id adf61e73a8af0-1b6dc094c6emr3507275637.2.1718040198918; Mon, 10 Jun 2024 10:23:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718040198; cv=pass; d=google.com; s=arc-20160816; b=SJz5sRqWIybsQ9GKvCJHfto44TCxHTkS6ZpD8sxWG6un/xzEVzlUJp90GVg5IoSIS1 gHTaulwAMu0AAXbwipvgjTHug7IqbHVGYHMMm/r0sfklB70h6PTaNo++Co9cusG78Tfz Nbh/I8vouzkuYcSPo/p5mfrj+WRINRq3+4iY1FjzU/4qVWZt1INaxY8llH8HHTfZKs6m r/2pZIy2X08voGcEyXuxJJWRrwlbeqA+1KGuVjHKof9DDazGS6SwohhzQVf6ZsTBqCd2 EHH0GVt2cXnPqtWV+CqTJNqa6Ttvpr3Aj6wO3sT3fM/5qkCNmN4ICK5aiZXteS6xFiSZ 63jQ== 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=YaptIe9AIwN0Uz+MGsnUrLpVeMf07AIJW8twn1C/y0aU4/88WeMW+e8KjOylMh9pQy vVmztr2+D2Mqt5tFRF46ijBe7404Mcuk+M/KgQ0+sX7O4W/gGBba1nkz5klMJelgxMQP lbVZAAP0nhv9AMoYsPrJa+B8ESafJCjsuy9GoEuQYAMVbBXW9xN7ZCMpH/GdT/bLWrcl hMiC1mVX/VgV4xH0wqOmQN1pOc6xHbp602lsibUqEv4xu1tIh4uUfMHz4/C65+G/kNBK ERBIRPY7doCeA94MVVf1pg/zDg1AVb4NJybcZGmM9Mk9BXhxDRhluMfc6u8ogFtn20Yg +UaQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="d/QtOnsL"; 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-208585-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208585-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-70424cc99b6si4182613b3a.341.2024.06.10.10.23.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 10:23:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208585-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="d/QtOnsL"; 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-208585-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208585-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id C62FCB2767C for ; Mon, 10 Jun 2024 16:46:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C6966155723; Mon, 10 Jun 2024 16:42:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="d/QtOnsL"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="RpXGGtna" 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 78FCF15532C for ; Mon, 10 Jun 2024 16:42:34 +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=1718037756; cv=none; b=RrB4t3MguVIvYN1CVab9c9G8rD2bbtzxzixqOUZ41oiOcQ3qCjJ3UjRHUs8zUTmh8sMa3sHSjpFTdTQuIXqTW6aq+oWCWpdL0wyhnZya7+n24R93FG47yFqjauHVQ6MlZ3bR0jwUkfzUb9FSlPoaD+uYYC1iRUFZITuU+kS+4Ms= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718037756; c=relaxed/simple; bh=vhFqJQGzuzFxet5n8aXmRbKfqxdROxlKhbpES6yLgrw=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=mDQ3f+qDXEbS9ty57abXLrwYUZzOpkkU+FSH3lu4Bc/iCkLpf6slg2O8G9GMbgYpDQXLy62rRfHXiMN2xxdaSMMXClFJjLapct5RsIUGkM6o0X2Z9KL4QxTF0OhNWhGYhmBX82+w4lbU8NoQ8DaaxFS5gsQvcn9sU+Kap3mcu+Y= 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=d/QtOnsL; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=RpXGGtna; 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: <20240610164026.806827615@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1718037751; 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=d/QtOnsLXwSrRyD4OQFjbIWOO9L0WzgvJMrFQGNL6KQP87UpFEY1RFRj8PC+PhVaO4rt8L xNSP2IpyhWJjzpHShGWc148GPKN3Hg5mP8UdFCH63+xZ/q+GEB43POzUiVCtabVXWVRsY3 J4Bf12YfNFyyqHpheXqAB+njkJ7bRvzzrilpXXncQHWfi6fZB3FNVwQ9pZUUkAVKZYbRyu Lems3DOVkFWV8+XGBH0rjJnKUmH1cwJSwd5tbJi4gW0rHCrtTzKZjCd33IAihb4qv/jbil tuhVOfQK2pNBJeuoiTlLuQBBEfSJP6pjbIYAjvT6RlZG1zakVPGgLBzdS9jhCA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1718037751; 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=RpXGGtnaW6cMxPb2HqkPy4S73HLLyYlLKCi+DZ7ybVHtpoEr1TBWUiZ35Yc4yjIeMtY8Ya xb6CJ+fGuS7fB1DA== 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 V3 21/51] posix-cpu-timers: Make k_itimer::it_active consistent References: <20240610163452.591699700@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: Mon, 10 Jun 2024 18:42:31 +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; } /*