Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1700973 > unrolled thread

Re: [PATCH] drivers: cpuidle: Disable preemption before get_lppaca function call in pseries_idle_probe function

Started byVictor Aoqui <victora@linux.vnet.ibm.com>
First post2017-08-01 14:30 +0200
Last post2017-08-01 14:30 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] drivers: cpuidle: Disable preemption before get_lppaca  function call in pseries_idle_probe function Victor Aoqui <victora@linux.vnet.ibm.com> - 2017-08-01 14:30 +0200

#1700973 — Re: [PATCH] drivers: cpuidle: Disable preemption before get_lppaca function call in pseries_idle_probe function

FromVictor Aoqui <victora@linux.vnet.ibm.com>
Date2017-08-01 14:30 +0200
SubjectRe: [PATCH] drivers: cpuidle: Disable preemption before get_lppaca function call in pseries_idle_probe function
Message-ID<u9Etb-3XT-7@gated-at.bofh.it>
Em 2017-07-20 18:21, Benjamin Herrenschmidt escreveu:
> On Thu, 2017-07-20 at 14:57 -0300, Victor Aoqui wrote:
>> When CONFIG_PREEMPT=y, the following warning shows up:
>> 
>> BUG: using smp_processor_id() in preemptible [00000000] code: 
>> swapper/0/1
>> caller is pseries_processor_idle_init+0x58/0x21c
>> 
>> This warning shows up because preemption cannot occur when using
>> get_paca(), otherwise the paca_struct it points to may be the wrong 
>> one
>> just after.
>> 
>> For this reason, preemption needs to be disabled before
>> lppaca_shared_proc(get_lppaca()).
> 
> Also chekc the generated assembly. We had all sort of interesting
> issues where gcc would copy the paca pointer or the lppaca pointer
> to a GPR *outside* of the preempt disabled section...
> 
> In that specific case it's not a big deal but overall, I am not
> comfortable with PREEMPT on powerpc until we do something a bit
> more drastic...
> 
> I would like to remove all such direct accesses to paca, instead have a
> "new" get_paca() written in asm that does the preempt disable then
> returns the PACA in a GPR (not directly use r13, hide that from gcc),
> and which is paired with a put_paca().
> 
> The few places where we want to directly access r13 should be hand
> written in asm too to hide r13 from gcc, for accessing the irq_happened
> in the fast path of local_irq_enable/disable/... we should do the same
> with lock tokens.
> 
> Ben.

Hi Benjamin,

Sorry for the delay. I was a little bit busy last days.
I took note of your comments and I will work on those changes.
I will let you know soon when it's done.

Thanks

-- 
Victor Aoqui

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web