qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Thomas Huth <thuth@redhat.com>, qemu-s390x@nongnu.org
Cc: qemu-devel@nongnu.org, Richard Henderson <rth@twiddle.net>,
	Alexander Graf <agraf@suse.de>, Cornelia Huck <cohuck@redhat.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>
Subject: Re: [Qemu-devel] [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	[thread overview]
Message-ID: <0bef659c-1f6f-9f81-ba3b-1f0d8577cee8@redhat.com> (raw)
In-Reply-To: <02023ca6-bdab-5cf0-a882-b4c1e8c9e95b@redhat.com>

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 <david@redhat.com>
>> ---
>>  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	other threads:[~2018-04-06  9:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-06  9:35 [Qemu-devel] [PATCH v1 for-2.12] s390x/kvm: call cpu_synchronize_state() on every kvm_arch_handle_exit() David Hildenbrand
2018-04-06  9:40 ` Thomas Huth
2018-04-06  9:46   ` David Hildenbrand [this message]
2018-04-06  9:48     ` Cornelia Huck
2018-04-06 10:10 ` Christian Borntraeger
2018-04-06 10:58 ` Cornelia Huck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0bef659c-1f6f-9f81-ba3b-1f0d8577cee8@redhat.com \
    --to=david@redhat.com \
    --cc=agraf@suse.de \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).