From: Ian Campbell Subject: Re: xend segfaults when starting Date: Wed, 18 Aug 2010 13:18:13 +0100 Message-ID: <1282133893.3170.925.camel@zakaz.uk.xensource.com> References: <201008041512.12768.Christoph.Egger@amd.com> <1281532314.3170.45.camel@zakaz.uk.xensource.com> <201008181244.24578.Christoph.Egger@amd.com> <1282133659.3170.922.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1282133659.3170.922.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Christoph Egger Cc: "xen-devel@lists.xensource.com" , "Gianni Tedesco (3P)" , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Wed, 2010-08-18 at 13:14 +0100, Ian Campbell wrote: > Please can you try this patch: Ooops, that's not quite right (it still calls pthread_getspecific before _xc_init_hcall_buf). Please can you try this replacement for the original patch instead: diff -r ddbd38da0739 -r d31bfd188fd0 tools/libxc/xc_private.c --- a/tools/libxc/xc_private.c Wed Aug 18 13:14:57 2010 +0100 +++ b/tools/libxc/xc_private.c Wed Aug 18 13:17:48 2010 +0100 @@ -57,6 +57,8 @@ xc_interface *xc_interface_open(xentooll return 0; } +static void xc_clean_hcall_buf(void); + int xc_interface_close(xc_interface *xch) { int rc = 0; @@ -68,6 +70,9 @@ int xc_interface_close(xc_interface *xch rc = xc_interface_close_core(xch, xch->fd); if (rc) PERROR("Could not close hypervisor interface"); } + + xc_clean_hcall_buf(); + free(xch); return rc; } @@ -180,6 +185,8 @@ int hcall_buf_prep(void **addr, size_t l int hcall_buf_prep(void **addr, size_t len) { return 0; } void hcall_buf_release(void **addr, size_t len) { } +static void xc_clean_hcall_buf(void) { } + #else /* !__sun__ */ int lock_pages(void *addr, size_t len) @@ -228,6 +235,13 @@ static void _xc_init_hcall_buf(void) static void _xc_init_hcall_buf(void) { pthread_key_create(&hcall_buf_pkey, _xc_clean_hcall_buf); +} + +static void xc_clean_hcall_buf(void) +{ + pthread_once(&hcall_buf_pkey_once, _xc_init_hcall_buf); + + _xc_clean_hcall_buf(pthread_getspecific(hcall_buf_pkey)); } int hcall_buf_prep(void **addr, size_t len)