[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKohpom9q93cVD61qeht2WXgA=no64dwXowtMHS0wCy0k6qxXw@mail.gmail.com>
Date: Sat, 23 Feb 2013 09:09:31 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Nathan Zimmer <nzimmer@....com>
Cc: rjw@...k.pl, cpufreq@...r.kernel.org, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 2/2] cpufreq: Convert the cpufreq_driver_lock to use
the rcu
Hi Nathan,
Sorry for pointing out this so late but i still feel we are missing something
really important.
On 22 February 2013 21:54, Nathan Zimmer <nzimmer@....com> wrote:
> - read_lock_irqsave(&cpufreq_driver_lock, flags);
> + rcu_read_lock();
> + freqs->flags = rcu_dereference(cpufreq_driver)->flags;
> policy = per_cpu(cpufreq_cpu_data, freqs->cpu);
> - read_unlock_irqrestore(&cpufreq_driver_lock, flags);
> + rcu_read_unlock();
> - write_lock_irqsave(&cpufreq_driver_lock, flags);
> + spin_lock_irqsave(&cpufreq_driver_lock, flags);
> for_each_cpu(j, policy->cpus) {
> per_cpu(cpufreq_cpu_data, j) = policy;
> per_cpu(cpufreq_policy_cpu, j) = policy->cpu;
> }
> - write_unlock_irqrestore(&cpufreq_driver_lock, flags);
> + spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
Look at how we are protecting cpufreq_cpu_data here. rcu_read_[un]lock()
only marks the start/end of critical section. How are we sure here that
cpufreq_cpu_data is not read simultaneously when we are updating it?
rcu lock/unlock only works for cpufreq_driver pointer only and not for
this data. We still need the same locking for for cpufreq_cpu_data.
What do you say?
--
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