Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp511199lqb; Wed, 17 Apr 2024 03:11:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV9+4IoCSBb4rqHk84Yv+5VXxR44D8JYGqcOyc3q/5/mcx1ETjBGw1MohjSbkvuYNFTNplGhSBHwMT+QX1defZOqw2Cb7DkoO5ysCLPEQ== X-Google-Smtp-Source: AGHT+IG6k7Mq0M1sr5X/H9dgW1SrMRNZpNGeZ0f6v/ebva3Uvjj++LBvBue3CZOk1PBc8iufUlOE X-Received: by 2002:a50:d4d2:0:b0:56d:faa3:7dac with SMTP id e18-20020a50d4d2000000b0056dfaa37dacmr3917012edj.9.1713348715917; Wed, 17 Apr 2024 03:11:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713348715; cv=pass; d=google.com; s=arc-20160816; b=GqPjFtPvX4eZVJ7bY3T01fFz0akR4KWc/8C9BglCUabarghyaU+sJVMUq00+b02Jp3 QiSpd0flz0fsffBI/bsHAXTBkhSaJffT4onNB5ve4VAF23MOCdEivlENOba5xXD4c6SQ IddAub9nC1y6KO7Th19YHNzmm44ipKSmecnDc0KvVnbETu+qRY+ttKF5lc3AP2QkCjW0 bB22I5+OScFlKs1Yfjsn1eUuAHY+M7H5qicRfgZbBhazfbS9h662hhG/MPibTiH+Qxra 9oJt4VDsiS5zO/nGZouIeDtxL3mk8Jcxr1o500XsCVFs/+bGdw8qxsKL8v/B8GqLxFam iEhA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :dkim-signature:from; bh=PHGrCYyIXJXPc0UebXQRWLCm9Bbzq/e0Q6atneHTgEc=; fh=MxOqrKe8Fax3kxE77rA0inxVaQwZCyEyqDk4Qwcbk14=; b=Koz+Y+hUdxE28LJVYo1r6klO9elkHdDtO0gxTP+mXN7rJYVWH0M0n52RlaeDHwRKoJ oCJVrkTGvf8IwicID5GdF+vHOwkBguXmNsb6hF4w/LEuyD+KEMk7My5295cXlGfMAkCg buie/9DdeNT84UIDLKQsJ8j/8PG/dwydmrNJOoPzF53pIRno6n3lAsVdsH6QTNmOZ1Sr GZ2K9Vt7NPCjeeutPw4vC6YwffhEh2T5fsdQOW16WNbw/MpRXLNayPUWBcNF0RBp07Md Z911g2DB0E9dz1HN3LafU3sRw0RmuhZbdkj/ey+endBmlhYCDfb/l85Omm3+jwVWIev7 LNYg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=oQA29wj8; 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-148292-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148292-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id y5-20020a056402358500b005705bd978bbsi613361edc.43.2024.04.17.03.11.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 03:11:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-148292-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=oQA29wj8; 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-148292-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148292-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 6F4001F214D7 for ; Wed, 17 Apr 2024 10:11:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 480F713AD12; Wed, 17 Apr 2024 10:11:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="oQA29wj8"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="6ELvIzSX" 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 0FB431327E0 for ; Wed, 17 Apr 2024 10:11:29 +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=1713348691; cv=none; b=OxOMOejeXSJjguem2Cqj2NszMdrUtyMCGeshd9Kc0xrU9yOpPK0WhxWCZ5THMWDKT7aUnP/RAK67kyn8ncp22CF28Ejn4isJrZjcgQKEOXe+2PXoION3fCs27F05ZmG8bjl9aVqOO3sPK9uFEnNh5qmtbjjiTWlo6Ku1EH/hp7w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713348691; c=relaxed/simple; bh=KSWYUci3DoV7DaS5qMVVGhRJ/5tUi9813wRP0Nrkbno=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=rThQbE4m3VDGIEz9FRyXg4MLNEXvSQGHN9HmDMVLcqbjq2GdOOvkqH227s8tlnCPskkM8rt2E0ufGOnKfgU+9w/2+TWTMDxIvVjYLi7NNlacmPk2J1iJD9PJkczHtThIWLxSgORVLNmIUerKA3jc3mSMj7HvB9UooGtOlzWORLo= 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=oQA29wj8; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=6ELvIzSX; 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: Anna-Maria Behnsen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1713348688; 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=PHGrCYyIXJXPc0UebXQRWLCm9Bbzq/e0Q6atneHTgEc=; b=oQA29wj8SGodx3GSqF8saTFiv4dvOfpwN8oNZ54G3Q/t44U52TPAWO/Vl8CagJUS15W6Fl B9pmGftfxDT3VSCnA8BxSnV/ZdbxO6fATzg/5HDExBnkl9U/Wf6Y36FKMZYFDEeW3ncBib pDFfZGGKpAQU37gCQA4pEpR7eQdl5ukQQQm5oMQ3nwjE6dxF5w2c4SOWK/APCtgCeZCtJu kP9QvuOtPN1HJ0WoMG1hHiuf6DAKPwhyqBK0x32FaVX6mz0zVLP3Z0KdijnzWnVJ9o5OES 6N0BTQdCp+xrk9UJHNSUZIhmvzgqisJgisTPtYlIHXECWNDSQm4reZlAfsZqXQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1713348688; 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=PHGrCYyIXJXPc0UebXQRWLCm9Bbzq/e0Q6atneHTgEc=; b=6ELvIzSXUnMuE3hRvx/mB0YbHZ7x+OxUNWQRGKFNv0L+3bI7aqE6CjkZg6AA/L9lHcmSJF HfoVg+xA8NFrFhCg== To: Thomas Gleixner , LKML Cc: Frederic Weisbecker , John Stultz , Peter Zijlstra , Ingo Molnar , Stephen Boyd , Eric Biederman , Oleg Nesterov Subject: Re: [patch V2 21/50] posix-cpu-timers: Make k_itimer::it_active consistent In-Reply-To: <20240410165552.256162566@linutronix.de> References: <20240410164558.316665885@linutronix.de> <20240410165552.256162566@linutronix.de> Date: Wed, 17 Apr 2024 12:11:27 +0200 Message-ID: <87le5cwb74.fsf@somnus> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Thomas Gleixner writes: > 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; NIT: you could change the order of the above two commands, then it is in the same order as the others. with or without changing the NIT: Reviewed-by: Anna-Maria Behnsen