From: Thomas Huth <thuth@redhat.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>,
David Hildenbrand <david@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>
Subject: Re: [Qemu-devel] [PATCH RFC] s390x/kvm: call cpu_synchronize_state() on every kvm_arch_handle_exit()
Date: Thu, 5 Apr 2018 10:19:24 +0200 [thread overview]
Message-ID: <01b7db2f-d3a7-f9b1-2e76-9f33107cff4c@redhat.com> (raw)
In-Reply-To: <11ca3563-dd2c-f8b0-8336-323177477a00@de.ibm.com>
On 05.04.2018 09:53, Christian Borntraeger wrote:
>
>
> On 03/26/2018 11:20 AM, David Hildenbrand wrote:
>> Manually having to use cpu_synchronize_state() is error prone. I don't
>> think that the performance impact is that huge if we simply synchronize
>> the state on every kvm_arch_handle_exit() call. This makes the code
>> easier to maintain.
>>
>> We now also call it (although not neded) for
>> - KVM_EXIT_S390_RESET -> s390_reipl_request()
>> - KVM_EXIT_DEBUG -> kvm_arch_handle_debug_exit()
>> - unmanagable/unimplemented intercepts
>> - ICPT_WAITPSW -> s390_handle_wait() -> cpu gets halted
>> - ICPT_CPU_STOP -> do_stop_interrupt() -> cpu gets halted
>> - Scenarios where we inject an operation exception
>> - handle_sigp() on the source CPU
>> - 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.
>
> We had other issues in the past in other (common code) places. For example
> see
>
> commit 79ca7a1b898eb97c4192f3c78027a0f20485e7b4
> Author: Christian Borntraeger <borntraeger@de.ibm.com>
> AuthorDate: Tue Mar 7 15:19:08 2017 +0100
> Commit: Paolo Bonzini <pbonzini@redhat.com>
> CommitDate: Tue Mar 14 13:26:36 2017 +0100
>
> exec: add cpu_synchronize_state to cpu_memory_rw_debug
>
> so we might consider going even further.....But this will be tricky.
>
>
> FWIW, I think your patch even fixes a bug:
>
> --- snip ----
> static int handle_diag(S390CPU *cpu, struct kvm_run *run, uint32_t ipb)
> {
> int r = 0;
> uint16_t func_code;
>
> /*
> * For any diagnose call we support, bits 48-63 of the resulting
> * address specify the function code; the remainder is ignored.
> */
> func_code = decode_basedisp_rs(&cpu->env, ipb, NULL) & DIAG_KVM_CODE_MASK;
>
> ---->
> static inline hwaddr decode_basedisp_s(CPUS390XState *env, uint32_t ipb,
> uint8_t *ar)
> {
> hwaddr addr = 0;
> uint8_t reg;
>
> reg = ipb >> 28;
> if (reg > 0) {
> addr = env->regs[reg];
>
> ----> we do the sync_regs after this in the diag handler!
> So currently we only handle the case with base reg == 0 correctly.
> So
> diag x,y,0x500(0)
> works
>
>
> but things like
> lghi 1,0x500
> diag x,y,0(1)
>
> not unless I miss something.
FWIW: Sounds like a good idea for a new kvm-unit-test... any volunteers?
Thomas
next prev parent reply other threads:[~2018-04-05 8:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-26 9:20 [Qemu-devel] [PATCH RFC] s390x/kvm: call cpu_synchronize_state() on every kvm_arch_handle_exit() David Hildenbrand
2018-03-26 9:36 ` David Hildenbrand
2018-04-05 7:53 ` Christian Borntraeger
2018-04-05 8:03 ` David Hildenbrand
2018-04-05 8:03 ` Cornelia Huck
2018-04-05 8:19 ` Thomas Huth [this message]
2018-04-05 8:47 ` [Qemu-devel] [qemu-s390x] " Christian Borntraeger
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=01b7db2f-d3a7-f9b1-2e76-9f33107cff4c@redhat.com \
--to=thuth@redhat.com \
--cc=agraf@suse.de \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=rth@twiddle.net \
/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).