WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: libxc: fix bug of xc_tbuf_get_size()

To: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
Subject: [Xen-devel] Re: libxc: fix bug of xc_tbuf_get_size()
From: Yu Zhiguo <yuzg@xxxxxxxxxxxxxx>
Date: Wed, 10 Feb 2010 19:30:41 +0800
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Delivery-date: Wed, 10 Feb 2010 03:30:25 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C7982A1A.99AE%keir.fraser@xxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <C7982A1A.99AE%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 3.0a1 (Windows/2008050715)
Hi keir and George,

Keir Fraser wrote:
> When did this change, and who changed it? It would be good to collect an
> appropriate Ack, e.g., from George Dunlap, if it was his xentrace changes.
> 

 I found this bug when I try 'xentrace_setsize'. The default
'current tbuf size' should be 0x14 but 0x2 outputted.
 xc_tbuf_set_size() sets the tbuf size, it's ok. But xc_tbuf_get_size()
tries to get the size of t_info pages.

 Could George have a look at this problem?

Regards,

Yu

> I can't take un-acked patches from non-maintainers on stuff I don't have
> good knowledge of myself, this late in the release cycle.
> 
>  -- Keir
> 
> On 09/02/2010 10:57, "Yu Zhiguo" <yuzg@xxxxxxxxxxxxxx> wrote:
> 
>> The size in pages of trace buffer should be t_info->tbuf_size
>> rather than t_info pages.
>>
>> Signed-off-by: Yu Zhiguo <yuzg@xxxxxxxxxxxxxx>
>>
>> diff --git a/tools/libxc/xc_tbuf.c b/tools/libxc/xc_tbuf.c
>> --- a/tools/libxc/xc_tbuf.c
>> +++ b/tools/libxc/xc_tbuf.c
>> @@ -15,6 +15,7 @@
>>   */
>>  
>>  #include "xc_private.h"
>> +#include <xen/trace.h>
>>  
>>  static int tbuf_enable(int xc_handle, int enable)
>>  {
>> @@ -44,6 +45,7 @@
>>  
>>  int xc_tbuf_get_size(int xc_handle, unsigned long *size)
>>  {
>> +    struct t_info *t_info;
>>      int rc;
>>      DECLARE_SYSCTL;
>>  
>> @@ -52,9 +54,19 @@
>>      sysctl.u.tbuf_op.cmd  = XEN_SYSCTL_TBUFOP_get_info;
>>  
>>      rc = xc_sysctl(xc_handle, &sysctl);
>> -    if (rc == 0)
>> -        *size = sysctl.u.tbuf_op.size;
>> -    return rc;
>> +    if ( rc != 0 )
>> +        return rc;
>> +
>> +    t_info = xc_map_foreign_range(xc_handle, DOMID_XEN,
>> +                    sysctl.u.tbuf_op.size, PROT_READ | PROT_WRITE,
>> +                    sysctl.u.tbuf_op.buffer_mfn);
>> +
>> +    if ( t_info == NULL || t_info->tbuf_size == 0 )
>> +        return -1;
>> +
>> +    *size = t_info->tbuf_size;
>> +
>> +    return 0;
>>  }
>>  
>>  int xc_tbuf_enable(int xc_handle, unsigned long pages, unsigned long *mfn,
>>
> 
> 
> 
> 
> 


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>