From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: "He, Qing" <qing.he-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: kvm-devel <kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: Re: [PATCH 4/6] KVM: in-kernel LAPIC save and restore support
Date: Fri, 03 Aug 2007 19:43:52 +0300 [thread overview]
Message-ID: <46B35B48.9090907@qumranet.com> (raw)
In-Reply-To: <37E52D09333DE2469A03574C88DBF40F048EE4-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
He, Qing wrote:
> KVM: in-kernel LAPIC save and restore support
>
> This patch adds a new vcpu-based IOCTL to save and restore the local
> apic
> registers for a single vcpu. The kernel only copies the apic page as
> a whole,
> extraction of registers is left to userspace side. On restore, the
> APIC timer
> is restarted from the initial count, this introduces a little delay,
> but works
> fine
>
> Signed-off-by: Yaozu (Eddie) Dong <eddie.dong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Qing He <qing.he-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>
> static long kvm_vcpu_ioctl(struct file *filp,
> unsigned int ioctl, unsigned long arg)
> {
> @@ -2805,6 +2826,31 @@ static long kvm_vcpu_ioctl(struct file *filp,
> r = 0;
> break;
> }
> + case KVM_GET_LAPIC: {
> + struct kvm_lapic_state lapic;
> +
> + memset(&lapic, 0, sizeof lapic);
> + r = kvm_vcpu_ioctl_get_lapic(vcpu, &lapic);
> + if (r)
> + goto out;
> + r = -EFAULT;
> + if (copy_to_user(argp, &lapic, sizeof lapic))
> + goto out;
> + r = 0;
> + break;
> + }
>
> +/* for KVM_GET_LAPIC and KVM_SET_LAPIC */
> +#define KVM_APIC_REG_SIZE 0x400
> +struct kvm_lapic_state {
> + char regs[KVM_APIC_REG_SIZE];
> +};
> +
>
kvm_lapic_state is 1KB in size, and you are allocating it on the stack.
On i386, the stack can be 4KB, and you're allocating 25% of it...
While it's true that this code path is short and can't be compounded
with others like I/O code paths, still it's not a good idea to allocate
so much stack space. I suggest defining kvm_lapic_state as
#define KVM_LAPIC_NR_REGS 0x40
struct kvm_lapic_state {
u32 regs[KVM_LAPIC_NR_REGS];
};
That reduces the state size to 256 bytes.
--
error compiling committee.c: too many arguments to function
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
next prev parent reply other threads:[~2007-08-03 16:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-03 6:24 [PATCH 4/6] KVM: in-kernel LAPIC save and restore support He, Qing
[not found] ` <37E52D09333DE2469A03574C88DBF40F048EE4-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-08-03 16:43 ` Avi Kivity [this message]
[not found] ` <46B35B48.9090907-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-08-04 1:26 ` Dong, Eddie
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=46B35B48.9090907@qumranet.com \
--to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
--cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=qing.he-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.