qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH v1 4/5] xics: Use migration_id instead of cp


From: Nikunj A Dadhania
Subject: Re: [Qemu-devel] [RFC PATCH v1 4/5] xics: Use migration_id instead of cpu_index in XICS code
Date: Wed, 06 Jul 2016 14:38:04 +0530
User-agent: Notmuch/0.21 (https://notmuchmail.org) Emacs/25.0.94.1 (x86_64-redhat-linux-gnu)

Bharata B Rao <address@hidden> writes:

> xics maintains an array of ICPState structures which is indexed
> by cpu_index. Change this to index the ICPState array by migration_id
> for pseries-2.7 onwards. This allows migration of guest to suceed
> when there are holes in cpu_index range due to CPU hot removal.
>
> NOTE: In rtas_set_xive() and h_ipi(), cpu_dt_id is implicitly
> assume to be equivalent to migration_id.
>
> Signed-off-by: Bharata B Rao <address@hidden>
> ---
>  hw/intc/xics.c       | 12 ++++++++----
>  hw/intc/xics_kvm.c   | 11 +++++------
>  hw/intc/xics_spapr.c | 28 +++++++++++++++++++++-------
>  3 files changed, 34 insertions(+), 17 deletions(-)
>
> diff --git a/hw/intc/xics.c b/hw/intc/xics.c
> index cd48f42..ce7571e 100644
> --- a/hw/intc/xics.c
> +++ b/hw/intc/xics.c
> @@ -50,9 +50,11 @@ int xics_get_cpu_index_by_dt_id(int cpu_dt_id)
>  void xics_cpu_destroy(XICSState *xics, PowerPCCPU *cpu)
>  {
>      CPUState *cs = CPU(cpu);
> -    ICPState *ss = &xics->ss[cs->cpu_index];
> +    CPUClass *cc = CPU_GET_CLASS(cs);
> +    int server = cc->get_migration_id(cs);
> +    ICPState *ss = &xics->ss[server];

A helper like this will make code much more compact at other places:

static inline int xics_get_server(PowerPCCPU cpu)
{
    CPUState *cs = CPU(cpu);
    CPUClass *cc = CPU_GET_CLASS(cs);

    return cc->get_migration_id(cs);
}


void xics_cpu_destroy(XICSState *xics, PowerPCCPU *cpu)
{
    int server = xics_get_server(cpu);
    ICPState *ss = &xics->ss[server];
....

}

Regards
Nikunj




reply via email to

[Prev in Thread] Current Thread [Next in Thread]