lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 12 Oct 2020 17:30:13 +0000
From:   "Keller, Jacob E" <jacob.e.keller@...el.com>
To:     David Ahern <dsahern@...il.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        Jakub Kicinski <kuba@...nel.org>,
        Shannon Nelson <snelson@...sando.io>
Subject: RE: [iproute2-next v2 1/1] devlink: display elapsed time during flash
 update



> -----Original Message-----
> From: David Ahern <dsahern@...il.com>
> Sent: Tuesday, October 06, 2020 10:56 PM
> To: Keller, Jacob E <jacob.e.keller@...el.com>; netdev@...r.kernel.org; Jakub
> Kicinski <kuba@...nel.org>; Shannon Nelson <snelson@...sando.io>
> Subject: Re: [iproute2-next v2 1/1] devlink: display elapsed time during flash
> update
> 
> On 9/30/20 4:40 PM, Jacob Keller wrote:
> > @@ -3124,12 +3140,19 @@ static int cmd_dev_flash_status_cb(const struct
> nlmsghdr *nlh, void *data)
> >  		done =
> mnl_attr_get_u64(tb[DEVLINK_ATTR_FLASH_UPDATE_STATUS_DONE]);
> >  	if (tb[DEVLINK_ATTR_FLASH_UPDATE_STATUS_TOTAL])
> >  		total =
> mnl_attr_get_u64(tb[DEVLINK_ATTR_FLASH_UPDATE_STATUS_TOTAL]);
> > +	if (tb[DEVLINK_ATTR_FLASH_UPDATE_STATUS_TIMEOUT])
> > +		ctx->status_msg_timeout =
> mnl_attr_get_u64(tb[DEVLINK_ATTR_FLASH_UPDATE_STATUS_TIMEOUT]);
> > +	else
> > +		ctx->status_msg_timeout = 0;
> >
> >  	if (!nullstrcmp(msg, ctx->last_msg) &&
> >  	    !nullstrcmp(component, ctx->last_component) &&
> >  	    ctx->last_pc && ctx->not_first) {
> >  		pr_out_tty("\b\b\b\b\b"); /* clean percentage */
> >  	} else {
> > +		/* only update the last status timestamp if the message changed
> */
> > +		gettimeofday(&ctx->time_of_last_status, NULL);
> 
> gettimeofday/REALCLOCK should not be used for measuring time differences.
> 

Ah. Good point. This should use CLOCK_MONOTONIC instead, right?

> > +
> >  		if (ctx->not_first)
> >  			pr_out("\n");
> >  		if (component) {
> > @@ -3155,11 +3178,72 @@ static int cmd_dev_flash_status_cb(const struct
> nlmsghdr *nlh, void *data)
> >  	return MNL_CB_STOP;
> >  }
> >
> > +static void cmd_dev_flash_time_elapsed(struct cmd_dev_flash_status_ctx
> *ctx)
> > +{
> > +	struct timeval now, res;
> > +
> > +	gettimeofday(&now, NULL);
> > +	timersub(&now, &ctx->time_of_last_status, &res);
> > +

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ