Message ID | 20230323103913.40720-2-frankja@linux.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | s390x: uv-host: Fixups and extensions part 1 | expand |
Quoting Janosch Frank (2023-03-23 11:39:06) > The init memory has to be above 2G and 1M aligned but we're currently > aligning on 2G which means the allocations need a lot of unused > memory. > > Let's fix that. > > Signed-off-by: Janosch Frank <frankja@linux.ibm.com> > --- > s390x/uv-host.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/s390x/uv-host.c b/s390x/uv-host.c > index 33e6eec6..68de47e7 100644 > --- a/s390x/uv-host.c > +++ b/s390x/uv-host.c > @@ -555,7 +555,7 @@ static void test_init(void) > rc = uv_call(0, (uint64_t)&uvcb_init); > report(rc == 0 && uvcb_init.header.rc == UVC_RC_EXECUTED, "successful"); > > - mem = (uint64_t)memalign(1UL << 31, uvcb_qui.uv_base_stor_len); > + mem = (uint64_t)memalign_pages_flags(HPAGE_SIZE, uvcb_qui.uv_base_stor_len, AREA_NORMAL); > rc = uv_call(0, (uint64_t)&uvcb_init); > report(rc == 1 && uvcb_init.header.rc == 0x101, "double init"); > free((void *)mem); Your fix looks reasonable, but I think this is still broken, no? We allocate a new mem, initalize the ultravisor again and then free the memory. We do absolutely nothing with the allocated memory, do we? Are we maybe missing a uvcb_init.stor_origin = mem; here? Also, a comment stating that AREA_NORMAL starts at PFN 524288 (2G) might be nice.
diff --git a/s390x/uv-host.c b/s390x/uv-host.c index 33e6eec6..68de47e7 100644 --- a/s390x/uv-host.c +++ b/s390x/uv-host.c @@ -555,7 +555,7 @@ static void test_init(void) rc = uv_call(0, (uint64_t)&uvcb_init); report(rc == 0 && uvcb_init.header.rc == UVC_RC_EXECUTED, "successful"); - mem = (uint64_t)memalign(1UL << 31, uvcb_qui.uv_base_stor_len); + mem = (uint64_t)memalign_pages_flags(HPAGE_SIZE, uvcb_qui.uv_base_stor_len, AREA_NORMAL); rc = uv_call(0, (uint64_t)&uvcb_init); report(rc == 1 && uvcb_init.header.rc == 0x101, "double init"); free((void *)mem);
The init memory has to be above 2G and 1M aligned but we're currently aligning on 2G which means the allocations need a lot of unused memory. Let's fix that. Signed-off-by: Janosch Frank <frankja@linux.ibm.com> --- s390x/uv-host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)