diff mbox

[14/15] postcopy: Check for userfault+hugepage feature

Message ID 20170106182823.1960-15-dgilbert@redhat.com
State New
Headers show

Commit Message

Dr. David Alan Gilbert Jan. 6, 2017, 6:28 p.m. UTC
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

We need extra Linux kernel support (~4.9) to support userfaults
on hugetlbfs; check for them.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 migration/postcopy-ram.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Juan Quintela Jan. 31, 2017, 1:24 p.m. UTC | #1
"Dr. David Alan Gilbert (git)" <dgilbert@redhat.com> wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> We need extra Linux kernel support (~4.9) to support userfaults
> on hugetlbfs; check for them.
>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

Reviewed-by: Juan Quintela <quintela@redhat.com>


>  migration/postcopy-ram.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
> index 6b30b43..d12dd7f 100644
> --- a/migration/postcopy-ram.c
> +++ b/migration/postcopy-ram.c
> @@ -81,6 +81,17 @@ static bool ufd_version_check(int ufd)
>          return false;
>      }
>  
> +    if (getpagesize() != ram_pagesize_summary()) {

I am pretty sure that I don't like ram_pagesize_summary() name.  I have
already forgot what I mean O:-)
Dr. David Alan Gilbert Jan. 31, 2017, 4:20 p.m. UTC | #2
* Juan Quintela (quintela@redhat.com) wrote:
> "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com> wrote:
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> >
> > We need extra Linux kernel support (~4.9) to support userfaults
> > on hugetlbfs; check for them.
> >
> > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> 
> Reviewed-by: Juan Quintela <quintela@redhat.com>
> 
> 
> >  migration/postcopy-ram.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> >
> > diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
> > index 6b30b43..d12dd7f 100644
> > --- a/migration/postcopy-ram.c
> > +++ b/migration/postcopy-ram.c
> > @@ -81,6 +81,17 @@ static bool ufd_version_check(int ufd)
> >          return false;
> >      }
> >  
> > +    if (getpagesize() != ram_pagesize_summary()) {
> 
> I am pretty sure that I don't like ram_pagesize_summary() name.  I have
> already forgot what I mean O:-)

Suggested replacements welcome!

Dave

--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
diff mbox

Patch

diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index 6b30b43..d12dd7f 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -81,6 +81,17 @@  static bool ufd_version_check(int ufd)
         return false;
     }
 
+    if (getpagesize() != ram_pagesize_summary()) {
+        bool have_hp = false; 
+        /* We've got a huge page */
+#ifdef UFFD_FEATURE_MISSING_HUGETLBFS
+        have_hp = api_struct.features & UFFD_FEATURE_MISSING_HUGETLBFS;
+#endif
+        if (!have_hp) {
+            error_report("Userfault on this host does not support huge pages");
+            return false;
+        }
+    }
     return true;
 }