Hi - Looks fine overall. I have some minor issues that don't need to block merging this. Let me know if you want me to merge it, as-is.
On 2016-08-31 at 16:06 "Ronald G. Minnich" <[email protected]> wrote: > diff --git a/user/vmm/vthread.c b/user/vmm/vthread.c > +/* vthread_addr sets up a virtual_machine struct such that functions > + * can start up VM guests. It is like pthread_attr in that it sets up > + * default attributes and can be used in vthread_create calls. If > + * vm->nrgpcs is not set then the vm will be set up for 1 guest. */ > +int vthread_attr_init(struct virtual_machine *vm, int vmmflags) > +{ > + uint32_t *apic; > + unsigned long long *p512, *p1, *p2m; > + struct vm_trapframe *vm_tf; > + > + if (vm->nr_gpcs == 0) { > + /* TODO: should we set up for the max cores available? */ > + vm->nr_gpcs = 1; This will be the max number of guest_threads / vthreads that they will ever create. That could be an argument to attr_init. Alternatively, we could change the kernel interface to allow the number of GPCs to grow (something like "pass in the n gpcis for the new gpcs", or hopefully something less nasty). > + vm->gpcis = calloc(vm->nr_gpcs, sizeof(*vm->gpcis)); > + vm->gpcis->posted_irq_desc = page(NULL); > + vm->gpcis->vapic_addr = page(NULL); > + apic = vm->gpcis->apic_addr = page((void *)0xfee00000); > + memset(apic, 0, 4096); > + apic[0x30 / 4] = 0x01060015; Generic VMX question here: Does every VMCS need its own, distinct APIC page? If so, do we also need that page to be mapped at 0xfee00000? If so, I think we're going to have problems, since only one page can be mapped at 0xfee00000. > + vmm_init(vm, vmmflags); > + vm_tf = gth_to_vmtf(vm->gths[0]); > + vm_tf->tf_cr3 = (uint64_t)p512; > + } else { > + vmm_init(vm, vmmflags); Calling vmm_init() again (in the else case) actually doesn't do anything. It's meant to be called once, though if you call twice concurrently, you could theoretically trash yourself. Barret -- You received this message because you are subscribed to the Google Groups "Akaros" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/d/optout.
