Skip to contentSkip to conversation

x86/mm: silence a pointless warning

PATCH In review Jan Beulich 2 participants 6 messages May 2, 2017 – May 3, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/mm: silence a pointless warning

get_page() logs a message when it fails (dom_cow is never dying or paging_mode_external()), so better avoid the call when it's pointless to do anyway.

---
Possibly we could be even more rigid and bail right away if ->is_dying is set.

xen/arch/x86/mm/p2m.c +2 -2
@@ -501,9 +501,9 @@ struct page_info *get_page_from_gfn_p2m(
                 if ( fdom == NULL )
                     page = NULL;
             }
-            else if ( !get_page(page, d)
+            else if ( !get_page(page, d) &&
                       /* Page could be shared */
-                      && !get_page(page, dom_cow) )
+                      (!p2m_is_shared(*t) || !get_page(page, dom_cow)) )
                 page = NULL;
         }
         p2m_read_unlock(p2m);

x86/mm: silence a pointless warning

get_page() logs a message when it fails (dom_cow is never dying or paging_mode_external()), so better avoid the call when it's pointless to do anyway.

---
Possibly we could be even more rigid and bail right away if ->is_dying is set.

xen/arch/x86/mm/p2m.c +2 -2
@@ -501,9 +501,9 @@ struct page_info *get_page_from_gfn_p2m(
                 if ( fdom == NULL )
                     page = NULL;
             }
-            else if ( !get_page(page, d)
+            else if ( !get_page(page, d) &&
                       /* Page could be shared */
-                      && !get_page(page, dom_cow) )
+                      (!p2m_is_shared(*t) || !get_page(page, dom_cow)) )
                 page = NULL;
         }
         p2m_read_unlock(p2m);

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

#1 lore raw
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 02.05.17 at 17:15, <[email protected]> wrote:

get_page() logs a message when it fails (dom_cow is never dying or paging_mode_external()), so better avoid the call when it's pointless to do anyway.

---
Possibly we could be even more rigid and bail right away if ->is_dying is set.

xen/arch/x86/mm/p2m.c +0 -0
@@ -501,9 +501,9 @@ struct page_info *get_page_from_gfn_p2m(
                 if ( fdom == NULL )

xen/arch/x86/mm/p2m.c struct page_info *get_page_from_gfn_p2m( · line 509

Quoted 10 lines
xen/arch/x86/mm/p2m.c +2 -2
                     page = NULL;
             }
-            else if ( !get_page(page, d)
+            else if ( !get_page(page, d) &&
                       /* Page could be shared */
-                      && !get_page(page, dom_cow) )
+                      (!p2m_is_shared(*t) || !get_page(page, dom_cow)) )
                 page = NULL;
         }
         p2m_read_unlock(p2m);

The downside of this change is that they will turn silent what may be a hint towards a reason for one of the long standing migration issues we have (these warnings have appeared in recent osstest logs always in conjunction with a failed migration test). Locally I've used

xen/arch/x86/mm/p2m.c +6 -0
@@ -480,6 +480,12 @@ struct page_info *get_page_from_gfn_p2m(
     p2m_access_t _a;
     p2m_type_t _t;
     mfn_t mfn;
+static unsigned long cnt, thr;//temp
+if(d->is_dying && ++cnt > thr) {//temp
+ cnt |= thr;
+ printk("%pv: d%d dying (look up %lx)\n", current, d->domain_id, gfn);
+ dump_execution_state();
+}
 
     /* Allow t or a to be NULL */
     t = t ?: &_t;

but with about a dozen migrations I didn't get this to trigger. I therefore wonder whether we shouldn't, for a while, have something like this in master.

Jan

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

#2 lore raw
Quoted 34 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 02.05.17 at 17:15, <[email protected]> wrote:

get_page() logs a message when it fails (dom_cow is never dying or paging_mode_external()), so better avoid the call when it's pointless to do anyway.

---
Possibly we could be even more rigid and bail right away if ->is_dying is set.

xen/arch/x86/mm/p2m.c +0 -0
@@ -501,9 +501,9 @@ struct page_info *get_page_from_gfn_p2m(
                 if ( fdom == NULL )

xen/arch/x86/mm/p2m.c struct page_info *get_page_from_gfn_p2m( · line 509

Quoted 10 lines
xen/arch/x86/mm/p2m.c +2 -2
                     page = NULL;
             }
-            else if ( !get_page(page, d)
+            else if ( !get_page(page, d) &&
                       /* Page could be shared */
-                      && !get_page(page, dom_cow) )
+                      (!p2m_is_shared(*t) || !get_page(page, dom_cow)) )
                 page = NULL;
         }
         p2m_read_unlock(p2m);

The downside of this change is that they will turn silent what may be a hint towards a reason for one of the long standing migration issues we have (these warnings have appeared in recent osstest logs always in conjunction with a failed migration test). Locally I've used

xen/arch/x86/mm/p2m.c struct page_info *get_page_from_gfn_p2m( · line 485

Quoted 6 lines
xen/arch/x86/mm/p2m.c +3 -0
@@ -480,6 +480,12 @@ struct page_info *get_page_from_gfn_p2m(
     p2m_access_t _a;
     p2m_type_t _t;
     mfn_t mfn;
+static unsigned long cnt, thr;//temp
+if(d->is_dying && ++cnt > thr) {//temp
+ cnt |= thr;

Did you mean to reverse these here? As it is, unless you're modifying thr somewhere else, this will always be "cnt |= 0;" which will have no effect.

Quoted 10 lines
xen/arch/x86/mm/p2m.c +3 -0
+ printk("%pv: d%d dying (look up %lx)\n", current, d->domain_id, gfn);
+ dump_execution_state();
+}
 
     /* Allow t or a to be NULL */
     t = t ?: &_t;

but with about a dozen migrations I didn't get this to trigger. I therefore wonder whether we shouldn't, for a while, have something like this in master.

I haven't looked into the migration failure issue. If it was surrounded by #ifndef NDEBUG, it might be a reasonable approach.

-George

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

#3 lore raw
Quoted 33 lines
Quoted 1 line
Quoted 1 line · On 02.05.17 at 18:54, <[email protected]> wrote:
Quoted 31 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 02.05.17 at 17:15, <[email protected]> wrote:

get_page() logs a message when it fails (dom_cow is never dying or paging_mode_external()), so better avoid the call when it's pointless to do anyway.

---
Possibly we could be even more rigid and bail right away if ->is_dying is set.

xen/arch/x86/mm/p2m.c +0 -0
@@ -501,9 +501,9 @@ struct page_info *get_page_from_gfn_p2m(
                 if ( fdom == NULL )

xen/arch/x86/mm/p2m.c struct page_info *get_page_from_gfn_p2m( · line 509

Quoted 10 lines
xen/arch/x86/mm/p2m.c +2 -2
                     page = NULL;
             }
-            else if ( !get_page(page, d)
+            else if ( !get_page(page, d) &&
                       /* Page could be shared */
-                      && !get_page(page, dom_cow) )
+                      (!p2m_is_shared(*t) || !get_page(page, dom_cow)) )
                 page = NULL;
         }
         p2m_read_unlock(p2m);

The downside of this change is that they will turn silent what may be a hint towards a reason for one of the long standing migration issues we have (these warnings have appeared in recent osstest logs always in conjunction with a failed migration test). Locally I've used

Quoted 13 lines

xen/arch/x86/mm/p2m.c struct page_info *get_page_from_gfn_p2m( · line 485

Quoted 9 lines
xen/arch/x86/mm/p2m.c +3 -0
@@ -480,6 +480,12 @@ struct page_info *get_page_from_gfn_p2m(
     p2m_access_t _a;
     p2m_type_t _t;
     mfn_t mfn;
+static unsigned long cnt, thr;//temp
+if(d->is_dying && ++cnt > thr) {//temp
+ cnt |= thr;

Did you mean to reverse these here? As it is, unless you're modifying thr somewhere else, this will always be "cnt |= 0;" which will have no effect.

Oh, yes, of course. I must have been typing this in too mechanically, as I use this construct quite frequently when I'm unsure whether a message might trigger often.

Quoted 7 lines
Quoted 7 lines
xen/arch/x86/mm/p2m.c +3 -0
+ printk("%pv: d%d dying (look up %lx)\n", current, d->domain_id, gfn);
+ dump_execution_state();
+}
 
     /* Allow t or a to be NULL */
     t = t ?: &_t;
Quoted 6 lines
Quoted 3 lines

but with about a dozen migrations I didn't get this to trigger. I therefore wonder whether we shouldn't, for a while, have something like this in master.

I haven't looked into the migration failure issue. If it was surrounded by #ifndef NDEBUG, it might be a reasonable approach.

Yes, putting it inside such a conditional (and removing the //temp markers, which I use just for myself to make debugging code stand out, just like the seemingly bogus indentation) was of course the plan if we agreed to have this in master for a while.

Jan

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

Acked-by on v1 1/1
#4 lore raw
In reply to Jan Beulich
Quoted 5 lines · Jan Beulich

get_page() logs a message when it fails (dom_cow is never dying or paging_mode_external()), so better avoid the call when it's pointless to do anyway.

The other option would be to add "domain == dom_cow" as a condition for which get_page() doesn't report an error.

But on the whole I think this is probably the better option:

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

#5 lore raw
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 02.05.17 at 19:04, <[email protected]> wrote:
Quoted 5 lines · Jan Beulich

get_page() logs a message when it fails (dom_cow is never dying or paging_mode_external()), so better avoid the call when it's pointless to do anyway.

The other option would be to add "domain == dom_cow" as a condition for which get_page() doesn't report an error.

That would imo be undesirable namely for the currently one case where get_page(..., dom_cow) is being used from mem_sharing.c.

Quoted 3 lines

But on the whole I think this is probably the better option:

Thanks.

Jan

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