Message ID | 20241015164326.124987-7-imbrenda@linux.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | s390/kvm: Handle guest-related program interrupts in KVM | expand |
On Tue, Oct 15, 2024 at 06:43:21PM +0200, Claudio Imbrenda wrote: > Stop using gmap_enable(), gmap_disable(), gmap_get_enabled(). > > The correct guest ASCE is passed as a parameter of sie64a(), there is > no need to save the current gmap in lowcore. > > Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com> > Acked-by: Steffen Eiden <seiden@linux.ibm.com> > --- > arch/s390/kvm/kvm-s390.c | 7 +------ > arch/s390/kvm/vsie.c | 4 +--- > 2 files changed, 2 insertions(+), 9 deletions(-) > > diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c > index cfe3f8182aa5..df778a4a011d 100644 > --- a/arch/s390/kvm/kvm-s390.c > +++ b/arch/s390/kvm/kvm-s390.c > @@ -3719,7 +3719,6 @@ __u64 kvm_s390_get_cpu_timer(struct kvm_vcpu *vcpu) > void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) > { > > - gmap_enable(vcpu->arch.enabled_gmap); > kvm_s390_set_cpuflags(vcpu, CPUSTAT_RUNNING); > if (vcpu->arch.cputm_enabled && !is_vcpu_idle(vcpu)) > __start_cpu_timer_accounting(vcpu); > @@ -3732,8 +3731,6 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) > if (vcpu->arch.cputm_enabled && !is_vcpu_idle(vcpu)) > __stop_cpu_timer_accounting(vcpu); > kvm_s390_clear_cpuflags(vcpu, CPUSTAT_RUNNING); > - vcpu->arch.enabled_gmap = gmap_get_enabled(); > - gmap_disable(vcpu->arch.enabled_gmap); I guess you want to get rid of enabled_gmap as well, since it becomes unused with this patch: diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h index 603b56bfccd3..51201b4ac93a 100644 --- a/arch/s390/include/asm/kvm_host.h +++ b/arch/s390/include/asm/kvm_host.h @@ -750,8 +750,6 @@ struct kvm_vcpu_arch { struct hrtimer ckc_timer; struct kvm_s390_pgm_info pgm; struct gmap *gmap; - /* backup location for the currently enabled gmap when scheduled out */ - struct gmap *enabled_gmap; struct kvm_guestdbg_info_arch guestdbg; unsigned long pfault_token; unsigned long pfault_select; Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
On Mon, 21 Oct 2024 11:50:06 +0200 Heiko Carstens <hca@linux.ibm.com> wrote: > On Tue, Oct 15, 2024 at 06:43:21PM +0200, Claudio Imbrenda wrote: > > Stop using gmap_enable(), gmap_disable(), gmap_get_enabled(). > > > > The correct guest ASCE is passed as a parameter of sie64a(), there is > > no need to save the current gmap in lowcore. > > > > Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com> > > Acked-by: Steffen Eiden <seiden@linux.ibm.com> > > --- > > arch/s390/kvm/kvm-s390.c | 7 +------ > > arch/s390/kvm/vsie.c | 4 +--- > > 2 files changed, 2 insertions(+), 9 deletions(-) > > > > diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c > > index cfe3f8182aa5..df778a4a011d 100644 > > --- a/arch/s390/kvm/kvm-s390.c > > +++ b/arch/s390/kvm/kvm-s390.c > > @@ -3719,7 +3719,6 @@ __u64 kvm_s390_get_cpu_timer(struct kvm_vcpu *vcpu) > > void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) > > { > > > > - gmap_enable(vcpu->arch.enabled_gmap); > > kvm_s390_set_cpuflags(vcpu, CPUSTAT_RUNNING); > > if (vcpu->arch.cputm_enabled && !is_vcpu_idle(vcpu)) > > __start_cpu_timer_accounting(vcpu); > > @@ -3732,8 +3731,6 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) > > if (vcpu->arch.cputm_enabled && !is_vcpu_idle(vcpu)) > > __stop_cpu_timer_accounting(vcpu); > > kvm_s390_clear_cpuflags(vcpu, CPUSTAT_RUNNING); > > - vcpu->arch.enabled_gmap = gmap_get_enabled(); > > - gmap_disable(vcpu->arch.enabled_gmap); > > I guess you want to get rid of enabled_gmap as well, since it becomes > unused with this patch: oh yeah, I had missed that. I guess it can go in the next patch, where things are removed > > diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h > index 603b56bfccd3..51201b4ac93a 100644 > --- a/arch/s390/include/asm/kvm_host.h > +++ b/arch/s390/include/asm/kvm_host.h > @@ -750,8 +750,6 @@ struct kvm_vcpu_arch { > struct hrtimer ckc_timer; > struct kvm_s390_pgm_info pgm; > struct gmap *gmap; > - /* backup location for the currently enabled gmap when scheduled out */ > - struct gmap *enabled_gmap; > struct kvm_guestdbg_info_arch guestdbg; > unsigned long pfault_token; > unsigned long pfault_select; > > Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index cfe3f8182aa5..df778a4a011d 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -3719,7 +3719,6 @@ __u64 kvm_s390_get_cpu_timer(struct kvm_vcpu *vcpu) void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) { - gmap_enable(vcpu->arch.enabled_gmap); kvm_s390_set_cpuflags(vcpu, CPUSTAT_RUNNING); if (vcpu->arch.cputm_enabled && !is_vcpu_idle(vcpu)) __start_cpu_timer_accounting(vcpu); @@ -3732,8 +3731,6 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) if (vcpu->arch.cputm_enabled && !is_vcpu_idle(vcpu)) __stop_cpu_timer_accounting(vcpu); kvm_s390_clear_cpuflags(vcpu, CPUSTAT_RUNNING); - vcpu->arch.enabled_gmap = gmap_get_enabled(); - gmap_disable(vcpu->arch.enabled_gmap); } @@ -3751,8 +3748,6 @@ void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu) } if (test_kvm_facility(vcpu->kvm, 74) || vcpu->kvm->arch.user_instr0) vcpu->arch.sie_block->ictl |= ICTL_OPEREXC; - /* make vcpu_load load the right gmap on the first trigger */ - vcpu->arch.enabled_gmap = vcpu->arch.gmap; } static bool kvm_has_pckmo_subfunc(struct kvm *kvm, unsigned long nr) @@ -4891,7 +4886,7 @@ static int __vcpu_run(struct kvm_vcpu *vcpu) } exit_reason = sie64a(vcpu->arch.sie_block, vcpu->run->s.regs.gprs, - gmap_get_enabled()->asce); + vcpu->arch.gmap->asce); if (kvm_s390_pv_cpu_is_protected(vcpu)) { memcpy(vcpu->run->s.regs.gprs, sie_page->pv_grregs, diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c index 35e7dd882148..d03f95e528fe 100644 --- a/arch/s390/kvm/vsie.c +++ b/arch/s390/kvm/vsie.c @@ -1151,7 +1151,7 @@ static int do_vsie_run(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) current->thread.gmap_int_code = 0; barrier(); if (!kvm_s390_vcpu_sie_inhibited(vcpu)) - rc = sie64a(scb_s, vcpu->run->s.regs.gprs, gmap_get_enabled()->asce); + rc = sie64a(scb_s, vcpu->run->s.regs.gprs, vsie_page->gmap->asce); barrier(); vcpu->arch.sie_block->prog0c &= ~PROG_IN_SIE; @@ -1296,10 +1296,8 @@ static int vsie_run(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) if (!rc) rc = map_prefix(vcpu, vsie_page); if (!rc) { - gmap_enable(vsie_page->gmap); update_intervention_requests(vsie_page); rc = do_vsie_run(vcpu, vsie_page); - gmap_enable(vcpu->arch.gmap); } atomic_andnot(PROG_BLOCK_SIE, &scb_s->prog20);