From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH kvm-unit-tests 3/4] Add support for calling a function in guest mode Date: Sun, 28 Nov 2010 11:22:05 +0200 Message-ID: <4CF21F3D.8010007@redhat.com> References: <1290595933-13122-1-git-send-email-avi@redhat.com> <1290595933-13122-4-git-send-email-avi@redhat.com> <20101126141748.GB6124@redhat.com> <4CF0CC26.8030407@redhat.com> <20101128085952.GB3330@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , kvm@vger.kernel.org To: "Michael S. Tsirkin" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:27836 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751824Ab0K1JWJ (ORCPT ); Sun, 28 Nov 2010 04:22:09 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oAS9M81g031437 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 28 Nov 2010 04:22:09 -0500 In-Reply-To: <20101128085952.GB3330@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 11/28/2010 10:59 AM, Michael S. Tsirkin wrote: > On Sat, Nov 27, 2010 at 11:15:18AM +0200, Avi Kivity wrote: > > On 11/26/2010 04:17 PM, Michael S. Tsirkin wrote: > > >> + > > >> +#include "kvmxx.h" > > >> +#include > > > > > >This seems to use boost, which is not part of the standard library. > > >Do we want this dependency? > > >We'd need a configure check to verify it's installed. > > > > > > > I don't mind a boost dependency, but given this is in tr1, I > > switched to that instead. > > > > >> +#include > > >> + > > >> +namespace identity { > > >> + > > >> +void setup_vm(kvm::vm& vm); > > >> + > > >> +class vcpu { > > >> +public: > > >> + vcpu(kvm::vcpu& vcpu, boost::function guest_func, > > >> + unsigned long stack_size = 256 * 1024); > > > > > >So the thread stack is moved to use the heap instead? > > > > Only in guest mode. > > > > >Can we use pthread_attr_getstacksize and use the regular thread stack? > > >Good for portability. > > > > In practice 256K should be sufficient. This is for a unit test, not > > a qemu replacement. > > > Portability matters though. Isn't it a good idea to replace a bunch > or asm calls with pthread use? > I don't see how? The host/guest thunk has no pthread equivalent. -- error compiling committee.c: too many arguments to function