Sleep in preempt_disable on powernv with 'cat /proc/cpuinfo' on v4.15

Michael Ellerman mpe at ellerman.id.au
Wed Jan 10 02:31:40 AEDT 2018


Benjamin Herrenschmidt <benh at kernel.crashing.org> writes:

> On Mon, 2018-01-08 at 21:30 -0800, John Sperbeck wrote:
>> The pnv_get_proc_freq() function was recently changed to call
>> cpufreq_get(), instead of cpufreq_quick_get(), in order to fetch
>> a more up-to-date value for the CPU frequency:
>> 
>>    cd77b5ce208c153260ed7882d8910f2395bfaabd
>>    powerpc/powernv/cpufreq: Fix the frequency read by /proc/cpuinfo
>> 
>> Unfortunately, this function is called from show_cpuinfo() in
>> arch/powerpc/kernel/setup-common.c with preemption disabled.  The
>> cpufreq_get() function might do a down_read(), which can sleep.
>> 
>> With CONFIG_DEBUG_KERNEL and CONFIG_DEBUG_ATOMIC_SLEEP set, a warning
>> like the following is generated when running 'cat /proc/cpuinfo':

This was reported by Nick back in November just a few days after the
patch went in, so it's a little disappointing that it's still broken.

> We could just either remove the preempt_disable completely like
> x86 and keep it racy, or stick a cpus_read_lock around it. I dont think
> we need that preempt_disable, it's definitely overkill.
>
> Michael, what do you think ? I'm keen on sync'ing with x86 here...

Yeah I think we can drop it. The cpufreq seems to have some locking that
looks like it'll probably work - famous last words.

Who's writing the patch?

cheers


More information about the Linuxppc-dev mailing list