From nobody Sun Feb 8 19:04:51 2026 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 0FC2A14D2A4 for ; Mon, 10 Jun 2024 16:42:20 +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=1718037742; cv=none; b=A3yfTy2m8aeYl4OBHwFsOHgTDOI5CncuABUfux6tC40/b9QJC8Vg5NnwFr8YLylacdXdssFvQ29BQ4Kb1wSHX5R4RTmOE7r+V34sLrjRTptJkHuiEQp5W7nioiybHtb84lY1CsxLQVjXk9RqIp/3SavRQ+QQesZtDsZkkbmHqdw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718037742; c=relaxed/simple; bh=ELAaPaGkJq6p3gTMdWaH/+B64HkzxUph4WcIXAbdkUg=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=YbawPJEinHRkZkkthFT3c1mtOSDIFdlrVri0JQcqVLXqw3tJbnyzEDE75Fqt0bpofbrqkSSq40fnz0fU3gIVSMwEY6a4c30FnUsfCb8e2EcjJhYbIpDZgDf0OaHQVkc5x+tKdXQ6TZOjTfo44GCWtwfwx1K07pgZIGoPxNLO/pg= 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=ZhmZdNtx; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=B6jHuOpJ; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ZhmZdNtx"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="B6jHuOpJ" Message-ID: <20240610164026.162380808@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1718037739; 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=ZhmZdNtxWOeWwb4bYVD9mSeApzqUSLS/lZMFRYxuuTSBI8Ar0hnpKrXGeO4unxkPqvbjvh DYn/CrATrpN4owrrdaSNYrbQCRCxGVsOQcceldYhMApeB7dHEh1yz+F85Slx9Q3h4CsAFP aRrYiJ3v/XPm6mrJ0/KAnnA3pxXXvRLmkCPyYoKFfoLBt2bkBBbNooT2yTUYCcrVDekCpI 4j06j77AFLybsVZr5q9/ei/XQoEyk7CgWu522rYxtfMV/CkHK+mre2rUc0j3+6AC8tzKSr NOGAPXBXzoGzNL+9TbmR+jkibHy41jPzIiaBUmRSosLkjkHNxUL/GBbHD/bhnA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1718037739; 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=B6jHuOpJ2E/ua/aVOWaFbruYSDrCjKOdCi8mGwb3vrBRYUAp3xaEmeoGVjfRsCB/mAn9cc ucPHt1oe4aEAjjCg== 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 11/51] posix-cpu-timers: Handle SIGEV_NONE timers correctly in timer_set() 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 Date: Mon, 10 Jun 2024 18:42:18 +0200 (CEST) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 =3D exp - val; old->it_value =3D ns_to_timespec64(old_expires); } else { - old->it_value.tv_nsec =3D 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 =3D 0; + else + old->it_value.tv_nsec =3D 1; old->it_value.tv_sec =3D 0; } }