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] [day] [month] [year] [list]
Message-Id: <20120126010516.c5af4a4e.akpm@linux-foundation.org>
Date:	Thu, 26 Jan 2012 01:05:16 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Dmitry Antipov <dmitry.antipov@...aro.org>
Cc:	Thomas Gleixner <tglx@...utronix.de>, linux-kernel@...r.kernel.org,
	patches@...aro.org
Subject: Re: [PATCH] hrtimers: teach usleep_range() to return how many usecs
 was slept

On Mon, 16 Jan 2012 16:53:23 +0400 Dmitry Antipov <dmitry.antipov@...aro.org> wrote:

> Teach usleep_range() to return how many usecs was actually spent
> in sleep. The rationale beyond this is to convert jiffies-based
> wait-for-hardware loops like:
> 
> unsigned long timeout = jiffies + msecs_to_jiffies(1000);
> while (hw_is_not_ready()) {
> 	if (time_after(jiffies, timeout))
> 		return -ETIMEDOUT;
> 	msleep(1);
> }
> 
> to:
> 
> unsigned long timeout = 0;
> while (hw_is_not_ready()) {
>       if (timeout > USEC_PER_SEC)
> 	      return -ETIMEDOUT;
>       timeout += usleep_range(1000, 2000);
> }
> 

Is that useful enough to justify making the change?

>
>  int __sched schedule_hrtimeout_range(ktime_t *expires, unsigned long delta,
> -				     const enum hrtimer_mode mode)
> +				     const enum hrtimer_mode mode, unsigned long *elapsed)

Rather than adding another argument, I suggest you change the return
type to long and use return value semantics similar to schedule_timeout().

schedule_timeout() never returns -ve numbers and it returns jiffies,
but it will be close(r).

Returning usecs is odd.  One would expect it to return a ktime_t.  That
might inflict some code-size cost in callers.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ