Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp103508lqp; Fri, 12 Apr 2024 11:40:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX+smJW0/ombk7geqaOiWZY1mAur8rV9GIUWz8vj4pQ3oM6+WO0ayhbgqWWG35NZgZZBQRdlCPl+fsAjZHtkE6kipnvvkCszvyJu5V9OA== X-Google-Smtp-Source: AGHT+IFuLCY/mWHu1O2nmznh3ym82Hu39tOvdh2IN0l+ELcVGh9LAtvEJvvK6Mps4ynADupI0ltj X-Received: by 2002:a05:6870:8186:b0:22e:ce91:d6f8 with SMTP id k6-20020a056870818600b0022ece91d6f8mr3871598oae.51.1712947217761; Fri, 12 Apr 2024 11:40:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712947217; cv=pass; d=google.com; s=arc-20160816; b=fck8uhNeHk/j5hUzFE55y72jOSL2pB1XszzQunfZjLiBrNnQwO1stsKI3amHl1UGGr temvBRY4jWUYim8RAbWsjB0erA474Uwljj4UGpO4JhIO2N1umf8HlnxU+IqJ90D1PZGL KDGiuwPSIMDktxlnyFRda1o0AnI5qfe9ya5ORYCOp+5MC9VBtDR0gop8edWgS3RLqoVb zyzqpVo++2kvjUzSOk6xHDm5DlBm0or+BG7zOrM/xyfkj7nUKSXur7/rSbwjDSdxdSGQ Zl02UTOSzGRmFRRaYOqC4hWS6ZeaotURXVGHRRaKqdB+LHNkQmdssfY9315rZR0i7cHK vRmA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:user-agent:message-id:in-reply-to:date:references:cc:to :from; bh=IAlG/nLCLwo+z1EzWCsEo0OMC7DfE5fUT1KaAlEdhYc=; fh=gvzMsZGMkpNuSJ0irDfn5HKUEmdwfj7IedPvLBe08bs=; b=XOhAv6izCrNhUzDUJWhObhd/lwo+PTj+wU7/frBgDnwrS83vFLs/dmV1VpT3D6VjpO +aTB6j5HMvvXWRLSxwaiCI8G7GHvk57WgjOyhZl9p9Y7+/J0yOPYSXtC2XS62Iuo5jnA H0yxTT4erB3Ahj53ig5fPL+UPhgZtbTs0J3UP3mjKW7L9EeFkejbbLQV7+2jAjM7t0dM N2DnAF5vwfasX+316JxHUEEZft+USewZ9yVD6HAd1ObGwUepdU1J8Dy+UzoKwyFylZ9Y Ok+e/V8at89ZRPgEVIuvNblAqKdFxBXmlzipPTSEsQbeqq/NXCZ+JdhhyYd8R0pWecIF MSIA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=xmission.com dmarc=pass fromdomain=xmission.com); spf=pass (google.com: domain of linux-kernel+bounces-143219-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143219-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id c1-20020a37e101000000b0078ec3aee43fsi3704226qkm.80.2024.04.12.11.40.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 11:40:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143219-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; arc=pass (i=1 spf=pass spfdomain=xmission.com dmarc=pass fromdomain=xmission.com); spf=pass (google.com: domain of linux-kernel+bounces-143219-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143219-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com 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 79EE41C2200F for ; Fri, 12 Apr 2024 18:40:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 43E2514EC49; Fri, 12 Apr 2024 18:40:12 +0000 (UTC) Received: from out02.mta.xmission.com (out02.mta.xmission.com [166.70.13.232]) (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 479881BF2F for ; Fri, 12 Apr 2024 18:40:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=166.70.13.232 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712947211; cv=none; b=jN/tmsJfAdZrvtTS77MCEx/nsWMBBS7A8xhpvSRz/FqeH4wvrSGONtdkShbCtowsD/5HNF7doK58QvxxujC74WdFaLkbDMr3/RyBnojKSfGnHPbFSHiFqhcZ3bQZoCrOoG6Z4LJLUu5s0++LheL7N4pDvfWHmPNMZmaUw6USHOE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712947211; c=relaxed/simple; bh=Lqx4NWcv2NfqHkrr6UplSqWQw6HN5M/MsiaQsX3BOTU=; h=From:To:Cc:References:Date:In-Reply-To:Message-ID:MIME-Version: Content-Type:Subject; b=tuChugt+W5akIkZVgQxRF2kaxFQoLgml2jIkEJ4SZ+8Q5OCCWjbpp3swT6JXpuGMRyQdQ73hWC61eO2rGIqJ2qkSrKsS62Xn/5BI9AtFd/UVVQ7s8wjHH+y95OMkdoGXvKdzdrm3RLLjESoPw5L3y+Gn0Wn65/D10FviD9ga88Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=xmission.com; spf=pass smtp.mailfrom=xmission.com; arc=none smtp.client-ip=166.70.13.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=xmission.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xmission.com Received: from in01.mta.xmission.com ([166.70.13.51]:49452) by out02.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1rvLon-004EQ7-36; Fri, 12 Apr 2024 12:40:09 -0600 Received: from ip68-227-168-167.om.om.cox.net ([68.227.168.167]:36870 helo=email.froward.int.ebiederm.org.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1rvLom-001tOR-4J; Fri, 12 Apr 2024 12:40:08 -0600 From: "Eric W. Biederman" To: Thomas Gleixner Cc: LKML , Anna-Maria Behnsen , Frederic Weisbecker , John Stultz , Peter Zijlstra , Ingo Molnar , Stephen Boyd , Oleg Nesterov References: <20240410164558.316665885@linutronix.de> <20240410165551.571240036@linutronix.de> Date: Fri, 12 Apr 2024 13:40:02 -0500 In-Reply-To: <20240410165551.571240036@linutronix.de> (Thomas Gleixner's message of "Thu, 11 Apr 2024 00:46:29 +0200 (CEST)") Message-ID: <87cyquxw59.fsf@email.froward.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1rvLom-001tOR-4J;;;mid=<87cyquxw59.fsf@email.froward.int.ebiederm.org>;;;hst=in01.mta.xmission.com;;;ip=68.227.168.167;;;frm=ebiederm@xmission.com;;;spf=pass X-XM-AID: U2FsdGVkX19PsVGhf1Xt4dMzWW4n/IXnjYQH1v+ZSCc= X-SA-Exim-Connect-IP: 68.227.168.167 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Level: X-Spam-Virus: No X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * 0.7 XMSubLong Long Subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa03 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_02 5+ unique symbols in subject * 0.0 T_TooManySym_04 7+ unique symbols in subject * 0.0 T_TooManySym_03 6+ unique symbols in subject * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa03 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Thomas Gleixner X-Spam-Relay-Country: X-Spam-Timing: total 393 ms - load_scoreonly_sql: 0.04 (0.0%), signal_user_changed: 4.5 (1.2%), b_tie_ro: 3.2 (0.8%), parse: 1.13 (0.3%), extract_message_metadata: 12 (3.1%), get_uri_detail_list: 2.1 (0.5%), tests_pri_-2000: 4.7 (1.2%), tests_pri_-1000: 2.1 (0.5%), tests_pri_-950: 1.05 (0.3%), tests_pri_-900: 0.79 (0.2%), tests_pri_-90: 73 (18.5%), check_bayes: 71 (18.1%), b_tokenize: 6 (1.4%), b_tok_get_all: 7 (1.8%), b_comp_prob: 1.60 (0.4%), b_tok_touch_all: 54 (13.8%), b_finish: 0.73 (0.2%), tests_pri_0: 280 (71.3%), check_dkim_signature: 0.63 (0.2%), check_dkim_adsp: 2.2 (0.6%), poll_dns_idle: 0.58 (0.1%), tests_pri_10: 2.6 (0.7%), tests_pri_500: 8 (2.1%), rewrite_mail: 0.00 (0.0%) Subject: Re: [patch V2 10/50] posix-cpu-timers: Handle SIGEV_NONE timers correctly in timer_get() X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Thomas Gleixner writes: > 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. > > Signed-off-by: Thomas Gleixner > --- > V2: Split out into new patch to make review simpler - Frederic > --- > kernel/time/posix-cpu-timers.c | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) > > --- a/kernel/time/posix-cpu-timers.c > +++ b/kernel/time/posix-cpu-timers.c > @@ -787,15 +787,17 @@ static int posix_cpu_timer_set(struct k_ > > static void __posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec64 *itp, u64 now) > { > + bool sigev_none = timer->it_sigev_notify == SIGEV_NONE; > u64 expires, iv = timer->it_interval; > > /* > * Make sure that interval timers are moved forward for the > * following cases: > + * - SIGEV_NONE timers which are never armed > * - Timers which expired, but the signal has not yet been > * delivered > */ > - if (iv && (timer->it_requeue_pending & REQUEUE_PENDING)) > + if (iv && ((timer->it_requeue_pending & REQUEUE_PENDING) || sigev_none)) > expires = bump_cpu_timer(timer, now); > else > expires = cpu_timer_getexpires(&timer->it.cpu); > @@ -809,11 +811,13 @@ static void __posix_cpu_timer_get(struct > itp->it_value = ns_to_timespec64(expires - now); > } else { Why not make this else condition? } else if (!sigev_none) { And not need to change the rest of the code? > /* > - * The timer should have expired already, but the firing > - * hasn't taken place yet. Say it's just about to expire. > + * 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. > */ > - itp->it_value.tv_nsec = 1; > - itp->it_value.tv_sec = 0; > + if (!sigev_none) > + itp->it_value.tv_nsec = 1; Do you perhaps need a comment somewhere that itp is zeroed in do_timer_gettime? The code now depends upon that for setting itp->it_value when it did not used to, making it look at first glance like you have created an uninitialized variable. Probably just something in the description of the change would be sufficient. > } > } >