Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp65127lqg; Wed, 10 Apr 2024 15:48:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWCQmuWO0A/w/jjz98DzR59HKNXgPQe+pW5G8mjgmrQiyt0CdrFulHqI/CHVNYWRb4wzv/0K4rZwNVKO90QnKYeZJRs2eCbBwbut7JzxA== X-Google-Smtp-Source: AGHT+IFRkcaUazROfY/0EgADpNb+v9Pje/5EKFT6OxwtbTq38jmDsr0/4oDf6CBbmBD64UkiCwX4 X-Received: by 2002:a05:6359:1790:b0:186:29ce:3982 with SMTP id mb16-20020a056359179000b0018629ce3982mr4940470rwb.24.1712789327263; Wed, 10 Apr 2024 15:48:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712789327; cv=pass; d=google.com; s=arc-20160816; b=PM9J93dIBuVmzcZuPUgjLV4WgangUHXT17VRwXNYgTohU0vPlvpG681zyKJ5yT6CZ7 b+hUUcRI5RXbboKZOT3rf5VrOOyYmYZcMc3wGIqhHJCtTgHJEuXLEKmftbsrdHrIgpIU 4XnWuw+kSB6q9RWhp/7/jVvOxHJ6bAglk051UcUesRZ7MN7kojeJd5t2AW9ETYfF2Sxw 0vMJSA4Q8ch3AmqRcd0/XF5wDSczHJUb0IHvsfDBMuz5u9RlhknNdFQQ+I6kkp2dWsXH aYd/txQLsBU3XB/7sIBXweJb/wC2Zr2Supe4UCkSzRdQmuwrJMCNc4owlEEkF3R1gomp Eq+A== 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=amj9rEI4omA2o9SPkzdGtXDAK0TjsBjy30f0aomhQz0=; fh=joBs/8L+orz77ylyCy6wqNwwi35f7sYhLR+/TQjQjhI=; b=b+Zez6qSBOPsOSIKU7r8IgX+u3d6Zml9I+dN5XVO1jLxqPYPnao1AhSTQddOe1SZls fE0EMpFaL8wkwVhuoXoGg6x32AnBTxfhm9QCJph/6msMOA9tjWUiZSuPmOAgG0/+tdvf gvW267GX5spFPs/giO5ervuPo4ZBcseaP9PrkY2ck+hjMk+3/BmPBHl4PfhR7XIy/gG1 DghhGkbJl6tgoSWVPeWkAHQVI13VJsoPhxU2a8nh7YBYPAuu8RdFAr0n3ilVl5Q1Ap1w DtrFMNL0SBu1yU9TCjhlqJbLG264iQ88mzbhVtLr1oSCnwObzeOKCSiQYQ6prvXdODEI aFrQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=X1XIAc5i; dkim=neutral (no key) header.i=@linutronix.de; 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-139464-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139464-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id g12-20020a63564c000000b005dc97ac8afcsi96597pgm.125.2024.04.10.15.48.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 15:48:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139464-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=@linutronix.de header.s=2020 header.b=X1XIAc5i; dkim=neutral (no key) header.i=@linutronix.de; 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-139464-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139464-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id D4CA3283B84 for ; Wed, 10 Apr 2024 22:48:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E94A7481D0; Wed, 10 Apr 2024 22:46:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="X1XIAc5i"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="RBNNpa/c" 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 BBFB947A55 for ; Wed, 10 Apr 2024 22:46:33 +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=1712789195; cv=none; b=IvYGXJliPSfGBgNb+uiohsbhF/tBH/onmUbQM6sPYx8vykrB8UMXNZrauGummfgY27htD55Fx+YqXzqKEHiU5pF/buT7AQ0WWeBNZdPcjli4YbRVoW9Pot/tu0JcT10yvwbA8OphX9hn2c4rARBrO7dUmv0P5lTmScDtfK/czPo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712789195; c=relaxed/simple; bh=ELAaPaGkJq6p3gTMdWaH/+B64HkzxUph4WcIXAbdkUg=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=sW+FWeWGQBGScwdZUr3CNDEsQG9ybJVFO8lwDXIPzbih1AGEGvWILwqJ+qLENOWVPH4uir5cuNXp5gBmVyW0O1Cl0QJFuYVCnftGtOiLMkOK/b7EDdOSRw/cspg5bC+MW2F008Jqe9QJjmlGTnjLA7LBdgWC6svmwA05j1rqvSQ= 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=X1XIAc5i; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=RBNNpa/c; 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: <20240410165551.635345704@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1712789191; 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=amj9rEI4omA2o9SPkzdGtXDAK0TjsBjy30f0aomhQz0=; b=X1XIAc5ij2T1DenkME9geSLVZ5+2chgjOLrHVCBPgXDu1pbdO6nF4K7Yd63o7BoELiiuqa I1Gtiuykz8zstGf10d0kLon2yKIQFSBmM2l2mcoma0pXmgCVi7EbGrBfawvL84DvTKIk0u 8YCPC25TYGpnSOLProlR/fEXpmC75DALdryHs+tnCTlaoVE+q6HhWLz5cnLDHkm5RcY3Z4 H4AAl3sXCzp7j711VgjxheNh35sX08s4FXFYrYRFNgkxyD6yhXvYhXlpdL2+Yh27IgX2v7 E5wtHysFQaWPD6YfdkCfDqISXa/gy+8R05c+WY+fZtqJwi6LLDbTb4zdPrv7CQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1712789191; 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=amj9rEI4omA2o9SPkzdGtXDAK0TjsBjy30f0aomhQz0=; b=RBNNpa/c5LCQEjTTy+WVRDmuoswkLSi6v/fibcAYXPq/f/PWBE9oNctbolPglNeip7xT8Y BLhS5ggEoKVX8PCw== 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 11/50] posix-cpu-timers: Handle SIGEV_NONE timers correctly in timer_set() 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:31 +0200 (CEST) Expired SIGEV_NONE oneshot timers must return 0 nsec for the expiry time in timer_get(), but the posix CPU timer implementation returns 1 nsec. Add the missing conditional. This will be cleaned up in a follow up patch. Signed-off-by: Thomas Gleixner --- V2: Split out into new patch to make review simpler - Frederic --- kernel/time/posix-cpu-timers.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) --- a/kernel/time/posix-cpu-timers.c +++ b/kernel/time/posix-cpu-timers.c @@ -706,7 +706,16 @@ static int posix_cpu_timer_set(struct k_ old_expires = exp - val; old->it_value = ns_to_timespec64(old_expires); } else { - old->it_value.tv_nsec = 1; + /* + * A single shot SIGEV_NONE timer must return 0, when it is + * expired! Timers which have a real signal delivery mode + * must return a remaining time greater than 0 because the + * signal has not yet been delivered. + */ + if (sigev_none) + old->it_value.tv_nsec = 0; + else + old->it_value.tv_nsec = 1; old->it_value.tv_sec = 0; } }