All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: PPC: Book3S: fix XIVE migration of pending interrupts
@ 2017-12-12 12:02 ` Cédric Le Goater
  0 siblings, 0 replies; 22+ messages in thread
From: Cédric Le Goater @ 2017-12-12 12:02 UTC (permalink / raw)
  To: kvm-ppc, Paul Mackerras, Benjamin Herrenschmidt
  Cc: linuxppc-dev, Michael Ellerman, Cédric Le Goater

When restoring a pending interrupt, we are setting the Q bit to force
a retrigger in xive_finish_unmask(). But we also need to force an EOI
in this case to reach the same initial state : P=1, Q=0.

This can be done by not setting 'old_p' for pending interrupts which
will inform xive_finish_unmask() that an EOI needs to be sent.

Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---

 Tested with a guest running iozone.

 arch/powerpc/kvm/book3s_xive.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kvm/book3s_xive.c b/arch/powerpc/kvm/book3s_xive.c
index bf457843e032..b5e6d227a034 100644
--- a/arch/powerpc/kvm/book3s_xive.c
+++ b/arch/powerpc/kvm/book3s_xive.c
@@ -1558,7 +1558,7 @@ static int xive_set_source(struct kvmppc_xive *xive, long irq, u64 addr)
 
 	/*
 	 * Restore P and Q. If the interrupt was pending, we
-	 * force both P and Q, which will trigger a resend.
+	 * force Q and !P, which will trigger a resend.
 	 *
 	 * That means that a guest that had both an interrupt
 	 * pending (queued) and Q set will restore with only
@@ -1566,7 +1566,7 @@ static int xive_set_source(struct kvmppc_xive *xive, long irq, u64 addr)
 	 * is perfectly fine as coalescing interrupts that haven't
 	 * been presented yet is always allowed.
 	 */
-	if (val & KVM_XICS_PRESENTED || val & KVM_XICS_PENDING)
+	if (val & KVM_XICS_PRESENTED && !(val & KVM_XICS_PENDING))
 		state->old_p = true;
 	if (val & KVM_XICS_QUEUED || val & KVM_XICS_PENDING)
 		state->old_q = true;
-- 
2.13.6

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

* [PATCH] KVM: PPC: Book3S: fix XIVE migration of pending interrupts
@ 2017-12-12 12:02 ` Cédric Le Goater
  0 siblings, 0 replies; 22+ messages in thread
From: Cédric Le Goater @ 2017-12-12 12:02 UTC (permalink / raw)
  To: kvm-ppc, Paul Mackerras, Benjamin Herrenschmidt
  Cc: linuxppc-dev, Michael Ellerman, Cédric Le Goater

When restoring a pending interrupt, we are setting the Q bit to force
a retrigger in xive_finish_unmask(). But we also need to force an EOI
in this case to reach the same initial state : P=1, Q=0.

This can be done by not setting 'old_p' for pending interrupts which
will inform xive_finish_unmask() that an EOI needs to be sent.

Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---

 Tested with a guest running iozone.

 arch/powerpc/kvm/book3s_xive.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kvm/book3s_xive.c b/arch/powerpc/kvm/book3s_xive.c
index bf457843e032..b5e6d227a034 100644
--- a/arch/powerpc/kvm/book3s_xive.c
+++ b/arch/powerpc/kvm/book3s_xive.c
@@ -1558,7 +1558,7 @@ static int xive_set_source(struct kvmppc_xive *xive, long irq, u64 addr)
 
 	/*
 	 * Restore P and Q. If the interrupt was pending, we
-	 * force both P and Q, which will trigger a resend.
+	 * force Q and !P, which will trigger a resend.
 	 *
 	 * That means that a guest that had both an interrupt
 	 * pending (queued) and Q set will restore with only
@@ -1566,7 +1566,7 @@ static int xive_set_source(struct kvmppc_xive *xive, long irq, u64 addr)
 	 * is perfectly fine as coalescing interrupts that haven't
 	 * been presented yet is always allowed.
 	 */
-	if (val & KVM_XICS_PRESENTED || val & KVM_XICS_PENDING)
+	if (val & KVM_XICS_PRESENTED && !(val & KVM_XICS_PENDING))
 		state->old_p = true;
 	if (val & KVM_XICS_QUEUED || val & KVM_XICS_PENDING)
 		state->old_q = true;
-- 
2.13.6


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

* Re: [PATCH] KVM: PPC: Book3S: fix XIVE migration of pending interrupts
  2017-12-12 12:02 ` Cédric Le Goater
@ 2017-12-12 13:15   ` Laurent Vivier
  -1 siblings, 0 replies; 22+ messages in thread
From: Laurent Vivier @ 2017-12-12 13:15 UTC (permalink / raw)
  To: Cédric Le Goater, kvm-ppc, Paul Mackerras, Benjamin Herrenschmidt
  Cc: linuxppc-dev

On 12/12/2017 13:02, Cédric Le Goater wrote:
> When restoring a pending interrupt, we are setting the Q bit to force
> a retrigger in xive_finish_unmask(). But we also need to force an EOI
> in this case to reach the same initial state : P=1, Q=0.
> 
> This can be done by not setting 'old_p' for pending interrupts which
> will inform xive_finish_unmask() that an EOI needs to be sent.
> 
> Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
> 
>  Tested with a guest running iozone.
> 
>  arch/powerpc/kvm/book3s_xive.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/book3s_xive.c b/arch/powerpc/kvm/book3s_xive.c
> index bf457843e032..b5e6d227a034 100644
> --- a/arch/powerpc/kvm/book3s_xive.c
> +++ b/arch/powerpc/kvm/book3s_xive.c
> @@ -1558,7 +1558,7 @@ static int xive_set_source(struct kvmppc_xive *xive, long irq, u64 addr)
>  
>  	/*
>  	 * Restore P and Q. If the interrupt was pending, we
> -	 * force both P and Q, which will trigger a resend.
> +	 * force Q and !P, which will trigger a resend.
>  	 *
>  	 * That means that a guest that had both an interrupt
>  	 * pending (queued) and Q set will restore with only
> @@ -1566,7 +1566,7 @@ static int xive_set_source(struct kvmppc_xive *xive, long irq, u64 addr)
>  	 * is perfectly fine as coalescing interrupts that haven't
>  	 * been presented yet is always allowed.
>  	 */
> -	if (val & KVM_XICS_PRESENTED || val & KVM_XICS_PENDING)
> +	if (val & KVM_XICS_PRESENTED && !(val & KVM_XICS_PENDING))
>  		state->old_p = true;
>  	if (val & KVM_XICS_QUEUED || val & KVM_XICS_PENDING)
>  		state->old_q = true;
> 

Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Tested-by: Laurent Vivier <lvivier@redhat.com>

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

* Re: [PATCH] KVM: PPC: Book3S: fix XIVE migration of pending interrupts
@ 2017-12-12 13:15   ` Laurent Vivier
  0 siblings, 0 replies; 22+ messages in thread
From: Laurent Vivier @ 2017-12-12 13:15 UTC (permalink / raw)
  To: Cédric Le Goater, kvm-ppc, Paul Mackerras, Benjamin Herrenschmidt
  Cc: linuxppc-dev

On 12/12/2017 13:02, Cédric Le Goater wrote:
> When restoring a pending interrupt, we are setting the Q bit to force
> a retrigger in xive_finish_unmask(). But we also need to force an EOI
> in this case to reach the same initial state : P=1, Q=0.
> 
> This can be done by not setting 'old_p' for pending interrupts which
> will inform xive_finish_unmask() that an EOI needs to be sent.
> 
> Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
> 
>  Tested with a guest running iozone.
> 
>  arch/powerpc/kvm/book3s_xive.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/book3s_xive.c b/arch/powerpc/kvm/book3s_xive.c
> index bf457843e032..b5e6d227a034 100644
> --- a/arch/powerpc/kvm/book3s_xive.c
> +++ b/arch/powerpc/kvm/book3s_xive.c
> @@ -1558,7 +1558,7 @@ static int xive_set_source(struct kvmppc_xive *xive, long irq, u64 addr)
>  
>  	/*
>  	 * Restore P and Q. If the interrupt was pending, we
> -	 * force both P and Q, which will trigger a resend.
> +	 * force Q and !P, which will trigger a resend.
>  	 *
>  	 * That means that a guest that had both an interrupt
>  	 * pending (queued) and Q set will restore with only
> @@ -1566,7 +1566,7 @@ static int xive_set_source(struct kvmppc_xive *xive, long irq, u64 addr)
>  	 * is perfectly fine as coalescing interrupts that haven't
>  	 * been presented yet is always allowed.
>  	 */
> -	if (val & KVM_XICS_PRESENTED || val & KVM_XICS_PENDING)
> +	if (val & KVM_XICS_PRESENTED && !(val & KVM_XICS_PENDING))
>  		state->old_p = true;
>  	if (val & KVM_XICS_QUEUED || val & KVM_XICS_PENDING)
>  		state->old_q = true;
> 

Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Tested-by: Laurent Vivier <lvivier@redhat.com>


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

* Re: [PATCH] KVM: PPC: Book3S: fix XIVE migration of pending interrupts
  2017-12-12 12:02 ` Cédric Le Goater
@ 2017-12-20  8:24   ` Laurent Vivier
  -1 siblings, 0 replies; 22+ messages in thread
From: Laurent Vivier @ 2017-12-20  8:24 UTC (permalink / raw)
  To: Cédric Le Goater, kvm-ppc, Paul Mackerras, Benjamin Herrenschmidt
  Cc: linuxppc-dev, Michael Ellerman

On 12/12/2017 13:02, Cédric Le Goater wrote:
> When restoring a pending interrupt, we are setting the Q bit to force
> a retrigger in xive_finish_unmask(). But we also need to force an EOI
> in this case to reach the same initial state : P=1, Q=0.
> 
> This can be done by not setting 'old_p' for pending interrupts which
> will inform xive_finish_unmask() that an EOI needs to be sent.
> 
> Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
> 
>  Tested with a guest running iozone.
> 
>  arch/powerpc/kvm/book3s_xive.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

We really need this patch to fix VM migration on POWER9.
When will it be merged?

Thanks,
Laurent

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

* Re: [PATCH] KVM: PPC: Book3S: fix XIVE migration of pending interrupts
@ 2017-12-20  8:24   ` Laurent Vivier
  0 siblings, 0 replies; 22+ messages in thread
From: Laurent Vivier @ 2017-12-20  8:24 UTC (permalink / raw)
  To: Cédric Le Goater, kvm-ppc, Paul Mackerras, Benjamin Herrenschmidt
  Cc: linuxppc-dev, Michael Ellerman

On 12/12/2017 13:02, Cédric Le Goater wrote:
> When restoring a pending interrupt, we are setting the Q bit to force
> a retrigger in xive_finish_unmask(). But we also need to force an EOI
> in this case to reach the same initial state : P=1, Q=0.
> 
> This can be done by not setting 'old_p' for pending interrupts which
> will inform xive_finish_unmask() that an EOI needs to be sent.
> 
> Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
> 
>  Tested with a guest running iozone.
> 
>  arch/powerpc/kvm/book3s_xive.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

We really need this patch to fix VM migration on POWER9.
When will it be merged?

Thanks,
Laurent

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

* Re: [PATCH] KVM: PPC: Book3S: fix XIVE migration of pending interrupts
  2017-12-20  8:24   ` Laurent Vivier
@ 2017-12-22  4:34     ` Michael Ellerman
  -1 siblings, 0 replies; 22+ messages in thread
From: Michael Ellerman @ 2017-12-22  4:34 UTC (permalink / raw)
  To: Laurent Vivier, Cédric Le Goater, kvm-ppc, Paul Mackerras,
	Benjamin Herrenschmidt
  Cc: linuxppc-dev

Laurent Vivier <lvivier@redhat.com> writes:

> On 12/12/2017 13:02, C=C3=A9dric Le Goater wrote:
>> When restoring a pending interrupt, we are setting the Q bit to force
>> a retrigger in xive_finish_unmask(). But we also need to force an EOI
>> in this case to reach the same initial state : P=3D1, Q=3D0.
>>=20
>> This can be done by not setting 'old_p' for pending interrupts which
>> will inform xive_finish_unmask() that an EOI needs to be sent.
>>=20
>> Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>> Signed-off-by: C=C3=A9dric Le Goater <clg@kaod.org>
>> ---
>>=20
>>  Tested with a guest running iozone.
>>=20
>>  arch/powerpc/kvm/book3s_xive.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> We really need this patch to fix VM migration on POWER9.
> When will it be merged?

Paul is away, so I'll merge it via the powerpc tree.

I'll mark it:

  Fixes: 5af50993850a ("KVM: PPC: Book3S HV: Native usage of the XIVE inter=
rupt controller")
  Cc: stable@vger.kernel.org # v4.12+

cheers

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

* Re: [PATCH] KVM: PPC: Book3S: fix XIVE migration of pending interrupts
@ 2017-12-22  4:34     ` Michael Ellerman
  0 siblings, 0 replies; 22+ messages in thread
From: Michael Ellerman @ 2017-12-22  4:34 UTC (permalink / raw)
  To: Laurent Vivier, Cédric Le Goater, kvm-ppc, Paul Mackerras,
	Benjamin Herrenschmidt
  Cc: linuxppc-dev

Laurent Vivier <lvivier@redhat.com> writes:

> On 12/12/2017 13:02, Cédric Le Goater wrote:
>> When restoring a pending interrupt, we are setting the Q bit to force
>> a retrigger in xive_finish_unmask(). But we also need to force an EOI
>> in this case to reach the same initial state : P=1, Q=0.
>> 
>> This can be done by not setting 'old_p' for pending interrupts which
>> will inform xive_finish_unmask() that an EOI needs to be sent.
>> 
>> Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>> ---
>> 
>>  Tested with a guest running iozone.
>> 
>>  arch/powerpc/kvm/book3s_xive.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> We really need this patch to fix VM migration on POWER9.
> When will it be merged?

Paul is away, so I'll merge it via the powerpc tree.

I'll mark it:

  Fixes: 5af50993850a ("KVM: PPC: Book3S HV: Native usage of the XIVE interrupt controller")
  Cc: stable@vger.kernel.org # v4.12+

cheers

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

* Re: [PATCH] KVM: PPC: Book3S: fix XIVE migration of pending interrupts
  2017-12-22  4:34     ` Michael Ellerman
@ 2017-12-22  7:54       ` Paul Mackerras
  -1 siblings, 0 replies; 22+ messages in thread
From: Paul Mackerras @ 2017-12-22  7:54 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Laurent Vivier, Cédric Le Goater, kvm-ppc,
	Benjamin Herrenschmidt, linuxppc-dev

On Fri, Dec 22, 2017 at 03:34:20PM +1100, Michael Ellerman wrote:
> Laurent Vivier <lvivier@redhat.com> writes:
> 
> > On 12/12/2017 13:02, Cédric Le Goater wrote:
> >> When restoring a pending interrupt, we are setting the Q bit to force
> >> a retrigger in xive_finish_unmask(). But we also need to force an EOI
> >> in this case to reach the same initial state : P=1, Q=0.
> >> 
> >> This can be done by not setting 'old_p' for pending interrupts which
> >> will inform xive_finish_unmask() that an EOI needs to be sent.
> >> 
> >> Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> >> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> >> ---
> >> 
> >>  Tested with a guest running iozone.
> >> 
> >>  arch/powerpc/kvm/book3s_xive.c | 4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > We really need this patch to fix VM migration on POWER9.
> > When will it be merged?
> 
> Paul is away, so I'll merge it via the powerpc tree.
> 
> I'll mark it:
> 
>   Fixes: 5af50993850a ("KVM: PPC: Book3S HV: Native usage of the XIVE interrupt controller")
>   Cc: stable@vger.kernel.org # v4.12+

Thanks for doing that.

If you felt like merging Alexey's patch "KVM: PPC: Book3S PR: Fix WIMG
handling under pHyp" with my acked-by, that would be fine too.  The
commit message needs a little work - the reason for using HPTE_R_M is
not just because it seems to work, but because current POWER
processors require M set on mappings for normal pages, and pHyp
enforces that.

Cheers,
Paul.

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

* Re: [PATCH] KVM: PPC: Book3S: fix XIVE migration of pending interrupts
@ 2017-12-22  7:54       ` Paul Mackerras
  0 siblings, 0 replies; 22+ messages in thread
From: Paul Mackerras @ 2017-12-22  7:54 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Laurent Vivier, Cédric Le Goater, kvm-ppc,
	Benjamin Herrenschmidt, linuxppc-dev

On Fri, Dec 22, 2017 at 03:34:20PM +1100, Michael Ellerman wrote:
> Laurent Vivier <lvivier@redhat.com> writes:
> 
> > On 12/12/2017 13:02, Cédric Le Goater wrote:
> >> When restoring a pending interrupt, we are setting the Q bit to force
> >> a retrigger in xive_finish_unmask(). But we also need to force an EOI
> >> in this case to reach the same initial state : P=1, Q=0.
> >> 
> >> This can be done by not setting 'old_p' for pending interrupts which
> >> will inform xive_finish_unmask() that an EOI needs to be sent.
> >> 
> >> Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> >> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> >> ---
> >> 
> >>  Tested with a guest running iozone.
> >> 
> >>  arch/powerpc/kvm/book3s_xive.c | 4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > We really need this patch to fix VM migration on POWER9.
> > When will it be merged?
> 
> Paul is away, so I'll merge it via the powerpc tree.
> 
> I'll mark it:
> 
>   Fixes: 5af50993850a ("KVM: PPC: Book3S HV: Native usage of the XIVE interrupt controller")
>   Cc: stable@vger.kernel.org # v4.12+

Thanks for doing that.

If you felt like merging Alexey's patch "KVM: PPC: Book3S PR: Fix WIMG
handling under pHyp" with my acked-by, that would be fine too.  The
commit message needs a little work - the reason for using HPTE_R_M is
not just because it seems to work, but because current POWER
processors require M set on mappings for normal pages, and pHyp
enforces that.

Cheers,
Paul.

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

* Re: [PATCH] KVM: PPC: Book3S: fix XIVE migration of pending interrupts
  2017-12-22  7:54       ` Paul Mackerras
@ 2017-12-22  7:57         ` Laurent Vivier
  -1 siblings, 0 replies; 22+ messages in thread
From: Laurent Vivier @ 2017-12-22  7:57 UTC (permalink / raw)
  To: Paul Mackerras, Michael Ellerman
  Cc: Cédric Le Goater, kvm-ppc, Benjamin Herrenschmidt, linuxppc-dev

On 22/12/2017 08:54, Paul Mackerras wrote:
> On Fri, Dec 22, 2017 at 03:34:20PM +1100, Michael Ellerman wrote:
>> Laurent Vivier <lvivier@redhat.com> writes:
>>
>>> On 12/12/2017 13:02, Cédric Le Goater wrote:
>>>> When restoring a pending interrupt, we are setting the Q bit to force
>>>> a retrigger in xive_finish_unmask(). But we also need to force an EOI
>>>> in this case to reach the same initial state : P=1, Q=0.
>>>>
>>>> This can be done by not setting 'old_p' for pending interrupts which
>>>> will inform xive_finish_unmask() that an EOI needs to be sent.
>>>>
>>>> Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>>>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>>>> ---
>>>>
>>>>  Tested with a guest running iozone.
>>>>
>>>>  arch/powerpc/kvm/book3s_xive.c | 4 ++--
>>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> We really need this patch to fix VM migration on POWER9.
>>> When will it be merged?
>>
>> Paul is away, so I'll merge it via the powerpc tree.
>>
>> I'll mark it:
>>
>>   Fixes: 5af50993850a ("KVM: PPC: Book3S HV: Native usage of the XIVE interrupt controller")
>>   Cc: stable@vger.kernel.org # v4.12+
> 
> Thanks for doing that.
> 
> If you felt like merging Alexey's patch "KVM: PPC: Book3S PR: Fix WIMG
> handling under pHyp" with my acked-by, that would be fine too.  The
> commit message needs a little work - the reason for using HPTE_R_M is
> not just because it seems to work, but because current POWER
> processors require M set on mappings for normal pages, and pHyp
> enforces that.

We also need:

KVM: PPC: Book3S HV: Fix pending_pri value in kvmppc_xive_get_icp()

Thanks,
Laurent

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

* Re: [PATCH] KVM: PPC: Book3S: fix XIVE migration of pending interrupts
@ 2017-12-22  7:57         ` Laurent Vivier
  0 siblings, 0 replies; 22+ messages in thread
From: Laurent Vivier @ 2017-12-22  7:57 UTC (permalink / raw)
  To: Paul Mackerras, Michael Ellerman
  Cc: Cédric Le Goater, kvm-ppc, Benjamin Herrenschmidt, linuxppc-dev

On 22/12/2017 08:54, Paul Mackerras wrote:
> On Fri, Dec 22, 2017 at 03:34:20PM +1100, Michael Ellerman wrote:
>> Laurent Vivier <lvivier@redhat.com> writes:
>>
>>> On 12/12/2017 13:02, Cédric Le Goater wrote:
>>>> When restoring a pending interrupt, we are setting the Q bit to force
>>>> a retrigger in xive_finish_unmask(). But we also need to force an EOI
>>>> in this case to reach the same initial state : P=1, Q=0.
>>>>
>>>> This can be done by not setting 'old_p' for pending interrupts which
>>>> will inform xive_finish_unmask() that an EOI needs to be sent.
>>>>
>>>> Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>>>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>>>> ---
>>>>
>>>>  Tested with a guest running iozone.
>>>>
>>>>  arch/powerpc/kvm/book3s_xive.c | 4 ++--
>>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> We really need this patch to fix VM migration on POWER9.
>>> When will it be merged?
>>
>> Paul is away, so I'll merge it via the powerpc tree.
>>
>> I'll mark it:
>>
>>   Fixes: 5af50993850a ("KVM: PPC: Book3S HV: Native usage of the XIVE interrupt controller")
>>   Cc: stable@vger.kernel.org # v4.12+
> 
> Thanks for doing that.
> 
> If you felt like merging Alexey's patch "KVM: PPC: Book3S PR: Fix WIMG
> handling under pHyp" with my acked-by, that would be fine too.  The
> commit message needs a little work - the reason for using HPTE_R_M is
> not just because it seems to work, but because current POWER
> processors require M set on mappings for normal pages, and pHyp
> enforces that.

We also need:

KVM: PPC: Book3S HV: Fix pending_pri value in kvmppc_xive_get_icp()

Thanks,
Laurent

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

* Re: [PATCH] KVM: PPC: Book3S: fix XIVE migration of pending interrupts
  2017-12-22  7:54       ` Paul Mackerras
@ 2017-12-22 11:22         ` Michael Ellerman
  -1 siblings, 0 replies; 22+ messages in thread
From: Michael Ellerman @ 2017-12-22 11:22 UTC (permalink / raw)
  To: Paul Mackerras
  Cc: Laurent Vivier, Cédric Le Goater, kvm-ppc,
	Benjamin Herrenschmidt, linuxppc-dev

Paul Mackerras <paulus@ozlabs.org> writes:

> On Fri, Dec 22, 2017 at 03:34:20PM +1100, Michael Ellerman wrote:
>> Laurent Vivier <lvivier@redhat.com> writes:
>>=20
>> > On 12/12/2017 13:02, C=C3=A9dric Le Goater wrote:
>> >> When restoring a pending interrupt, we are setting the Q bit to force
>> >> a retrigger in xive_finish_unmask(). But we also need to force an EOI
>> >> in this case to reach the same initial state : P=3D1, Q=3D0.
>> >>=20
>> >> This can be done by not setting 'old_p' for pending interrupts which
>> >> will inform xive_finish_unmask() that an EOI needs to be sent.
>> >>=20
>> >> Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>> >> Signed-off-by: C=C3=A9dric Le Goater <clg@kaod.org>
>> >> ---
>> >>=20
>> >>  Tested with a guest running iozone.
>> >>=20
>> >>  arch/powerpc/kvm/book3s_xive.c | 4 ++--
>> >>  1 file changed, 2 insertions(+), 2 deletions(-)
>> >
>> > We really need this patch to fix VM migration on POWER9.
>> > When will it be merged?
>>=20
>> Paul is away, so I'll merge it via the powerpc tree.
>>=20
>> I'll mark it:
>>=20
>>   Fixes: 5af50993850a ("KVM: PPC: Book3S HV: Native usage of the XIVE in=
terrupt controller")
>>   Cc: stable@vger.kernel.org # v4.12+
>
> Thanks for doing that.
>
> If you felt like merging Alexey's patch "KVM: PPC: Book3S PR: Fix WIMG
> handling under pHyp" with my acked-by, that would be fine too.  The
> commit message needs a little work - the reason for using HPTE_R_M is
> not just because it seems to work, but because current POWER
> processors require M set on mappings for normal pages, and pHyp
> enforces that.

OK. I saw this too late, but I'll pick that one up next week. If someone
sends me an updated change log I will merge all of their patches for
ever.

cheers

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

* Re: [PATCH] KVM: PPC: Book3S: fix XIVE migration of pending interrupts
@ 2017-12-22 11:22         ` Michael Ellerman
  0 siblings, 0 replies; 22+ messages in thread
From: Michael Ellerman @ 2017-12-22 11:22 UTC (permalink / raw)
  To: Paul Mackerras
  Cc: Laurent Vivier, Cédric Le Goater, kvm-ppc,
	Benjamin Herrenschmidt, linuxppc-dev

Paul Mackerras <paulus@ozlabs.org> writes:

> On Fri, Dec 22, 2017 at 03:34:20PM +1100, Michael Ellerman wrote:
>> Laurent Vivier <lvivier@redhat.com> writes:
>> 
>> > On 12/12/2017 13:02, Cédric Le Goater wrote:
>> >> When restoring a pending interrupt, we are setting the Q bit to force
>> >> a retrigger in xive_finish_unmask(). But we also need to force an EOI
>> >> in this case to reach the same initial state : P=1, Q=0.
>> >> 
>> >> This can be done by not setting 'old_p' for pending interrupts which
>> >> will inform xive_finish_unmask() that an EOI needs to be sent.
>> >> 
>> >> Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>> >> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>> >> ---
>> >> 
>> >>  Tested with a guest running iozone.
>> >> 
>> >>  arch/powerpc/kvm/book3s_xive.c | 4 ++--
>> >>  1 file changed, 2 insertions(+), 2 deletions(-)
>> >
>> > We really need this patch to fix VM migration on POWER9.
>> > When will it be merged?
>> 
>> Paul is away, so I'll merge it via the powerpc tree.
>> 
>> I'll mark it:
>> 
>>   Fixes: 5af50993850a ("KVM: PPC: Book3S HV: Native usage of the XIVE interrupt controller")
>>   Cc: stable@vger.kernel.org # v4.12+
>
> Thanks for doing that.
>
> If you felt like merging Alexey's patch "KVM: PPC: Book3S PR: Fix WIMG
> handling under pHyp" with my acked-by, that would be fine too.  The
> commit message needs a little work - the reason for using HPTE_R_M is
> not just because it seems to work, but because current POWER
> processors require M set on mappings for normal pages, and pHyp
> enforces that.

OK. I saw this too late, but I'll pick that one up next week. If someone
sends me an updated change log I will merge all of their patches for
ever.

cheers

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

* Re: [PATCH] KVM: PPC: Book3S: fix XIVE migration of pending interrupts
  2017-12-22  7:57         ` Laurent Vivier
@ 2017-12-22 11:22           ` Michael Ellerman
  -1 siblings, 0 replies; 22+ messages in thread
From: Michael Ellerman @ 2017-12-22 11:22 UTC (permalink / raw)
  To: Laurent Vivier, Paul Mackerras
  Cc: Cédric Le Goater, kvm-ppc, Benjamin Herrenschmidt, linuxppc-dev

Laurent Vivier <lvivier@redhat.com> writes:

> On 22/12/2017 08:54, Paul Mackerras wrote:
>> On Fri, Dec 22, 2017 at 03:34:20PM +1100, Michael Ellerman wrote:
>>> Laurent Vivier <lvivier@redhat.com> writes:
>>>
>>>> On 12/12/2017 13:02, C=C3=A9dric Le Goater wrote:
>>>>> When restoring a pending interrupt, we are setting the Q bit to force
>>>>> a retrigger in xive_finish_unmask(). But we also need to force an EOI
>>>>> in this case to reach the same initial state : P=3D1, Q=3D0.
>>>>>
>>>>> This can be done by not setting 'old_p' for pending interrupts which
>>>>> will inform xive_finish_unmask() that an EOI needs to be sent.
>>>>>
>>>>> Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>>>>> Signed-off-by: C=C3=A9dric Le Goater <clg@kaod.org>
>>>>> ---
>>>>>
>>>>>  Tested with a guest running iozone.
>>>>>
>>>>>  arch/powerpc/kvm/book3s_xive.c | 4 ++--
>>>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>> We really need this patch to fix VM migration on POWER9.
>>>> When will it be merged?
>>>
>>> Paul is away, so I'll merge it via the powerpc tree.
>>>
>>> I'll mark it:
>>>
>>>   Fixes: 5af50993850a ("KVM: PPC: Book3S HV: Native usage of the XIVE i=
nterrupt controller")
>>>   Cc: stable@vger.kernel.org # v4.12+
>>=20
>> Thanks for doing that.
>>=20
>> If you felt like merging Alexey's patch "KVM: PPC: Book3S PR: Fix WIMG
>> handling under pHyp" with my acked-by, that would be fine too.  The
>> commit message needs a little work - the reason for using HPTE_R_M is
>> not just because it seems to work, but because current POWER
>> processors require M set on mappings for normal pages, and pHyp
>> enforces that.
>
> We also need:
>
> KVM: PPC: Book3S HV: Fix pending_pri value in kvmppc_xive_get_icp()

I've merged that one.

cheers

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

* Re: [PATCH] KVM: PPC: Book3S: fix XIVE migration of pending interrupts
@ 2017-12-22 11:22           ` Michael Ellerman
  0 siblings, 0 replies; 22+ messages in thread
From: Michael Ellerman @ 2017-12-22 11:22 UTC (permalink / raw)
  To: Laurent Vivier, Paul Mackerras
  Cc: Cédric Le Goater, kvm-ppc, Benjamin Herrenschmidt, linuxppc-dev

Laurent Vivier <lvivier@redhat.com> writes:

> On 22/12/2017 08:54, Paul Mackerras wrote:
>> On Fri, Dec 22, 2017 at 03:34:20PM +1100, Michael Ellerman wrote:
>>> Laurent Vivier <lvivier@redhat.com> writes:
>>>
>>>> On 12/12/2017 13:02, Cédric Le Goater wrote:
>>>>> When restoring a pending interrupt, we are setting the Q bit to force
>>>>> a retrigger in xive_finish_unmask(). But we also need to force an EOI
>>>>> in this case to reach the same initial state : P=1, Q=0.
>>>>>
>>>>> This can be done by not setting 'old_p' for pending interrupts which
>>>>> will inform xive_finish_unmask() that an EOI needs to be sent.
>>>>>
>>>>> Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>>>>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>>>>> ---
>>>>>
>>>>>  Tested with a guest running iozone.
>>>>>
>>>>>  arch/powerpc/kvm/book3s_xive.c | 4 ++--
>>>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>> We really need this patch to fix VM migration on POWER9.
>>>> When will it be merged?
>>>
>>> Paul is away, so I'll merge it via the powerpc tree.
>>>
>>> I'll mark it:
>>>
>>>   Fixes: 5af50993850a ("KVM: PPC: Book3S HV: Native usage of the XIVE interrupt controller")
>>>   Cc: stable@vger.kernel.org # v4.12+
>> 
>> Thanks for doing that.
>> 
>> If you felt like merging Alexey's patch "KVM: PPC: Book3S PR: Fix WIMG
>> handling under pHyp" with my acked-by, that would be fine too.  The
>> commit message needs a little work - the reason for using HPTE_R_M is
>> not just because it seems to work, but because current POWER
>> processors require M set on mappings for normal pages, and pHyp
>> enforces that.
>
> We also need:
>
> KVM: PPC: Book3S HV: Fix pending_pri value in kvmppc_xive_get_icp()

I've merged that one.

cheers

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

* Re: KVM: PPC: Book3S: fix XIVE migration of pending interrupts
  2017-12-12 12:02 ` Cédric Le Goater
@ 2017-12-22 11:24   ` Michael Ellerman
  -1 siblings, 0 replies; 22+ messages in thread
From: Michael Ellerman @ 2017-12-22 11:24 UTC (permalink / raw)
  To: Cédric Le Goater, kvm-ppc, Paul Mackerras, Benjamin Herrenschmidt
  Cc: linuxppc-dev, Cédric Le Goater

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 746 bytes --]

On Tue, 2017-12-12 at 12:02:04 UTC, =?utf-8?q?C=C3=A9dric_Le_Goater?= wrote:
> When restoring a pending interrupt, we are setting the Q bit to force
> a retrigger in xive_finish_unmask(). But we also need to force an EOI
> in this case to reach the same initial state : P=1, Q=0.
> 
> This can be done by not setting 'old_p' for pending interrupts which
> will inform xive_finish_unmask() that an EOI needs to be sent.
> 
> Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> Reviewed-by: Laurent Vivier <lvivier@redhat.com>
> Tested-by: Laurent Vivier <lvivier@redhat.com>

Applied to powerpc fixes, thanks.

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

cheers

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

* Re: KVM: PPC: Book3S: fix XIVE migration of pending interrupts
@ 2017-12-22 11:24   ` Michael Ellerman
  0 siblings, 0 replies; 22+ messages in thread
From: Michael Ellerman @ 2017-12-22 11:24 UTC (permalink / raw)
  To: Cédric Le Goater, kvm-ppc, Paul Mackerras, Benjamin Herrenschmidt
  Cc: linuxppc-dev, Cédric Le Goater

On Tue, 2017-12-12 at 12:02:04 UTC, =?utf-8?q?Cédric_Le_Goater?= wrote:
> When restoring a pending interrupt, we are setting the Q bit to force
> a retrigger in xive_finish_unmask(). But we also need to force an EOI
> in this case to reach the same initial state : P=1, Q=0.
> 
> This can be done by not setting 'old_p' for pending interrupts which
> will inform xive_finish_unmask() that an EOI needs to be sent.
> 
> Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> Reviewed-by: Laurent Vivier <lvivier@redhat.com>
> Tested-by: Laurent Vivier <lvivier@redhat.com>

Applied to powerpc fixes, thanks.

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

cheers

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

* Re: [PATCH] KVM: PPC: Book3S: fix XIVE migration of pending interrupts
  2017-12-22 11:22         ` Michael Ellerman
@ 2017-12-22 11:58           ` Greg Kurz
  -1 siblings, 0 replies; 22+ messages in thread
From: Greg Kurz @ 2017-12-22 11:58 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Paul Mackerras, Laurent Vivier, Cédric Le Goater, kvm-ppc,
	Benjamin Herrenschmidt, linuxppc-dev

On Fri, 22 Dec 2017 22:22:08 +1100
Michael Ellerman <mpe@ellerman.id.au> wrote:

> Paul Mackerras <paulus@ozlabs.org> writes:
>=20
> > On Fri, Dec 22, 2017 at 03:34:20PM +1100, Michael Ellerman wrote: =20
> >> Laurent Vivier <lvivier@redhat.com> writes:
> >>  =20
> >> > On 12/12/2017 13:02, C=C3=A9dric Le Goater wrote: =20
> >> >> When restoring a pending interrupt, we are setting the Q bit to for=
ce
> >> >> a retrigger in xive_finish_unmask(). But we also need to force an E=
OI
> >> >> in this case to reach the same initial state : P=3D1, Q=3D0.
> >> >>=20
> >> >> This can be done by not setting 'old_p' for pending interrupts which
> >> >> will inform xive_finish_unmask() that an EOI needs to be sent.
> >> >>=20
> >> >> Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> >> >> Signed-off-by: C=C3=A9dric Le Goater <clg@kaod.org>
> >> >> ---
> >> >>=20
> >> >>  Tested with a guest running iozone.
> >> >>=20
> >> >>  arch/powerpc/kvm/book3s_xive.c | 4 ++--
> >> >>  1 file changed, 2 insertions(+), 2 deletions(-) =20
> >> >
> >> > We really need this patch to fix VM migration on POWER9.
> >> > When will it be merged? =20
> >>=20
> >> Paul is away, so I'll merge it via the powerpc tree.
> >>=20
> >> I'll mark it:
> >>=20
> >>   Fixes: 5af50993850a ("KVM: PPC: Book3S HV: Native usage of the XIVE =
interrupt controller")
> >>   Cc: stable@vger.kernel.org # v4.12+ =20
> >
> > Thanks for doing that.
> >
> > If you felt like merging Alexey's patch "KVM: PPC: Book3S PR: Fix WIMG
> > handling under pHyp" with my acked-by, that would be fine too.  The
> > commit message needs a little work - the reason for using HPTE_R_M is
> > not just because it seems to work, but because current POWER
> > processors require M set on mappings for normal pages, and pHyp
> > enforces that. =20
>=20
> OK. I saw this too late, but I'll pick that one up next week. If someone
> sends me an updated change log I will merge all of their patches for
> ever.
>=20

Really ? Opportunity makes the thief, so here's my take :P

8<---------------------------------------------------------------------->8
KVM: PPC: Book3S: fix XIVE migration of pending interrupts

96df226 "KVM: PPC: Book3S PR: Preserve storage control bits" added WIMG
bits preserving but it missed 2 special cases:
- a magic page in kvmppc_mmu_book3s_64_xlate() and
- guest real mode in kvmppc_handle_pagefault().

For these ptes WIMG were 0 and pHyp failed on these causing a guest to
stop in the very beginning at NIP=3D0x100 (due to bd9166ffe
"KVM: PPC: Book3S PR: Exit KVM on failed mapping").

According to LoPAPR v1.1 14.5.4.1.2 H_ENTER:

 The hypervisor checks that the WIMG bits within the PTE are appropriate
 for the physical page number else H_Parameter return. (For System Memory
 pages WIMG=3D0010, or, 1110 if the SAO option is enabled, and for IO pages
 WIMG=3D01**.)

This hence initializes WIMG to non-zero value HPTE_R_M (0x10), as expected
by pHyp.

Fixes: 96df226 "KVM: PPC: Book3S PR: Preserve storage control bits"
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
8<---------------------------------------------------------------------->8

Cheers,

--
Greg

> cheers
> --
> To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] KVM: PPC: Book3S: fix XIVE migration of pending interrupts
@ 2017-12-22 11:58           ` Greg Kurz
  0 siblings, 0 replies; 22+ messages in thread
From: Greg Kurz @ 2017-12-22 11:58 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Paul Mackerras, Laurent Vivier, Cédric Le Goater, kvm-ppc,
	Benjamin Herrenschmidt, linuxppc-dev

On Fri, 22 Dec 2017 22:22:08 +1100
Michael Ellerman <mpe@ellerman.id.au> wrote:

> Paul Mackerras <paulus@ozlabs.org> writes:
> 
> > On Fri, Dec 22, 2017 at 03:34:20PM +1100, Michael Ellerman wrote:  
> >> Laurent Vivier <lvivier@redhat.com> writes:
> >>   
> >> > On 12/12/2017 13:02, Cédric Le Goater wrote:  
> >> >> When restoring a pending interrupt, we are setting the Q bit to force
> >> >> a retrigger in xive_finish_unmask(). But we also need to force an EOI
> >> >> in this case to reach the same initial state : P=1, Q=0.
> >> >> 
> >> >> This can be done by not setting 'old_p' for pending interrupts which
> >> >> will inform xive_finish_unmask() that an EOI needs to be sent.
> >> >> 
> >> >> Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> >> >> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> >> >> ---
> >> >> 
> >> >>  Tested with a guest running iozone.
> >> >> 
> >> >>  arch/powerpc/kvm/book3s_xive.c | 4 ++--
> >> >>  1 file changed, 2 insertions(+), 2 deletions(-)  
> >> >
> >> > We really need this patch to fix VM migration on POWER9.
> >> > When will it be merged?  
> >> 
> >> Paul is away, so I'll merge it via the powerpc tree.
> >> 
> >> I'll mark it:
> >> 
> >>   Fixes: 5af50993850a ("KVM: PPC: Book3S HV: Native usage of the XIVE interrupt controller")
> >>   Cc: stable@vger.kernel.org # v4.12+  
> >
> > Thanks for doing that.
> >
> > If you felt like merging Alexey's patch "KVM: PPC: Book3S PR: Fix WIMG
> > handling under pHyp" with my acked-by, that would be fine too.  The
> > commit message needs a little work - the reason for using HPTE_R_M is
> > not just because it seems to work, but because current POWER
> > processors require M set on mappings for normal pages, and pHyp
> > enforces that.  
> 
> OK. I saw this too late, but I'll pick that one up next week. If someone
> sends me an updated change log I will merge all of their patches for
> ever.
> 

Really ? Opportunity makes the thief, so here's my take :P

8<---------------------------------------------------------------------->8
KVM: PPC: Book3S: fix XIVE migration of pending interrupts

96df226 "KVM: PPC: Book3S PR: Preserve storage control bits" added WIMG
bits preserving but it missed 2 special cases:
- a magic page in kvmppc_mmu_book3s_64_xlate() and
- guest real mode in kvmppc_handle_pagefault().

For these ptes WIMG were 0 and pHyp failed on these causing a guest to
stop in the very beginning at NIP=0x100 (due to bd9166ffe
"KVM: PPC: Book3S PR: Exit KVM on failed mapping").

According to LoPAPR v1.1 14.5.4.1.2 H_ENTER:

 The hypervisor checks that the WIMG bits within the PTE are appropriate
 for the physical page number else H_Parameter return. (For System Memory
 pages WIMG\010, or, 1110 if the SAO option is enabled, and for IO pages
 WIMG\x01**.)

This hence initializes WIMG to non-zero value HPTE_R_M (0x10), as expected
by pHyp.

Fixes: 96df226 "KVM: PPC: Book3S PR: Preserve storage control bits"
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
8<---------------------------------------------------------------------->8

Cheers,

--
Greg

> cheers
> --
> To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

* Re: [PATCH] KVM: PPC: Book3S: fix XIVE migration of pending interrupts
  2017-12-22 11:58           ` Greg Kurz
@ 2017-12-22 12:18             ` Greg Kurz
  -1 siblings, 0 replies; 22+ messages in thread
From: Greg Kurz @ 2017-12-22 12:18 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Paul Mackerras, Laurent Vivier, Cédric Le Goater, kvm-ppc,
	Benjamin Herrenschmidt, linuxppc-dev

On Fri, 22 Dec 2017 12:58:47 +0100
Greg Kurz <groug@kaod.org> wrote:

> On Fri, 22 Dec 2017 22:22:08 +1100
> Michael Ellerman <mpe@ellerman.id.au> wrote:
> 
> > Paul Mackerras <paulus@ozlabs.org> writes:
[...]
> > >
> > > Thanks for doing that.
> > >
> > > If you felt like merging Alexey's patch "KVM: PPC: Book3S PR: Fix WIMG
> > > handling under pHyp" with my acked-by, that would be fine too.  The
> > > commit message needs a little work - the reason for using HPTE_R_M is
> > > not just because it seems to work, but because current POWER
> > > processors require M set on mappings for normal pages, and pHyp
> > > enforces that.    
> > 
> > OK. I saw this too late, but I'll pick that one up next week. If someone
> > sends me an updated change log I will merge all of their patches for
> > ever.
> >   
> 
> Really ? Opportunity makes the thief, so here's my take :P
> 
> 8<---------------------------------------------------------------------->8
> KVM: PPC: Book3S: fix XIVE migration of pending interrupts

Oops! Paste error... Title should be:

KVM: PPC: Book3S PR: Fix WIMG handling under pHyp

> 
> 96df226 "KVM: PPC: Book3S PR: Preserve storage control bits" added WIMG
> bits preserving but it missed 2 special cases:
> - a magic page in kvmppc_mmu_book3s_64_xlate() and
> - guest real mode in kvmppc_handle_pagefault().
> 
> For these ptes WIMG were 0 and pHyp failed on these causing a guest to
> stop in the very beginning at NIP=0x100 (due to bd9166ffe
> "KVM: PPC: Book3S PR: Exit KVM on failed mapping").
> 
> According to LoPAPR v1.1 14.5.4.1.2 H_ENTER:
> 
>  The hypervisor checks that the WIMG bits within the PTE are appropriate
>  for the physical page number else H_Parameter return. (For System Memory
>  pages WIMG=0010, or, 1110 if the SAO option is enabled, and for IO pages
>  WIMG=01**.)
> 
> This hence initializes WIMG to non-zero value HPTE_R_M (0x10), as expected
> by pHyp.
> 
> Fixes: 96df226 "KVM: PPC: Book3S PR: Preserve storage control bits"
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> 8<---------------------------------------------------------------------->8
> 
> Cheers,
> 
> --
> Greg
> 
> > cheers
> > --
> > To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html  
> 

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

* Re: [PATCH] KVM: PPC: Book3S: fix XIVE migration of pending interrupts
@ 2017-12-22 12:18             ` Greg Kurz
  0 siblings, 0 replies; 22+ messages in thread
From: Greg Kurz @ 2017-12-22 12:18 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Paul Mackerras, Laurent Vivier, Cédric Le Goater, kvm-ppc,
	Benjamin Herrenschmidt, linuxppc-dev

On Fri, 22 Dec 2017 12:58:47 +0100
Greg Kurz <groug@kaod.org> wrote:

> On Fri, 22 Dec 2017 22:22:08 +1100
> Michael Ellerman <mpe@ellerman.id.au> wrote:
> 
> > Paul Mackerras <paulus@ozlabs.org> writes:
[...]
> > >
> > > Thanks for doing that.
> > >
> > > If you felt like merging Alexey's patch "KVM: PPC: Book3S PR: Fix WIMG
> > > handling under pHyp" with my acked-by, that would be fine too.  The
> > > commit message needs a little work - the reason for using HPTE_R_M is
> > > not just because it seems to work, but because current POWER
> > > processors require M set on mappings for normal pages, and pHyp
> > > enforces that.    
> > 
> > OK. I saw this too late, but I'll pick that one up next week. If someone
> > sends me an updated change log I will merge all of their patches for
> > ever.
> >   
> 
> Really ? Opportunity makes the thief, so here's my take :P
> 
> 8<---------------------------------------------------------------------->8
> KVM: PPC: Book3S: fix XIVE migration of pending interrupts

Oops! Paste error... Title should be:

KVM: PPC: Book3S PR: Fix WIMG handling under pHyp

> 
> 96df226 "KVM: PPC: Book3S PR: Preserve storage control bits" added WIMG
> bits preserving but it missed 2 special cases:
> - a magic page in kvmppc_mmu_book3s_64_xlate() and
> - guest real mode in kvmppc_handle_pagefault().
> 
> For these ptes WIMG were 0 and pHyp failed on these causing a guest to
> stop in the very beginning at NIP=0x100 (due to bd9166ffe
> "KVM: PPC: Book3S PR: Exit KVM on failed mapping").
> 
> According to LoPAPR v1.1 14.5.4.1.2 H_ENTER:
> 
>  The hypervisor checks that the WIMG bits within the PTE are appropriate
>  for the physical page number else H_Parameter return. (For System Memory
>  pages WIMG\010, or, 1110 if the SAO option is enabled, and for IO pages
>  WIMG\x01**.)
> 
> This hence initializes WIMG to non-zero value HPTE_R_M (0x10), as expected
> by pHyp.
> 
> Fixes: 96df226 "KVM: PPC: Book3S PR: Preserve storage control bits"
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> 8<---------------------------------------------------------------------->8
> 
> Cheers,
> 
> --
> Greg
> 
> > cheers
> > --
> > To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html  
> 


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

end of thread, other threads:[~2017-12-22 18:12 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-12 12:02 [PATCH] KVM: PPC: Book3S: fix XIVE migration of pending interrupts Cédric Le Goater
2017-12-12 12:02 ` Cédric Le Goater
2017-12-12 13:15 ` Laurent Vivier
2017-12-12 13:15   ` Laurent Vivier
2017-12-20  8:24 ` Laurent Vivier
2017-12-20  8:24   ` Laurent Vivier
2017-12-22  4:34   ` Michael Ellerman
2017-12-22  4:34     ` Michael Ellerman
2017-12-22  7:54     ` Paul Mackerras
2017-12-22  7:54       ` Paul Mackerras
2017-12-22  7:57       ` Laurent Vivier
2017-12-22  7:57         ` Laurent Vivier
2017-12-22 11:22         ` Michael Ellerman
2017-12-22 11:22           ` Michael Ellerman
2017-12-22 11:22       ` Michael Ellerman
2017-12-22 11:22         ` Michael Ellerman
2017-12-22 11:58         ` Greg Kurz
2017-12-22 11:58           ` Greg Kurz
2017-12-22 12:18           ` Greg Kurz
2017-12-22 12:18             ` Greg Kurz
2017-12-22 11:24 ` Michael Ellerman
2017-12-22 11:24   ` Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.