All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v1 for-2.12 0/2] s390x/kvm: last minute fixes
@ 2018-04-09 11:30 David Hildenbrand
  2018-04-09 11:30 ` [Qemu-devel] [PATCH v1 for-2.12 1/2] s390x/mmu: don't overwrite pending exception in mmu translate David Hildenbrand
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: David Hildenbrand @ 2018-04-09 11:30 UTC (permalink / raw)
  To: qemu-s390x
  Cc: qemu-devel, Richard Henderson, Alexander Graf, Cornelia Huck,
	Christian Borntraeger, Thomas Huth

Patch 1 only applies to old KVM instances without the virtual memory access
IOCTL in KVM.

Patch 2 could be problematic when toggling PER in a restart interrupt.
Watchpoint recomputation only applies to TCG.

David Hildenbrand (2):
  s390x/mmu: don't overwrite pending exception in mmu translate
  s390x: load_psw() should only exchange the PSW for KVM

 target/s390x/helper.c     | 10 ++++++----
 target/s390x/mmu_helper.c |  2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)

-- 
2.14.3

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

* [Qemu-devel] [PATCH v1 for-2.12 1/2] s390x/mmu: don't overwrite pending exception in mmu translate
  2018-04-09 11:30 [Qemu-devel] [PATCH v1 for-2.12 0/2] s390x/kvm: last minute fixes David Hildenbrand
@ 2018-04-09 11:30 ` David Hildenbrand
  2018-04-09 11:44   ` Thomas Huth
  2018-04-09 11:50   ` [Qemu-devel] [qemu-s390x] " Christian Borntraeger
  2018-04-09 11:30 ` [Qemu-devel] [PATCH v1 for-2.12 2/2] s390x: load_psw() should only exchange the PSW for KVM David Hildenbrand
  2018-04-09 12:35 ` [Qemu-devel] [PATCH v1 for-2.12 0/2] s390x/kvm: last minute fixes Cornelia Huck
  2 siblings, 2 replies; 14+ messages in thread
From: David Hildenbrand @ 2018-04-09 11:30 UTC (permalink / raw)
  To: qemu-s390x
  Cc: qemu-devel, Richard Henderson, Alexander Graf, Cornelia Huck,
	Christian Borntraeger, Thomas Huth, David Hildenbrand

If we already triggered another exception, don't overwrite it with a
protection exception.

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 target/s390x/mmu_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c
index 1deeb6e6e4..a25deef5dd 100644
--- a/target/s390x/mmu_helper.c
+++ b/target/s390x/mmu_helper.c
@@ -325,7 +325,7 @@ static int mmu_translate_asce(CPUS390XState *env, target_ulong vaddr,
 
     r = mmu_translate_region(env, vaddr, asc, asce, level, raddr, flags, rw,
                              exc);
-    if (rw == MMU_DATA_STORE && !(*flags & PAGE_WRITE)) {
+    if (!r && rw == MMU_DATA_STORE && !(*flags & PAGE_WRITE)) {
         trigger_prot_fault(env, vaddr, asc, rw, exc);
         return -1;
     }
-- 
2.14.3

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

* [Qemu-devel] [PATCH v1 for-2.12 2/2] s390x: load_psw() should only exchange the PSW for KVM
  2018-04-09 11:30 [Qemu-devel] [PATCH v1 for-2.12 0/2] s390x/kvm: last minute fixes David Hildenbrand
  2018-04-09 11:30 ` [Qemu-devel] [PATCH v1 for-2.12 1/2] s390x/mmu: don't overwrite pending exception in mmu translate David Hildenbrand
@ 2018-04-09 11:30 ` David Hildenbrand
  2018-04-09 11:35   ` Christian Borntraeger
  2018-04-09 11:56   ` Thomas Huth
  2018-04-09 12:35 ` [Qemu-devel] [PATCH v1 for-2.12 0/2] s390x/kvm: last minute fixes Cornelia Huck
  2 siblings, 2 replies; 14+ messages in thread
From: David Hildenbrand @ 2018-04-09 11:30 UTC (permalink / raw)
  To: qemu-s390x
  Cc: qemu-devel, Richard Henderson, Alexander Graf, Cornelia Huck,
	Christian Borntraeger, Thomas Huth, David Hildenbrand

Let's simplify it a bit. On some weird circumstances we would have tried
to recompute watchpoints when running under KVM.

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 target/s390x/helper.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/target/s390x/helper.c b/target/s390x/helper.c
index 615fa24ab9..e8548f340a 100644
--- a/target/s390x/helper.c
+++ b/target/s390x/helper.c
@@ -103,16 +103,18 @@ void load_psw(CPUS390XState *env, uint64_t mask, uint64_t addr)
 
     env->psw.addr = addr;
     env->psw.mask = mask;
-    if (tcg_enabled()) {
-        env->cc_op = (mask >> 44) & 3;
+
+    /* KVM will handle all WAITs and trigger a WAIT exit on disabled_wait */
+    if (!tcg_enabled()) {
+        return;
     }
+    env->cc_op = (mask >> 44) & 3;
 
     if ((old_mask ^ mask) & PSW_MASK_PER) {
         s390_cpu_recompute_watchpoints(CPU(s390_env_get_cpu(env)));
     }
 
-    /* KVM will handle all WAITs and trigger a WAIT exit on disabled_wait */
-    if (tcg_enabled() && (mask & PSW_MASK_WAIT)) {
+    if (mask & PSW_MASK_WAIT) {
         s390_handle_wait(s390_env_get_cpu(env));
     }
 }
-- 
2.14.3

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

* Re: [Qemu-devel] [PATCH v1 for-2.12 2/2] s390x: load_psw() should only exchange the PSW for KVM
  2018-04-09 11:30 ` [Qemu-devel] [PATCH v1 for-2.12 2/2] s390x: load_psw() should only exchange the PSW for KVM David Hildenbrand
@ 2018-04-09 11:35   ` Christian Borntraeger
  2018-04-09 11:36     ` David Hildenbrand
  2018-04-09 11:56   ` Thomas Huth
  1 sibling, 1 reply; 14+ messages in thread
From: Christian Borntraeger @ 2018-04-09 11:35 UTC (permalink / raw)
  To: David Hildenbrand, qemu-s390x
  Cc: qemu-devel, Richard Henderson, Alexander Graf, Cornelia Huck,
	Thomas Huth



On 04/09/2018 01:30 PM, David Hildenbrand wrote:
> Let's simplify it a bit. On some weird circumstances we would have tried
> to recompute watchpoints when running under KVM.
> 
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  target/s390x/helper.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/target/s390x/helper.c b/target/s390x/helper.c
> index 615fa24ab9..e8548f340a 100644
> --- a/target/s390x/helper.c
> +++ b/target/s390x/helper.c
> @@ -103,16 +103,18 @@ void load_psw(CPUS390XState *env, uint64_t mask, uint64_t addr)
> 
>      env->psw.addr = addr;
>      env->psw.mask = mask;
> -    if (tcg_enabled()) {
> -        env->cc_op = (mask >> 44) & 3;
> +
> +    /* KVM will handle all WAITs and trigger a WAIT exit on disabled_wait */
> +    if (!tcg_enabled()) {
> +        return;
>      }
> +    env->cc_op = (mask >> 44) & 3;

Do we have any call path were KVM could call load_psw?

> 
>      if ((old_mask ^ mask) & PSW_MASK_PER) {
>          s390_cpu_recompute_watchpoints(CPU(s390_env_get_cpu(env)));
>      }
> 
> -    /* KVM will handle all WAITs and trigger a WAIT exit on disabled_wait */
> -    if (tcg_enabled() && (mask & PSW_MASK_WAIT)) {
> +    if (mask & PSW_MASK_WAIT) {
>          s390_handle_wait(s390_env_get_cpu(env));
>      }
>  }
> 

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

* Re: [Qemu-devel] [PATCH v1 for-2.12 2/2] s390x: load_psw() should only exchange the PSW for KVM
  2018-04-09 11:35   ` Christian Borntraeger
@ 2018-04-09 11:36     ` David Hildenbrand
  2018-04-09 11:40       ` Christian Borntraeger
  0 siblings, 1 reply; 14+ messages in thread
From: David Hildenbrand @ 2018-04-09 11:36 UTC (permalink / raw)
  To: Christian Borntraeger, qemu-s390x
  Cc: qemu-devel, Richard Henderson, Alexander Graf, Cornelia Huck,
	Thomas Huth

On 09.04.2018 13:35, Christian Borntraeger wrote:
> 
> 
> On 04/09/2018 01:30 PM, David Hildenbrand wrote:
>> Let's simplify it a bit. On some weird circumstances we would have tried
>> to recompute watchpoints when running under KVM.
>>
>> Signed-off-by: David Hildenbrand <david@redhat.com>
>> ---
>>  target/s390x/helper.c | 10 ++++++----
>>  1 file changed, 6 insertions(+), 4 deletions(-)
>>
>> diff --git a/target/s390x/helper.c b/target/s390x/helper.c
>> index 615fa24ab9..e8548f340a 100644
>> --- a/target/s390x/helper.c
>> +++ b/target/s390x/helper.c
>> @@ -103,16 +103,18 @@ void load_psw(CPUS390XState *env, uint64_t mask, uint64_t addr)
>>
>>      env->psw.addr = addr;
>>      env->psw.mask = mask;
>> -    if (tcg_enabled()) {
>> -        env->cc_op = (mask >> 44) & 3;
>> +
>> +    /* KVM will handle all WAITs and trigger a WAIT exit on disabled_wait */
>> +    if (!tcg_enabled()) {
>> +        return;
>>      }
>> +    env->cc_op = (mask >> 44) & 3;
> 
> Do we have any call path were KVM could call load_psw?

do_restart_interrupt()

SIGP while the target CPU is stopped.

> 
>>
>>      if ((old_mask ^ mask) & PSW_MASK_PER) {
>>          s390_cpu_recompute_watchpoints(CPU(s390_env_get_cpu(env)));
>>      }
>>
>> -    /* KVM will handle all WAITs and trigger a WAIT exit on disabled_wait */
>> -    if (tcg_enabled() && (mask & PSW_MASK_WAIT)) {
>> +    if (mask & PSW_MASK_WAIT) {
>>          s390_handle_wait(s390_env_get_cpu(env));
>>      }
>>  }
>>
> 


-- 

Thanks,

David / dhildenb

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

* Re: [Qemu-devel] [PATCH v1 for-2.12 2/2] s390x: load_psw() should only exchange the PSW for KVM
  2018-04-09 11:36     ` David Hildenbrand
@ 2018-04-09 11:40       ` Christian Borntraeger
  2018-04-09 11:44         ` David Hildenbrand
  0 siblings, 1 reply; 14+ messages in thread
From: Christian Borntraeger @ 2018-04-09 11:40 UTC (permalink / raw)
  To: David Hildenbrand, qemu-s390x
  Cc: qemu-devel, Richard Henderson, Alexander Graf, Cornelia Huck,
	Thomas Huth



On 04/09/2018 01:36 PM, David Hildenbrand wrote:
> On 09.04.2018 13:35, Christian Borntraeger wrote:
>>
>>
>> On 04/09/2018 01:30 PM, David Hildenbrand wrote:
>>> Let's simplify it a bit. On some weird circumstances we would have tried
>>> to recompute watchpoints when running under KVM.
>>>
>>> Signed-off-by: David Hildenbrand <david@redhat.com>
>>> ---
>>>  target/s390x/helper.c | 10 ++++++----
>>>  1 file changed, 6 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/target/s390x/helper.c b/target/s390x/helper.c
>>> index 615fa24ab9..e8548f340a 100644
>>> --- a/target/s390x/helper.c
>>> +++ b/target/s390x/helper.c
>>> @@ -103,16 +103,18 @@ void load_psw(CPUS390XState *env, uint64_t mask, uint64_t addr)
>>>
>>>      env->psw.addr = addr;
>>>      env->psw.mask = mask;
>>> -    if (tcg_enabled()) {
>>> -        env->cc_op = (mask >> 44) & 3;
>>> +
>>> +    /* KVM will handle all WAITs and trigger a WAIT exit on disabled_wait */
>>> +    if (!tcg_enabled()) {
>>> +        return;
>>>      }
>>> +    env->cc_op = (mask >> 44) & 3;
>>
>> Do we have any call path were KVM could call load_psw?
> 
> do_restart_interrupt()
> 
> SIGP while the target CPU is stopped.

makes sense. Can you add that to the patch description? that makes it easier to understand
what can really go wrong without this patch.

> 
>>
>>>
>>>      if ((old_mask ^ mask) & PSW_MASK_PER) {
>>>          s390_cpu_recompute_watchpoints(CPU(s390_env_get_cpu(env)));
>>>      }
>>>
>>> -    /* KVM will handle all WAITs and trigger a WAIT exit on disabled_wait */
>>> -    if (tcg_enabled() && (mask & PSW_MASK_WAIT)) {
>>> +    if (mask & PSW_MASK_WAIT) {
>>>          s390_handle_wait(s390_env_get_cpu(env));
>>>      }
>>>  }
>>>
>>
> 
> 

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

* Re: [Qemu-devel] [PATCH v1 for-2.12 2/2] s390x: load_psw() should only exchange the PSW for KVM
  2018-04-09 11:40       ` Christian Borntraeger
@ 2018-04-09 11:44         ` David Hildenbrand
  2018-04-09 11:46           ` Christian Borntraeger
  2018-04-09 11:49           ` Cornelia Huck
  0 siblings, 2 replies; 14+ messages in thread
From: David Hildenbrand @ 2018-04-09 11:44 UTC (permalink / raw)
  To: Christian Borntraeger, qemu-s390x
  Cc: qemu-devel, Richard Henderson, Alexander Graf, Cornelia Huck,
	Thomas Huth

On 09.04.2018 13:40, Christian Borntraeger wrote:
> 
> 
> On 04/09/2018 01:36 PM, David Hildenbrand wrote:
>> On 09.04.2018 13:35, Christian Borntraeger wrote:
>>>
>>>
>>> On 04/09/2018 01:30 PM, David Hildenbrand wrote:
>>>> Let's simplify it a bit. On some weird circumstances we would have tried
>>>> to recompute watchpoints when running under KVM.



>>>>
>>>> Signed-off-by: David Hildenbrand <david@redhat.com>
>>>> ---
>>>>  target/s390x/helper.c | 10 ++++++----
>>>>  1 file changed, 6 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/target/s390x/helper.c b/target/s390x/helper.c
>>>> index 615fa24ab9..e8548f340a 100644
>>>> --- a/target/s390x/helper.c
>>>> +++ b/target/s390x/helper.c
>>>> @@ -103,16 +103,18 @@ void load_psw(CPUS390XState *env, uint64_t mask, uint64_t addr)
>>>>
>>>>      env->psw.addr = addr;
>>>>      env->psw.mask = mask;
>>>> -    if (tcg_enabled()) {
>>>> -        env->cc_op = (mask >> 44) & 3;
>>>> +
>>>> +    /* KVM will handle all WAITs and trigger a WAIT exit on disabled_wait */
>>>> +    if (!tcg_enabled()) {
>>>> +        return;
>>>>      }
>>>> +    env->cc_op = (mask >> 44) & 3;
>>>
>>> Do we have any call path were KVM could call load_psw?
>>
>> do_restart_interrupt()
>>
>> SIGP while the target CPU is stopped.
> 
> makes sense. Can you add that to the patch description? that makes it easier to understand
> what can really go wrong without this patch.

Sure!

Conny, when (and if ;) ) picking this up, can you change the description to

"Let's simplify it a bit. On some weird circumstances we would have
tried to recompute watchpoints when running under KVM. load_psw() is
called from do_restart_interrupt() during a SIGP RESTART if the target
CPU is STOPPED. Let's touch watchpoints only in the TCG case - where
they are used for PER emulation."


-- 

Thanks,

David / dhildenb

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

* Re: [Qemu-devel] [PATCH v1 for-2.12 1/2] s390x/mmu: don't overwrite pending exception in mmu translate
  2018-04-09 11:30 ` [Qemu-devel] [PATCH v1 for-2.12 1/2] s390x/mmu: don't overwrite pending exception in mmu translate David Hildenbrand
@ 2018-04-09 11:44   ` Thomas Huth
  2018-04-09 11:50   ` [Qemu-devel] [qemu-s390x] " Christian Borntraeger
  1 sibling, 0 replies; 14+ messages in thread
From: Thomas Huth @ 2018-04-09 11:44 UTC (permalink / raw)
  To: David Hildenbrand, qemu-s390x
  Cc: qemu-devel, Richard Henderson, Alexander Graf, Cornelia Huck,
	Christian Borntraeger

On 09.04.2018 13:30, David Hildenbrand wrote:
> If we already triggered another exception, don't overwrite it with a
> protection exception.
> 
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  target/s390x/mmu_helper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c
> index 1deeb6e6e4..a25deef5dd 100644
> --- a/target/s390x/mmu_helper.c
> +++ b/target/s390x/mmu_helper.c
> @@ -325,7 +325,7 @@ static int mmu_translate_asce(CPUS390XState *env, target_ulong vaddr,
>  
>      r = mmu_translate_region(env, vaddr, asc, asce, level, raddr, flags, rw,
>                               exc);
> -    if (rw == MMU_DATA_STORE && !(*flags & PAGE_WRITE)) {
> +    if (!r && rw == MMU_DATA_STORE && !(*flags & PAGE_WRITE)) {
>          trigger_prot_fault(env, vaddr, asc, rw, exc);
>          return -1;
>      }

Looks right.

Reviewed-by: Thomas Huth <thuth@redhat.com>

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

* Re: [Qemu-devel] [PATCH v1 for-2.12 2/2] s390x: load_psw() should only exchange the PSW for KVM
  2018-04-09 11:44         ` David Hildenbrand
@ 2018-04-09 11:46           ` Christian Borntraeger
  2018-04-09 11:49           ` Cornelia Huck
  1 sibling, 0 replies; 14+ messages in thread
From: Christian Borntraeger @ 2018-04-09 11:46 UTC (permalink / raw)
  To: David Hildenbrand, qemu-s390x
  Cc: qemu-devel, Richard Henderson, Alexander Graf, Cornelia Huck,
	Thomas Huth



On 04/09/2018 01:44 PM, David Hildenbrand wrote:
> On 09.04.2018 13:40, Christian Borntraeger wrote:
>>
>>
>> On 04/09/2018 01:36 PM, David Hildenbrand wrote:
>>> On 09.04.2018 13:35, Christian Borntraeger wrote:
>>>>
>>>>
>>>> On 04/09/2018 01:30 PM, David Hildenbrand wrote:
>>>>> Let's simplify it a bit. On some weird circumstances we would have tried
>>>>> to recompute watchpoints when running under KVM.
> 
> 
> 
>>>>>
>>>>> Signed-off-by: David Hildenbrand <david@redhat.com>
>>>>> ---
>>>>>  target/s390x/helper.c | 10 ++++++----
>>>>>  1 file changed, 6 insertions(+), 4 deletions(-)
>>>>>
>>>>> diff --git a/target/s390x/helper.c b/target/s390x/helper.c
>>>>> index 615fa24ab9..e8548f340a 100644
>>>>> --- a/target/s390x/helper.c
>>>>> +++ b/target/s390x/helper.c
>>>>> @@ -103,16 +103,18 @@ void load_psw(CPUS390XState *env, uint64_t mask, uint64_t addr)
>>>>>
>>>>>      env->psw.addr = addr;
>>>>>      env->psw.mask = mask;
>>>>> -    if (tcg_enabled()) {
>>>>> -        env->cc_op = (mask >> 44) & 3;
>>>>> +
>>>>> +    /* KVM will handle all WAITs and trigger a WAIT exit on disabled_wait */
>>>>> +    if (!tcg_enabled()) {
>>>>> +        return;
>>>>>      }
>>>>> +    env->cc_op = (mask >> 44) & 3;
>>>>
>>>> Do we have any call path were KVM could call load_psw?
>>>
>>> do_restart_interrupt()
>>>
>>> SIGP while the target CPU is stopped.
>>
>> makes sense. Can you add that to the patch description? that makes it easier to understand
>> what can really go wrong without this patch.
> 
> Sure!
> 
> Conny, when (and if ;) ) picking this up, can you change the description to
> 
> "Let's simplify it a bit. On some weird circumstances we would have
> tried to recompute watchpoints when running under KVM. load_psw() is
> called from do_restart_interrupt() during a SIGP RESTART if the target
> CPU is STOPPED. Let's touch watchpoints only in the TCG case - where
> they are used for PER emulation."
> 
With that:

Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>

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

* Re: [Qemu-devel] [PATCH v1 for-2.12 2/2] s390x: load_psw() should only exchange the PSW for KVM
  2018-04-09 11:44         ` David Hildenbrand
  2018-04-09 11:46           ` Christian Borntraeger
@ 2018-04-09 11:49           ` Cornelia Huck
  1 sibling, 0 replies; 14+ messages in thread
From: Cornelia Huck @ 2018-04-09 11:49 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: Christian Borntraeger, qemu-s390x, qemu-devel, Richard Henderson,
	Alexander Graf, Thomas Huth

On Mon, 9 Apr 2018 13:44:30 +0200
David Hildenbrand <david@redhat.com> wrote:

> Conny, when (and if ;) ) picking this up, can you change the description to
> 
> "Let's simplify it a bit. On some weird circumstances we would have
> tried to recompute watchpoints when running under KVM. load_psw() is
> called from do_restart_interrupt() during a SIGP RESTART if the target
> CPU is STOPPED. Let's touch watchpoints only in the TCG case - where
> they are used for PER emulation."

Will do. Patch looks good to me, but waiting for some review.

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

* Re: [Qemu-devel] [qemu-s390x] [PATCH v1 for-2.12 1/2] s390x/mmu: don't overwrite pending exception in mmu translate
  2018-04-09 11:30 ` [Qemu-devel] [PATCH v1 for-2.12 1/2] s390x/mmu: don't overwrite pending exception in mmu translate David Hildenbrand
  2018-04-09 11:44   ` Thomas Huth
@ 2018-04-09 11:50   ` Christian Borntraeger
  2018-04-09 11:55     ` Cornelia Huck
  1 sibling, 1 reply; 14+ messages in thread
From: Christian Borntraeger @ 2018-04-09 11:50 UTC (permalink / raw)
  To: David Hildenbrand, qemu-s390x
  Cc: Thomas Huth, Cornelia Huck, Alexander Graf, qemu-devel,
	Richard Henderson



On 04/09/2018 01:30 PM, David Hildenbrand wrote:
> If we already triggered another exception, don't overwrite it with a
> protection exception.
> 
> Signed-off-by: David Hildenbrand <david@redhat.com>


Can you add your description from the cover letter regarding
"only applies to old KVM instances without the virtual memory access
IOCTL in KVM."

with that
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
>  target/s390x/mmu_helper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c
> index 1deeb6e6e4..a25deef5dd 100644
> --- a/target/s390x/mmu_helper.c
> +++ b/target/s390x/mmu_helper.c
> @@ -325,7 +325,7 @@ static int mmu_translate_asce(CPUS390XState *env, target_ulong vaddr,
>  
>      r = mmu_translate_region(env, vaddr, asc, asce, level, raddr, flags, rw,
>                               exc);
> -    if (rw == MMU_DATA_STORE && !(*flags & PAGE_WRITE)) {
> +    if (!r && rw == MMU_DATA_STORE && !(*flags & PAGE_WRITE)) {
>          trigger_prot_fault(env, vaddr, asc, rw, exc);
>          return -1;
>      }
> 

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

* Re: [Qemu-devel] [qemu-s390x] [PATCH v1 for-2.12 1/2] s390x/mmu: don't overwrite pending exception in mmu translate
  2018-04-09 11:50   ` [Qemu-devel] [qemu-s390x] " Christian Borntraeger
@ 2018-04-09 11:55     ` Cornelia Huck
  0 siblings, 0 replies; 14+ messages in thread
From: Cornelia Huck @ 2018-04-09 11:55 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: David Hildenbrand, qemu-s390x, Thomas Huth, Alexander Graf,
	qemu-devel, Richard Henderson

On Mon, 9 Apr 2018 13:50:03 +0200
Christian Borntraeger <borntraeger@de.ibm.com> wrote:

> On 04/09/2018 01:30 PM, David Hildenbrand wrote:
> > If we already triggered another exception, don't overwrite it with a
> > protection exception.
> > 
> > Signed-off-by: David Hildenbrand <david@redhat.com>  
> 
> 
> Can you add your description from the cover letter regarding
> "only applies to old KVM instances without the virtual memory access
> IOCTL in KVM."

Will add that.

> 
> with that
> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
> > ---
> >  target/s390x/mmu_helper.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c
> > index 1deeb6e6e4..a25deef5dd 100644
> > --- a/target/s390x/mmu_helper.c
> > +++ b/target/s390x/mmu_helper.c
> > @@ -325,7 +325,7 @@ static int mmu_translate_asce(CPUS390XState *env, target_ulong vaddr,
> >  
> >      r = mmu_translate_region(env, vaddr, asc, asce, level, raddr, flags, rw,
> >                               exc);
> > -    if (rw == MMU_DATA_STORE && !(*flags & PAGE_WRITE)) {
> > +    if (!r && rw == MMU_DATA_STORE && !(*flags & PAGE_WRITE)) {
> >          trigger_prot_fault(env, vaddr, asc, rw, exc);
> >          return -1;
> >      }
> >   
> 

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

* Re: [Qemu-devel] [PATCH v1 for-2.12 2/2] s390x: load_psw() should only exchange the PSW for KVM
  2018-04-09 11:30 ` [Qemu-devel] [PATCH v1 for-2.12 2/2] s390x: load_psw() should only exchange the PSW for KVM David Hildenbrand
  2018-04-09 11:35   ` Christian Borntraeger
@ 2018-04-09 11:56   ` Thomas Huth
  1 sibling, 0 replies; 14+ messages in thread
From: Thomas Huth @ 2018-04-09 11:56 UTC (permalink / raw)
  To: David Hildenbrand, qemu-s390x
  Cc: qemu-devel, Richard Henderson, Alexander Graf, Cornelia Huck,
	Christian Borntraeger

On 09.04.2018 13:30, David Hildenbrand wrote:
> Let's simplify it a bit. On some weird circumstances we would have tried
> to recompute watchpoints when running under KVM.
> 
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  target/s390x/helper.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/target/s390x/helper.c b/target/s390x/helper.c
> index 615fa24ab9..e8548f340a 100644
> --- a/target/s390x/helper.c
> +++ b/target/s390x/helper.c
> @@ -103,16 +103,18 @@ void load_psw(CPUS390XState *env, uint64_t mask, uint64_t addr)
>  
>      env->psw.addr = addr;
>      env->psw.mask = mask;
> -    if (tcg_enabled()) {
> -        env->cc_op = (mask >> 44) & 3;
> +
> +    /* KVM will handle all WAITs and trigger a WAIT exit on disabled_wait */
> +    if (!tcg_enabled()) {
> +        return;
>      }
> +    env->cc_op = (mask >> 44) & 3;
>  
>      if ((old_mask ^ mask) & PSW_MASK_PER) {
>          s390_cpu_recompute_watchpoints(CPU(s390_env_get_cpu(env)));
>      }
>  
> -    /* KVM will handle all WAITs and trigger a WAIT exit on disabled_wait */
> -    if (tcg_enabled() && (mask & PSW_MASK_WAIT)) {
> +    if (mask & PSW_MASK_WAIT) {
>          s390_handle_wait(s390_env_get_cpu(env));
>      }
>  }
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>

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

* Re: [Qemu-devel] [PATCH v1 for-2.12 0/2] s390x/kvm: last minute fixes
  2018-04-09 11:30 [Qemu-devel] [PATCH v1 for-2.12 0/2] s390x/kvm: last minute fixes David Hildenbrand
  2018-04-09 11:30 ` [Qemu-devel] [PATCH v1 for-2.12 1/2] s390x/mmu: don't overwrite pending exception in mmu translate David Hildenbrand
  2018-04-09 11:30 ` [Qemu-devel] [PATCH v1 for-2.12 2/2] s390x: load_psw() should only exchange the PSW for KVM David Hildenbrand
@ 2018-04-09 12:35 ` Cornelia Huck
  2 siblings, 0 replies; 14+ messages in thread
From: Cornelia Huck @ 2018-04-09 12:35 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: qemu-s390x, qemu-devel, Richard Henderson, Alexander Graf,
	Christian Borntraeger, Thomas Huth

On Mon,  9 Apr 2018 13:30:17 +0200
David Hildenbrand <david@redhat.com> wrote:

> Patch 1 only applies to old KVM instances without the virtual memory access
> IOCTL in KVM.
> 
> Patch 2 could be problematic when toggling PER in a restart interrupt.
> Watchpoint recomputation only applies to TCG.
> 
> David Hildenbrand (2):
>   s390x/mmu: don't overwrite pending exception in mmu translate
>   s390x: load_psw() should only exchange the PSW for KVM
> 
>  target/s390x/helper.c     | 10 ++++++----
>  target/s390x/mmu_helper.c |  2 +-
>  2 files changed, 7 insertions(+), 5 deletions(-)
> 

Thanks, queued to s390-fixes.

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

end of thread, other threads:[~2018-04-09 12:35 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-09 11:30 [Qemu-devel] [PATCH v1 for-2.12 0/2] s390x/kvm: last minute fixes David Hildenbrand
2018-04-09 11:30 ` [Qemu-devel] [PATCH v1 for-2.12 1/2] s390x/mmu: don't overwrite pending exception in mmu translate David Hildenbrand
2018-04-09 11:44   ` Thomas Huth
2018-04-09 11:50   ` [Qemu-devel] [qemu-s390x] " Christian Borntraeger
2018-04-09 11:55     ` Cornelia Huck
2018-04-09 11:30 ` [Qemu-devel] [PATCH v1 for-2.12 2/2] s390x: load_psw() should only exchange the PSW for KVM David Hildenbrand
2018-04-09 11:35   ` Christian Borntraeger
2018-04-09 11:36     ` David Hildenbrand
2018-04-09 11:40       ` Christian Borntraeger
2018-04-09 11:44         ` David Hildenbrand
2018-04-09 11:46           ` Christian Borntraeger
2018-04-09 11:49           ` Cornelia Huck
2018-04-09 11:56   ` Thomas Huth
2018-04-09 12:35 ` [Qemu-devel] [PATCH v1 for-2.12 0/2] s390x/kvm: last minute fixes Cornelia Huck

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.