[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PATCH 1/8] exec: reduce CONFIG_USER_ONLY ifdeffenery
From: |
David Gibson |
Subject: |
Re: [Qemu-ppc] [PATCH 1/8] exec: reduce CONFIG_USER_ONLY ifdeffenery |
Date: |
Fri, 22 Jul 2016 11:30:39 +1000 |
User-agent: |
Mutt/1.6.2 (2016-07-01) |
On Thu, Jul 21, 2016 at 05:54:32PM +0200, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <address@hidden>
Reviewed-by: David Gibson <address@hidden>
I think this is long overdue.
> ---
> bsd-user/qemu.h | 2 --
> include/exec/exec-all.h | 12 ++++++++++++
> linux-user/qemu.h | 2 --
> exec.c | 17 +++--------------
> 4 files changed, 15 insertions(+), 18 deletions(-)
>
> diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
> index 6ccc544..2b2b918 100644
> --- a/bsd-user/qemu.h
> +++ b/bsd-user/qemu.h
> @@ -209,8 +209,6 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong
> old_size,
> abi_ulong new_addr);
> int target_msync(abi_ulong start, abi_ulong len, int flags);
> extern unsigned long last_brk;
> -void cpu_list_lock(void);
> -void cpu_list_unlock(void);
> #if defined(CONFIG_USE_NPTL)
> void mmap_fork_start(void);
> void mmap_fork_end(int child);
> diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
> index acda7b6..d008296 100644
> --- a/include/exec/exec-all.h
> +++ b/include/exec/exec-all.h
> @@ -56,6 +56,18 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
> target_ulong pc, target_ulong cs_base,
> uint32_t flags,
> int cflags);
> +#if defined(CONFIG_USER_ONLY)
> +void cpu_list_lock(void);
> +void cpu_list_unlock(void);
> +#else
> +static inline void cpu_list_unlock(void)
> +{
> +}
> +static inline void cpu_list_lock(void)
> +{
> +}
> +#endif
> +
> void cpu_exec_init(CPUState *cpu, Error **errp);
> void QEMU_NORETURN cpu_loop_exit(CPUState *cpu);
> void QEMU_NORETURN cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc);
> diff --git a/linux-user/qemu.h b/linux-user/qemu.h
> index cdf23a7..bef465d 100644
> --- a/linux-user/qemu.h
> +++ b/linux-user/qemu.h
> @@ -419,8 +419,6 @@ int target_msync(abi_ulong start, abi_ulong len, int
> flags);
> extern unsigned long last_brk;
> extern abi_ulong mmap_next_start;
> abi_ulong mmap_find_vma(abi_ulong, abi_ulong);
> -void cpu_list_lock(void);
> -void cpu_list_unlock(void);
> void mmap_fork_start(void);
> void mmap_fork_end(int child);
>
> diff --git a/exec.c b/exec.c
> index 60cf46a..2f57c62 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -642,23 +642,17 @@ void cpu_exec_exit(CPUState *cpu)
> {
> CPUClass *cc = CPU_GET_CLASS(cpu);
>
> -#if defined(CONFIG_USER_ONLY)
> cpu_list_lock();
> -#endif
> if (cpu->cpu_index == -1) {
> /* cpu_index was never allocated by this @cpu or was already freed.
> */
> -#if defined(CONFIG_USER_ONLY)
> cpu_list_unlock();
> -#endif
> return;
> }
>
> QTAILQ_REMOVE(&cpus, cpu, node);
> cpu_release_index(cpu);
> cpu->cpu_index = -1;
> -#if defined(CONFIG_USER_ONLY)
> cpu_list_unlock();
> -#endif
>
> if (cc->vmsd != NULL) {
> vmstate_unregister(NULL, cc->vmsd, cpu);
> @@ -670,7 +664,7 @@ void cpu_exec_exit(CPUState *cpu)
>
> void cpu_exec_init(CPUState *cpu, Error **errp)
> {
> - CPUClass *cc = CPU_GET_CLASS(cpu);
> + CPUClass *cc ATTRIBUTE_UNUSED = CPU_GET_CLASS(cpu);
> Error *local_err = NULL;
>
> cpu->as = NULL;
> @@ -694,22 +688,17 @@ void cpu_exec_init(CPUState *cpu, Error **errp)
> object_ref(OBJECT(cpu->memory));
> #endif
>
> -#if defined(CONFIG_USER_ONLY)
> cpu_list_lock();
> -#endif
> cpu->cpu_index = cpu_get_free_index(&local_err);
> if (local_err) {
> error_propagate(errp, local_err);
> -#if defined(CONFIG_USER_ONLY)
> cpu_list_unlock();
> -#endif
> return;
> }
> QTAILQ_INSERT_TAIL(&cpus, cpu, node);
> -#if defined(CONFIG_USER_ONLY)
> - (void) cc;
> cpu_list_unlock();
> -#else
> +
> +#ifndef CONFIG_USER_ONLY
> if (qdev_get_vmsd(DEVICE(cpu)) == NULL) {
> vmstate_register(NULL, cpu->cpu_index, &vmstate_cpu_common, cpu);
> }
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
signature.asc
Description: PGP signature
- [Qemu-ppc] [PATCH 0/8] Fix migration issues with arbitrary cpu-hot(un)plug, Igor Mammedov, 2016/07/21
- [Qemu-ppc] [PATCH 1/8] exec: reduce CONFIG_USER_ONLY ifdeffenery, Igor Mammedov, 2016/07/21
- Re: [Qemu-ppc] [PATCH 1/8] exec: reduce CONFIG_USER_ONLY ifdeffenery,
David Gibson <=
- [Qemu-ppc] [PATCH 3/8] exec: set cpu_index only if it's been explictly set, Igor Mammedov, 2016/07/21
- [Qemu-ppc] [PATCH 5/8] pc: init CPUState->cpu_index with index in possible_cpus[], Igor Mammedov, 2016/07/21
- [Qemu-ppc] [PATCH 6/8] spapr: init CPUState->cpu_index with index relative to core-id, Igor Mammedov, 2016/07/21