mbox series

[kvm-unit-tests,v2,0/6] s390x: smp: use CPU indexes instead of addresses

Message ID 20220204130855.39520-1-imbrenda@linux.ibm.com (mailing list archive)
Headers show
Series s390x: smp: use CPU indexes instead of addresses | expand

Message

Claudio Imbrenda Feb. 4, 2022, 1:08 p.m. UTC
On s390x there are no guarantees about the CPU addresses, except that
they shall be unique. This means that in some environments, it is
theoretically possible that there is no match between the CPU address
and its position (index) in the list of available CPUs returned by the
system. Moreover, there are no guarantees about the ordering of the
list, or even that it is consistent each time it is returned.

This series fixes a small bug in the SMP initialization code, adds a
guarantee that the boot CPU will always have index 0, changes the
existing smp_* functions to take indexes instead of addresses, and
introduces some functions to allow tests to use CPU indexes instead of
using hardcoded CPU addresses. This will allow the tests to run
successfully in more environments (e.g. z/VM, LPAR).

Some existing tests are adapted to take advantage of the new
functionalities.

v1->v2
* refactored the smp_* functions to accept indexes instead of addresses
* also fixed uv-host test

Claudio Imbrenda (6):
  lib: s390x: smp: guarantee that boot CPU has index 0
  lib: s390x: smp: refactor smp functions to accept indexes
  s390x: smp: use CPU indexes instead of addresses
  s390x: firq: use CPU indexes instead of addresses
  s390x: skrf: use CPU indexes instead of addresses
  s390x: uv-host: use CPU indexes instead of addresses

 lib/s390x/smp.h |  20 +++---
 lib/s390x/smp.c | 173 +++++++++++++++++++++++++++++-------------------
 s390x/firq.c    |  26 ++------
 s390x/skrf.c    |   2 +-
 s390x/smp.c     |  22 +++---
 s390x/uv-host.c |   4 +-
 6 files changed, 137 insertions(+), 110 deletions(-)