[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4C72921A.8000308@redhat.com>
Date: Mon, 23 Aug 2010 18:22:02 +0300
From: Avi Kivity <avi@...hat.com>
To: Gleb Natapov <gleb@...hat.com>
CC: kvm@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, mingo@...e.hu,
a.p.zijlstra@...llo.nl, tglx@...utronix.de, hpa@...or.com,
riel@...hat.com, cl@...ux-foundation.org, mtosatti@...hat.com
Subject: Re: [PATCH v5 02/12] Add PV MSR to enable asynchronous page faults
delivery.
On 07/19/2010 06:30 PM, Gleb Natapov wrote:
> Guess enables async PF vcpu functionality using this MSR.
>
>
>
> +static int kvm_pv_enable_async_pf(struct kvm_vcpu *vcpu, u64 data)
> +{
> + u64 gpa = data& ~0x3f;
> + int offset = offset_in_page(gpa);
> + unsigned long addr;
> +
> + /* Bits 1:5 are resrved, Should be zero */
> + if (data& 0x3e)
> + return 1;
> +
> + vcpu->arch.apf_msr_val = data;
> +
> + if (!(data& KVM_ASYNC_PF_ENABLED)) {
> + vcpu->arch.apf_data = NULL;
> + return 0;
> + }
> +
> + addr = gfn_to_hva(vcpu->kvm, gpa>> PAGE_SHIFT);
> + if (kvm_is_error_hva(addr))
> + return 1;
> +
> + vcpu->arch.apf_data = (u32 __user*)(addr + offset);
This can be invalidated by host userspace playing with memory regions.
It needs to be recalculated on memory map changes, and it may disappear
from under the guest's feet (in which case we're allowed to
KVM_REQ_TRIPLE_FAULT it).
(note: this is a much better approach than kvmclock's and vapic's, we
should copy it there)
> +
> + /* check if address is mapped */
> + if (get_user(offset, vcpu->arch.apf_data)) {
> + vcpu->arch.apf_data = NULL;
> + return 1;
> + }
So, this check can succeed today but fail tomorrow.
> + return 0;
> +}
> +
--
error compiling committee.c: too many arguments to function
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists