linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/time: Fix clockevent_decrementer initalisation for PR KVM
@ 2018-10-19  4:23 Michael Ellerman
  2018-10-20  6:59 ` Anton Blanchard
  2018-10-22  9:40 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Ellerman @ 2018-10-19  4:23 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: paulus, anton, kvm-ppc

In the recent commit 8b78fdb045de ("powerpc/time: Use
clockevents_register_device(), fixing an issue with large
decrementer") we changed the way we initialise the decrementer
clockevent(s).

We no longer initialise the mult & shift values of
decrementer_clockevent itself.

This has the effect of breaking PR KVM, because it uses those values
in kvmppc_emulate_dec(). The symptom is guest kernels spin forever
mid-way through boot.

For now fix it by assigning back to decrementer_clockevent the mult
and shift values.

Fixes: 8b78fdb045de ("powerpc/time: Use clockevents_register_device(), fixing an issue with large decrementer")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/kernel/time.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 40868f3ee113..68e8f963d108 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -989,6 +989,10 @@ static void register_decrementer_clockevent(int cpu)
 
 	printk_once(KERN_DEBUG "clockevent: %s mult[%x] shift[%d] cpu[%d]\n",
 		    dec->name, dec->mult, dec->shift, cpu);
+
+	/* Set values for KVM, see kvm_emulate_dec() */
+	decrementer_clockevent.mult = dec->mult;
+	decrementer_clockevent.shift = dec->shift;
 }
 
 static void enable_large_decrementer(void)
-- 
2.17.2


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

* Re: [PATCH] powerpc/time: Fix clockevent_decrementer initalisation for PR KVM
  2018-10-19  4:23 [PATCH] powerpc/time: Fix clockevent_decrementer initalisation for PR KVM Michael Ellerman
@ 2018-10-20  6:59 ` Anton Blanchard
  2018-10-22  9:40 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Anton Blanchard @ 2018-10-20  6:59 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, paulus, kvm-ppc

On Fri, 19 Oct 2018 15:23:19 +1100
Michael Ellerman <mpe@ellerman.id.au> wrote:

> In the recent commit 8b78fdb045de ("powerpc/time: Use
> clockevents_register_device(), fixing an issue with large
> decrementer") we changed the way we initialise the decrementer
> clockevent(s).
> 
> We no longer initialise the mult & shift values of
> decrementer_clockevent itself.
> 
> This has the effect of breaking PR KVM, because it uses those values
> in kvmppc_emulate_dec(). The symptom is guest kernels spin forever
> mid-way through boot.
> 
> For now fix it by assigning back to decrementer_clockevent the mult
> and shift values.

Thanks Michael, I missed that completely.

Acked-by: Anton Blanchard <anton@samba.org>

Anton

> 
> Fixes: 8b78fdb045de ("powerpc/time: Use
> clockevents_register_device(), fixing an issue with large
> decrementer") Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> ---
>  arch/powerpc/kernel/time.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
> index 40868f3ee113..68e8f963d108 100644
> --- a/arch/powerpc/kernel/time.c
> +++ b/arch/powerpc/kernel/time.c
> @@ -989,6 +989,10 @@ static void register_decrementer_clockevent(int
> cpu) 
>  	printk_once(KERN_DEBUG "clockevent: %s mult[%x] shift[%d]
> cpu[%d]\n", dec->name, dec->mult, dec->shift, cpu);
> +
> +	/* Set values for KVM, see kvm_emulate_dec() */
> +	decrementer_clockevent.mult = dec->mult;
> +	decrementer_clockevent.shift = dec->shift;
>  }
>  
>  static void enable_large_decrementer(void)


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

* Re: powerpc/time: Fix clockevent_decrementer initalisation for PR KVM
  2018-10-19  4:23 [PATCH] powerpc/time: Fix clockevent_decrementer initalisation for PR KVM Michael Ellerman
  2018-10-20  6:59 ` Anton Blanchard
@ 2018-10-22  9:40 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2018-10-22  9:40 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev; +Cc: paulus, anton, kvm-ppc

On Fri, 2018-10-19 at 04:23:19 UTC, Michael Ellerman wrote:
> In the recent commit 8b78fdb045de ("powerpc/time: Use
> clockevents_register_device(), fixing an issue with large
> decrementer") we changed the way we initialise the decrementer
> clockevent(s).
> 
> We no longer initialise the mult & shift values of
> decrementer_clockevent itself.
> 
> This has the effect of breaking PR KVM, because it uses those values
> in kvmppc_emulate_dec(). The symptom is guest kernels spin forever
> mid-way through boot.
> 
> For now fix it by assigning back to decrementer_clockevent the mult
> and shift values.
> 
> Fixes: 8b78fdb045de ("powerpc/time: Use clockevents_register_device(), fixing an issue with large decrementer")
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> Acked-by: Anton Blanchard <anton@samba.org>

Applied to powerpc next.

https://git.kernel.org/powerpc/c/b4d16ab58c41ff0125822464bdff07

cheers

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

end of thread, other threads:[~2018-10-22 10:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-19  4:23 [PATCH] powerpc/time: Fix clockevent_decrementer initalisation for PR KVM Michael Ellerman
2018-10-20  6:59 ` Anton Blanchard
2018-10-22  9:40 ` Michael Ellerman

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