Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/vmm/vmm.c
Show First 20 Lines • Show All 168 Lines • ▼ Show 20 Lines | struct vm { | ||||
cpuset_t rendezvous_req_cpus; /* (x) rendezvous requested */ | cpuset_t rendezvous_req_cpus; /* (x) rendezvous requested */ | ||||
cpuset_t rendezvous_done_cpus; /* (x) rendezvous finished */ | cpuset_t rendezvous_done_cpus; /* (x) rendezvous finished */ | ||||
void *rendezvous_arg; /* (x) rendezvous func/arg */ | void *rendezvous_arg; /* (x) rendezvous func/arg */ | ||||
vm_rendezvous_func_t rendezvous_func; | vm_rendezvous_func_t rendezvous_func; | ||||
struct mtx rendezvous_mtx; /* (o) rendezvous lock */ | struct mtx rendezvous_mtx; /* (o) rendezvous lock */ | ||||
struct mem_map mem_maps[VM_MAX_MEMMAPS]; /* (i) guest address space */ | struct mem_map mem_maps[VM_MAX_MEMMAPS]; /* (i) guest address space */ | ||||
struct mem_seg mem_segs[VM_MAX_MEMSEGS]; /* (o) guest memory regions */ | struct mem_seg mem_segs[VM_MAX_MEMSEGS]; /* (o) guest memory regions */ | ||||
struct vmspace *vmspace; /* (o) guest's address space */ | struct vmspace *vmspace; /* (o) guest's address space */ | ||||
char name[VM_MAX_NAMELEN]; /* (o) virtual machine name */ | char name[VM_MAX_NAMELEN+1]; /* (o) virtual machine name */ | ||||
jhb: I suspect this results in some padding now? Perhaps it would be best to move this field below… | |||||
khngAuthorUnsubmitted Done Inline ActionsIt does not create padding with default SPECNAMELEN on FreeBSD 12 and 13, but might be the case for other SPECNAMELEN values. khng: It does not create padding with default SPECNAMELEN on FreeBSD 12 and 13, but might be the case… | |||||
struct vcpu vcpu[VM_MAXCPU]; /* (i) guest vcpus */ | struct vcpu vcpu[VM_MAXCPU]; /* (i) guest vcpus */ | ||||
/* The following describe the vm cpu topology */ | /* The following describe the vm cpu topology */ | ||||
uint16_t sockets; /* (o) num of sockets */ | uint16_t sockets; /* (o) num of sockets */ | ||||
uint16_t cores; /* (o) num of cores/socket */ | uint16_t cores; /* (o) num of cores/socket */ | ||||
uint16_t threads; /* (o) num of threads/core */ | uint16_t threads; /* (o) num of threads/core */ | ||||
uint16_t maxcpus; /* (o) max pluggable cpus */ | uint16_t maxcpus; /* (o) max pluggable cpus */ | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 289 Lines • ▼ Show 20 Lines | vm_create(const char *name, struct vm **retvm) | ||||
/* | /* | ||||
* If vmm.ko could not be successfully initialized then don't attempt | * If vmm.ko could not be successfully initialized then don't attempt | ||||
* to create the virtual machine. | * to create the virtual machine. | ||||
*/ | */ | ||||
if (!vmm_initialized) | if (!vmm_initialized) | ||||
return (ENXIO); | return (ENXIO); | ||||
if (name == NULL || strlen(name) >= VM_MAX_NAMELEN) | if (name == NULL || strnlen(name, VM_MAX_NAMELEN + 1) == | ||||
VM_MAX_NAMELEN + 1) | |||||
return (EINVAL); | return (EINVAL); | ||||
vmspace = vmmops_vmspace_alloc(0, VM_MAXUSER_ADDRESS_LA48); | vmspace = vmmops_vmspace_alloc(0, VM_MAXUSER_ADDRESS_LA48); | ||||
if (vmspace == NULL) | if (vmspace == NULL) | ||||
return (ENOMEM); | return (ENOMEM); | ||||
vm = malloc(sizeof(struct vm), M_VM, M_WAITOK | M_ZERO); | vm = malloc(sizeof(struct vm), M_VM, M_WAITOK | M_ZERO); | ||||
strcpy(vm->name, name); | strcpy(vm->name, name); | ||||
▲ Show 20 Lines • Show All 2,461 Lines • Show Last 20 Lines |
I suspect this results in some padding now? Perhaps it would be best to move this field below the vcpu[] array at least?