Skip to contentSkip to conversation

RFC: enable CONFIG_LIVEPATCH in all relevant arm64 builds

PATCH In review Ian Jackson 5 participants 9 messages Jun 5, 2019 1 message not in the archive

lore
Share & tools
lore
#2 lore raw

PATCH 2/2 RFC: enable CONFIG_LIVEPATCH in all relevant arm64 builds

In reply to a message not in the archive

Right now there is a bug in, at least, Xen 4.11, where it does not boot on some of our ARM64 machines but only if CONFIG_LIVEPATCH is *dis*abled.

We think this is due to Xen not playing by the proper cache management rules in the ARM ARM. We think that CONFIG_LIVEPATCH is not really
relevant: it just causes slight changes in timing or memory accesses or code layout: so, another roll of the dice. Ie we think it is random coincidence that it works with CONFIG_LIVEPATCH and fails without it.

Right now the bug is masked in the osstest flights which test the Xen branches because they all are all built with CONFIG_LIVEPATCH enabled. The non-Xen branches until now have been built with CONFIG_LIVEPATCH disabled.

The overall result is blockage of the CI for, currently, qemu-xen-4.11-testing. This blockage is not a true regression; the code was always buggy. It's just that something has changed and now the bug bites.

Switching on CONFIG_LIVEPATCH for the affected tests will, hopefully, make this problem "go away" again. This is clearly a bodge. But it is better than simply force pushing: if we can get it to boot, we will be able to run the other tests.

I have used standalone-generate-dump-flight-runvars and the effect is to turn on enable_livepatch in build-arm64 in precisely qemu-upstream-xen-4.11-testing.

AIUI:

An alternative would be to backport 00c96d7742 "xen/arm: mm: Set-up page permission for Xen mappings earlier on", to affected Xen stable branches. That would differently permute the cases where things fail. In particular on some hardware, including (we think) all hardware we actually have, the violation of the architecture cache rules would be absolutely irrelevant because of microarchitectural details. But it might cause regressions on other hardware.

CC Stefano Stabellini <[email protected]>
CC Jan Beulich <[email protected]>
CC Anthony Perard <[email protected]
CC Julien Grall <[email protected]>
---
 mfi-common | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
mfi-common +2 -1
index b86febda..52a38cb4 100644
@@ -373,7 +373,8 @@ create_build_jobs () {
         fi
     fi
 
-    if branch_wants_livepatch; then
+    if branch_wants_livepatch ||
+          [ $arch = arm64 -a "$xenbranch" = xen-4.11-testing ]; then
        livepatch_runvars='enable_livepatch=true'
     fi
     eval "
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

PATCH 1/2 mfi-common: break out xenbranch_supports_livepatch

In reply to a message not in the archive

No functional change.

Verified with standalone-generate-dump-flight-runvars.

---
 mfi-common | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
mfi-common +9 -2
index 30f2692d..b86febda 100644
@@ -72,8 +72,8 @@ branch_wants_xtf_tests () {
   esac
 }
 
-branch_wants_livepatch () {
-  case "$branch" in
+xenbranch_supports_livepatch () {
+  case "$xenbranch" in
     xen-3.*)    return 1;;
     xen-4.0-testing)   return 1;;
     xen-4.1-testing)   return 1;;
@@ -83,6 +83,13 @@ branch_wants_livepatch () {
     xen-4.5-testing)   return 1;;
     xen-4.6-testing)   return 1;;
     xen-4.7-testing)   return 1;;
+    *)      return 0;;
+  esac
+}
+
+branch_wants_livepatch () {
+  if ! xenbranch_supports_livepatch; then return 1; fi
+  case "$branch" in
     xen-*)      return 0;;
     osstest*)   return 0;;
     *)          return 1;;
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#3 lore raw
In reply to Ian Jackson

Hi Ian,

Quoted 21 lines · Ian Jackson

Right now there is a bug in, at least, Xen 4.11, where it does not boot on some of our ARM64 machines but only if CONFIG_LIVEPATCH is *dis*abled.

We think this is due to Xen not playing by the proper cache management rules in the ARM ARM. We think that CONFIG_LIVEPATCH is not really
relevant: it just causes slight changes in timing or memory accesses or code layout: so, another roll of the dice. Ie we think it is random coincidence that it works with CONFIG_LIVEPATCH and fails without it.

Right now the bug is masked in the osstest flights which test the Xen branches because they all are all built with CONFIG_LIVEPATCH enabled. The non-Xen branches until now have been built with CONFIG_LIVEPATCH disabled.

The overall result is blockage of the CI for, currently, qemu-xen-4.11-testing. This blockage is not a true regression; the code was always buggy. It's just that something has changed and now the bug bites.

Quoted 4 lines

Switching on CONFIG_LIVEPATCH for the affected tests will, hopefully, make this problem "go away" again. This is clearly a bodge. But it is better than simply force pushing: if we can get it to boot, we will be able to run the other tests.

How about disabling the test on rochester?

Cheers,

Quoted 39 lines

I have used standalone-generate-dump-flight-runvars and the effect is to turn on enable_livepatch in build-arm64 in precisely qemu-upstream-xen-4.11-testing.

AIUI:

An alternative would be to backport 00c96d7742 "xen/arm: mm: Set-up page permission for Xen mappings earlier on", to affected Xen stable branches. That would differently permute the cases where things fail. In particular on some hardware, including (we think) all hardware we actually have, the violation of the architecture cache rules would be absolutely irrelevant because of microarchitectural details. But it might cause regressions on other hardware.

CC Stefano Stabellini <[email protected]>
CC Jan Beulich <[email protected]>
CC Anthony Perard <[email protected]
CC Julien Grall <[email protected]>
---
  mfi-common | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
mfi-common +2 -1
index b86febda..52a38cb4 100644
@@ -373,7 +373,8 @@ create_build_jobs () {
          fi
      fi
 
-    if branch_wants_livepatch; then
+    if branch_wants_livepatch ||
+          [ $arch = arm64 -a "$xenbranch" = xen-4.11-testing ]; then
         livepatch_runvars='enable_livepatch=true'
      fi
      eval "
Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#9 lore raw
In reply to Ian Jackson

mfi-common create_build_jobs () { · line 379

Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 05.06.19 at 13:13, <[email protected]> wrote:
mfi-common +2 -1
@@ -373,7 +373,8 @@ create_build_jobs () {
         fi
     fi
 
-    if branch_wants_livepatch; then
+    if branch_wants_livepatch ||
+          [ $arch = arm64 -a "$xenbranch" = xen-4.11-testing ]; then
        livepatch_runvars='enable_livepatch=true'
     fi

Isn't this overly restrictive, i.e. wouldn't this better be done uniformly for all branches?

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw

Re: [Xen-devel] [OSSTEST PATCH 2/2] RFC: enable CONFIG_LIVEPATCH in all relevant arm64 builds [and 1 more messages]

In reply to Julien Grall

Julien Grall writes ("Re: [OSSTEST PATCH 2/2] RFC: enable CONFIG_LIVEPATCH in all relevant arm64 builds"):

Quoted 7 lines · Ian Jackson
Quoted 4 lines

Switching on CONFIG_LIVEPATCH for the affected tests will, hopefully, make this problem "go away" again. This is clearly a bodge. But it is better than simply force pushing: if we can get it to boot, we will be able to run the other tests.

How about disabling the test on rochester?

I could invent a new hostflag
xen-4.11-arm64-seems-to-boot-ok
but that seems ridiculous.

And, we presumably want to actually test other things on rochester!

Jan Beulich writes ("Re: [OSSTEST PATCH 2/2] RFC: enable CONFIG_LIVEPATCH in all relevant arm64 builds"):

Quoted 7 lines · On 05.06.19 at 13:13, <[email protected]> wrote:
Quoted 6 lines
mfi-common +0 -0
@@ -373,7 +373,8 @@ create_build_jobs () {
         fi
     fi
 
Quoted 8 lines

mfi-common create_build_jobs () { · line 379

Quoted 5 lines
mfi-common +2 -1
-    if branch_wants_livepatch; then
+    if branch_wants_livepatch ||
+          [ $arch = arm64 -a "$xenbranch" = xen-4.11-testing ]; then
        livepatch_runvars='enable_livepatch=true'
     fi

Isn't this overly restrictive, i.e. wouldn't this better be done uniformly for all branches?

No. Because the bug is a random failure, I don't want to permute all the other branches and maybe cause them to experience it.

I still think it would be better to fix this in the Xen code.

Would it be possible to make whether to do "wrong thing A" (which does not boot on rochster) or "wrong thing B" (which boots on rochester but not on some other unknown machine(s)) a config or boot-time option ?

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#5 lore raw

Re: [Xen-devel] [OSSTEST PATCH 2/2] RFC: enable CONFIG_LIVEPATCH in all relevant arm64 builds [and 1 more messages]

Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 05.06.19 at 13:31, <[email protected]> wrote:

I still think it would be better to fix this in the Xen code.

Fully agree. But as Julien says - fully fixing this may be too intrusive for old branches (provided it gets fixed on master at all).

Quoted 3 lines

Would it be possible to make whether to do "wrong thing A" (which does not boot on rochster) or "wrong thing B" (which boots on rochester but not on some other unknown machine(s)) a config or boot-time option ?

Since it's apparently Xen image dependent, a boot time option seems unlikely to be a possibility. A config option might be possible, but that, as you say elsewhere on another aspect, seems ridiculous. But in the end the Arm maintainers will know best...

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#6 lore raw

Re: [Xen-devel] [OSSTEST PATCH 2/2] RFC: enable CONFIG_LIVEPATCH in all relevant arm64 builds [and 1 more messages]

Hi,

Quoted 5 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 05.06.19 at 13:31, <[email protected]> wrote:

I still think it would be better to fix this in the Xen code.

Fully agree. But as Julien says - fully fixing this may be too intrusive for old branches (provided it gets fixed on master at all).

Well we have no other choice than fixing in master... Otherwise we are facing Xen to be completely unusable on newer platform.

However, it is very unlikely to be fixed in old branches because the boot/memory code needs a full rewrite.

Quoted 8 lines
Quoted 4 lines

Would it be possible to make whether to do "wrong thing A" (which does not boot on rochster) or "wrong thing B" (which boots on rochester but not on some other unknown machine(s)) a config or boot-time option ? >

Since it's apparently Xen image dependent, a boot time option seems unlikely to be a possibility. A config option might be possible, but that, as you say elsewhere on another aspect, seems ridiculous. But in the end the Arm maintainers will know best...

None of those options looks appealing to me because we are not immune to have more bug looming in the future because of any backport patches that can decrease/increase size of Xen.

We will just have to live with it and address them as they come in stable branches.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#8 lore raw

Re: [Xen-devel] [OSSTEST PATCH 2/2] RFC: enable CONFIG_LIVEPATCH in all relevant arm64 builds [and 1 more messages]

In reply to Ian Jackson

Hi Ian,

Quoted 7 lines · Ian Jackson

Julien Grall writes ("Re: [OSSTEST PATCH 2/2] RFC: enable CONFIG_LIVEPATCH in all relevant arm64 builds"):

Quoted 6 lines · Ian Jackson
Quoted 4 lines

Switching on CONFIG_LIVEPATCH for the affected tests will, hopefully, make this problem "go away" again. This is clearly a bodge. But it is better than simply force pushing: if we can get it to boot, we will be able to run the other tests.

Quoted 7 lines
Quoted 1 line

How about disabling the test on rochester?

I could invent a new hostflag
xen-4.11-arm64-seems-to-boot-ok
but that seems ridiculous.

And, we presumably want to actually test other things on rochester!

The problem is I have no way to tell whether a given Xen will boot on Thunder-X (or any other Arm platform we may buy) at any point the future.

It would be preferable if we have a way to say "test FOO can't run on rochester{0,1}".

Quoted 18 lines

Jan Beulich writes ("Re: [OSSTEST PATCH 2/2] RFC: enable CONFIG_LIVEPATCH in all relevant arm64 builds"):

Quoted 7 lines · On 05.06.19 at 13:13, <[email protected]> wrote:
Quoted 6 lines
mfi-common +0 -0
@@ -373,7 +373,8 @@ create_build_jobs () {
          fi
      fi
 
Quoted 8 lines

mfi-common create_build_jobs () { · line 379

Quoted 5 lines
mfi-common +2 -1
-    if branch_wants_livepatch; then
+    if branch_wants_livepatch ||
+          [ $arch = arm64 -a "$xenbranch" = xen-4.11-testing ]; then
         livepatch_runvars='enable_livepatch=true'
      fi

Isn't this overly restrictive, i.e. wouldn't this better be done uniformly for all branches?

Quoted 4 lines

No. Because the bug is a random failure, I don't want to permute all the other branches and maybe cause them to experience it.

I still think it would be better to fix this in the Xen code.

I am afraid that's not going to be possible. It requires a full rework of the boot and memory code. At the moment, I have 100 patches written, and I would expect much more to come.

Quoted 4 lines

Would it be possible to make whether to do "wrong thing A" (which does not boot on rochster) or "wrong thing B" (which boots on rochester but not on some other unknown machine(s)) a config or boot-time option ?

That's not an option for me. There are no promise that Xen will not crash in the future on Thunder-X (or any new platform we have) without addressing all the problem.

This is an annoying problem, but the only thing we can do is limiting the testing on Thunder-X for the time being.

This is not the first time we face Arm Arm violation in Xen. We already had similar problem on Arm32 with the Set/Way (remember guest crashing time to time).

I hope such issues will show how critical it is to work actively making Xen more compliant rather than piling up more work on top of unstable foundation.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#7 lore raw

Re: [Xen-devel] [OSSTEST PATCH 2/2] RFC: enable CONFIG_LIVEPATCH in all relevant arm64 builds [and 1 more messages]

In reply to Jan Beulich
Quoted 5 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 05.06.19 at 13:31, <[email protected]> wrote:

I still think it would be better to fix this in the Xen code.

Fully agree. But as Julien says - fully fixing this may be too intrusive for old branches (provided it gets fixed on master at all).

In case it looked like I was of a different opinion let me expand on what I wrote before.

I fully agree that we should fix it in the Xen code, in the stable trees. Especially given that we have a "fix" to backport. Work-arounding it in OSSTest is only a last resort.

However, there is a separate point about having consistent build flags across the OSSTest tests that I think it is worth considering, that goes beyond this specific issue. I wrote a longer reply in [1]. In this regard I think that enabling CONFIG_LIVEPATCH for all our branches, as Jan mentioned, then introducing separate flights with a different set of CONFIG_* would probably be a good way forward.

[1] alpine.DEB.2.21.1906041132030.14041@sstabellini-ThinkPad-T480s

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel