Commit ed55705d authored by Marcelo Tosatti's avatar Marcelo Tosatti

x86: pvclock kvm: align allocation size to page size

To match whats mapped via vsyscalls to userspace.
Reported-by: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent 899f7b26
...@@ -218,6 +218,9 @@ static void kvm_shutdown(void) ...@@ -218,6 +218,9 @@ static void kvm_shutdown(void)
void __init kvmclock_init(void) void __init kvmclock_init(void)
{ {
unsigned long mem; unsigned long mem;
int size;
size = PAGE_ALIGN(sizeof(struct pvclock_vsyscall_time_info)*NR_CPUS);
if (!kvm_para_available()) if (!kvm_para_available())
return; return;
...@@ -231,16 +234,14 @@ void __init kvmclock_init(void) ...@@ -231,16 +234,14 @@ void __init kvmclock_init(void)
printk(KERN_INFO "kvm-clock: Using msrs %x and %x", printk(KERN_INFO "kvm-clock: Using msrs %x and %x",
msr_kvm_system_time, msr_kvm_wall_clock); msr_kvm_system_time, msr_kvm_wall_clock);
mem = memblock_alloc(sizeof(struct pvclock_vsyscall_time_info)*NR_CPUS, mem = memblock_alloc(size, PAGE_SIZE);
PAGE_SIZE);
if (!mem) if (!mem)
return; return;
hv_clock = __va(mem); hv_clock = __va(mem);
if (kvm_register_clock("boot clock")) { if (kvm_register_clock("boot clock")) {
hv_clock = NULL; hv_clock = NULL;
memblock_free(mem, memblock_free(mem, size);
sizeof(struct pvclock_vsyscall_time_info)*NR_CPUS);
return; return;
} }
pv_time_ops.sched_clock = kvm_clock_read; pv_time_ops.sched_clock = kvm_clock_read;
...@@ -275,7 +276,7 @@ int __init kvm_setup_vsyscall_timeinfo(void) ...@@ -275,7 +276,7 @@ int __init kvm_setup_vsyscall_timeinfo(void)
struct pvclock_vcpu_time_info *vcpu_time; struct pvclock_vcpu_time_info *vcpu_time;
unsigned int size; unsigned int size;
size = sizeof(struct pvclock_vsyscall_time_info)*NR_CPUS; size = PAGE_ALIGN(sizeof(struct pvclock_vsyscall_time_info)*NR_CPUS);
preempt_disable(); preempt_disable();
cpu = smp_processor_id(); cpu = smp_processor_id();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment