Re: [PATCH kvm-unit-tests 3/4] Add support for calling a function in guest mode

Michael S. Tsirkin
2010-11-28T09:00:11Z

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<boost/function.hpp>
> >
> >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<vector>
> >> +
> >> +namespace identity {
> >> +
> >> +void setup_vm(kvm::vm& vm);
> >> +
> >> +class vcpu {
> >> +public:
> >> + vcpu(kvm::vcpu& vcpu, boost::function<void ()> 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 have a truly marvellous patch that fixes the bug which this
> signature is too narrow to contain.