From: "tiejun.chen" <tiejun.chen@windriver.com>
To: Scott Wood <scottwood@freescale.com>,
Alexander Graf <agraf@suse.de>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: "<kvm-ppc@vger.kernel.org>" <kvm-ppc@vger.kernel.org>,
"<kvm@vger.kernel.org> list" <kvm@vger.kernel.org>
Subject: Re: [v1][PATCH 1/1] KVM: PPC: disable preemption when using hard_irq_disable()
Date: Fri, 12 Jul 2013 03:22:28 +0000 [thread overview]
Message-ID: <51DF7674.1070906@windriver.com> (raw)
In-Reply-To: <1373560585.8183.261@snotra>
On 07/12/2013 12:36 AM, Scott Wood wrote:
> On 07/11/2013 11:30:41 AM, Alexander Graf wrote:
>>
>> On 11.07.2013, at 18:18, Scott Wood wrote:
>>
>> > On 07/11/2013 08:07:30 AM, Alexander Graf wrote:
>> >> get_paca() warns when we're preemptible. We're only not preemptible when
>> either preempt is disabled or irqs are disabled. Irqs are disabled, but
>> arch_irqs_disabled() doesn't know, because it only checks for soft disabled IRQs.
>> >> So we can fix this either by setting IRQs as soft disabled as well
>> >
>> > If we set IRQs as soft-disabled prior to calling hard_irq_disable(), then
>> hard_irq_disable() will fail to call trace_hardirqs_off().
>>
>> Right...
>
> Plus we'd have the same problem trying to set soft_enabled to 0.
>
>> >> Any preferences?
>> >
>> > Use arch_local_save_flags() in hard_irq_disable() instead of reading
>> soft_enabled with C code.
>>
>> That only operates on the soft_enabled bit. We also need to access irq_happened.
>
> OK, so we'll need more inline asm.
If so, why not to remove directly hard_irq_disable() inside kvmppc_handle_exit()
by reverting that commit, "kvm/ppc/booke64: Fix lazy ee handling in
kvmppc_handle_exit()"?
Then we can use SOFT_DISABLE_INTS() explicitly before call kvmppc_handle_exit()
like this:
KVM: PPC: Book3E HV: call SOFT_DISABLE_INTS to sync the software state
We enter with interrupts disabled in hardware, but we need to
call SOFT_DISABLE_INTS anyway to ensure that the software state
is kept in sync.
Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
diff --git a/arch/powerpc/kvm/bookehv_interrupts.S
b/arch/powerpc/kvm/bookehv_interrupts.S
index e8ed7d6..b521d21 100644
--- a/arch/powerpc/kvm/bookehv_interrupts.S
+++ b/arch/powerpc/kvm/bookehv_interrupts.S
@@ -33,6 +33,8 @@
#ifdef CONFIG_64BIT
#include <asm/exception-64e.h>
+#include <asm/hw_irq.h>
+#include <asm/irqflags.h>
#else
#include "../kernel/head_booke.h" /* for THREAD_NORMSAVE() */
#endif
@@ -469,6 +471,14 @@ _GLOBAL(kvmppc_resume_host)
PPC_LL r3, HOST_RUN(r1)
mr r5, r14 /* intno */
mr r14, r4 /* Save vcpu pointer. */
+#ifdef CONFIG_64BIT
+ /*
+ * We enter with interrupts disabled in hardware, but
+ * we need to call SOFT_DISABLE_INTS anyway to ensure
+ * that the software state is kept in sync.
+ */
+ SOFT_DISABLE_INTS(r7,r8)
+#endif
bl kvmppc_handle_exit
/* Restore vcpu pointer and the nonvolatiles we used. */
Tiejun
next prev parent reply other threads:[~2013-07-12 3:22 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1373559480.8183.258@snotra>
2013-07-12 0:30 ` [v1][PATCH 1/1] KVM: PPC: disable preemption when using hard_irq_disable() Benjamin Herrenschmidt
[not found] ` <FB21594A-C233-4A97-8503-E2A1275F8F17@suse.de>
[not found] ` <1373560585.8183.261@snotra>
2013-07-12 3:22 ` tiejun.chen [this message]
[not found] <1373651433.8183.276@snotra>
2013-07-12 23:05 ` Benjamin Herrenschmidt
2013-07-15 2:20 ` tiejun.chen
2013-07-15 2:47 ` Benjamin Herrenschmidt
2013-07-15 3:03 ` tiejun.chen
[not found] ` <1373909248.8183.303@snotra>
2013-07-16 2:15 ` tiejun.chen
2013-07-15 2:25 ` tiejun.chen
2013-07-10 6:02 Tiejun Chen
2013-07-10 9:49 ` Alexander Graf
2013-07-11 2:48 ` tiejun.chen
2013-07-11 9:49 ` Alexander Graf
2013-07-11 12:28 ` Benjamin Herrenschmidt
2013-07-11 12:47 ` Alexander Graf
2013-07-11 12:54 ` Benjamin Herrenschmidt
2013-07-11 13:07 ` Alexander Graf
2013-07-12 0:19 ` Benjamin Herrenschmidt
2013-07-12 2:13 ` tiejun.chen
2013-07-12 3:57 ` Benjamin Herrenschmidt
2013-07-12 4:54 ` tiejun.chen
2013-07-14 4:13 ` Benjamin Herrenschmidt
2013-07-15 3:04 ` tiejun.chen
2013-07-10 19:15 ` Scott Wood
2013-07-11 2:59 ` tiejun.chen
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=51DF7674.1070906@windriver.com \
--to=tiejun.chen@windriver.com \
--cc=agraf@suse.de \
--cc=benh@kernel.crashing.org \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=scottwood@freescale.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