linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: PPC: Use schedule instead of cond_resched
@ 2013-12-10 14:21 Aneesh Kumar K.V
  2013-12-10 14:40 ` Alexander Graf
  0 siblings, 1 reply; 7+ messages in thread
From: Aneesh Kumar K.V @ 2013-12-10 14:21 UTC (permalink / raw)
  To: agraf, benh, paulus; +Cc: linuxppc-dev, kvm, kvm-ppc, Aneesh Kumar K.V

From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>

We already checked need_resched. So we can call schedule directly

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---

NOTE: This patch also work around a regression upstream w.r.t PR KVM

 BUG: soft lockup - CPU#0 stuck for 23s! [qemu-system-ppc:4394]
 Modules linked in:
 CPU: 0 PID: 4394 Comm: qemu-system-ppc Not tainted 3.13.0-rc3+ #98
 task: c0000001d0788400 ti: c0000001dca00000 task.ti: c0000001dca00000
 NIP: c00000000082dd80 LR: c000000000081ae0 CTR: c000000000062ba0
 REGS: c0000001dca02f70 TRAP: 0901   Not tainted  (3.13.0-rc3+)
 MSR: 8000000000009032 <SF,EE,ME,IR,DR,RI>  CR: 24822024  XER: 00000000
 CFAR: c000000000081adc SOFTE: 1
 GPR00: c000000000081ae0 c0000001dca031f0 c000000000d67ab0 0000000000000001
 GPR04: 0000000071000002 0000000000000001 00000189a0d786b7 00000000018c0000
 GPR08: 0000000000000001 0000000000000000 0000000000000000 c000000000da0000
 GPR12: 0000000000000c00 c00000000fef0000
 NIP [c00000000082dd80] ._cond_resched+0x0/0x40
 LR [c000000000081ae0] .kvmppc_prepare_to_enter+0x2a0/0x2e0
 Call Trace:
 [c0000001dca031f0] [c000000000081ae0] .kvmppc_prepare_to_enter+0x2a0/0x2e0 (unreliable)
 [c0000001dca03290] [c00000000008f2cc] .kvmppc_handle_exit_pr+0xec/0xa40
 [c0000001dca03340] [c0000000000918c4] kvm_start_lightweight+0xac/0xbc
 [c0000001dca03510] [c00000000008efe0] .kvmppc_vcpu_run_pr+0x130/0x2a0
 [c0000001dca039e0] [c0000000000855bc] .kvmppc_vcpu_run+0x2c/0x40
 [c0000001dca03a50] [c000000000082c94] .kvm_arch_vcpu_ioctl_run+0x54/0x1b0
 [c0000001dca03ae0] [c00000000007d5f8] .kvm_vcpu_ioctl+0x478/0x740
 [c0000001dca03ca0] [c000000000218864] .do_vfs_ioctl+0x4a4/0x760
 [c0000001dca03d80] [c000000000218b78] .SyS_ioctl+0x58/0xb0
 [c0000001dca03e30] [c000000000009e58] syscall_exit+0x0/0x98
 Instruction dump:
 e92d0260 e94911c0 812a0004 5529f07e 5529103e 912a0004 38210080 e8010010
 ebc1fff0 ebe1fff8 7c0803a6 4e800020 <7c0802a6> 38600000 f8010010 f821ff91 

 arch/powerpc/kvm/powerpc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index e4d511c8b38b..6a49b23a3276 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -74,7 +74,7 @@ int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu)
 	while (true) {
 		if (need_resched()) {
 			local_irq_enable();
-			cond_resched();
+			schedule();
 			local_irq_disable();
 			continue;
 		}
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] KVM: PPC: Use schedule instead of cond_resched
  2013-12-10 14:21 [PATCH] KVM: PPC: Use schedule instead of cond_resched Aneesh Kumar K.V
@ 2013-12-10 14:40 ` Alexander Graf
  2013-12-10 16:08   ` Aneesh Kumar K.V
  2013-12-10 20:52   ` Benjamin Herrenschmidt
  0 siblings, 2 replies; 7+ messages in thread
From: Alexander Graf @ 2013-12-10 14:40 UTC (permalink / raw)
  To: Aneesh Kumar K.V
  Cc: Paul Mackerras, linuxppc-dev, kvm-ppc,
	kvm@vger.kernel.org mailing list


On 10.12.2013, at 15:21, Aneesh Kumar K.V =
<aneesh.kumar@linux.vnet.ibm.com> wrote:

> From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
>=20
> We already checked need_resched. So we can call schedule directly
>=20
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

The real fix for the issue you're seeing is

  https://lkml.org/lkml/2013/11/28/241


Alex

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] KVM: PPC: Use schedule instead of cond_resched
  2013-12-10 14:40 ` Alexander Graf
@ 2013-12-10 16:08   ` Aneesh Kumar K.V
  2013-12-10 17:00     ` Alexander Graf
  2013-12-10 20:52   ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 7+ messages in thread
From: Aneesh Kumar K.V @ 2013-12-10 16:08 UTC (permalink / raw)
  To: Alexander Graf
  Cc: Paul Mackerras, linuxppc-dev, kvm-ppc,
	kvm@vger.kernel.org mailing list

Alexander Graf <agraf@suse.de> writes:

> On 10.12.2013, at 15:21, Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> wrote:
>
>> From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
>> 
>> We already checked need_resched. So we can call schedule directly
>> 
>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
>
> The real fix for the issue you're seeing is
>
>   https://lkml.org/lkml/2013/11/28/241

True, I mentioned that in the thread

https://lkml.org/lkml/2013/12/9/64

But do we need to do cond_resched after we checked for need_resched() ?

-aneesh

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] KVM: PPC: Use schedule instead of cond_resched
  2013-12-10 16:08   ` Aneesh Kumar K.V
@ 2013-12-10 17:00     ` Alexander Graf
  0 siblings, 0 replies; 7+ messages in thread
From: Alexander Graf @ 2013-12-10 17:00 UTC (permalink / raw)
  To: Aneesh Kumar K.V
  Cc: Paul Mackerras, linuxppc-dev, kvm-ppc,
	kvm@vger.kernel.org mailing list


On 10.12.2013, at 17:08, Aneesh Kumar K.V =
<aneesh.kumar@linux.vnet.ibm.com> wrote:

> Alexander Graf <agraf@suse.de> writes:
>=20
>> On 10.12.2013, at 15:21, Aneesh Kumar K.V =
<aneesh.kumar@linux.vnet.ibm.com> wrote:
>>=20
>>> From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
>>>=20
>>> We already checked need_resched. So we can call schedule directly
>>>=20
>>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
>>=20
>> The real fix for the issue you're seeing is
>>=20
>>  https://lkml.org/lkml/2013/11/28/241
>=20
> True, I mentioned that in the thread
>=20
> https://lkml.org/lkml/2013/12/9/64
>=20
> But do we need to do cond_resched after we checked for need_resched() =
?

This is really just copying the logic from kvm_resched() from =
virt/kvm/kvm_main.c. And I'd prefer not to diverge from that. I do agree =
that there's a good chance we don't need it, as it seems to predate =
preempt notifiers:

  =
https://git.kernel.org/cgit/virt/kvm/kvm.git/commit/?id=3D3fca03653010b8c5=
fa63b99fc94c78cbfb433d00

But this is a discussion that should occur on the non-ppc specific code =
first :).


Alex

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] KVM: PPC: Use schedule instead of cond_resched
  2013-12-10 14:40 ` Alexander Graf
  2013-12-10 16:08   ` Aneesh Kumar K.V
@ 2013-12-10 20:52   ` Benjamin Herrenschmidt
  2013-12-10 22:48     ` Peter Zijlstra
  1 sibling, 1 reply; 7+ messages in thread
From: Benjamin Herrenschmidt @ 2013-12-10 20:52 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: kvm@vger.kernel.org mailing list, Alexander Graf, kvm-ppc,
	Paul Mackerras, Aneesh Kumar K.V, linuxppc-dev

On Tue, 2013-12-10 at 15:40 +0100, Alexander Graf wrote:
> On 10.12.2013, at 15:21, Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> wrote:
> 
> > From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
> > 
> > We already checked need_resched. So we can call schedule directly
> > 
> > Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> 
> The real fix for the issue you're seeing is
> 
>   https://lkml.org/lkml/2013/11/28/241
> 

And is still not upstream.... Peter ?

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] KVM: PPC: Use schedule instead of cond_resched
  2013-12-10 20:52   ` Benjamin Herrenschmidt
@ 2013-12-10 22:48     ` Peter Zijlstra
  2013-12-10 22:59       ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Zijlstra @ 2013-12-10 22:48 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: kvm@vger.kernel.org mailing list, Alexander Graf, kvm-ppc,
	Paul Mackerras, Aneesh Kumar K.V, linuxppc-dev

On Wed, Dec 11, 2013 at 07:52:51AM +1100, Benjamin Herrenschmidt wrote:
> On Tue, 2013-12-10 at 15:40 +0100, Alexander Graf wrote:
> > On 10.12.2013, at 15:21, Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> wrote:
> > 
> > > From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
> > > 
> > > We already checked need_resched. So we can call schedule directly
> > > 
> > > Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> > 
> > The real fix for the issue you're seeing is
> > 
> >   https://lkml.org/lkml/2013/11/28/241
> > 
> 
> And is still not upstream.... Peter ?

Yeah, I went on holidays and the patch just sat there. I'll prod Ingo
into merging it.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] KVM: PPC: Use schedule instead of cond_resched
  2013-12-10 22:48     ` Peter Zijlstra
@ 2013-12-10 22:59       ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 7+ messages in thread
From: Benjamin Herrenschmidt @ 2013-12-10 22:59 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: kvm@vger.kernel.org mailing list, Alexander Graf, kvm-ppc,
	Paul Mackerras, Aneesh Kumar K.V, linuxppc-dev

On Tue, 2013-12-10 at 23:48 +0100, Peter Zijlstra wrote:
> 
> Yeah, I went on holidays and the patch just sat there. I'll prod Ingo
> into merging it.

Thanks !

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-12-11  2:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-10 14:21 [PATCH] KVM: PPC: Use schedule instead of cond_resched Aneesh Kumar K.V
2013-12-10 14:40 ` Alexander Graf
2013-12-10 16:08   ` Aneesh Kumar K.V
2013-12-10 17:00     ` Alexander Graf
2013-12-10 20:52   ` Benjamin Herrenschmidt
2013-12-10 22:48     ` Peter Zijlstra
2013-12-10 22:59       ` Benjamin Herrenschmidt

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).