qemu-s390x
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [qemu-s390x] [PATCH v1 for-2.12] s390x/kvm: call cpu_synchronize_sta


From: David Hildenbrand
Subject: Re: [qemu-s390x] [PATCH v1 for-2.12] s390x/kvm: call cpu_synchronize_state() on every kvm_arch_handle_exit()
Date: Fri, 6 Apr 2018 11:46:22 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2

On 06.04.2018 11:40, Thomas Huth wrote:
> On 06.04.2018 11:35, David Hildenbrand wrote:
>> Manually having to use cpu_synchronize_state() is error prone. And as
>> Christian Borntraeger discovered, e.g. handle_diag() is currently
>> missing a cpu_synchronize_state(), as decode_basedisp_s() uses a
>> general purpose register value internally.
>>
>> So let's do an overall cpu_synchronize_state(), which fixes at least the
>> one mentioned BUG. We will clean up the superfluous cpu_synchronize_state()
>> calls later.
>>
>> We now also call it (although maybe not neded) for
>> - KVM_EXIT_S390_RESET -> s390_reipl_request()
>> - KVM_EXIT_DEBUG -> kvm_arch_handle_debug_exit()
>> - unmanagable/unimplemented intercepts
>> - ICPT_CPU_STOP -> do_stop_interrupt() -> cpu gets halted
>> - Scenarios where we inject an operation exception
>> - handle_stsi()
>>
>> I don't think any of these are performance critical. Especially as we
>> have all information directly contained in kvm_run, there are no
>> additional IOCTLs to issue on modern kernels.
>>
>> Signed-off-by: David Hildenbrand <address@hidden>
>> ---
>>  target/s390x/kvm.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
>> index f570896dc1..fb59d92def 100644
>> --- a/target/s390x/kvm.c
>> +++ b/target/s390x/kvm.c
>> @@ -1778,6 +1778,8 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run 
>> *run)
>>  
>>      qemu_mutex_lock_iothread();
>>  
>> +    cpu_synchronize_state(cs);
> 
> Since we're in kvm.c here, maybe rather call kvm_cpu_synchronize_state()
> directly to avoid the wrapper function?
> 
>  Thomas
> 

No strong opinion. I can see that kvm_cpu_synchronize_state()
- is not used in target/s390x/kvm.c yet
- is very rarely used in kvm code in general

-- 

Thanks,

David / dhildenb



reply via email to

[Prev in Thread] Current Thread [Next in Thread]