Skip to contentSkip to conversation

tests/resource: set grant version for created domains

PATCH In review Roger Pau Monne 3 participants 5 messages Nov 15, 2021 – Nov 16, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/resource: set grant version for created domains

Set the grant table version for the created domains to use version 1, as that's the used by the test cases. Without setting the grant version the domains for the tests cannot be created.

Fixes 7379f9e10a ('gnttab: allow setting max version per-domain')

---
Cc: Ian Jackson <[email protected]>

This patch only modifies a test, so it should be safe to commit as it's not going to cause any changes to the hypervisor or the tools. Worse that could happen is it makes the test even more broken, but it's already unusable.

---
 tools/tests/resource/test-resource.c | 3 +++
 1 file changed, 3 insertions(+)
tools/tests/resource/test-resource.c +3 -0
index 988f96f7c1..658dd52aed 100644
@@ -120,6 +120,7 @@ static void test_domain_configurations(void)
             .create = {
                 .max_vcpus = 2,
                 .max_grant_frames = 40,
+                .grant_opts = 1,
             },
         },
         {
@@ -128,6 +129,7 @@ static void test_domain_configurations(void)
                 .flags = XEN_DOMCTL_CDF_hvm,
                 .max_vcpus = 2,
                 .max_grant_frames = 40,
+                .grant_opts = 1,
                 .arch = {
                     .emulation_flags = XEN_X86_EMU_LAPIC,
                 },
@@ -140,6 +142,7 @@ static void test_domain_configurations(void)
                 .flags = XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap,
                 .max_vcpus = 2,
                 .max_grant_frames = 40,
+                .grant_opts = 1,
             },
         },
 #endif
Signature · 1 line
2.33.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Roger Pau Monne

Set the grant table version for the created domains to use version 1, as that's the used by the test cases. Without setting the grant version the domains for the tests cannot be created.

Fixes 7379f9e10a ('gnttab: allow setting max version per-domain')

Technically

However, two remarks:

Quoted 19 lines
tools/tests/resource/test-resource.c +2 -0
@@ -120,6 +120,7 @@ static void test_domain_configurations(void)
             .create = {
                 .max_vcpus = 2,
                 .max_grant_frames = 40,
+                .grant_opts = 1,
             },
         },
         {
@@ -128,6 +129,7 @@ static void test_domain_configurations(void)
                 .flags = XEN_DOMCTL_CDF_hvm,
                 .max_vcpus = 2,
                 .max_grant_frames = 40,
+                .grant_opts = 1,
                 .arch = {
                     .emulation_flags = XEN_X86_EMU_LAPIC,
                 },

tools/tests/resource/test-resource.c static void test_domain_configurations(void) · line 148

Quoted 7 lines
tools/tests/resource/test-resource.c +1 -0
@@ -140,6 +142,7 @@ static void test_domain_configurations(void)
                 .flags = XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap,
                 .max_vcpus = 2,
                 .max_grant_frames = 40,
+                .grant_opts = 1,
             },
         },
 #endif

The literal 1-s here are really odd to read already now. It would get worse if some flags were specified later on and then used here, ending in e.g.

.grant_opts = XEN_DOMCTL_CDG_feature | 1,

Imo there really ought to be a wrapper macro, such that use sites will at the same time have documented what this 1 is about:

.grant_opts = XEN_DOMCTL_CDG_version(1),

And then I guess tools/tests/tsx/test-tsx.c needs similar adjustment.

Jan

#2 lore raw
Quoted 45 lines · Jan Beulich
Quoted 7 lines · Roger Pau Monne

Set the grant table version for the created domains to use version 1, as that's the used by the test cases. Without setting the grant version the domains for the tests cannot be created.

Fixes 7379f9e10a ('gnttab: allow setting max version per-domain')

Technically

However, two remarks:

Quoted 19 lines
tools/tests/resource/test-resource.c +2 -0
@@ -120,6 +120,7 @@ static void test_domain_configurations(void)
             .create = {
                 .max_vcpus = 2,
                 .max_grant_frames = 40,
+                .grant_opts = 1,
             },
         },
         {
@@ -128,6 +129,7 @@ static void test_domain_configurations(void)
                 .flags = XEN_DOMCTL_CDF_hvm,
                 .max_vcpus = 2,
                 .max_grant_frames = 40,
+                .grant_opts = 1,
                 .arch = {
                     .emulation_flags = XEN_X86_EMU_LAPIC,
                 },

tools/tests/resource/test-resource.c static void test_domain_configurations(void) · line 148

Quoted 7 lines
tools/tests/resource/test-resource.c +1 -0
@@ -140,6 +142,7 @@ static void test_domain_configurations(void)
                 .flags = XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap,
                 .max_vcpus = 2,
                 .max_grant_frames = 40,
+                .grant_opts = 1,
             },
         },
 #endif

The literal 1-s here are really odd to read already now. It would get worse if some flags were specified later on and then used here, ending in e.g.

Quoted 6 lines

.grant_opts = XEN_DOMCTL_CDG_feature | 1,

Imo there really ought to be a wrapper macro, such that use sites will at the same time have documented what this 1 is about:

.grant_opts = XEN_DOMCTL_CDG_version(1),

OK. I better add one now before we start gaining more of those.

Quoted 2 lines

And then I guess tools/tests/tsx/test-tsx.c needs similar adjustment.

Yes, and the python bindings will also need an adjustment.

Thanks, Roger.

#3 lore raw
In reply to Roger Pau Monne

Roger Pau Monne writes ("[PATCH for-4.16] tests/resource: set grant version for created domains"):

Quoted 7 lines

Set the grant table version for the created domains to use version 1, as that's the used by the test cases. Without setting the grant version the domains for the tests cannot be created.

Fixes 7379f9e10a ('gnttab: allow setting max version per-domain')
#4 lore raw
Quoted 10 lines · Ian Jackson

Roger Pau Monne writes ("[PATCH for-4.16] tests/resource: set grant version for created domains"):

Quoted 7 lines

Set the grant table version for the created domains to use version 1, as that's the used by the test cases. Without setting the grant version the domains for the tests cannot be created.

Fixes 7379f9e10a ('gnttab: allow setting max version per-domain')

I was meaning to commit this, but you've replied to the singleton v1 patch which is now in the middle of a 4-patch series. I can't very well assume (silently) that you've meant your ack to apply to that series - please clarify.

Jan