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]
Message-ID: <AANLkTik-fgCF_W0-DBE6UVTpjqF6Jf=u7bQYkcweEegQ@mail.gmail.com>
Date:	Tue, 1 Feb 2011 08:20:13 +0200
From:	Ohad Ben-Cohen <ohad@...ery.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	linux-omap@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org, Greg KH <greg@...ah.com>,
	Tony Lindgren <tony@...mide.com>,
	Benoit Cousson <b-cousson@...com>,
	Grant Likely <grant.likely@...retlab.ca>,
	Suman Anna <s-anna@...com>, Kevin Hilman <khilman@...com>,
	Arnd Bergmann <arnd@...db.de>, Paul Walmsley <paul@...an.com>,
	Hari Kanigeri <hari.kanigeri@...il.com>,
	Simon Que <simonque@...il.com>
Subject: Re: [PATCH v4 1/4] drivers: hwspinlock: add framework

On Tue, Feb 1, 2011 at 1:38 AM, Andrew Morton <akpm@...ux-foundation.org> wrote:
> It's a little irritating having two hwspinlock.h's.
> hwspinlock_internal.h wold be a conventional approach.  But it's not a
> big deal.
...

>> +/**
>> + * __hwspin_lock_timeout() - lock an hwspinlock with timeout limit
>> + * @hwlock: the hwspinlock to be locked
>> + * @timeout: timeout value in jiffies
>
> hm, why in jiffies?
>
> The problem here is that lazy programmers will use
>
>        hwspin_lock_timeout(lock, 10, ...)
>
> and their code will work happily with HZ=100 but will explode with HZ=1000.
>
> IOW, this interface *requires* that all callers perform a
> seconds-to-jiffies conversion before calling hwspin_lock_timeout().  So
> why not reduce their effort and their ability to make mistakes by
> defining the API to take seconds?

I considered that, but then decided to use jiffies in order to be
consistent with wait_event_timeout/schedule_timeout (although I don't
return the remaining jiffies in case the lock is taken before the
timeout elapses), and also to allow user-selected granularity.

But I do kind of like the idea of not using jiffies. We can probably
even move to msecs, since anyway this is an error condition, and
people who needs a quick check should just use the trylock() version.

I'll do a quick respin of the patches with that and the
hwspinlock_internal.h comment above.

Thanks,
Ohad.
--
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