Message ID | 1359129329-21274-1-git-send-email-afaerber@suse.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, Jan 25, 2013 at 04:55:29PM +0100, Andreas Färber wrote: > Since commit 20d695a9254c1b086a456d3b79a3c311236643ba (kvm: Pass > CPUState to kvm_arch_*) CPUArchState is no longer needed. > > Allows to change qemu_kvm_eat_signals() argument as well. > > Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Gleb Natapov <gleb@redhat.com> > --- > Extracted from my qom-cpu-8 queue. > > cpus.c | 8 ++++---- > include/sysemu/kvm.h | 2 +- > kvm-all.c | 3 +-- > kvm-stub.c | 2 +- > 4 Dateien geändert, 7 Zeilen hinzugefügt(+), 8 Zeilen entfernt(-) > > diff --git a/cpus.c b/cpus.c > index a4390c3..41779eb 100644 > --- a/cpus.c > +++ b/cpus.c > @@ -517,7 +517,7 @@ static void qemu_init_sigbus(void) > prctl(PR_MCE_KILL, PR_MCE_KILL_SET, PR_MCE_KILL_EARLY, 0, 0); > } > > -static void qemu_kvm_eat_signals(CPUArchState *env) > +static void qemu_kvm_eat_signals(CPUState *cpu) > { > struct timespec ts = { 0, 0 }; > siginfo_t siginfo; > @@ -538,7 +538,7 @@ static void qemu_kvm_eat_signals(CPUArchState *env) > > switch (r) { > case SIGBUS: > - if (kvm_on_sigbus_vcpu(env, siginfo.si_code, siginfo.si_addr)) { > + if (kvm_on_sigbus_vcpu(cpu, siginfo.si_code, siginfo.si_addr)) { > sigbus_reraise(); > } > break; > @@ -560,7 +560,7 @@ static void qemu_init_sigbus(void) > { > } > > -static void qemu_kvm_eat_signals(CPUArchState *env) > +static void qemu_kvm_eat_signals(CPUState *cpu) > { > } > #endif /* !CONFIG_LINUX */ > @@ -727,7 +727,7 @@ static void qemu_kvm_wait_io_event(CPUArchState *env) > qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex); > } > > - qemu_kvm_eat_signals(env); > + qemu_kvm_eat_signals(cpu); > qemu_wait_io_event_common(cpu); > } > > diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h > index 384ee66..6e6dfb3 100644 > --- a/include/sysemu/kvm.h > +++ b/include/sysemu/kvm.h > @@ -159,7 +159,7 @@ int kvm_update_guest_debug(CPUArchState *env, unsigned long reinject_trap); > int kvm_set_signal_mask(CPUArchState *env, const sigset_t *sigset); > #endif > > -int kvm_on_sigbus_vcpu(CPUArchState *env, int code, void *addr); > +int kvm_on_sigbus_vcpu(CPUState *cpu, int code, void *addr); > int kvm_on_sigbus(int code, void *addr); > > /* internal API */ > diff --git a/kvm-all.c b/kvm-all.c > index 363a358..04ec2d5 100644 > --- a/kvm-all.c > +++ b/kvm-all.c > @@ -2026,9 +2026,8 @@ int kvm_set_ioeventfd_pio_word(int fd, uint16_t addr, uint16_t val, bool assign) > return 0; > } > > -int kvm_on_sigbus_vcpu(CPUArchState *env, int code, void *addr) > +int kvm_on_sigbus_vcpu(CPUState *cpu, int code, void *addr) > { > - CPUState *cpu = ENV_GET_CPU(env); > return kvm_arch_on_sigbus_vcpu(cpu, code, addr); > } > > diff --git a/kvm-stub.c b/kvm-stub.c > index 47f8dca..760aadc 100644 > --- a/kvm-stub.c > +++ b/kvm-stub.c > @@ -112,7 +112,7 @@ int kvm_set_ioeventfd_mmio(int fd, uint32_t adr, uint32_t val, bool assign, uint > return -ENOSYS; > } > > -int kvm_on_sigbus_vcpu(CPUArchState *env, int code, void *addr) > +int kvm_on_sigbus_vcpu(CPUState *cpu, int code, void *addr) > { > return 1; > } > -- > 1.7.10.4 -- Gleb. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Am 28.01.2013 14:50, schrieb Gleb Natapov: > On Fri, Jan 25, 2013 at 04:55:29PM +0100, Andreas Färber wrote: >> Since commit 20d695a9254c1b086a456d3b79a3c311236643ba (kvm: Pass >> CPUState to kvm_arch_*) CPUArchState is no longer needed. >> >> Allows to change qemu_kvm_eat_signals() argument as well. >> >> Signed-off-by: Andreas Färber <afaerber@suse.de> > Reviewed-by: Gleb Natapov <gleb@redhat.com> Thanks, applied to qom-cpu: https://github.com/afaerber/qemu-cpu/commits/qom-cpu Background was: https://lists.nongnu.org/archive/html/qemu-devel/2013-01/msg03087.html <<< [...] qemu_init_vcpu() still operates on CPUArchState and thus cannot be moved into CPUClass yet. The reason is that cpus.c:qemu_kvm_cpu_thread_fn sets cpu_single_env, and I do not see a solution for that - suggestions or patches welcome. However, I see that kvm-all.c:kvm_on_sigbus_vcpu() can be switched to CPUState now, so that cpus.c:qemu_kvm_eat_signals() can be changed to CPUState, used from cpus.c:qemu_kvm_wait_io_event(). But cpus.c:cpu_thread_is_idle() still uses env->halted, which is blocked by the search for an acceptable solution to flush the TLB at CPUState level (exec.c:cpu_common_post_load()). >>> A less elegant but working solution is on my qom-cpu-8 branch (based off qom-cpu-next): I introduced a void *env_ptr CPUState field. While potentially opening a can of worms I wanted to avoid, it allows us to defer finding a solution to the target_ulong-dependent TLB some more. Regards, Andreas
diff --git a/cpus.c b/cpus.c index a4390c3..41779eb 100644 --- a/cpus.c +++ b/cpus.c @@ -517,7 +517,7 @@ static void qemu_init_sigbus(void) prctl(PR_MCE_KILL, PR_MCE_KILL_SET, PR_MCE_KILL_EARLY, 0, 0); } -static void qemu_kvm_eat_signals(CPUArchState *env) +static void qemu_kvm_eat_signals(CPUState *cpu) { struct timespec ts = { 0, 0 }; siginfo_t siginfo; @@ -538,7 +538,7 @@ static void qemu_kvm_eat_signals(CPUArchState *env) switch (r) { case SIGBUS: - if (kvm_on_sigbus_vcpu(env, siginfo.si_code, siginfo.si_addr)) { + if (kvm_on_sigbus_vcpu(cpu, siginfo.si_code, siginfo.si_addr)) { sigbus_reraise(); } break; @@ -560,7 +560,7 @@ static void qemu_init_sigbus(void) { } -static void qemu_kvm_eat_signals(CPUArchState *env) +static void qemu_kvm_eat_signals(CPUState *cpu) { } #endif /* !CONFIG_LINUX */ @@ -727,7 +727,7 @@ static void qemu_kvm_wait_io_event(CPUArchState *env) qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex); } - qemu_kvm_eat_signals(env); + qemu_kvm_eat_signals(cpu); qemu_wait_io_event_common(cpu); } diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 384ee66..6e6dfb3 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -159,7 +159,7 @@ int kvm_update_guest_debug(CPUArchState *env, unsigned long reinject_trap); int kvm_set_signal_mask(CPUArchState *env, const sigset_t *sigset); #endif -int kvm_on_sigbus_vcpu(CPUArchState *env, int code, void *addr); +int kvm_on_sigbus_vcpu(CPUState *cpu, int code, void *addr); int kvm_on_sigbus(int code, void *addr); /* internal API */ diff --git a/kvm-all.c b/kvm-all.c index 363a358..04ec2d5 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -2026,9 +2026,8 @@ int kvm_set_ioeventfd_pio_word(int fd, uint16_t addr, uint16_t val, bool assign) return 0; } -int kvm_on_sigbus_vcpu(CPUArchState *env, int code, void *addr) +int kvm_on_sigbus_vcpu(CPUState *cpu, int code, void *addr) { - CPUState *cpu = ENV_GET_CPU(env); return kvm_arch_on_sigbus_vcpu(cpu, code, addr); } diff --git a/kvm-stub.c b/kvm-stub.c index 47f8dca..760aadc 100644 --- a/kvm-stub.c +++ b/kvm-stub.c @@ -112,7 +112,7 @@ int kvm_set_ioeventfd_mmio(int fd, uint32_t adr, uint32_t val, bool assign, uint return -ENOSYS; } -int kvm_on_sigbus_vcpu(CPUArchState *env, int code, void *addr) +int kvm_on_sigbus_vcpu(CPUState *cpu, int code, void *addr) { return 1; }
Since commit 20d695a9254c1b086a456d3b79a3c311236643ba (kvm: Pass CPUState to kvm_arch_*) CPUArchState is no longer needed. Allows to change qemu_kvm_eat_signals() argument as well. Signed-off-by: Andreas Färber <afaerber@suse.de> --- Extracted from my qom-cpu-8 queue. cpus.c | 8 ++++---- include/sysemu/kvm.h | 2 +- kvm-all.c | 3 +-- kvm-stub.c | 2 +- 4 Dateien geändert, 7 Zeilen hinzugefügt(+), 8 Zeilen entfernt(-)