Skip to contentSkip to conversation

target-ppc: Add POWER8E_v2.1 CPU model.

PATCH In review David Gibson 3 participants 12 messages Jul 8, 2015 – Jul 13, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-ppc: Add POWER8E_v2.1 CPU model.

From: Andrea Bolognani <[email protected]>

Add a missing PVR value for the POWER8E v2.1 CPU. Information taken from the kernel cputable.

---
 target-ppc/cpu-models.c | 4 +++-
 target-ppc/cpu-models.h | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

Alex,

Not sure if this counts as a bugfix which can be merged now we're in the hard freeze. The lack of it does mean we can't work on one of our dev machines which has this CPU.

target-ppc/cpu-models.c +3 -1
index 4d5ab4b..9d8769b 100644
@@ -1140,6 +1140,8 @@
                 "POWER7+ v2.1")
     POWERPC_DEF("POWER8E_v1.0",  CPU_POWERPC_POWER8E_v10,            POWER8,
                 "POWER8E v1.0")
+    POWERPC_DEF("POWER8E_v2.1",  CPU_POWERPC_POWER8E_v21,            POWER8,
+                "POWER8E v2.1")
     POWERPC_DEF("POWER8_v1.0",   CPU_POWERPC_POWER8_v10,             POWER8,
                 "POWER8 v1.0")
     POWERPC_DEF("970_v2.2",      CPU_POWERPC_970_v22,                970,
@@ -1389,7 +1391,7 @@ PowerPCCPUAlias ppc_cpu_aliases[] = {
     { "POWER5gs", "POWER5+_v2.1" },
     { "POWER7", "POWER7_v2.3" },
     { "POWER7+", "POWER7+_v2.1" },
-    { "POWER8E", "POWER8E_v1.0" },
+    { "POWER8E", "POWER8E_v2.1" },
     { "POWER8", "POWER8_v1.0" },
     { "970", "970_v2.2" },
     { "970fx", "970fx_v3.1" },
target-ppc/cpu-models.h +1 -0
index 9d80e72..add31c6 100644
@@ -558,6 +558,7 @@ enum {
     CPU_POWERPC_POWER7P_v21        = 0x004A0201,
     CPU_POWERPC_POWER8E_BASE       = 0x004B0000,
     CPU_POWERPC_POWER8E_v10        = 0x004B0100,
+    CPU_POWERPC_POWER8E_v21        = 0x004B0201,
     CPU_POWERPC_POWER8_BASE        = 0x004D0000,
     CPU_POWERPC_POWER8_v10         = 0x004D0100,
     CPU_POWERPC_970_v22            = 0x00390202,
Signature · 1 line
2.4.3
#1 lore raw
Quoted 12 lines · David Gibson

From: Andrea Bolognani <[email protected]>

Add a missing PVR value for the POWER8E v2.1 CPU. Information taken from the kernel cputable.

---
  target-ppc/cpu-models.c | 4 +++-
  target-ppc/cpu-models.h | 1 +
  2 files changed, 4 insertions(+), 1 deletion(-)
Quoted 5 lines

Alex,

Not sure if this counts as a bugfix which can be merged now we're in the hard freeze. The lack of it does mean we can't work on one of our dev machines which has this CPU.

Why is this a stopper? We stopped bothering with exact PVRs some time ago and -cpu POWER8 or -cpu host still work.

Quoted 36 lines
target-ppc/cpu-models.c +3 -1
index 4d5ab4b..9d8769b 100644
@@ -1140,6 +1140,8 @@
                  "POWER7+ v2.1")
      POWERPC_DEF("POWER8E_v1.0",  CPU_POWERPC_POWER8E_v10,            POWER8,
                  "POWER8E v1.0")
+    POWERPC_DEF("POWER8E_v2.1",  CPU_POWERPC_POWER8E_v21,            POWER8,
+                "POWER8E v2.1")
      POWERPC_DEF("POWER8_v1.0",   CPU_POWERPC_POWER8_v10,             POWER8,
                  "POWER8 v1.0")
      POWERPC_DEF("970_v2.2",      CPU_POWERPC_970_v22,                970,
@@ -1389,7 +1391,7 @@ PowerPCCPUAlias ppc_cpu_aliases[] = {
      { "POWER5gs", "POWER5+_v2.1" },
      { "POWER7", "POWER7_v2.3" },
      { "POWER7+", "POWER7+_v2.1" },
-    { "POWER8E", "POWER8E_v1.0" },
+    { "POWER8E", "POWER8E_v2.1" },
      { "POWER8", "POWER8_v1.0" },
      { "970", "970_v2.2" },
      { "970fx", "970fx_v3.1" },
target-ppc/cpu-models.h +1 -0
index 9d80e72..add31c6 100644
@@ -558,6 +558,7 @@ enum {
      CPU_POWERPC_POWER7P_v21        = 0x004A0201,
      CPU_POWERPC_POWER8E_BASE       = 0x004B0000,
      CPU_POWERPC_POWER8E_v10        = 0x004B0100,
+    CPU_POWERPC_POWER8E_v21        = 0x004B0201,
      CPU_POWERPC_POWER8_BASE        = 0x004D0000,
      CPU_POWERPC_POWER8_v10         = 0x004D0100,
      CPU_POWERPC_970_v22            = 0x00390202,
Signature · 1 line
Alexey
#2 lore raw
Quoted 15 lines · Alexey Kardashevskiy
Quoted 14 lines · David Gibson

From: Andrea Bolognani <[email protected]>

Add a missing PVR value for the POWER8E v2.1 CPU. Information taken from the kernel cputable.

---
 target-ppc/cpu-models.c | 4 +++-
 target-ppc/cpu-models.h | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

Alex,

Quoted 7 lines
Quoted 3 lines

Not sure if this counts as a bugfix which can be merged now we're in the hard freeze. The lack of it does mean we can't work on one of our dev machines which has this CPU.

Why is this a stopper? We stopped bothering with exact PVRs some time ago and -cpu POWER8 or -cpu host still work.

Andrea, can you clarify?

I think it's because libvirt likes to specify a specific CPU - and if it gets the new PVR from the host, qemu won't understand it.

Signature · 4 lines
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
#3 lore raw
Quoted 21 lines · David Gibson
Quoted 20 lines · Alexey Kardashevskiy
Quoted 17 lines · David Gibson

From: Andrea Bolognani <[email protected]>

Add a missing PVR value for the POWER8E v2.1 CPU. Information taken from the kernel cputable.

---
  target-ppc/cpu-models.c | 4 +++-
  target-ppc/cpu-models.h | 1 +
  2 files changed, 4 insertions(+), 1 deletion(-)

Alex,

Not sure if this counts as a bugfix which can be merged now we're in the hard freeze. The lack of it does mean we can't work on one of our dev machines which has this CPU.

Quoted 7 lines
Quoted 2 lines

Why is this a stopper? We stopped bothering with exact PVRs some time ago and -cpu POWER8 or -cpu host still work.

Andrea, can you clarify?

I think it's because libvirt likes to specify a specific CPU - and if it gets the new PVR from the host, qemu won't understand it.

A specific CPU in this case is "POWER8", I added this specifically for libvirt (to allow migration between all versions of POWER8), it should not use versioned CPUs and it does not in powerkvm.

There is actually a patch to make this PVR masking/subclassing nicer, I replied to it with adding you in cc:, please have a look. Andreas Faerber had objections which I did not really grasp then.

Signature · 1 line
Alexey
#4 lore raw
Quoted 27 lines · Alexey Kardashevskiy
Quoted 26 lines · David Gibson
Quoted 15 lines · Alexey Kardashevskiy
Quoted 14 lines · David Gibson

From: Andrea Bolognani <[email protected]>

Add a missing PVR value for the POWER8E v2.1 CPU. Information taken from the kernel cputable.

---
 target-ppc/cpu-models.c | 4 +++-
 target-ppc/cpu-models.h | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

Alex,

Quoted 7 lines
Quoted 3 lines

Not sure if this counts as a bugfix which can be merged now we're in the hard freeze. The lack of it does mean we can't work on one of our dev machines which has this CPU.

Why is this a stopper? We stopped bothering with exact PVRs some time ago and -cpu POWER8 or -cpu host still work.

Andrea, can you clarify?

Quoted 7 lines
Quoted 2 lines

I think it's because libvirt likes to specify a specific CPU - and if it gets the new PVR from the host, qemu won't understand it.

A specific CPU in this case is "POWER8", I added this specifically for libvirt (to allow migration between all versions of POWER8), it should not use versioned CPUs and it does not in powerkvm.

Uh.. won't that make qemu attempt to set a specific PVR, though - which will fail with recent KVM if it's not *exactly* the same as the host PVR.

Quoted 6 lines

There is actually a patch to make this PVR masking/subclassing nicer, I replied to it with adding you in cc:, please have a look. Andreas Faerber had objections which I did not really grasp then.

Signature · 4 lines
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
#5 lore raw
Quoted 32 lines · David Gibson
Quoted 31 lines · Alexey Kardashevskiy
Quoted 28 lines · David Gibson
Quoted 15 lines · Alexey Kardashevskiy
Quoted 14 lines · David Gibson

From: Andrea Bolognani <[email protected]>

Add a missing PVR value for the POWER8E v2.1 CPU. Information taken from the kernel cputable.

---
  target-ppc/cpu-models.c | 4 +++-
  target-ppc/cpu-models.h | 1 +
  2 files changed, 4 insertions(+), 1 deletion(-)

Alex,

Quoted 7 lines
Quoted 3 lines

Not sure if this counts as a bugfix which can be merged now we're in the hard freeze. The lack of it does mean we can't work on one of our dev machines which has this CPU.

Why is this a stopper? We stopped bothering with exact PVRs some time ago and -cpu POWER8 or -cpu host still work.

Andrea, can you clarify?

I think it's because libvirt likes to specify a specific CPU - and if it gets the new PVR from the host, qemu won't understand it.

Quoted 7 lines
Quoted 3 lines

A specific CPU in this case is "POWER8", I added this specifically for libvirt (to allow migration between all versions of POWER8), it should not use versioned CPUs and it does not in powerkvm.

Uh.. won't that make qemu attempt to set a specific PVR, though - which will fail with recent KVM if it's not *exactly* the same as the host PVR.

The "POWER8" CPU class is created dynamically (like the "host" CPU class) and has the actual host PVR so setting it to KVM cannot fail.

When TCG, the class is not registered and alias is used instead.

Quoted 6 lines
Quoted 5 lines

There is actually a patch to make this PVR masking/subclassing nicer, I replied to it with adding you in cc:, please have a look. Andreas Faerber had objections which I did not really grasp then.

Signature · 1 line
Alexey
#6 lore raw
Quoted 10 lines · Alexey Kardashevskiy
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines

I think it's because libvirt likes to specify a specific CPU - and if
it gets the new PVR from the host, qemu won't understand it.

A specific CPU in this case is "POWER8", I added this specifically for
libvirt (to allow migration between all versions of POWER8), it should not
use versioned CPUs and it does not in powerkvm.

Does "all versions of POWER8" include things like POWER8E, POWER8NVL and "POWER8 DD1", as one of the variations is known in the kernel source? Can we safely migrate guests eg. from a POWER8 v1.0 host to a POWER8E v2.1 host?

Quoted 10 lines
Quoted 4 lines

Uh.. won't that make qemu attempt to set a specific PVR, though - which will fail with recent KVM if it's not *exactly* the same as the
host PVR.

The "POWER8" CPU class is created dynamically (like the "host" CPU class)
and has the actual host PVR so setting it to KVM cannot fail.

When TCG, the class is not registered and alias is used instead.

Can you please point out where the dynamical creation happens for the POWER8 class? I haven't been able to locate it, but then again I'm all but familiar with QEMU's source :)

Quoted 1 line

From libvirt's point of view, it would be nice to be able to identify

as "POWER8" anything that looks like it, by matching the host's PVR agains a numer of known PVRs (with relative bitmask). Ideally, if the host can be identified as POWER8, that's the only CPU model libvirt should advertise...

Cheers.

Signature · 2 lines
Andrea Bolognani
Software Engineer - Virtualization Team
#7 lore raw
Quoted 12 lines · Andrea Bolognani
Quoted 10 lines · Alexey Kardashevskiy
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines

I think it's because libvirt likes to specify a specific CPU - and if
it gets the new PVR from the host, qemu won't understand it.

A specific CPU in this case is "POWER8", I added this specifically for
libvirt (to allow migration between all versions of POWER8), it should not
use versioned CPUs and it does not in powerkvm.

Quoted 4 lines

Does "all versions of POWER8" include things like POWER8E, POWER8NVL and "POWER8 DD1", as one of the variations is known in the kernel source? Can we safely migrate guests eg. from a POWER8 v1.0 host to a POWER8E v2.1 host?

Yes. afaik the only difference between POWER8 and POWER8E is how many cores are packed into an actual chip.

Quoted 9 lines
Quoted 9 lines
Quoted 4 lines

Uh.. won't that make qemu attempt to set a specific PVR, though - which will fail with recent KVM if it's not *exactly* the same as the
host PVR.

The "POWER8" CPU class is created dynamically (like the "host" CPU class)
and has the actual host PVR so setting it to KVM cannot fail.

Quoted 5 lines
Quoted 1 line

When TCG, the class is not registered and alias is used instead.

Can you please point out where the dynamical creation happens for the POWER8 class? I haven't been able to locate it, but then again I'm all but familiar with QEMU's source :)

kvm_ppc_register_host_cpu_type(), last chunk:

/* Register generic family CPU class for a family */ pvr_pcc = ppc_cpu_get_family_class(pvr_pcc);
dc = DEVICE_CLASS(pvr_pcc);
type_info.parent = object_class_get_name(OBJECT_CLASS(pvr_pcc)); type_info.name = g_strdup_printf("%s-"TYPE_POWERPC_CPU, dc->desc); type_register(&type_info);

Quoted 5 lines

From libvirt's point of view, it would be nice to be able to identify
as "POWER8" anything that looks like it, by matching the host's PVR agains a numer of known PVRs (with relative bitmask). Ideally, if the host can be identified as POWER8, that's the only CPU model libvirt should advertise...

I have a very little idea about libvirt here. QEMU considers everything with 0x004dxxxx and 0x004bxxxx as POWER8 (ppc_pvr_match_power8() helper) and supports migration between these.

I am adding Shiva to the coversation, he might enlighen us how this is solved by powerkvm's libvirt.

Signature · 1 line
Alexey
#8 lore raw
Quoted 10 lines · Alexey Kardashevskiy
Quoted 6 lines

Does "all versions of POWER8" include things like POWER8E, POWER8NVL
and "POWER8 DD1", as one of the variations is known in the kernel source? Can we safely migrate guests eg. from a POWER8 v1.0 host to a POWER8E v2.1 host?

Yes. afaik the only difference between POWER8 and POWER8E is how many cores
are packed into an actual chip.

If I'm reading the kernel source[1] correctly, there are actually subtle
differences other than the number of cores:

  #define CPU_FTRS_POWER8 (/* Bunch of features here */)
  #define CPU_FTRS_POWER8E (CPU_FTRS_POWER8 | CPU_FTR_PMAO_BUG)
  #define CPU_FTRS_POWER8_DD1 (CPU_FTRS_POWER8 & ~CPU_FTR_DBELL)

Whether or not these differences will cause issues, I have no idea :)

Quoted 8 lines
Quoted 7 lines

From libvirt's point of view, it would be nice to be able to
identify
as "POWER8" anything that looks like it, by matching the host's PVR agains a numer of known PVRs (with relative bitmask). Ideally, if the
host can be identified as POWER8, that's the only CPU model libvirt should advertise...

Quoted 5 lines

I have a very little idea about libvirt here. QEMU considers everything
with 0x004dxxxx and 0x004bxxxx as POWER8 (ppc_pvr_match_power8() helper)
and supports migration between these.

Looking again at the kernel source[2]:

{ /* Power8E */

      .pvr_mask               = 0xffff0000,
      .pvr_value              = 0x004b0000,
      .cpu_name               = "POWER8E (raw)",
      .cpu_features           = CPU_FTRS_POWER8E,
      .cpu_user_features      = COMMON_USER_POWER8,
      .cpu_user_features2     = COMMON_USER2_POWER8,
      .mmu_features           = MMU_FTRS_POWER8,
      .icache_bsize           = 128,
      .dcache_bsize           = 128,
      .num_pmcs               = 6,
      .pmc_type               = PPC_PMC_IBM,
      .oprofile_cpu_type      = "ppc64/power8",
      .oprofile_type          = PPC_OPROFILE_INVALID,
      .cpu_setup              = __setup_cpu_power8,
      .cpu_restore            = __restore_cpu_power8,
      .flush_tlb              = __flush_tlb_power8,
      .machine_check_early    = __machine_check_early_realmode_p8,
      .platform               = "power8",
  },
  {   /* Power8NVL */
      .pvr_mask               = 0xffff0000,
      .pvr_value              = 0x004c0000,
      .cpu_name               = "POWER8NVL (raw)",
      .cpu_features           = CPU_FTRS_POWER8,
      /* Same as above */
  },
  {   /* Power8 DD1: Does not support doorbell IPIs */
      .pvr_mask               = 0xffffff00,
      .pvr_value              = 0x004d0100,
      .cpu_name               = "POWER8 (raw)",
      .cpu_features           = CPU_FTRS_POWER8_DD1,
      /* Same as above */
  },
  {   /* Power8 */
      .pvr_mask               = 0xffff0000,
      .pvr_value              = 0x004d0000,
      .cpu_name               = "POWER8 (raw)",
      .cpu_features           = CPU_FTRS_POWER8,
      /* Same as above */

},

So the PVR matching, as done currently in QEMU, will include POWER8DD1 but exclude POWER8NVL, which according to to commit ddee09c0 and the code
above is absolutely identical to POWER8.

libvirt currently considers the guest CPU model to be compatible with the host CPU model if both have the same PVR, which is clearly far from optimal.

If we can rely on the above CPU families, as identified by pvr_value and pvr_mask, to behave exactly the same for our purposes[3], then we can change libvirt to perform the same kind of PVR matching as QEMU and report to the user that the guest CPU model POWER8 is compatible with all of the above host CPU models.

Quoted 3 lines

I am adding Shiva to the coversation, he might enlighen us how this is
solved by powerkvm's libvirt.

Sure, the more the merrier :)

Cheers.

[1] arch/powerpc/include/asm/cputable.h
[2] arch/powerpc/kernel/cputable.c
[3] eg. a guest running on a POWER8E host can be migrated to a POWER8DD1 host, despite the fact that the former has
CPU_FTR_PMAO_BUG
and the latter lacks CPU_FTR_DBELL.

Signature · 2 lines
Andrea Bolognani
Software Engineer - Virtualization Team
#9 lore raw
Quoted 12 lines · Andrea Bolognani
Quoted 10 lines · Alexey Kardashevskiy
Quoted 6 lines

Does "all versions of POWER8" include things like POWER8E, POWER8NVL
and "POWER8 DD1", as one of the variations is known in the kernel source? Can we safely migrate guests eg. from a POWER8 v1.0 host to a POWER8E v2.1 host?

Yes. afaik the only difference between POWER8 and POWER8E is how many cores
are packed into an actual chip.

Quoted 6 lines

If I'm reading the kernel source[1] correctly, there are actually subtle
differences other than the number of cores:

   #define CPU_FTRS_POWER8 (/* Bunch of features here */)
   #define CPU_FTRS_POWER8E (CPU_FTRS_POWER8 | CPU_FTR_PMAO_BUG)

POWER8E was the first family of POWER8. Some revisions of POWER8E have this bug. The bug is that if we migrate from a good POWER8 to POWER8 with this bug, perf counters will stop working as the source kernel did not detect broken CPU and did not enable a workaround. We do not really know how many of this chips are out there (not many I believe) and how many have this bug. And also I guess that more people will be annoyed by inability to migrate rather than by broken perf.

I'd leave migration enabled but it is worth mentioning somewhere in user's guide that if the user migrates a guest to POWER8E with the specific PVR, perf might break.

Quoted 1 line
   #define CPU_FTRS_POWER8_DD1 (CPU_FTRS_POWER8 & ~CPU_FTR_DBELL)

This bug appears in POWER8E and POWER8 1.0 ("DD1"). The bug is that when a CPU thread wakes up after nap because of doorbell message, the doorbell interrupt is not pending. Guests cannot do nap themselves (they use H_CEDE hypercall for this), when a thread wakes up, it wakes in the host context so there is nothing to handle in the guest, it is purely for KVM to workaround.

Quoted 58 lines

Whether or not these differences will cause issues, I have no idea :)

Quoted 8 lines
Quoted 7 lines

From libvirt's point of view, it would be nice to be able to
identify
as "POWER8" anything that looks like it, by matching the host's PVR agains a numer of known PVRs (with relative bitmask). Ideally, if the
host can be identified as POWER8, that's the only CPU model libvirt should advertise...

Quoted 5 lines

I have a very little idea about libvirt here. QEMU considers everything
with 0x004dxxxx and 0x004bxxxx as POWER8 (ppc_pvr_match_power8() helper)
and supports migration between these.

Looking again at the kernel source[2]:

{ /* Power8E */

       .pvr_mask               = 0xffff0000,
       .pvr_value              = 0x004b0000,
       .cpu_name               = "POWER8E (raw)",
       .cpu_features           = CPU_FTRS_POWER8E,
       .cpu_user_features      = COMMON_USER_POWER8,
       .cpu_user_features2     = COMMON_USER2_POWER8,
       .mmu_features           = MMU_FTRS_POWER8,
       .icache_bsize           = 128,
       .dcache_bsize           = 128,
       .num_pmcs               = 6,
       .pmc_type               = PPC_PMC_IBM,
       .oprofile_cpu_type      = "ppc64/power8",
       .oprofile_type          = PPC_OPROFILE_INVALID,
       .cpu_setup              = __setup_cpu_power8,
       .cpu_restore            = __restore_cpu_power8,
       .flush_tlb              = __flush_tlb_power8,
       .machine_check_early    = __machine_check_early_realmode_p8,
       .platform               = "power8",
   },
   {   /* Power8NVL */
       .pvr_mask               = 0xffff0000,
       .pvr_value              = 0x004c0000,
       .cpu_name               = "POWER8NVL (raw)",
       .cpu_features           = CPU_FTRS_POWER8,
       /* Same as above */
   },
   {   /* Power8 DD1: Does not support doorbell IPIs */
       .pvr_mask               = 0xffffff00,
       .pvr_value              = 0x004d0100,
       .cpu_name               = "POWER8 (raw)",
       .cpu_features           = CPU_FTRS_POWER8_DD1,
       /* Same as above */
   },
   {   /* Power8 */
       .pvr_mask               = 0xffff0000,
       .pvr_value              = 0x004d0000,
       .cpu_name               = "POWER8 (raw)",
       .cpu_features           = CPU_FTRS_POWER8,
       /* Same as above */
Quoted 6 lines

},

So the PVR matching, as done currently in QEMU, will include POWER8DD1 but exclude POWER8NVL, which according to to commit ddee09c0 and the code
above is absolutely identical to POWER8.

Yeah, we have to add 0x004c0000 into the POWER8 family as well, I'll doublecheck.

Quoted 26 lines

libvirt currently considers the guest CPU model to be compatible with the host CPU model if both have the same PVR, which is clearly far from optimal.

If we can rely on the above CPU families, as identified by pvr_value and pvr_mask, to behave exactly the same for our purposes[3], then we can change libvirt to perform the same kind of PVR matching as QEMU and report to the user that the guest CPU model POWER8 is compatible with all of the above host CPU models.

Quoted 3 lines

I am adding Shiva to the coversation, he might enlighen us how this is
solved by powerkvm's libvirt.

Sure, the more the merrier :)

Cheers.

[1] arch/powerpc/include/asm/cputable.h
[2] arch/powerpc/kernel/cputable.c
[3] eg. a guest running on a POWER8E host can be migrated to a POWER8DD1 host, despite the fact that the former has
CPU_FTR_PMAO_BUG
and the latter lacks CPU_FTR_DBELL.

Signature · 1 line
Alexey
#10 lore raw
Quoted 22 lines · Alexey Kardashevskiy
Quoted 7 lines

If I'm reading the kernel source[1] correctly, there are actually subtle
differences other than the number of cores:

   #define CPU_FTRS_POWER8 (/* Bunch of features here */)
   #define CPU_FTRS_POWER8E (CPU_FTRS_POWER8 | CPU_FTR_PMAO_BUG)

POWER8E was the first family of POWER8. Some revisions of POWER8E have this
bug. The bug is that if we migrate from a good POWER8 to POWER8 with this
bug, perf counters will stop working as the source kernel did not detect
broken CPU and did not enable a workaround. We do not really know how many
of this chips are out there (not many I believe) and how many have this
bug. And also I guess that more people will be annoyed by inability to
migrate rather than by broken perf.

Quoted 5 lines

I'd leave migration enabled but it is worth mentioning somewhere in user's
guide that if the user migrates a guest to POWER8E with the specific PVR,
perf might break.

David said we might be able to just apply the kernel PMAO workaround unconditionally, which would of course be great. Even if that turns out not to be possible, I agree with you that allowing migration is more important than not breaking performance monitoring, and documenting this properly should be enough.

Quoted 12 lines
Quoted 1 line
   #define CPU_FTRS_POWER8_DD1 (CPU_FTRS_POWER8 & ~CPU_FTR_DBELL)

This bug appears in POWER8E and POWER8 1.0 ("DD1"). The bug is that when a
CPU thread wakes up after nap because of doorbell message, the doorbell
interrupt is not pending. Guests cannot do nap themselves (they use H_CEDE
hypercall for this), when a thread wakes up, it wakes in the host context
so there is nothing to handle in the guest, it is purely for KVM to workaround.

Great news!

Quoted 9 lines
Quoted 6 lines

So the PVR matching, as done currently in QEMU, will include POWER8DD1
but exclude POWER8NVL, which according to to commit ddee09c0 and the
code
above is absolutely identical to POWER8.

Yeah, we have to add 0x004c0000 into the POWER8 family as well, I'll doublecheck.

Okay. libvirt will soon advertise just POWER8 instead of specific models, and will consider the POWER8 guest CPU model to be compatible with any host having a POWER8* CPU, using the same PVR values and masks as the kernel. Once QEMU is updated to include POWER8NVL, the behavior will be consistent across the stack.

Just to be sure: the same applies to POWER7 as well, right? It certainly looks so from both the kernel and QEMU code.

Thanks a lot for all the precious bits of information you've provided.

Cheers.

Signature · 2 lines
Andrea Bolognani
Software Engineer - Virtualization Team
#11 lore raw
Quoted 57 lines · Andrea Bolognani
Quoted 22 lines · Alexey Kardashevskiy
Quoted 7 lines

If I'm reading the kernel source[1] correctly, there are actually subtle
differences other than the number of cores:

    #define CPU_FTRS_POWER8 (/* Bunch of features here */)
    #define CPU_FTRS_POWER8E (CPU_FTRS_POWER8 | CPU_FTR_PMAO_BUG)

POWER8E was the first family of POWER8. Some revisions of POWER8E have this
bug. The bug is that if we migrate from a good POWER8 to POWER8 with this
bug, perf counters will stop working as the source kernel did not detect
broken CPU and did not enable a workaround. We do not really know how many
of this chips are out there (not many I believe) and how many have this
bug. And also I guess that more people will be annoyed by inability to
migrate rather than by broken perf.

Quoted 5 lines

I'd leave migration enabled but it is worth mentioning somewhere in user's
guide that if the user migrates a guest to POWER8E with the specific PVR,
perf might break.

David said we might be able to just apply the kernel PMAO workaround unconditionally, which would of course be great. Even if that turns out not to be possible, I agree with you that allowing migration is more important than not breaking performance monitoring, and documenting this properly should be enough.

Quoted 12 lines
Quoted 1 line
    #define CPU_FTRS_POWER8_DD1 (CPU_FTRS_POWER8 & ~CPU_FTR_DBELL)

This bug appears in POWER8E and POWER8 1.0 ("DD1"). The bug is that when a
CPU thread wakes up after nap because of doorbell message, the doorbell
interrupt is not pending. Guests cannot do nap themselves (they use H_CEDE
hypercall for this), when a thread wakes up, it wakes in the host context
so there is nothing to handle in the guest, it is purely for KVM to workaround.

Great news!

Quoted 7 lines
Quoted 6 lines

So the PVR matching, as done currently in QEMU, will include POWER8DD1
but exclude POWER8NVL, which according to to commit ddee09c0 and the
code
above is absolutely identical to POWER8.

Quoted 8 lines
Quoted 2 lines

Yeah, we have to add 0x004c0000 into the POWER8 family as well, I'll doublecheck.

Okay. libvirt will soon advertise just POWER8 instead of specific models, and will consider the POWER8 guest CPU model to be compatible with any host having a POWER8* CPU, using the same PVR values and masks as the kernel. Once QEMU is updated to include POWER8NVL, the behavior will be consistent across the stack.

Correct.

Quoted 2 lines

Just to be sure: the same applies to POWER7 as well, right? It certainly looks so from both the kernel and QEMU code.

Right.

Quoted 1 line

Thanks a lot for all the precious bits of information you've provided.

I've learnt a lot too :)

Signature · 1 line
Alexey