[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Xen-devel] [PATCH v3 3/4] xen: refactor debugtrace data
 
- To: Jan Beulich <jbeulich@xxxxxxxx>
 
- From: Juergen Gross <jgross@xxxxxxxx>
 
- Date: Tue, 3 Sep 2019 15:26:39 +0200
 
- Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, George Dunlap <George.Dunlap@xxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Ian Jackson <ian.jackson@xxxxxxxxxxxxx>, Tim Deegan <tim@xxxxxxx>, Julien Grall <julien.grall@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
 
- Delivery-date: Tue, 03 Sep 2019 13:26:53 +0000
 
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
 
 
 
On 03.09.19 13:50, Jan Beulich wrote:
 
On 03.09.2019 12:31, Juergen Gross wrote:
 
On 03.09.19 12:16, Jan Beulich wrote:
 
On 28.08.2019 10:00, Juergen Gross wrote:
 
+static unsigned int debugtrace_kilobytes = 128;
 
 
Since you touch this anyway, add __initdata? Maybe also move it
next to its integer_param()?
 
 
This is modified in patch 4 again, and there I need it in the running
system for support of cpu hotplug with per-cpu buffers.
 
 
Right, I've meanwhile noticed this. Hence it's fine to keep as is.
 
@@ -165,12 +171,14 @@ static int __init debugtrace_init(void)
           return 0;
   
       order = get_order_from_bytes(bytes);
-    debugtrace_buf = alloc_xenheap_pages(order, 0);
-    ASSERT(debugtrace_buf != NULL);
+    data = alloc_xenheap_pages(order, 0);
+    if ( !data )
+        return -ENOMEM;
    
-    memset(debugtrace_buf, '\0', bytes);
+    memset(data, '\0', bytes);
    
-    debugtrace_bytes = bytes;
+    data->bytes = bytes - sizeof(*data);
+    debtr_data = data;
 
 
The allocation may end up being almost twice as big as what gets
actually used this way. Wouldn't it make sense to re-calculate
"bytes" from "order"?
 
 
Yes, you are right.
 
 
Actually I wasn't, which I did notice seeing the relevant piece
of code getting touched in patch 4:
     while ( (kbytes = (debugtrace_kilobytes & (debugtrace_kilobytes-1))) != 0 )
         debugtrace_kilobytes = kbytes;
 
For kbytes < 4 you still were right.
Juergen
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel 
 
    
     |