Re: x86: pvclock kvm: align allocation size to page size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 18, 2013 at 10:58:14PM -0300, Marcelo Tosatti wrote:
> 
> To match whats mapped via vsyscalls to userspace.
> 
> Reported-by: Peter Hurley <peter@xxxxxxxxxxxxxxxxxx>
> Signed-off-by: Marcelo Tosatti <mtosatti@xxxxxxxxxx>
> 
Reviewed-by: Gleb Natapov <gleb@xxxxxxxxxx>

> diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
> index 220a360..5bedbdd 100644
> --- a/arch/x86/kernel/kvmclock.c
> +++ b/arch/x86/kernel/kvmclock.c
> @@ -218,6 +218,9 @@ static void kvm_shutdown(void)
>  void __init kvmclock_init(void)
>  {
>  	unsigned long mem;
> +	int size;
> +
> +	size = PAGE_ALIGN(sizeof(struct pvclock_vsyscall_time_info)*NR_CPUS);
>  
>  	if (!kvm_para_available())
>  		return;
> @@ -231,16 +234,14 @@ void __init kvmclock_init(void)
>  	printk(KERN_INFO "kvm-clock: Using msrs %x and %x",
>  		msr_kvm_system_time, msr_kvm_wall_clock);
>  
> -	mem = memblock_alloc(sizeof(struct pvclock_vsyscall_time_info)*NR_CPUS,
> -			     PAGE_SIZE);
> +	mem = memblock_alloc(size, PAGE_SIZE);
>  	if (!mem)
>  		return;
>  	hv_clock = __va(mem);
>  
>  	if (kvm_register_clock("boot clock")) {
>  		hv_clock = NULL;
> -		memblock_free(mem,
> -			sizeof(struct pvclock_vsyscall_time_info)*NR_CPUS);
> +		memblock_free(mem, size);
>  		return;
>  	}
>  	pv_time_ops.sched_clock = kvm_clock_read;
> @@ -275,7 +276,7 @@ int __init kvm_setup_vsyscall_timeinfo(void)
>  	struct pvclock_vcpu_time_info *vcpu_time;
>  	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();
>  	cpu = smp_processor_id();
> 

--
			Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux