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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 11 Jan 2011 19:25:01 -0800
From:	Saravana Kannan <skannan@...eaurora.org>
To:	Jeremy Kerr <jeremy.kerr@...onical.com>
CC:	Paul Mundt <lethal@...ux-sh.org>,
	Lorenzo Pieralisi <Lorenzo.Pieralisi@....com>,
	Russell King - ARM Linux <linux@....linux.org.uk>,
	linux-sh@...r.kernel.org,
	Ben Herrenschmidt <benh@...nel.crashing.org>,
	Sascha Hauer <s.hauer@...gutronix.de>,
	linux-kernel@...r.kernel.org,
	Uwe Kleine-König 
	<u.kleine-koenig@...gutronix.de>,
	Vincent Guittot <vincent.guittot@...aro.org>,
	linux-arm-kernel@...ts.infradead.org
Subject: Re: Locking in the clk API

On 01/11/2011 06:35 AM, Jeremy Kerr wrote:
> Hi Paul,
>
>> Again, you are approaching it from the angle that an atomic clock is a
>> special requirement rather than the default behaviour.
>
> I'm not considering it a special requirement, but it's still a requirement
> (that the called function does not sleep).
>
> The problem with the inverse logic (clk_enable/clk_enable_sleepable) is that
> now you've made the caller need to know what kind of clock it has, or might
> have one day.

I think it's just a matter of how you interpret the name of the API in 
English. It doesn't make the decision making of the developer any easier.

Just having a _atomic suffix doesn't mean the driver developer doesn't 
need to know what type of clock it is. They are still making the 
assumption that the enable/disable for that clock can be done atomically 
-- namely an "atomic clock".

Similarly, when a driver developer calls the _sleepable APIs in their 
code, for all practical purposes, they are making an assumption that the 
enable/disable for that clock *needs to* (not may) sleep.

>   * For clk_enable/clk_enable_atomic, the decision is: is this call in an
>     atomic context?
>
>   * For clk_enable/clk_enable_sleepable, the decision is: might the clock code
>     have given us a sleeping clock?

Having said the above, I'm slightly leaning towards 
clk_enable/disable_atomic since it lines up with the 
.suspend/.suspend_noirq functions in pm_ops.

Also, since it's good to reduce the amount of work that needs to be done 
atomically, I think it would be good to make a developer explicitly 
state they need _atomic functions and make them think about if they 
really need to do that.

-Saravana

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
--
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