From nobody Sat Aug 06 10:18:50 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 4M0JMt34ccz4YcYT for ; Sat, 6 Aug 2022 10:18:50 +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 4M0JMt0kf2z49XJ for ; Sat, 6 Aug 2022 10:18:50 +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 4M0JMs6t9dzVwD for ; Sat, 6 Aug 2022 10:18:49 +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 276AIniF036640 for ; Sat, 6 Aug 2022 10:18:49 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 276AInYt036639 for bugs@FreeBSD.org; Sat, 6 Aug 2022 10:18:49 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 264729] RTC clock is set incorrectly upon resume if NTP is in use Date: Sat, 06 Aug 2022 10:18:50 +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.1-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: crahman@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created 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=1659781130; 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=/c95wRAEbmzJ84r+w9Kt8/Edr495FpR9EIDLqCiedcA=; b=g+62YUgJEz3EbHwZSpL17KRc41NfVdqD98cFV14LC5b30zosJ3n3WbJx7cXDDQ6paQ/8cG 0Zsv+P1NPVhnymB0NuqtRAjYowXcUyygOJRiLnfV1Wau3mvnhCQFj6g1A8W9C37pEFjwXf JaPsKohudmf/ImUE3rlo/5pHQ1xT0hbJORnF5vlghCedKIk17HbeFgYgmOGC7Em+DoBDw2 yDy3dKMFOId2Lra9SNIkSjj/XH3xKwZ+NRZ8IfQoPZoftI9Rzq6xB0A9EmMS8k8PmtlRae +j3dIJZ6xqiSxU4N991KWUzIVoouIA6raoxWkLbVBOBbljwQJpY0+wPhIUwp7A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1659781130; a=rsa-sha256; cv=none; b=F854Ld0ugmakjpVT6caiJCw+SKdHAZBTyuqkcc570mTBO396EFBst45UnAwwnFFyMGEXQB ZTzYsOmSusIMw7zrmeN/lM5vY89r8y5KY8GW4Q5vb8dK5tZpdAwFIqE00RW3F5Wob3kN3v 3pPY9hMvIv0ZFR6jg56IbdG1pY8GruKhcPUZXyoF/QDE4+NVnJugPchS8XlV4V73Ou9a8z gyte3D7uKsBVDcMXEDAIRpI+lukbmvAoFUzJEUe4QlrTVsXfLtWTSPTIYR75ApgCmbPKEC ILfI9K2syKdiu3j/pTom9Hdyo7KkMIyedk0Nk4GZo1utS8dDPPNjIReRbevqyA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D264729 --- Comment #1 from crahman@gmail.com --- Created attachment 235719 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D235719&action= =3Dedit Patch to correct problem To provide a more precise description of the problem: After ntp is synced and ntp_is_time_error() returns true, when periodic_resettodr() is run every 1800 or so seconds as a callout, it saves= the current system time to the RTC clocks. During a resume, after a suspend, it runs immediately, before inittodr().=20 inittodr() sets the system time based upon the RTC clocks. But because periodic_resettodr() runs first, it puts the uninitialized system time into= the RTC, which is then used to initialize the system time. As a result, if a suspend/resume is done while ntp is synced, the time will= be incorrect. The problem may be solved by writing the system time to the RTC before the suspend, and cancelling the callout. Upon wakeup, after the RTC clock is r= ead, the callout can be started again. --=20 You are receiving this mail because: You are the assignee for the bug.=