From: Collin Walling <walling@linux.ibm.com>
To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org
Cc: borntraeger@de.ibm.com, thuth@redhat.com, cohuck@redhat.com,
frankja@linux.ibm.com, david@redhat.com
Subject: [RFC PATCH] s390: kvm: reduce frequency of CPU syncs of diag318 info
Date: Mon, 22 Nov 2021 17:33:07 -0500 [thread overview]
Message-ID: <20211122223307.101790-1-walling@linux.ibm.com> (raw)
DIAGNOSE 0318 is invoked only once during IPL. As such, the
diag318 info will only change once initially and during resets.
Let's only sync the register to convey the info to KVM if and
only if the diag318 info has changed. Only set the dirty bit
flag for diag318 whenever it must be updated.
The migration handler will invoke the set_diag318 helper on
post_load to ensure the info is set on the destination machine.
Signed-off-by: Collin Walling <walling@linux.ibm.com>
---
target/s390x/kvm/kvm.c | 5 -----
target/s390x/machine.c | 14 ++++++++++++++
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c
index 6acf14d5ec..6a141399f7 100644
--- a/target/s390x/kvm/kvm.c
+++ b/target/s390x/kvm/kvm.c
@@ -599,11 +599,6 @@ int kvm_arch_put_registers(CPUState *cs, int level)
cs->kvm_run->kvm_dirty_regs |= KVM_SYNC_ETOKEN;
}
- if (can_sync_regs(cs, KVM_SYNC_DIAG318)) {
- cs->kvm_run->s.regs.diag318 = env->diag318_info;
- cs->kvm_run->kvm_dirty_regs |= KVM_SYNC_DIAG318;
- }
-
/* Finally the prefix */
if (can_sync_regs(cs, KVM_SYNC_PREFIX)) {
cs->kvm_run->s.regs.prefix = env->psa;
diff --git a/target/s390x/machine.c b/target/s390x/machine.c
index 37a076858c..a5d113ce3a 100644
--- a/target/s390x/machine.c
+++ b/target/s390x/machine.c
@@ -234,6 +234,19 @@ const VMStateDescription vmstate_etoken = {
}
};
+static int diag318_post_load(void *opaque, int version_id)
+{
+ S390CPU *cpu = opaque;
+ CPUState *cs = CPU(cpu);
+ CPUS390XState *env = &S390_CPU(cs)->env;
+
+ if (kvm_enabled()) {
+ kvm_s390_set_diag318(cs, env->diag318_info);
+ }
+
+ return 0;
+}
+
static bool diag318_needed(void *opaque)
{
return s390_has_feat(S390_FEAT_DIAG_318);
@@ -243,6 +256,7 @@ const VMStateDescription vmstate_diag318 = {
.name = "cpu/diag318",
.version_id = 1,
.minimum_version_id = 1,
+ .post_load = diag318_post_load,
.needed = diag318_needed,
.fields = (VMStateField[]) {
VMSTATE_UINT64(env.diag318_info, S390CPU),
--
2.31.1
next reply other threads:[~2021-11-22 22:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-22 22:33 Collin Walling [this message]
2021-11-22 22:43 ` [RFC PATCH] s390: kvm: reduce frequency of CPU syncs of diag318 info Collin Walling
2021-11-23 6:14 ` Christian Borntraeger
2021-12-02 20:54 ` Collin Walling
2021-12-06 8:27 ` 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=20211122223307.101790-1-walling@linux.ibm.com \
--to=walling@linux.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--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 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.