Skip to contentSkip to conversation

KVM-PR is broken with current QEMU

Qemu-devel Thomas Huth 5 participants 14 messages Sep 20, 2016 – Sep 22, 2016

lore
Share & tools
lore
#0 lore raw

Hi,

when I try to run my guest in KVM-PR mode, current QEMU refuses to start:

  $ sudo qemu-system-ppc64 -M pseries,accel=kvm,kvm-type=PR \
                           -nographic -vga none -cpu POWER8
  qemu: fatal: Unknown MMU model 851972

... followed by a useless register dump. I've bisected the issue, and it seems like the problem has been introduced by this commit here:

commit 4322e8ced5aaac7191958f09622d199fe61e2d87
ppc: Fix 64K pages support in full emulation

Seems like KVM PR is using the "degraded" ISA variants (without the 1TB segments), but the new POWERPC_MMU_64K flag has not been added to those. Has this been done on purpose, or was this just by accident? I can make KVM PR working again with the following patch:

target-ppc/cpu-qom.h +2 -0
index 2864105..36694cb 100644
@@ -81,6 +81,7 @@ enum powerpc_mmu_t {
                              | POWERPC_MMU_AMR | 0x00000003,
     /* Architecture 2.06 "degraded" (no 1T segments)           */
     POWERPC_MMU_2_06a      = POWERPC_MMU_64 | POWERPC_MMU_AMR
+                             | POWERPC_MMU_64K
                              | 0x00000003,
     /* Architecture 2.07 variant                               */
     POWERPC_MMU_2_07       = POWERPC_MMU_64 | POWERPC_MMU_1TSEG
@@ -88,6 +89,7 @@ enum powerpc_mmu_t {
                              | POWERPC_MMU_AMR | 0x00000004,
     /* Architecture 2.07 "degraded" (no 1T segments)           */
     POWERPC_MMU_2_07a      = POWERPC_MMU_64 | POWERPC_MMU_AMR
+                             | POWERPC_MMU_64K
                              | 0x00000004,
 };
 

However, not sure whether this is the right fix ... Cédric, Ben, any ideas?

Thomas

#1 lore raw
Quoted 11 lines · Thomas Huth

Hi,

when I try to run my guest in KVM-PR mode, current QEMU refuses to start:

  $ sudo qemu-system-ppc64 -M pseries,accel=kvm,kvm-type=PR \
                           -nographic -vga none -cpu POWER8
  qemu: fatal: Unknown MMU model 851972

... followed by a useless register dump. I've bisected the issue, and it seems like the problem has been introduced by this commit here:

Quoted 6 lines

commit 4322e8ced5aaac7191958f09622d199fe61e2d87
ppc: Fix 64K pages support in full emulation

Seems like KVM PR is using the "degraded" ISA variants (without the 1TB segments), but the new POWERPC_MMU_64K flag has not been added to those. Has this been done on purpose, or was this just by accident?

The "degraded" architecture support has some history behind it :

commit 126a79300971 added it
commit aa4bb5875231 removed it.
commit ba3ecda05e93 readded it.
commit 4322e8ced5aa forgot about it again

Quoted 1 line

I can make KVM PR working again with the following patch:

I think this is correct. Let's wait for Ben to chime in :)

Thanks,

C.

Quoted 21 lines
target-ppc/cpu-qom.h +2 -0
index 2864105..36694cb 100644
@@ -81,6 +81,7 @@ enum powerpc_mmu_t {
                              | POWERPC_MMU_AMR | 0x00000003,
     /* Architecture 2.06 "degraded" (no 1T segments)           */
     POWERPC_MMU_2_06a      = POWERPC_MMU_64 | POWERPC_MMU_AMR
+                             | POWERPC_MMU_64K
                              | 0x00000003,
     /* Architecture 2.07 variant                               */
     POWERPC_MMU_2_07       = POWERPC_MMU_64 | POWERPC_MMU_1TSEG
@@ -88,6 +89,7 @@ enum powerpc_mmu_t {
                              | POWERPC_MMU_AMR | 0x00000004,
     /* Architecture 2.07 "degraded" (no 1T segments)           */
     POWERPC_MMU_2_07a      = POWERPC_MMU_64 | POWERPC_MMU_AMR
+                             | POWERPC_MMU_64K
                              | 0x00000004,
 };
 

However, not sure whether this is the right fix ... Cédric, Ben, any ideas?

#2 lore raw
Quoted 21 lines · Cédric Le Goater
Quoted 11 lines · Thomas Huth

Hi,

when I try to run my guest in KVM-PR mode, current QEMU refuses to start:

  $ sudo qemu-system-ppc64 -M pseries,accel=kvm,kvm-type=PR \
                           -nographic -vga none -cpu POWER8
  qemu: fatal: Unknown MMU model 851972

... followed by a useless register dump. I've bisected the issue, and it seems like the problem has been introduced by this commit here:

Quoted 6 lines

commit 4322e8ced5aaac7191958f09622d199fe61e2d87
ppc: Fix 64K pages support in full emulation

Seems like KVM PR is using the "degraded" ISA variants (without the 1TB segments), but the new POWERPC_MMU_64K flag has not been added to those. Has this been done on purpose, or was this just by accident?

The "degraded" architecture support has some history behind it :

Quoted 8 lines

commit 126a79300971 added it
commit aa4bb5875231 removed it.
commit ba3ecda05e93 readded it.
commit 4322e8ced5aa forgot about it again

Quoted 1 line

I can make KVM PR working again with the following patch:

I think this is correct. Let's wait for Ben to chime in :)

So I confirm the bug and the fix.

There are other issues after in the guest (kernel crashing). But I think these are related to TM which is not supported in KVM-PR. I am not sure where we are on that point.

Thanks,

C.

Quoted 25 lines
Quoted 21 lines
target-ppc/cpu-qom.h +2 -0
index 2864105..36694cb 100644
@@ -81,6 +81,7 @@ enum powerpc_mmu_t {
                              | POWERPC_MMU_AMR | 0x00000003,
     /* Architecture 2.06 "degraded" (no 1T segments)           */
     POWERPC_MMU_2_06a      = POWERPC_MMU_64 | POWERPC_MMU_AMR
+                             | POWERPC_MMU_64K
                              | 0x00000003,
     /* Architecture 2.07 variant                               */
     POWERPC_MMU_2_07       = POWERPC_MMU_64 | POWERPC_MMU_1TSEG
@@ -88,6 +89,7 @@ enum powerpc_mmu_t {
                              | POWERPC_MMU_AMR | 0x00000004,
     /* Architecture 2.07 "degraded" (no 1T segments)           */
     POWERPC_MMU_2_07a      = POWERPC_MMU_64 | POWERPC_MMU_AMR
+                             | POWERPC_MMU_64K
                              | 0x00000004,
 };
 

However, not sure whether this is the right fix ... Cédric, Ben, any ideas?

#3 lore raw
Quoted 29 lines · Cédric Le Goater
Quoted 28 lines · Cédric Le Goater
Quoted 11 lines · Thomas Huth

Hi,

when I try to run my guest in KVM-PR mode, current QEMU refuses to start:

  $ sudo qemu-system-ppc64 -M pseries,accel=kvm,kvm-type=PR \
                           -nographic -vga none -cpu POWER8
  qemu: fatal: Unknown MMU model 851972

... followed by a useless register dump. I've bisected the issue, and it seems like the problem has been introduced by this commit here:

Quoted 6 lines

commit 4322e8ced5aaac7191958f09622d199fe61e2d87
ppc: Fix 64K pages support in full emulation

Seems like KVM PR is using the "degraded" ISA variants (without the 1TB segments), but the new POWERPC_MMU_64K flag has not been added to those. Has this been done on purpose, or was this just by accident?

The "degraded" architecture support has some history behind it :

commit 126a79300971 added it
commit aa4bb5875231 removed it.
commit ba3ecda05e93 readded it.
commit 4322e8ced5aa forgot about it again

Quoted 1 line

I can make KVM PR working again with the following patch:

Quoted 7 lines
Quoted 1 line

I think this is correct. Let's wait for Ben to chime in :)

So I confirm the bug and the fix.

There are other issues after in the guest (kernel crashing). But I think these are related to TM which is not supported in KVM-PR. I am not sure where we are on that point.

There was a patch some months ago:

https://lists.gnu.org/archive/html/qemu-ppc/2016-04/msg00046.html

... but I think it has never been included, as far as I can see.

Thomas

#4 lore raw
Quoted 38 lines · Thomas Huth
Quoted 29 lines · Cédric Le Goater
Quoted 28 lines · Cédric Le Goater
Quoted 11 lines · Thomas Huth

Hi,

when I try to run my guest in KVM-PR mode, current QEMU refuses to start:

  $ sudo qemu-system-ppc64 -M pseries,accel=kvm,kvm-type=PR \
                           -nographic -vga none -cpu POWER8
  qemu: fatal: Unknown MMU model 851972

... followed by a useless register dump. I've bisected the issue, and it seems like the problem has been introduced by this commit here:

Quoted 6 lines

commit 4322e8ced5aaac7191958f09622d199fe61e2d87
ppc: Fix 64K pages support in full emulation

Seems like KVM PR is using the "degraded" ISA variants (without the 1TB segments), but the new POWERPC_MMU_64K flag has not been added to those. Has this been done on purpose, or was this just by accident?

The "degraded" architecture support has some history behind it :

commit 126a79300971 added it
commit aa4bb5875231 removed it.
commit ba3ecda05e93 readded it.
commit 4322e8ced5aa forgot about it again

Quoted 1 line

I can make KVM PR working again with the following patch:

Quoted 7 lines
Quoted 1 line

I think this is correct. Let's wait for Ben to chime in :)

So I confirm the bug and the fix.

There are other issues after in the guest (kernel crashing). But I think these are related to TM which is not supported in KVM-PR. I am not sure where we are on that point.

Quoted 5 lines

There was a patch some months ago:

https://lists.gnu.org/archive/html/qemu-ppc/2016-04/msg00046.html

... but I think it has never been included, as far as I can see.

and with that patch, the guest fully boots. But David had some concerns on the way it is done. It would be nice to put some cycle on this.

Thanks,

C.

#5 lore raw
Quoted 2 lines · Cédric Le Goater
Quoted 1 line · Thomas Huth

On 20.09.2016 16:04, Cédric Le Goater wrote:

[...]

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

There are other issues after in the guest (kernel crashing). But I think these are related to TM which is not supported in KVM-PR. I am not sure where we are on that point.

Quoted 8 lines
Quoted 5 lines

There was a patch some months ago:

https://lists.gnu.org/archive/html/qemu-ppc/2016-04/msg00046.html

... but I think it has never been included, as far as I can see.

and with that patch, the guest fully boots. But David had some concerns on the way it is done. It would be nice to put some cycle on this.

Looking at the mail thread, I think TM should be currently disabled for both, KVM-PR and TCG, i.e. only enabled for KVM-HV. The TM support in TCG is just fake, since TBEGIN always fails.
Once we've got proper TM support in TCG, this can be easily changed within QEMU. And once we've got TM support in KVM-PR, I think we should also introduce a capability flag to KVM which can be used to inform QEMU about this.

So I think Anton's patch currently just lacks the check for TCG. Anton, if you've got some spare minutes, could you maybe send an updated version of that patch?

Thanks,
Thomas

#6 lore raw
Quoted 12 lines · Thomas Huth
Quoted 2 lines · Cédric Le Goater
Quoted 1 line · Thomas Huth

On 20.09.2016 16:04, Cédric Le Goater wrote:

[...]

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

There are other issues after in the guest (kernel crashing). But I think these are related to TM which is not supported in KVM-PR. I am not sure where we are on that point.

There was a patch some months ago:

https://lists.gnu.org/archive/html/qemu-ppc/2016-04/msg00046.html

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

... but I think it has never been included, as far as I can see.

and with that patch, the guest fully boots. But David had some concerns on the way it is done. It would be nice to put some cycle on this.

Looking at the mail thread, I think TM should be currently disabled for both, KVM-PR and TCG, i.e. only enabled for KVM-HV. The TM support in TCG is just fake, since TBEGIN always fails.

Right. So there's two questions here

1) Is qemu correctly advertising availability of TM in the device tree?

If not we need to fix that, which might involve adding a kernel capability for the PR case.

2) Is the kvm unit test properly checking for availability of TM before executing?

Quoted 8 lines

Once we've got proper TM support in TCG, this can be easily changed within QEMU. And once we've got TM support in KVM-PR, I think we should also introduce a capability flag to KVM which can be used to inform QEMU about this.

So I think Anton's patch currently just lacks the check for TCG. Anton, if you've got some spare minutes, could you maybe send an updated version of that patch?

Sorry, which patch of Anton's?

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
#7 lore raw
Quoted 18 lines · On Thu, 22 Sep 2016 11:57:15 +1000 David Gibson <[email protected]>…
Quoted 17 lines · Thomas Huth
Quoted 2 lines · Cédric Le Goater
Quoted 1 line · Thomas Huth

On 20.09.2016 16:04, Cédric Le Goater wrote:

[...]

Quoted 12 lines
Quoted 9 lines
Quoted 3 lines

There are other issues after in the guest (kernel crashing). But I think these are related to TM which is not supported in KVM-PR. I am not sure where we are on that point.

There was a patch some months ago:

https://lists.gnu.org/archive/html/qemu-ppc/2016-04/msg00046.html

... but I think it has never been included, as far as I can see.

and with that patch, the guest fully boots. But David had some concerns on the way it is done. It would be nice to put some cycle on this.

Quoted 8 lines
Quoted 3 lines

Looking at the mail thread, I think TM should be currently disabled for both, KVM-PR and TCG, i.e. only enabled for KVM-HV. The TM support in TCG is just fake, since TBEGIN always fails.

Right. So there's two questions here

1) Is qemu correctly advertising availability of TM in the device tree?

If I've got that right, it's currently always advertising TM, even if it's not really available (in TCG mode and PR mode).

Quoted 5 lines

If not we need to fix that, which might involve adding a kernel capability for the PR case.

2) Is the kvm unit test properly checking for availability of TM before executing?

Not yet. That's why it would be good to get a proper way for testing for the availability of TM --> i.e. something like Anton's patch.

Quoted 10 lines
Quoted 8 lines

Once we've got proper TM support in TCG, this can be easily changed within QEMU. And once we've got TM support in KVM-PR, I think we should also introduce a capability flag to KVM which can be used to inform QEMU about this.

So I think Anton's patch currently just lacks the check for TCG. Anton, if you've got some spare minutes, could you maybe send an updated version of that patch?

Sorry, which patch of Anton's?

This one:
https://lists.gnu.org/archive/html/qemu-ppc/2016-04/msg00415.html

Thomas

#8 lore raw
Quoted 47 lines · On Thu, 22 Sep 2016 07:30:52 +0200 Thomas Huth <[email protected]> wrote:
Quoted 18 lines · On Thu, 22 Sep 2016 11:57:15 +1000 David Gibson <[email protected]>…
Quoted 17 lines · Thomas Huth
Quoted 2 lines · Cédric Le Goater
Quoted 1 line · Thomas Huth

On 20.09.2016 16:04, Cédric Le Goater wrote:

[...]

Quoted 12 lines
Quoted 9 lines
Quoted 3 lines

There are other issues after in the guest (kernel crashing). But I think these are related to TM which is not supported in KVM-PR. I am not sure where we are on that point.

There was a patch some months ago:

https://lists.gnu.org/archive/html/qemu-ppc/2016-04/msg00046.html

... but I think it has never been included, as far as I can see.

and with that patch, the guest fully boots. But David had some concerns on the way it is done. It would be nice to put some cycle on this.

Quoted 8 lines
Quoted 3 lines

Looking at the mail thread, I think TM should be currently disabled for both, KVM-PR and TCG, i.e. only enabled for KVM-HV. The TM support in TCG is just fake, since TBEGIN always fails.

Right. So there's two questions here

1) Is qemu correctly advertising availability of TM in the device tree?

If I've got that right, it's currently always advertising TM, even if it's not really available (in TCG mode and PR mode).

Quoted 5 lines

If not we need to fix that, which might involve adding a kernel capability for the PR case.

2) Is the kvm unit test properly checking for availability of TM before executing?

Not yet. That's why it would be good to get a proper way for testing for the availability of TM --> i.e. something like Anton's patch.

Quoted 5 lines
Quoted 5 lines

Once we've got proper TM support in TCG, this can be easily changed within QEMU. And once we've got TM support in KVM-PR, I think we should also introduce a capability flag to KVM which can be used to inform QEMU about this.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

So I think Anton's patch currently just lacks the check for TCG. Anton, if you've got some spare minutes, could you maybe send an updated version of that patch?

Sorry, which patch of Anton's?

This one:
https://lists.gnu.org/archive/html/qemu-ppc/2016-04/msg00415.html

Actually, looking at that whole pa-feature code in QEMU, I think there's some more work to do here: Everything that is not using mmu_model==POWERPC_MMU_2_06 is automatically getting pa_features_207. This is sometimes completely wrong, for example when running with KVM-PR, the mmu_model for POWER7 is POWERPC_MMU_2_06a instead. Or when running with TCG, I think it's also perfectly legal to run the pseries machine with a POWER5+ or PPC970 CPU - and we certainly do not want to use pa_features_207 there.

So if you like, I can try to come up with a small patch series that cleans up this mess - and I could also include an updated versions of Anton's patch there unless he wants to redo the changes on his own...?

Thomas

#9 lore raw
Quoted 68 lines · Thomas Huth
Quoted 47 lines · On Thu, 22 Sep 2016 07:30:52 +0200 Thomas Huth <[email protected]> wrote:
Quoted 18 lines · On Thu, 22 Sep 2016 11:57:15 +1000 David Gibson <[email protected]>…
Quoted 17 lines · Thomas Huth
Quoted 2 lines · Cédric Le Goater
Quoted 1 line · Thomas Huth

On 20.09.2016 16:04, Cédric Le Goater wrote:

[...]

Quoted 12 lines
Quoted 9 lines
Quoted 3 lines

There are other issues after in the guest (kernel crashing). But I think these are related to TM which is not supported in KVM-PR. I am not sure where we are on that point.

There was a patch some months ago:

https://lists.gnu.org/archive/html/qemu-ppc/2016-04/msg00046.html

... but I think it has never been included, as far as I can see.

and with that patch, the guest fully boots. But David had some concerns on the way it is done. It would be nice to put some cycle on this.

Quoted 8 lines
Quoted 3 lines

Looking at the mail thread, I think TM should be currently disabled for both, KVM-PR and TCG, i.e. only enabled for KVM-HV. The TM support in TCG is just fake, since TBEGIN always fails.

Right. So there's two questions here

1) Is qemu correctly advertising availability of TM in the device tree?

If I've got that right, it's currently always advertising TM, even if it's not really available (in TCG mode and PR mode).

Quoted 5 lines

If not we need to fix that, which might involve adding a kernel capability for the PR case.

2) Is the kvm unit test properly checking for availability of TM before executing?

Not yet. That's why it would be good to get a proper way for testing for the availability of TM --> i.e. something like Anton's patch.

Quoted 5 lines
Quoted 5 lines

Once we've got proper TM support in TCG, this can be easily changed within QEMU. And once we've got TM support in KVM-PR, I think we should also introduce a capability flag to KVM which can be used to inform QEMU about this.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

So I think Anton's patch currently just lacks the check for TCG. Anton, if you've got some spare minutes, could you maybe send an updated version of that patch?

Sorry, which patch of Anton's?

This one:
https://lists.gnu.org/archive/html/qemu-ppc/2016-04/msg00415.html

Actually, looking at that whole pa-feature code in QEMU, I think there's some more work to do here: Everything that is not using mmu_model==POWERPC_MMU_2_06 is automatically getting pa_features_207. This is sometimes completely wrong, for example when running with KVM-PR, the mmu_model for POWER7 is POWERPC_MMU_2_06a instead. Or when running with TCG, I think it's also perfectly legal to run the pseries machine with a POWER5+ or PPC970 CPU - and we certainly do not want to use pa_features_207 there.

Quoted 6 lines

So if you like, I can try to come up with a small patch series that cleans up this mess - and I could also include an updated versions of Anton's patch there unless he wants to redo the changes on his own...?

Thomas

That would be nice. I just gave a quick try on a f24/le kvm-pr running under a f24/le kvm-hv running under powernv. Only your couple of patches plus Anton's are needed to make it work.

Thanks,

C.

#10 lore raw
In reply to Thomas Huth

Hi Thomas,

Quoted 3 lines

So if you like, I can try to come up with a small patch series that cleans up this mess - and I could also include an updated versions of Anton's patch there unless he wants to redo the changes on his own...?

Thanks for looking at this. I'm travelling (stuck in an airport at the moment) and wont be able to get to this for a few days. If you could incorporate my fixes that would be great!

From memory we were waiting on KVM_CAP_PPC_HTM, which thanks to Sam is now upstream in 23528bb21ee2

Anton

#11 lore raw
In reply to Thomas Huth
Quoted 28 lines · Thomas Huth

Seems like KVM PR is using the "degraded" ISA variants (without the 1TB
segments), but the new POWERPC_MMU_64K flag has not been added to those.
Has this been done on purpose, or was this just by accident? I can make KVM PR working again with the following patch:

target-ppc/cpu-qom.h +0 -0
index 2864105..36694cb 100644
@@ -81,6 +81,7 @@ enum powerpc_mmu_t {
                               | POWERPC_MMU_AMR | 0x00000003,
      /* Architecture 2.06 "degraded" (no 1T segments)           */

     POWERPC_MMU_2_06a      = POWERPC_MMU_64 | POWERPC_MMU_AMR +                             | POWERPC_MMU_64K
                              | 0x00000003,
     /* Architecture 2.07 variant                               */ POWERPC_MMU_2_07       = POWERPC_MMU_64 | POWERPC_MMU_1TSEG

target-ppc/cpu-qom.h +0 -0
@@ -88,6 +89,7 @@ enum powerpc_mmu_t {
                               | POWERPC_MMU_AMR | 0x00000004,
      /* Architecture 2.07 "degraded" (no 1T segments)           */

     POWERPC_MMU_2_07a      = POWERPC_MMU_64 | POWERPC_MMU_AMR +                             | POWERPC_MMU_64K
                              | 0x00000004,
 };

Quoted 2 lines

However, not sure whether this is the right fix ... Cédric, Ben, any ideas?

Oh I thought I had removed the degraded variants ... Definitely looks like an accident. I *think* PR KVM supports 64K pages, no ? If not, then we shouldn't enable the flag.. somebody needs to check the kernel.

Cheers,
Ben.

#12 lore raw
Quoted 29 lines · Benjamin Herrenschmidt
Quoted 28 lines · Thomas Huth

Seems like KVM PR is using the "degraded" ISA variants (without the 1TB
segments), but the new POWERPC_MMU_64K flag has not been added to those.
Has this been done on purpose, or was this just by accident? I can make KVM PR working again with the following patch:

target-ppc/cpu-qom.h +2 -0
index 2864105..36694cb 100644
@@ -81,6 +81,7 @@ enum powerpc_mmu_t {
                              | POWERPC_MMU_AMR | 0x00000003,
     /* Architecture 2.06 "degraded" (no 1T segments)           */
     POWERPC_MMU_2_06a      = POWERPC_MMU_64 | POWERPC_MMU_AMR
+                             | POWERPC_MMU_64K
                              | 0x00000003,
     /* Architecture 2.07 variant                               */
     POWERPC_MMU_2_07       = POWERPC_MMU_64 | POWERPC_MMU_1TSEG
@@ -88,6 +89,7 @@ enum powerpc_mmu_t {
                              | POWERPC_MMU_AMR | 0x00000004,
     /* Architecture 2.07 "degraded" (no 1T segments)           */
     POWERPC_MMU_2_07a      = POWERPC_MMU_64 | POWERPC_MMU_AMR
+                             | POWERPC_MMU_64K
                              | 0x00000004,
 };
 
Quoted 6 lines
Quoted 2 lines

However, not sure whether this is the right fix ... Cédric, Ben, any ideas?

Oh I thought I had removed the degraded variants ... Definitely looks like an accident. I *think* PR KVM supports 64K pages, no ? If not, then we shouldn't enable the flag.. somebody needs to check the kernel.

I've now added some debug printf statements to kvm_fixup_page_sizes() in QEMU, and it seems that at least my current downstream kernel does not report support for 64K page sizes. So the right fix is likely to disable the POWERPC_MMU_64K bit there in env->mmu_model if the kernel does not report support for 64K pages. I'll try to come up with a patch...

But actually, now I wonder why my kernel does not support this page size. There was a kernel patch from Paul (a4a0f2524acc2c6 - "KVM: PPC:
Book3S PR: Allow guest to use 64k pages") which added this page size to KVM-PR, so IMHO it should work ... Seem like I need to do some more debugging here...

Thomas

#13 lore raw
In reply to Benjamin Herrenschmidt
Quoted 29 lines · On Wed, 21 Sep 2016 07:45:35 +1000 Benjamin Herrenschmidt…
Quoted 28 lines · Thomas Huth

Seems like KVM PR is using the "degraded" ISA variants (without the 1TB
segments), but the new POWERPC_MMU_64K flag has not been added to those.
Has this been done on purpose, or was this just by accident? I can make KVM PR working again with the following patch:

target-ppc/cpu-qom.h +0 -0
index 2864105..36694cb 100644
@@ -81,6 +81,7 @@ enum powerpc_mmu_t {
                               | POWERPC_MMU_AMR | 0x00000003,
      /* Architecture 2.06 "degraded" (no 1T segments)           */

     POWERPC_MMU_2_06a      = POWERPC_MMU_64 | POWERPC_MMU_AMR +                             | POWERPC_MMU_64K
                              | 0x00000003,
     /* Architecture 2.07 variant                               */ POWERPC_MMU_2_07       = POWERPC_MMU_64 | POWERPC_MMU_1TSEG

target-ppc/cpu-qom.h +0 -0
@@ -88,6 +89,7 @@ enum powerpc_mmu_t {
                               | POWERPC_MMU_AMR | 0x00000004,
      /* Architecture 2.07 "degraded" (no 1T segments)           */

     POWERPC_MMU_2_07a      = POWERPC_MMU_64 | POWERPC_MMU_AMR +                             | POWERPC_MMU_64K
                              | 0x00000004,
 };

Quoted 6 lines
Quoted 2 lines

However, not sure whether this is the right fix ... Cédric, Ben, any ideas?

Oh I thought I had removed the degraded variants ... Definitely looks like an accident. I *think* PR KVM supports 64K pages, no ? If not, then we shouldn't enable the flag.. somebody needs to check the kernel.

Yes, it supports 64k pages - but only on POWER8, not on POWER8E or POWER8NVL yet. I've posted a patch to fix this here:

https://patchwork.ozlabs.org/patch/672841/

Thomas