From: Gleb Natapov <gleb@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm <kvm@vger.kernel.org>
Subject: Re: x86: pvclock kvm: align allocation size to page size
Date: Tue, 19 Feb 2013 15:22:10 +0200 [thread overview]
Message-ID: <20130219132210.GK3600@redhat.com> (raw)
In-Reply-To: <20130219015814.GA7679@amt.cnet>
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@hurleysoftware.com>
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
>
Reviewed-by: Gleb Natapov <gleb@redhat.com>
> 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.
prev parent reply other threads:[~2013-02-19 13:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-19 1:58 x86: pvclock kvm: align allocation size to page size Marcelo Tosatti
2013-02-19 13:22 ` Gleb Natapov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130219132210.GK3600@redhat.com \
--to=gleb@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox