From: Victor Aoqui <victora@linux.vnet.ibm.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: rjw@rjwysocki.net, daniel.lezcano@linaro.org, paulus@samba.org,
mpe@ellerman.id.au, linux-pm@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
ltc-interlock@lists.linux.ibm.com, victora@br.ibm.com,
mauricfo@linux.vnet.ibm.com
Subject: Re: [PATCH] drivers: cpuidle: Disable preemption before get_lppaca function call in pseries_idle_probe function
Date: Tue, 01 Aug 2017 09:28:29 -0300 [thread overview]
Message-ID: <a4a42aadef838e115db89590a2ebeb67@linux.vnet.ibm.com> (raw)
In-Reply-To: <1500585713.10674.10.camel@kernel.crashing.org>
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
prev parent reply other threads:[~2017-08-01 12:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-20 17:57 [PATCH] drivers: cpuidle: Disable preemption before get_lppaca function call in pseries_idle_probe function Victor Aoqui
2017-07-20 21:21 ` Benjamin Herrenschmidt
2017-08-01 12:28 ` Victor Aoqui [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a4a42aadef838e115db89590a2ebeb67@linux.vnet.ibm.com \
--to=victora@linux.vnet.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=ltc-interlock@lists.linux.ibm.com \
--cc=mauricfo@linux.vnet.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=rjw@rjwysocki.net \
--cc=victora@br.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).