From: Alexander Graf <graf@amazon.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Cc: Matt Evans <matt@ozlabs.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>,
Paul Mackerras <paulus@samba.org>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH v2] KVM: PPC: Book3S PR: Enable MSR_DR for switch_mmu_context()
Date: Tue, 10 May 2022 14:33:40 +0200 [thread overview]
Message-ID: <5ad0f302-c1e1-b400-c3f3-a97c1cd443e8@amazon.com> (raw)
In-Reply-To: <f7416897-2ca5-6b2f-cfd3-30d9bcc557cd@csgroup.eu>
On 10.05.22 13:31, Christophe Leroy wrote:
> Le 10/05/2022 à 13:18, Alexander Graf a écrit :
>> Commit 863771a28e27 ("powerpc/32s: Convert switch_mmu_context() to C")
>> moved the switch_mmu_context() to C. While in principle a good idea, it
>> meant that the function now uses the stack. The stack is not accessible
>> from real mode though.
>>
>> So to keep calling the function, let's turn on MSR_DR while we call it.
>> That way, all pointer references to the stack are handled virtually.
> Is the system ready to handle a DSI in case the stack is not mapped ?
A DSI itself will be an interrupt again which will in turn destroy the
SPRG that we're saving. Guess I was trying to be too smart :). I'll use
Matt's original suggestion and just put it on the stack.
>> In addition, make sure to save/restore r12 in an SPRG, as it may get
>> clobbered by the C function.
>>
>> Reported-by: Matt Evans <matt@ozlabs.org>
>> Fixes: 863771a28e27 ("powerpc/32s: Convert switch_mmu_context() to C")
> Oops, sorry for that. I didn't realise that there was other callers to
> switch_mmu_context() than switch_mm_irqs_off().
No worries, the compiled C version looks a lot nicer than the previous
asm one - and it was a good way to identify whether there still are
users of KVM on Book3S 32bit out there :)
Alex
Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879
prev parent reply other threads:[~2022-05-10 12:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-10 11:18 [PATCH v2] KVM: PPC: Book3S PR: Enable MSR_DR for switch_mmu_context() Alexander Graf
2022-05-10 11:31 ` Christophe Leroy
2022-05-10 12:33 ` Alexander Graf [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=5ad0f302-c1e1-b400-c3f3-a97c1cd443e8@amazon.com \
--to=graf@amazon.com \
--cc=christophe.leroy@csgroup.eu \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=matt@ozlabs.org \
--cc=paulus@samba.org \
--cc=stable@vger.kernel.org \
/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).