On Tue, Jan 06, 2026 at 02:45:26PM +0100, Michal Berger wrote:
> Currently,  whenever sim is restarted SEL's time_offset is reset to
> the initial reference point, which in case of a Linux's host is its
> btime. As a default ref, this may feel fine but in case there was an
> explicit Set SEL Time cmd sent during sim's runtime it feels
> reasonable to expect the offset to remain the same across subsequent
> resets.
> 
> The following proposal is to save the offset within the SEL file
> and slurp it in whenever BMC is reinitialized (similarly to already
> existing "last_{add,erase}_time" params).
> 
> In case host is rebooted the offset will still "break" (i.e. go
> backwards) but the discrepancy wouldn't be that big as going
> back to "pre-init" timestamp (which according to ipmitool is
> anything < 0x20000000) - I believe this case would be also
> less frequent compared to how often sim can be restarted in
> general.

Applied, thank you.

-corey

> 
> Signed-off-by: Michal Berger <[email protected]>
> ---
>  lanserv/bmc_storage.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/lanserv/bmc_storage.c b/lanserv/bmc_storage.c
> index cb1678d9..021d0118 100644
> --- a/lanserv/bmc_storage.c
> +++ b/lanserv/bmc_storage.c
> @@ -134,6 +134,8 @@ handle_sel_time(const char *name, long val, void *cb_data)
>       mc->sel.last_add_time = val;
>      else if (strcmp(name, "last_erase_time") == 0)
>       mc->sel.last_erase_time = val;
> +    else if (strcmp(name, "time_offset") == 0)
> +     mc->sel.time_offset = val;
>      return ITER_PERSIST_CONTINUE;
>  }
>  
> @@ -183,6 +185,10 @@ rewrite_sels(lmc_data_t *mc)
>      if (err)
>       goto out_err;
>  
> +    err = add_persist_int(p, mc->sel.time_offset, "time_offset");
> +    if (err)
> +     goto out_err;
> +
>      for (e = mc->sel.entries; e; e = e->next) {
>       err = add_persist_data(p, e->data, 16, "%d", e->record_id);
>       if (err)
> @@ -663,6 +669,8 @@ handle_set_sel_time(lmc_data_t    *mc,
>  
>      rdata[0] = 0;
>      *rdata_len = 1;
> +
> +    rewrite_sels(mc);
>  }
>  
>  /*
> -- 
> 2.43.0
> 
> 
> 
> _______________________________________________
> Openipmi-developer mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/openipmi-developer


_______________________________________________
Openipmi-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openipmi-developer

Reply via email to