From nobody Tue May 24 21:10:04 2022 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D219F1B54067 for ; Tue, 24 May 2022 21:10:04 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4L76KS4qgkz4q8Q for ; Tue, 24 May 2022 21:10:04 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 869CB4185 for ; Tue, 24 May 2022 21:10:04 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 24OLA4jp057320 for ; Tue, 24 May 2022 21:10:04 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 24OLA4dh057319 for bugs@FreeBSD.org; Tue, 24 May 2022 21:10:04 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 258412] kevent EVFILT_TIMER, EV_DISPATCH lost if event is re-enabled Date: Tue, 24 May 2022 21:10:04 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 13.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: markj@FreeBSD.org X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc bug_status Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1653426604; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aVYw5vTEAV/mc2wHPNzHIkdD6TytGM3J5TOa9m2GpIM=; b=cTx6nAJ6y8zCkqOk2sKakYn+Hgqa26WlIMWkMXAv20RJAJSRrx2Sh39FV6huwWr0s+nlp9 TmF80EiBSvp+VVkCrymX6i3dn3MyIStNFHwpVU51W8Rb14YE2LwANMk0imJbGYZpaGhXXl WB8qzDHutmTH0s9xZn7ohSn3InVEg1IdUNTa/agLoXykbkyJrA5GO2MBW1CL5IyC1dw7Y2 J5ryP30dBqtrUJpubP+JjerPXhQHHI1cNSpS1oEeT5cW04L+47WXc/BR/SY9swBBsQA5di zawZvsAn9SfovBR+aCbSd2neY0g+BM4WJi8B5SNgPehEpRKwT3tbGhP+wuljLg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1653426604; a=rsa-sha256; cv=none; b=ci/AsKSuYoCblwpq6Wd4eDh6hfnt+UvYQIqoldCHzUOKCdacNIyWdxl4ob4Dbk4DmnZd6d TqYoOPYlhiNR0ilgIFR6zqkeg1wbZh44sdjfco/HfqrX9BSivnojFQpn0XDYOVgwSlPq70 0L+tssGTsah7OHrRpwj35GeLBmidcarue9/JH7j+dCtfhMMMfXIYsxe1euqLyKBZgyR31+ w+SqekeD8zhrEeOLOiTfGsEbr61ZBd7jFUU2IJx/1DfoZRoxXgZXEKNrjRoAdLhhzoPXsY xPRIlFbfjaKMfoZSz55grUTO1sdZ+JcQo24Mn26kbsBfhZcdG4vL5jFINw7MHw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D258412 Mark Johnston changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |markj@FreeBSD.org Status|New |Open --- Comment #2 from Mark Johnston --- Thanks for the report and the pointer to the updated libkqueue tests. I'm sorry this didn't get any attention sooner. I ported three new timer tests to our in-tree copy of the libkqueue test su= ite, periodic_modify, periodic_to_oneshot, and dispatch. They found a couple of kernel bugs unrelated to the one that you described. Looking at our documentation, it's not obvious to me that FreeBSD's behavio= ur in the dispatch test is incorrect. With a periodic timer, EV_DISPATCH masks the knote after its state is retrieved by kqueue(), but the timer continues= to fire and we continue to count events. So when the timer filter is unmasked with EV_ENABLE | EV_DISPATCH, the knote is immediately activated. That see= ms consistent with my reading of the documentation. > The above step fails on FreeBSD 13, we get one event with the data field = set to 1. I would expect this to be 2 =3D 500ms / 200ms. That itself is a kernel bug= which I have a patch for. > Adding EV_ADD to the call re-enabling the timer does nothing, as does onl= y passing EV_ENABLE. In fact, adding EV_ADD fixes the test for me on FreeBSD. That also seems to make sense, since EV_ADD causes the timer state to be reset, throwing away timer firings that occurred while the knote was masked. So, I'm not sure what to do here. I spent some time looking at the XNU sou= rces to better understand what macos is doing but don't quite understand their t= imer state machine yet. --=20 You are receiving this mail because: You are the assignee for the bug.=