Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp483032lqp; Mon, 10 Jun 2024 09:44:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVYKRhWQ0VU6zYzNGVDIVgFcZwCrd8BAGd8MW/6QMFsaSOOLbmTAtGavn019YuYv4jN0CJJsg5wR8usQ6gvQe5uBw32FP7LLcJXigYmaQ== X-Google-Smtp-Source: AGHT+IFk1ZC9sZMUMd5W+CtIeip7APpcFy/lEcYpYWB8oRWIARXJE8jhiTQANQiDIIBPsicHV0/u X-Received: by 2002:ad4:4eaa:0:b0:6ad:8167:ac48 with SMTP id 6a1803df08f44-6b089f5bbe0mr3528856d6.24.1718037841203; Mon, 10 Jun 2024 09:44:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718037841; cv=pass; d=google.com; s=arc-20160816; b=Bce2d4bK0gliSQV0836Is3QwW5rcwp7NRC9BbpvYACEVG5ew1osPoJhLjueX4PPy3G q/PGv1D4QmEFzMXN7W0cs7RwDH0jspcDOzaR1bQPIfiirT8E8uWIqx1QO+rnbZg1EbPW XdoWRKUiI2uvKbZTzpqXje1fzjAC5cZyX65nv5Z/+lTuVT9aaS7Ur9xjjmITFciSRsDk Ukv8RY1zfShiNJfNKtNNFIV2v1u6Bc0ydT89b/+8NP5q3cNbKdgTgRRksLjYcyyr/6SP bEq9QgzMgHQtcnH1zsil5d9ABpy48wXyKdnKhLepGh8VasC/ftAQUipMfoKNlkrlDjpi VY8w== 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=oZJu76xpAlnc+7iIlKA/XgbO2csaKoxN+e0dPLTJ1ozBni7B2+nBaWI4GdVy1B541q 7WBM3TLi8dnaYeSu1ZLvfcIfcQ7YmL/YJ1SCtpLnAKixpc6+SP7EqD1Fu3kOmghmYRIx A6l4XzUb4BJhky5lT7c20/BC1b6WCDCQNu9tKsQ0RQuyc7dIUwDmlNiXN9T2gURIiF82 YGtJiYpxH0XfNwdZ63qhwylV+flCNMWS2HK5l/X1M1AZ+jj9cvRkZXFDKaaPR8/n4Gzk P3sl8Piavj15pBlETM7TCUcBMW/qrFddSQJ6ZLDclAlNhLXKFYxJjdZi66BeSarir/VV QqRw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ZhmZdNtx; 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-208574-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208574-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. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-44038b7989csi72161851cf.704.2024.06.10.09.44.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 09:44:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208574-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ZhmZdNtx; 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-208574-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208574-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 E59141C219F2 for ; Mon, 10 Jun 2024 16:44:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7197B150991; Mon, 10 Jun 2024 16:42:23 +0000 (UTC) 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" 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 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 Content-Type: text/plain; charset=UTF-8 Date: Mon, 10 Jun 2024 18:42:18 +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; } }