uint64_t start, end, num;
uint64_t guest_cur;
uint64_t num_regions;
+ uint64_t num_regions_shown;
if (!(f=fopen(GUEST_FILE,"r"))) {
fprintf(stderr,"Could not find number of regions for %s\n",vmdev);
return 0;
}
- if (sscanf(buf,"Regions: %llu",&num_regions)==1) {
+ if (sscanf(buf,"Regions: %llu (%llu shown)",&num_regions,&num_regions_shown)==2) {
break;
}
}
+
+ if (num_regions != num_regions_shown) {
+ fprintf(stderr,"Cannot see all regions for %s\n",vmdev);
+ return 0;
+ }
struct v3_guest_mem_map *m =
(struct v3_guest_mem_map *) malloc(sizeof(struct v3_guest_mem_map)+num_regions*sizeof(struct v3_guest_mem_block));
#include "v3_ctrl.h"
+// set to zero to ignore, or set
+// to a level likely given the largest contiguous
+// page allocation outside of the base regions
+// note that the seed pools provide 2-4 MB chunks
+// to start
+#define PALACIOS_MIN_ALLOC (64*4096)
#define SYS_PATH "/sys/devices/system/memory/"
}
if (op==ADD) {
- mem_size_bytes = atoll(argv[optind]) * (1024 * 1024);
+ mem_size_bytes = (unsigned long long) (atof(argv[optind]) * (1024 * 1024));
- if (mem_size_bytes > palacios_runtime_mem_block_size) {
- EPRINTF("Trying to add a larger single chunk of memory than Palacios can manage\n"
+ if (mem_size_bytes < palacios_runtime_mem_block_size ||
+ (PALACIOS_MIN_ALLOC!=0 && mem_size_bytes < PALACIOS_MIN_ALLOC)) {
+ EPRINTF("Trying to add a smaller single chunk of memory than Palacios needs\n"
"Your request: %llu bytes\n"
"Palacios run-time memory block size: %llu bytes\n",
- mem_size_bytes, palacios_runtime_mem_block_size);
+ "Palacios minimal contiguous alloc: %llu bytes\n",
+ mem_size_bytes, palacios_runtime_mem_block_size,
+ PALACIOS_MIN_ALLOC);
return -1;
}
- if (mem_size_bytes < palacios_runtime_mem_block_size) {
- EPRINTF("Trying to add a smaller single chunk of memory than Palacios can manage\n"
- "Your request: %llu bytes\n"
- "Palacios run-time memory block size: %llu bytes\n",
- mem_size_bytes, palacios_runtime_mem_block_size);
- return -1;
- }
-
if (request && mem_size_bytes > kernel_max_page_alloc_bytes) {
EPRINTF("Trying to request a larger single chunk of memory than the kernel can allocate\n"
"Your request: %llu bytes\n"
return 0;
}
-/*
-static int bitcount(uint64_t x)
-{
- int c=0;
-
- while (x) {
- c+=x&0x1;
- x>>=1;
- }
- return c;
-}
-
-static int is_pow2(x)
-{
- int c = bitcount(x);
-
- return c==0 || c==1;
-}
-*/
static uint64_t log2(uint64_t x)
{
vm->resource_control.pg_filter_state = &vm->cachepart_state;
- // V3_Sleep(50000000);
-
return 0;
}
return 0;
}
-static unsigned count=0;
int v3_cachepart_filter(void *paddr, v3_cachepart_t *c)
{
PrintDebug(VM_NONE,VCORE_NONE,"cachepart: %p is color 0x%llx required colors: [0x%llx,0x%llx] %s\n",paddr,color,c->min_color,c->max_color, color>=c->min_color && color<=c->max_color ? "ACCEPT" : "REJECT");
- /*
- if (count<10) {
- V3_Sleep(5000000);
- count++;
- }
- */
-
return color>=c->min_color && color<=c->max_color;
}
$maxalloc = 4194304;
-print "What is your kernel's maximum contiguous page allocation size in bytes (typicaly (MAX_ORDER-1)*4096) [$maxalloc] : ";
+print "What is your kernel's maximum contiguous page allocation size in bytes (typically 2^(MAX_ORDER-1)*4096) [$maxalloc] : ";
$maxalloc = get_user($maxalloc);
print "Desired memory block size? [$maxalloc or less, power of 2] : ";
$memblocksize = get_user($maxalloc);
} while ($memblocksize>$maxalloc && !powerof2($memblocksize));
+ do {
+ print "You are not using hot-remove, so we can adjust the allocation size\n";
+ print "Typically, you want this as large as possible (up to what your\n";
+ print "kernel allows, but for special purposes, for example cache\n";
+ print "partitioning, you want this to be as small as possible (just\n";
+ print "larger than the largest contiguous allocation your guests will need.)\n";
+ print "Desired allocation size? [$maxalloc or less, power of 2] : ";
+ $allocsize = get_user($maxalloc);
+ } while ($allocsize>$maxalloc && !powerof2($allocsize));
+} else {
+ $allocsize=$memblocksize;
}
$mem = 1024;
Compiled Memory Block Size: $compmemblocksize
Override Memory Block Size: $override_memblocksize
Actual Memory Block Size: $memblocksize
+ Allocation Block Size: $allocsize
Allow Devmem: $devmem
Support QEMU devices: $qemu
QEMU directory: $qemudir
-$chunk = $memblocksize / (1024 * 1024) ;
+$chunk = $allocsize / (1024 * 1024) ;
$numchunks = $mem / $chunk;
$chunkspernode = $numchunks / $numnodes;