Patchwork [2/2,v3,S390-KVM] Regsync: Utilize selective runtime reg sync for hot code paths

login
register
mail settings
Submitter Jason J. Herne
Date March 11, 2013, 5:58 p.m.
Message ID <1363024736-2650-3-git-send-email-jjherne@us.ibm.com>
Download mbox | patch
Permalink /patch/226628/
State New
Headers show

Comments

Jason J. Herne - March 11, 2013, 5:58 p.m.
Make use of new kvm_s390_get_registers_partial() for kvm_handle_css_inst() and
handle_hypercall() since they only need registers from the partial set and they
are called quite frequently.

Signed-off-by: Jason J. Herne <jjherne@us.ibm.com>
---
 target-s390x/kvm.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
Christian Borntraeger - April 22, 2013, 9:01 a.m.
On 11/03/13 18:58, Jason J. Herne wrote:
> Make use of new kvm_s390_get_registers_partial() for kvm_handle_css_inst() and
> handle_hypercall() since they only need registers from the partial set and they
> are called quite frequently.
> 
> Signed-off-by: Jason J. Herne <jjherne@us.ibm.com>
> ---
>  target-s390x/kvm.c |   11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
> index 934757e..36861aa 100644
> --- a/target-s390x/kvm.c
> +++ b/target-s390x/kvm.c
> @@ -468,12 +468,16 @@ static int kvm_handle_css_inst(S390CPU *cpu, struct kvm_run *run,
>      int r = 0;
>      int no_cc = 0;
>      CPUS390XState *env = &cpu->env;
> +    CPUState *cs = ENV_GET_CPU(env);
> 
>      if (ipa0 != 0xb2) {
>          /* Not handled for now. */
>          return -1;
>      }
> -    cpu_synchronize_state(env);
> +
> +    kvm_s390_get_registers_partial(cs);
> +    cs->kvm_vcpu_dirty = true;
> +
>      switch (ipa1) {
>      case PRIV_XSCH:
>          r = ioinst_handle_xsch(env, env->regs[1]);


Looks good, but can you also do the same for TSCH?
This is also related to the main I/O path.


> @@ -604,7 +608,10 @@ static int handle_priv(S390CPU *cpu, struct kvm_run *run,
> 
>  static int handle_hypercall(CPUS390XState *env, struct kvm_run *run)
>  {
> -    cpu_synchronize_state(env);
> +    CPUState *cs = ENV_GET_CPU(env);
> +
> +    kvm_s390_get_registers_partial(cs);
> +    cs->kvm_vcpu_dirty = true;
>      env->regs[2] = s390_virtio_hypercall(env);
> 
>      return 0;
>

Patch

diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index 934757e..36861aa 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -468,12 +468,16 @@  static int kvm_handle_css_inst(S390CPU *cpu, struct kvm_run *run,
     int r = 0;
     int no_cc = 0;
     CPUS390XState *env = &cpu->env;
+    CPUState *cs = ENV_GET_CPU(env);
 
     if (ipa0 != 0xb2) {
         /* Not handled for now. */
         return -1;
     }
-    cpu_synchronize_state(env);
+
+    kvm_s390_get_registers_partial(cs);
+    cs->kvm_vcpu_dirty = true;
+
     switch (ipa1) {
     case PRIV_XSCH:
         r = ioinst_handle_xsch(env, env->regs[1]);
@@ -604,7 +608,10 @@  static int handle_priv(S390CPU *cpu, struct kvm_run *run,
 
 static int handle_hypercall(CPUS390XState *env, struct kvm_run *run)
 {
-    cpu_synchronize_state(env);
+    CPUState *cs = ENV_GET_CPU(env);
+
+    kvm_s390_get_registers_partial(cs);
+    cs->kvm_vcpu_dirty = true;
     env->regs[2] = s390_virtio_hypercall(env);
 
     return 0;