From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mx.groups.io with SMTP id smtpd.web09.14192.1614960780248450474 for ; Fri, 05 Mar 2021 08:13:00 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=D4kUwr4j; spf=pass (domain: kernel.org, ip: 198.145.29.99, mailfrom: ardb@kernel.org) Received: by mail.kernel.org (Postfix) with ESMTPSA id 5CF046508D for ; Fri, 5 Mar 2021 16:12:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614960779; bh=NQZqh4aOp6pZIUM7dQ+tEGjTTHOFZquvCtReAeHuMOQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=D4kUwr4j47kvAz0bqAuFFjYmFYA3K+GUlbQEtIf6hyfgE1VcRNFssk10Tj+UnqmSm eO6O3E08V8sQzMWFTGMC87IxSzDUn/Jh4yE2Oa/iFfC6ONdvlHAb9s1J77+1EYdLOO +juuaPgxmySvI/2KbZ58aOais2Vpn3wa1Lqp5tnxv0YyeAh7KdMJ0o/E2g8r2O605V QAMb0ywB32YQq94lGichNBrfpwWW5/VEzI5leKXBRfXcnAmGBqjpUHJ6CZ9y5kNNKV 73Xh4E7QC8TJB2nfi7e9Q3Z3lWVP3dA0FkivE5dTyM8sxJMfMkoZIkI1a2uBXJHJB7 98RV/Vee2xhZQ== Received: by mail-oi1-f169.google.com with SMTP id w65so3046978oie.7 for ; Fri, 05 Mar 2021 08:12:59 -0800 (PST) X-Gm-Message-State: AOAM533iw0xekA7JBkN2wwVbKGrGgWc7HTVnMbnM4FIRXMSQfjoav329 Lca8XNptbHO/qa77jik+UflPfN3M4EmGB6/ANeU= X-Google-Smtp-Source: ABdhPJwjRf6cmLofo/pzA3DBazSWYt0kutrC9csyXNMEFbQo4+P8mYu9XU9CpvHJApjn3dYrGyb5pfAT3g1uzmlLAHE= X-Received: by 2002:aca:b6c1:: with SMTP id g184mr7743227oif.47.1614960778654; Fri, 05 Mar 2021 08:12:58 -0800 (PST) MIME-Version: 1.0 References: <20210305161116.13141-1-rebecca@nuviainc.com> In-Reply-To: <20210305161116.13141-1-rebecca@nuviainc.com> From: "Ard Biesheuvel" Date: Fri, 5 Mar 2021 17:12:46 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/1] EmbeddedPkg: Only print LibGetTime message about compile time epoch once To: Rebecca Cran Cc: devel@edk2.groups.io, Leif Lindholm , Ard Biesheuvel , Samer El-Haj-Mahmoud Content-Type: text/plain; charset="UTF-8" On Fri, 5 Mar 2021 at 17:11, Rebecca Cran wrote: > > The message "LibGetTime: RtcEpochSeconds non volatile variable was not > found - Using compilation time epoch." can be printed a very large > number of times, causing log files to become excessively large. This is > because the RtcEpochSeconds variable only gets set if LibSetTime is > called, for example by running 'time 12:00' in the UEFI Shell. > > Avoid this by setting RtcEpochSeconds to BUILD_EPOCH (EpochSeconds) > after printing the message. It's set to a volatile variable so the > message will be displayed on future boots and not hidden. > > Commit 44ae214591e58af468eacb7b873eaa0bc187c4fa reduced the verbosity of > the message to DEBUG_VERBOSE. Revert it back to DEBUG_INFO so it's more > prominent now that it doesn't get printed so frequently. > > Signed-off-by: Rebecca Cran Acked-by: Ard Biesheuvel > --- > EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.c b/EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.c > index 4210708cff36..de6fbb40e61b 100644 > --- a/EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.c > +++ b/EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.c > @@ -88,10 +88,18 @@ LibGetTime ( > // > EpochSeconds = BUILD_EPOCH; > DEBUG (( > - DEBUG_VERBOSE, > + DEBUG_INFO, > "LibGetTime: %s non volatile variable was not found - Using compilation time epoch.\n", > mEpochVariableName > )); > + > + EfiSetVariable ( > + (CHAR16 *)mEpochVariableName, > + &gEfiCallerIdGuid, > + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, > + sizeof (EpochSeconds), > + &EpochSeconds > + ); > } > Counter = GetPerformanceCounter (); > EpochSeconds += DivU64x64Remainder (Counter, Freq, &Remainder); > -- > 2.26.2 >