Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp138355lqp; Fri, 12 Apr 2024 12:49:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXIyLOzSXtOoYxaUxAqr9Pb6AiSLKsPK+SMGimQofPywyeSbSyc80goHATNdDyN2GDRvXxHk1ApNcYXgUu+hQ6+pd2Ii+bsoshGAO1Ybw== X-Google-Smtp-Source: AGHT+IEq6WIpobGjkeZxSYzwyOhkll+dnuK4MHGFtPWOO5noVJZ7UcDvrM+Z8XfFBsA2Wh8xXsI4 X-Received: by 2002:a05:6a20:12c3:b0:1a9:8834:ee7d with SMTP id v3-20020a056a2012c300b001a98834ee7dmr5079444pzg.4.1712951385397; Fri, 12 Apr 2024 12:49:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712951385; cv=pass; d=google.com; s=arc-20160816; b=g2vhPJ9Oc9F17q/1J482WxrXUYlhjAb2jGFRfFz0BdtoBuAe+uM5SCm4jSplEEOPsF jrRolR3S9rXAklgeVNc8Z9QHvO6wqt0Na2/EkTTvtEDtc9t54rbc58CX16v6kL5LVYDh sHxcz9SPrfYAYPLnwNahDby+jQNeLbmC2uRNAFdkBciKzDVSa/q8DdPoBTadtlonXdFh IXno98CPXWw8pE256fnVIlB41w6CIdN1tlmhfDL7y8jwdxnd9bG/B5a4e6V3sXTphUID IOHGlEYZzlAP4icDzPxtOZ/XIoxzy+zRBr1cq8ZmPEaNrAyo4G2yVNq1JCAo8C5PjfOq 6rHQ== 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=wq8zW2oy5QC/9QD9CMB1fAp3LCVcl1LW1lDrklI7ZkM=; fh=NCTis4ymTI85epPe/yXRZiYUMU6K+XRAvcmJcJ7VZC0=; b=bwi1hoefGBoCLHCR50G/3mR0Fnqg3DyatwrEeZNrOtY5OziA6KjwgY8rMw6lQHDPZM ssD54rEnMo/Q+HM/fAImL0oPaXAxTAzgWQCyBVtIt+BTmkzkLo+Ou+8for5cyPE4UbhZ ETcNCYbAw0AXUu6q9nCC1wuISYpRUgZqUtc7TeXp3VO+Fq9a1UvkKfVrsv78/PO745Jg lmE3tswEN2gS8B3dUgbif9h+L/hhSka/Wt57TjuU8n8lpU7cvcrykmlEfxh2aw6Ho/uc 7DVAmDLEcF02tLT2OALdM7I5UHZIVVZHBw6B/MDTLmVDtJogi3EXj+SEDL1o2rHmWWxs T6Jw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=x9z6nxd3; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="45YL/6qm"; 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-143274-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143274-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. [139.178.88.99]) by mx.google.com with ESMTPS id y28-20020a63495c000000b005e0b862f469si3796546pgk.158.2024.04.12.12.49.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 12:49:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143274-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=x9z6nxd3; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="45YL/6qm"; 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-143274-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143274-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 097A0281E63 for ; Fri, 12 Apr 2024 19:49:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5B61A150986; Fri, 12 Apr 2024 19:49:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="x9z6nxd3"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="45YL/6qm" 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 49A3514F9E5 for ; Fri, 12 Apr 2024 19:49:38 +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=1712951379; cv=none; b=Vu2Tga2XCLx60MifskhO8x68CwEhzQGVZntbtRhkdoDFHPQgRSO+Nr5/DvxccOZobe76ppWkBX2EDf1u4ErQPI6GKOakbc/s27SvdI5A0fsgUTuLDX50DJpdOWxbK6nidYt5rY7Z0unSlk10JQKQ4cT1DNZAt1Tff4FqUysEHC8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712951379; c=relaxed/simple; bh=jA6ARrGtgWJ7UuNLrRb9blum6qtvsT8qGF19szID6Yc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=aR/GSogHCOuQqTqVoadIN1Aob6pqYFzYPfI3YOtU/6bAeNRWWnXM7x7TIz3QWo6z+AziBUPiNj0BMfIf8Rkvfl9Ee8JaO2+TV87O68a79ea4tPN5ZFSdlRqcaq7jaPuv+Uy4VJHpFpDIuIZUtg0sC+D6AIlVDV0P+wIjzfh1WMM= 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=x9z6nxd3; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=45YL/6qm; 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: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1712951376; 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=wq8zW2oy5QC/9QD9CMB1fAp3LCVcl1LW1lDrklI7ZkM=; b=x9z6nxd3tbC96PsU8CcvXTH/20675Hw5LLOzdeHH7SYqP5f2dSGqj9PtSSJ3uXYB3Cn2Fd 7S+wG3tLxgT2kmsmO6TJSaZl24iN8FcpsoRYY89IkimQKDyIKDKfXuKyhSrpM9vWyMTPoW IpW7hSg6tUlyPLeGNhKauJSvLFrocnDrfMMMpCFfHPW3raLPluWarsSqGlGd7coo6NSw6G 8S3zVwvXEC/YfbkRbMxmUYJMMOAwP1WBAssrQeUWSFgZr4G3lWOWRxXrN/Hp3XF/hiWGxC WeyunrbAwcq8HTuW2HTSwD2BV86kDx0HjYL/3/JrqkFmk7WqaqUSA4MOOGZ0yg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1712951376; 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=wq8zW2oy5QC/9QD9CMB1fAp3LCVcl1LW1lDrklI7ZkM=; b=45YL/6qmPa8wYhREKF9EEiuONy/EDAh2GdfHXoqN4ZXBeyxGy4fI7sBWx/nTlrJoJJNu5g KxRTrXd2Bu0GtUDg== To: "Eric W. Biederman" Cc: LKML , Anna-Maria Behnsen , Frederic Weisbecker , John Stultz , Peter Zijlstra , Ingo Molnar , Stephen Boyd , Oleg Nesterov Subject: Re: [patch V2 10/50] posix-cpu-timers: Handle SIGEV_NONE timers correctly in timer_get() In-Reply-To: <87cyquxw59.fsf@email.froward.int.ebiederm.org> References: <20240410164558.316665885@linutronix.de> <20240410165551.571240036@linutronix.de> <87cyquxw59.fsf@email.froward.int.ebiederm.org> Date: Fri, 12 Apr 2024 21:49:35 +0200 Message-ID: <87h6g6z7hs.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Fri, Apr 12 2024 at 13:40, Eric W. Biederman wrote: > Thomas Gleixner writes: >> - 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? Duh, yes. /* >> - * 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. Fair enough. Thanks, tglx