xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] page-alloc: accompany BUG() with printk()
@ 2019-05-15  8:44 Jan Beulich
  2019-05-15  8:44 ` [Xen-devel] " Jan Beulich
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Jan Beulich @ 2019-05-15  8:44 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall

Log information likely relevant for understanding why the BUG()s were
triggering.

Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -984,7 +984,15 @@ static struct page_info *alloc_heap_page
     for ( i = 0; i < (1 << order); i++ )
     {
         /* Reference count must continuously be zero for free pages. */
-        BUG_ON((pg[i].count_info & ~PGC_need_scrub) != PGC_state_free);
+        if ( (pg[i].count_info & ~PGC_need_scrub) != PGC_state_free )
+        {
+            printk(XENLOG_ERR
+                   "pg[%u] MFN %"PRI_mfn" c=%#lx o=%u v=%#lx t=%#x\n",
+                   i, mfn_x(page_to_mfn(pg + i)),
+                   pg[i].count_info, pg[i].v.free.order,
+                   pg[i].u.free.val, pg[i].tlbflush_timestamp);
+            BUG();
+        }
 
         /* PGC_need_scrub can only be set if first_dirty is valid */
         ASSERT(first_dirty != INVALID_DIRTY_IDX || !(pg[i].count_info & PGC_need_scrub));
@@ -1393,6 +1401,11 @@ static void free_heap_pages(
             break;
 
         default:
+            printk(XENLOG_ERR
+                   "pg[%u] MFN %"PRI_mfn" c=%#lx o=%u v=%#lx t=%#x\n",
+                   i, mfn_x(page_to_mfn(pg + i)),
+                   pg[i].count_info, pg[i].v.free.order,
+                   pg[i].u.free.val, pg[i].tlbflush_timestamp);
             BUG();
         }
 
@@ -2336,7 +2349,15 @@ void free_domheap_pages(struct page_info
 
             for ( i = 0; i < (1 << order); i++ )
             {
-                BUG_ON((pg[i].u.inuse.type_info & PGT_count_mask) != 0);
+                if ( pg[i].u.inuse.type_info & PGT_count_mask )
+                {
+                    printk(XENLOG_ERR
+                           "pg[%u] MFN %"PRI_mfn" c=%#lx o=%u v=%#lx t=%#x\n",
+                           i, mfn_x(page_to_mfn(pg + i)),
+                           pg[i].count_info, pg[i].v.free.order,
+                           pg[i].u.free.val, pg[i].tlbflush_timestamp);
+                    BUG();
+                }
                 arch_free_heap_page(d, &pg[i]);
             }
 





_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Xen-devel] [PATCH] page-alloc: accompany BUG() with printk()
  2019-05-15  8:44 [PATCH] page-alloc: accompany BUG() with printk() Jan Beulich
@ 2019-05-15  8:44 ` Jan Beulich
  2019-05-15  9:30 ` Wei Liu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 14+ messages in thread
From: Jan Beulich @ 2019-05-15  8:44 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall

Log information likely relevant for understanding why the BUG()s were
triggering.

Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -984,7 +984,15 @@ static struct page_info *alloc_heap_page
     for ( i = 0; i < (1 << order); i++ )
     {
         /* Reference count must continuously be zero for free pages. */
-        BUG_ON((pg[i].count_info & ~PGC_need_scrub) != PGC_state_free);
+        if ( (pg[i].count_info & ~PGC_need_scrub) != PGC_state_free )
+        {
+            printk(XENLOG_ERR
+                   "pg[%u] MFN %"PRI_mfn" c=%#lx o=%u v=%#lx t=%#x\n",
+                   i, mfn_x(page_to_mfn(pg + i)),
+                   pg[i].count_info, pg[i].v.free.order,
+                   pg[i].u.free.val, pg[i].tlbflush_timestamp);
+            BUG();
+        }
 
         /* PGC_need_scrub can only be set if first_dirty is valid */
         ASSERT(first_dirty != INVALID_DIRTY_IDX || !(pg[i].count_info & PGC_need_scrub));
@@ -1393,6 +1401,11 @@ static void free_heap_pages(
             break;
 
         default:
+            printk(XENLOG_ERR
+                   "pg[%u] MFN %"PRI_mfn" c=%#lx o=%u v=%#lx t=%#x\n",
+                   i, mfn_x(page_to_mfn(pg + i)),
+                   pg[i].count_info, pg[i].v.free.order,
+                   pg[i].u.free.val, pg[i].tlbflush_timestamp);
             BUG();
         }
 
@@ -2336,7 +2349,15 @@ void free_domheap_pages(struct page_info
 
             for ( i = 0; i < (1 << order); i++ )
             {
-                BUG_ON((pg[i].u.inuse.type_info & PGT_count_mask) != 0);
+                if ( pg[i].u.inuse.type_info & PGT_count_mask )
+                {
+                    printk(XENLOG_ERR
+                           "pg[%u] MFN %"PRI_mfn" c=%#lx o=%u v=%#lx t=%#x\n",
+                           i, mfn_x(page_to_mfn(pg + i)),
+                           pg[i].count_info, pg[i].v.free.order,
+                           pg[i].u.free.val, pg[i].tlbflush_timestamp);
+                    BUG();
+                }
                 arch_free_heap_page(d, &pg[i]);
             }
 





_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] page-alloc: accompany BUG() with printk()
  2019-05-15  8:44 [PATCH] page-alloc: accompany BUG() with printk() Jan Beulich
  2019-05-15  8:44 ` [Xen-devel] " Jan Beulich
@ 2019-05-15  9:30 ` Wei Liu
  2019-05-15  9:30   ` [Xen-devel] " Wei Liu
  2019-05-15  9:44 ` Roger Pau Monné
  2019-05-15 10:03 ` Andrew Cooper
  3 siblings, 1 reply; 14+ messages in thread
From: Wei Liu @ 2019-05-15  9:30 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, xen-devel

On Wed, May 15, 2019 at 02:44:07AM -0600, Jan Beulich wrote:
> Log information likely relevant for understanding why the BUG()s were
> triggering.
> 
> Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 

Reviewed-by: Wei Liu <wei.liu2@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Xen-devel] [PATCH] page-alloc: accompany BUG() with printk()
  2019-05-15  9:30 ` Wei Liu
@ 2019-05-15  9:30   ` Wei Liu
  0 siblings, 0 replies; 14+ messages in thread
From: Wei Liu @ 2019-05-15  9:30 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, xen-devel

On Wed, May 15, 2019 at 02:44:07AM -0600, Jan Beulich wrote:
> Log information likely relevant for understanding why the BUG()s were
> triggering.
> 
> Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 

Reviewed-by: Wei Liu <wei.liu2@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] page-alloc: accompany BUG() with printk()
  2019-05-15  8:44 [PATCH] page-alloc: accompany BUG() with printk() Jan Beulich
  2019-05-15  8:44 ` [Xen-devel] " Jan Beulich
  2019-05-15  9:30 ` Wei Liu
@ 2019-05-15  9:44 ` Roger Pau Monné
  2019-05-15  9:44   ` [Xen-devel] " Roger Pau Monné
  2019-05-15  9:59   ` Andrew Cooper
  2019-05-15 10:03 ` Andrew Cooper
  3 siblings, 2 replies; 14+ messages in thread
From: Roger Pau Monné @ 2019-05-15  9:44 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, xen-devel

On Wed, May 15, 2019 at 02:44:07AM -0600, Jan Beulich wrote:
> Log information likely relevant for understanding why the BUG()s were

Why not use panic instead of printk + BUG?

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Xen-devel] [PATCH] page-alloc: accompany BUG() with printk()
  2019-05-15  9:44 ` Roger Pau Monné
@ 2019-05-15  9:44   ` Roger Pau Monné
  2019-05-15  9:59   ` Andrew Cooper
  1 sibling, 0 replies; 14+ messages in thread
From: Roger Pau Monné @ 2019-05-15  9:44 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, xen-devel

On Wed, May 15, 2019 at 02:44:07AM -0600, Jan Beulich wrote:
> Log information likely relevant for understanding why the BUG()s were

Why not use panic instead of printk + BUG?

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] page-alloc: accompany BUG() with printk()
  2019-05-15  9:44 ` Roger Pau Monné
  2019-05-15  9:44   ` [Xen-devel] " Roger Pau Monné
@ 2019-05-15  9:59   ` Andrew Cooper
  2019-05-15  9:59     ` [Xen-devel] " Andrew Cooper
  2019-05-15 10:09     ` Roger Pau Monné
  1 sibling, 2 replies; 14+ messages in thread
From: Andrew Cooper @ 2019-05-15  9:59 UTC (permalink / raw)
  To: Roger Pau Monné, Jan Beulich
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Tim Deegan, Ian Jackson, Julien Grall, xen-devel

On 15/05/2019 10:44, Roger Pau Monné wrote:
> On Wed, May 15, 2019 at 02:44:07AM -0600, Jan Beulich wrote:
>> Log information likely relevant for understanding why the BUG()s were
> Why not use panic instead of printk + BUG?

Because the backtrace is useful a lot of the time.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Xen-devel] [PATCH] page-alloc: accompany BUG() with printk()
  2019-05-15  9:59   ` Andrew Cooper
@ 2019-05-15  9:59     ` Andrew Cooper
  2019-05-15 10:09     ` Roger Pau Monné
  1 sibling, 0 replies; 14+ messages in thread
From: Andrew Cooper @ 2019-05-15  9:59 UTC (permalink / raw)
  To: Roger Pau Monné, Jan Beulich
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Tim Deegan, Ian Jackson, Julien Grall, xen-devel

On 15/05/2019 10:44, Roger Pau Monné wrote:
> On Wed, May 15, 2019 at 02:44:07AM -0600, Jan Beulich wrote:
>> Log information likely relevant for understanding why the BUG()s were
> Why not use panic instead of printk + BUG?

Because the backtrace is useful a lot of the time.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] page-alloc: accompany BUG() with printk()
  2019-05-15  8:44 [PATCH] page-alloc: accompany BUG() with printk() Jan Beulich
                   ` (2 preceding siblings ...)
  2019-05-15  9:44 ` Roger Pau Monné
@ 2019-05-15 10:03 ` Andrew Cooper
  2019-05-15 10:03   ` [Xen-devel] " Andrew Cooper
  3 siblings, 1 reply; 14+ messages in thread
From: Andrew Cooper @ 2019-05-15 10:03 UTC (permalink / raw)
  To: Jan Beulich, xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Tim Deegan, Ian Jackson, Julien Grall

On 15/05/2019 09:44, Jan Beulich wrote:
> Log information likely relevant for understanding why the BUG()s were
> triggering.
>
> Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citirx.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Xen-devel] [PATCH] page-alloc: accompany BUG() with printk()
  2019-05-15 10:03 ` Andrew Cooper
@ 2019-05-15 10:03   ` Andrew Cooper
  0 siblings, 0 replies; 14+ messages in thread
From: Andrew Cooper @ 2019-05-15 10:03 UTC (permalink / raw)
  To: Jan Beulich, xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Tim Deegan, Ian Jackson, Julien Grall

On 15/05/2019 09:44, Jan Beulich wrote:
> Log information likely relevant for understanding why the BUG()s were
> triggering.
>
> Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citirx.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] page-alloc: accompany BUG() with printk()
  2019-05-15  9:59   ` Andrew Cooper
  2019-05-15  9:59     ` [Xen-devel] " Andrew Cooper
@ 2019-05-15 10:09     ` Roger Pau Monné
  2019-05-15 10:09       ` [Xen-devel] " Roger Pau Monné
  2019-05-15 10:12       ` Andrew Cooper
  1 sibling, 2 replies; 14+ messages in thread
From: Roger Pau Monné @ 2019-05-15 10:09 UTC (permalink / raw)
  To: Andrew Cooper
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Tim Deegan, Ian Jackson, Julien Grall,
	Jan Beulich, xen-devel

On Wed, May 15, 2019 at 10:59:20AM +0100, Andrew Cooper wrote:
> On 15/05/2019 10:44, Roger Pau Monné wrote:
> > On Wed, May 15, 2019 at 02:44:07AM -0600, Jan Beulich wrote:
> >> Log information likely relevant for understanding why the BUG()s were
> > Why not use panic instead of printk + BUG?
> 
> Because the backtrace is useful a lot of the time.

Oh, panic has no backtrace, that's not very useful. Maybe we could add
a panic_trace version to avoid having to do a printk + BUG. In any
case:

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Xen-devel] [PATCH] page-alloc: accompany BUG() with printk()
  2019-05-15 10:09     ` Roger Pau Monné
@ 2019-05-15 10:09       ` Roger Pau Monné
  2019-05-15 10:12       ` Andrew Cooper
  1 sibling, 0 replies; 14+ messages in thread
From: Roger Pau Monné @ 2019-05-15 10:09 UTC (permalink / raw)
  To: Andrew Cooper
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Tim Deegan, Ian Jackson, Julien Grall,
	Jan Beulich, xen-devel

On Wed, May 15, 2019 at 10:59:20AM +0100, Andrew Cooper wrote:
> On 15/05/2019 10:44, Roger Pau Monné wrote:
> > On Wed, May 15, 2019 at 02:44:07AM -0600, Jan Beulich wrote:
> >> Log information likely relevant for understanding why the BUG()s were
> > Why not use panic instead of printk + BUG?
> 
> Because the backtrace is useful a lot of the time.

Oh, panic has no backtrace, that's not very useful. Maybe we could add
a panic_trace version to avoid having to do a printk + BUG. In any
case:

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] page-alloc: accompany BUG() with printk()
  2019-05-15 10:09     ` Roger Pau Monné
  2019-05-15 10:09       ` [Xen-devel] " Roger Pau Monné
@ 2019-05-15 10:12       ` Andrew Cooper
  2019-05-15 10:12         ` [Xen-devel] " Andrew Cooper
  1 sibling, 1 reply; 14+ messages in thread
From: Andrew Cooper @ 2019-05-15 10:12 UTC (permalink / raw)
  To: Roger Pau Monné
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Tim Deegan, Ian Jackson, Julien Grall,
	Jan Beulich, xen-devel

On 15/05/2019 11:09, Roger Pau Monné wrote:
> On Wed, May 15, 2019 at 10:59:20AM +0100, Andrew Cooper wrote:
>> On 15/05/2019 10:44, Roger Pau Monné wrote:
>>> On Wed, May 15, 2019 at 02:44:07AM -0600, Jan Beulich wrote:
>>>> Log information likely relevant for understanding why the BUG()s were
>>> Why not use panic instead of printk + BUG?
>> Because the backtrace is useful a lot of the time.
> Oh, panic has no backtrace, that's not very useful. Maybe we could add
> a panic_trace version to avoid having to do a printk + BUG. In any
> case:

TBH, It would be better for BUG() to take a printk-like , but arranging
this to work is decidedly non-trivial, because it would have to be
arranged from #UD context with some way of passing va_args() behind the
scene.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Xen-devel] [PATCH] page-alloc: accompany BUG() with printk()
  2019-05-15 10:12       ` Andrew Cooper
@ 2019-05-15 10:12         ` Andrew Cooper
  0 siblings, 0 replies; 14+ messages in thread
From: Andrew Cooper @ 2019-05-15 10:12 UTC (permalink / raw)
  To: Roger Pau Monné
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Tim Deegan, Ian Jackson, Julien Grall,
	Jan Beulich, xen-devel

On 15/05/2019 11:09, Roger Pau Monné wrote:
> On Wed, May 15, 2019 at 10:59:20AM +0100, Andrew Cooper wrote:
>> On 15/05/2019 10:44, Roger Pau Monné wrote:
>>> On Wed, May 15, 2019 at 02:44:07AM -0600, Jan Beulich wrote:
>>>> Log information likely relevant for understanding why the BUG()s were
>>> Why not use panic instead of printk + BUG?
>> Because the backtrace is useful a lot of the time.
> Oh, panic has no backtrace, that's not very useful. Maybe we could add
> a panic_trace version to avoid having to do a printk + BUG. In any
> case:

TBH, It would be better for BUG() to take a printk-like , but arranging
this to work is decidedly non-trivial, because it would have to be
arranged from #UD context with some way of passing va_args() behind the
scene.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-05-15 10:13 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-15  8:44 [PATCH] page-alloc: accompany BUG() with printk() Jan Beulich
2019-05-15  8:44 ` [Xen-devel] " Jan Beulich
2019-05-15  9:30 ` Wei Liu
2019-05-15  9:30   ` [Xen-devel] " Wei Liu
2019-05-15  9:44 ` Roger Pau Monné
2019-05-15  9:44   ` [Xen-devel] " Roger Pau Monné
2019-05-15  9:59   ` Andrew Cooper
2019-05-15  9:59     ` [Xen-devel] " Andrew Cooper
2019-05-15 10:09     ` Roger Pau Monné
2019-05-15 10:09       ` [Xen-devel] " Roger Pau Monné
2019-05-15 10:12       ` Andrew Cooper
2019-05-15 10:12         ` [Xen-devel] " Andrew Cooper
2019-05-15 10:03 ` Andrew Cooper
2019-05-15 10:03   ` [Xen-devel] " Andrew Cooper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).