[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XENBUS PATCH 2/2] Be more tolerant of RealTimeIsUniversal values



On 13/08/2025 18:17, Owen Smith wrote:
>
>      status = SystemGetTimeInformation();
>      if (!NT_SUCCESS(status))
>          Error("Cannot read RealTimeIsUniversal, clock may be incorrect!
> \n");
>
> doesnt log the error code, and still returns STATUS_SUCCESS from this
> function (SystemInitialize).
>
> Owen

That's intentional to not fail the bootup when RealTimeIsUniversal is
misconfigured. I'll add the status code to the log entry.

>
> On Wed, Aug 13, 2025 at 5:12 PM Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx> wrote:
>
>     On 13/08/2025 18:09, Owen Smith wrote:
>      >
>      >
>      > On Wed, Aug 13, 2025 at 2:32 PM Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
>     wrote:
>      >
>      >
>      >     -    status = RegistryQueryDwordValue(Key, "RealTimeIsUniversal",
>      >     -                                     &RealTimeIsUniversal);
>      >     -    if (!NT_SUCCESS(status)) {
>      >     -        if (status != STATUS_OBJECT_NAME_NOT_FOUND)
>      >     -            goto fail2;
>      >     +    status = RegistryQueryDwordValue(Key, "RealTimeIsUniversal",
>      >     &ValueDword);
>      >     +    if (status == STATUS_OBJECT_NAME_NOT_FOUND) {
>      >     +        Context->RealTimeIsUniversal = FALSE;
>      >     +        goto done;
>      >     +    } else if (NT_SUCCESS(status)) {
>      >     +        Context->RealTimeIsUniversal = !!ValueDword;
>      >     +        goto done;
>      >     +    }
>      >
>      >     -        RealTimeIsUniversal = 0;
>      >     +    status = RegistryQueryQwordValue(Key, "RealTimeIsUniversal",
>      >     &ValueQword);
>      >     +    if (NT_SUCCESS(status)) {
>      >     +        Context->RealTimeIsUniversal = !!ValueQword;
>      >     +        goto done;
>      >           }
>      >
>      >     -    Context->RealTimeIsUniversal = RealTimeIsUniversal ?
>     TRUE : FALSE;
>      >     +    status = STATUS_UNSUCCESSFUL;
>      >     +    Context->RealTimeIsUniversal = FALSE;
>      >
>      >     +done:
>      >           Info("%s\n", Context->RealTimeIsUniversal ? "TRUE" :
>     "FALSE");
>      >
>      > The logic here seems more complicated than required. Would
>     something like
>      >
>      >      status = RegistryQueryDwordValue(Key, "RealTimeIsUniversal",
>      > &ValueDword);
>      >      if (NT_SUCCESS(status)) {
>      >          Context->RealTimeIsUniversal = !!ValueDword;
>      >          goto done;
>      >      }
>      >
>      >      status = RegistryQueryQwordValue(Key, "RealTimeIsUniversal",
>      > &ValueQword);
>      >      if (NT_SUCCESS(status)) {
>      >          Context->RealTimeIsUniversal = !!ValueQword;
>      >          goto done;
>      >      }
>      >
>      >      Context->RealTimeIsUniversal = FALSE;
>      >
>      > done:
>      >      Info("%s\n", Context->RealTimeIsUniversal ? "TRUE" : "FALSE");
>      >
>      > be cleaner?
>      >
>      > Owen
>      >
>
>     I didn't want SystemGetTimeInformation to error out when the
>     RealTimeIsUniversal value is absent since its status code is used later
>     on for error reporting. But I can also ignore the status code of
>     SystemGetTimeInformation instead. What do you prefer?
>
>
>     Ngoc Tu Dinh | Vates XCP-ng Developer
>
>     XCP-ng & Xen Orchestra - Vates solutions
>
>     web: https://vates.tech <https://vates.tech>
>
>



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech





 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.