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

Re: [Xen-devel] [PATCH] libxc: free thread specific hypercall buffer on

To: Christoph Egger <Christoph.Egger@xxxxxxx>
Subject: Re: [Xen-devel] [PATCH] libxc: free thread specific hypercall buffer on xc_interface_close
From: Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx>
Date: Wed, 18 Aug 2010 17:26:28 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 18 Aug 2010 09:28:31 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <201008181804.56934.Christoph.Egger@xxxxxxx>
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>
Organization: Citrix Systems, Inc.
References: <b1f4b4be1f94c0007794.1282143667@xxxxxxxxxxxxxxxxxxxxx> <201008181804.56934.Christoph.Egger@xxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Wed, 2010-08-18 at 17:04 +0100, Christoph Egger wrote:
> This patch prevents me from starting a guest until
> the outstanding issue - namely why is hcall_buf_prep() never called -
> is solved.

You wouldn't expect hcall_buf_prep to be called if you opened the xc
interface and then closed it without doing a hypercall which required
any locked down memory.

This updated version of the patch was intended to handle exactly this
case since it appears that under NetBSD it can cause issues.

Are you saying that you are seeing hypercalls which you expect to need
memory locking down but for which that has not happened?

The callers of hcall_buf_prep are pretty explicit and there aren't that
many of them.

With the attached patch to libxc I get the following output when
starting xend, so you see it is quite normal for the xc interface to be
called when hcall_buf_prep has never been called and we now handle that
case correctly.

        xc_interface_open
        xc_interface_open
        xc_interface_open
        xc_interface_close
        xc_clean_hcall_buf
        _xc_init_hcall_buf
        _xc_clean_hcall_buf
        xc_interface_open
        xc_interface_open
        xc_interface_open
        xc_interface_open
        xc_interface_open
        xc_interface_open
        xc_interface_open
        xc_interface_close
        xc_clean_hcall_buf
        _xc_clean_hcall_buf
        xc_interface_close
        xc_clean_hcall_buf
        _xc_clean_hcall_buf
        xc_interface_close
        xc_clean_hcall_buf
        _xc_clean_hcall_buf
        xc_interface_close
        xc_clean_hcall_buf
        _xc_clean_hcall_buf
        xc_interface_close
        xc_clean_hcall_buf
        _xc_clean_hcall_buf
        xc_interface_close
        xc_clean_hcall_buf
        _xc_clean_hcall_buf
        xc_interface_close
        xc_clean_hcall_buf
        _xc_clean_hcall_buf
        xc_interface_close
        xc_clean_hcall_buf
        _xc_clean_hcall_buf
        xc_interface_close
        xc_clean_hcall_buf
        _xc_clean_hcall_buf

When starting a PV domain I get

        xc_interface_open
        xc_interface_close
        xc_clean_hcall_buf
        _xc_init_hcall_buf
        _xc_clean_hcall_buf
        Using config file "/etc/xen/debian-x86_32p-1".
        xc_interface_open
        hcall_buf_prep(0xbfb56ca8,144)
        _xc_init_hcall_buf
        hcall_buf_prep hcall_buf allocated at 0x804b0d8
        hcall_buf_prep hcall_buf->buf allocated at 0x804c000
        hcall_buf_prep using preallocated buffer at 0x804c000 for 0xbfb56ca8
        hcall_buf_release(0x804c000,144)
        hcall_buf_release releasing preallocated buffer at 0x804c000 for 
0xbfb56ca8
        xc_interface_close
        xc_clean_hcall_buf
        _xc_clean_hcall_buf
        _xc_clean_hcall_buf unlock and free hcall_buf->buf 0x804c000
        _xc_clean_hcall_buf free hcall_buf 0x804b0d8

It is also safe to call _xc_clean_hcall_buf and then later call
hcall_buf_prep (and therefore allocate a buffer).

Ian.

Attachment: foo
Description: Text Data

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