[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4C73BC02.7090606@redhat.com>
Date: Tue, 24 Aug 2010 15:33:06 +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 08/12] Inject asynchronous page fault into a guest
if page is swapped out.
On 08/24/2010 03:28 PM, Gleb Natapov wrote:
> On Mon, Aug 23, 2010 at 07:17:20PM +0300, Avi Kivity wrote:
>>> +static int apf_put_user(struct kvm_vcpu *vcpu, u32 val)
>>> +{
>>> + if (unlikely(vcpu->arch.apf_memslot_ver !=
>>> + vcpu->kvm->memslot_version)) {
>>> + u64 gpa = vcpu->arch.apf_msr_val& ~0x3f;
>>> + unsigned long addr;
>>> + int offset = offset_in_page(gpa);
>>> +
>>> + addr = gfn_to_hva(vcpu->kvm, gpa>> PAGE_SHIFT);
>>> + vcpu->arch.apf_data = (u32 __user *)(addr + offset);
>>> + if (kvm_is_error_hva(addr)) {
>>> + vcpu->arch.apf_data = NULL;
>>> + return -EFAULT;
>>> + }
>>> + }
>>> +
>>> + return put_user(val, vcpu->arch.apf_data);
>>> +}
>> This nice cache needs to be outside apf to reduce complexity for
>> reviewers and since it is useful for others.
>>
>> Would be good to have memslot-cached kvm_put_guest() and kvm_get_guest().
>>
> Something like this? (only compile tested)
Yes, exactly.
--
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