qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] mm: Loosen MADV_NOHUGEPAGE to enable Qemu postc


From: Jason J. Herne
Subject: Re: [Qemu-devel] [PATCH] mm: Loosen MADV_NOHUGEPAGE to enable Qemu postcopy on s390
Date: Thu, 19 Nov 2015 09:30:42 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 11/19/2015 08:10 AM, Dr. David Alan Gilbert wrote:
* Christian Borntraeger (address@hidden) wrote:
On 11/18/2015 02:31 PM, Vlastimil Babka wrote:
[CC += address@hidden
...
Can you tell me if the following works for you:


 From 545809a18fa768eccdaafe9bd842490c3390b00c Mon Sep 17 00:00:00 2001
From: "Dr. David Alan Gilbert" <address@hidden>
Date: Thu, 19 Nov 2015 12:05:36 +0000
Subject: [PATCH] Assume madvise for (no)hugepage works

madvise() returns EINVAL in the case of many failures, but also
returns it in cases where the host kernel doesn't have THP enabled.
Postcopy only really cares that THP is off before it detects faults,
and turns it back on afterwards; so we're going to have
to assume that if the madvise fails then the host just doesn't do
THP and we can carry on with the postcopy.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
---
  migration/postcopy-ram.c | 10 ++--------
  1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index 22d6b18..3946aa9 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -241,10 +241,7 @@ static int cleanup_range(const char *block_name, void 
*host_addr,
       * We turned off hugepage for the precopy stage with postcopy enabled
       * we can turn it back on now.
       */
-    if (qemu_madvise(host_addr, length, QEMU_MADV_HUGEPAGE)) {
-        error_report("%s HUGEPAGE: %s", __func__, strerror(errno));
-        return -1;
-    }
+    qemu_madvise(host_addr, length, QEMU_MADV_HUGEPAGE);

      /*
       * We can also turn off userfault now since we should have all the
@@ -345,10 +342,7 @@ static int nhp_range(const char *block_name, void 
*host_addr,
       * do delete areas of the page, even if THP thinks a hugepage would
       * be a good idea, so force hugepages off.
       */
-    if (qemu_madvise(host_addr, length, QEMU_MADV_NOHUGEPAGE)) {
-        error_report("%s: NOHUGEPAGE: %s", __func__, strerror(errno));
-        return -1;
-    }
+    qemu_madvise(host_addr, length, QEMU_MADV_NOHUGEPAGE);

      return 0;
  }


I tried this without my madvise kernel patch, and was able to get by the problem as expected.

We still need the kernel patch set "Allow gmap fault to retry​" as posted to linux-mm to get userfaultfd support playing nicely with s390 async page faults. But that is a separate problem
entirely.

Tested-by: Jason J. Herne <address@hidden>

--
-- Jason J. Herne (address@hidden)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]