summary refs log tree commit diff stats
path: root/scripts/git-submodule.sh
diff options
context:
space:
mode:
authorGreg Kurz <groug@kaod.org>2018-02-14 20:40:53 +0100
committerDavid Gibson <david@gibson.dropbear.id.au>2018-02-16 12:14:26 +1100
commit5d0fb1508e2d279da74ef4a103e8def9b52c6304 (patch)
treec4345efc38ba0d49340bd97d65e7e4507af2899e /scripts/git-submodule.sh
parent14bb4486c819ea797a151b3e0fe53d6f5c7b3fc5 (diff)
downloadfocaccia-qemu-5d0fb1508e2d279da74ef4a103e8def9b52c6304.tar.gz
focaccia-qemu-5d0fb1508e2d279da74ef4a103e8def9b52c6304.zip
spapr: consolidate the VCPU id numbering logic in a single place
Several places in the code need to calculate a VCPU id:

    (cpu_index / smp_threads) * spapr->vsmt + cpu_index % smp_threads
    (core_id / smp_threads) * spapr->vsmt (1 user)
    index * spapr->vsmt (2 users)

or guess that the VCPU id of a given VCPU is the first thread of a virtual
core:

    index % spapr->vsmt != 0

Even if the numbering logic isn't that complex, it is rather fragile to
have these assumptions open-coded in several places. FWIW this was
proved with recent issues related to VSMT.

This patch moves the VCPU id formula to a single function to be called
everywhere the code needs to compute one. It also adds an helper to
guess if a VCPU is the first thread of a VCORE.

Signed-off-by: Greg Kurz <groug@kaod.org>
[dwg: Rename spapr_is_vcore() to spapr_is_thread0_in_vcore() for clarity]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'scripts/git-submodule.sh')
0 files changed, 0 insertions, 0 deletions