Subject: Re: Status report: sysmon_cpufreq(9) + powerctl(8)
To: Iain Hibbert <plunky@rya-online.net>
From: Jason Thorpe <thorpej@shagadelic.org>
List: tech-kern
Date: 09/28/2006 14:10:36
On Sep 28, 2006, at 2:00 PM, Iain Hibbert wrote:
> On Thu, 28 Sep 2006, Juan RP wrote:
>
>> Any more suggestions about the code?
>
> simple_lock(&sysmon_cpufreq_slock);
> error = prop_dictionary_copyout_ioctl(plist, cmd, DEV_PROP_D);
> simple_unlock(&sysmon_cpufreq_slock);
>
> I am not sure that this is altogether safe - if the copyout sleeps
> because
> ENOMEM, and another thread tries to get the lock in the meantime
> does that
> not just lock the CPU? (is a spinlock required?)
This code is actually wrong --- you're not allowed to hold a
simple_lock across a sleep.
> If another thread changes the dictionary during the externalize, I
> *think*
> it will just break the iterators and you will get an error. Jason?
Correct.
-- thorpej