Re: [PATCH 5/8] KVM: Add hva_to_memslot

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

 



On 08/09/2012 08:02 PM, Alexander Graf wrote:
> 
> 
> On 09.08.2012, at 12:36, Avi Kivity <avi@xxxxxxxxxx> wrote:
> 
>> On 08/09/2012 01:34 PM, Takuya Yoshikawa wrote:
>>> On Tue,  7 Aug 2012 12:57:13 +0200
>>> Alexander Graf <agraf@xxxxxxx> wrote:
>>> 
>>>> +struct kvm_memory_slot *hva_to_memslot(struct kvm *kvm, hva_t hva)
>>>> +{
>>>> +    struct kvm_memslots *slots = kvm_memslots(kvm);
>>>> +    struct kvm_memory_slot *memslot;
>>>> +
>>>> +    kvm_for_each_memslot(memslot, slots)
>>>> +        if (hva >= memslot->userspace_addr &&
>>>> +              hva < memslot->userspace_addr + memslot->npages)
>>>> +            return memslot;
>>>> +
>>>> +    return NULL;
>>>> +}
>>> 
>>> Can't we have two memory slots which contain that hva?
>>> I thought that's why hva handler had to check all slots.
>> 
>> We can and do.  Good catch.
>> 
> 
> Hrm. So I guess we can only do an hva_is_guest_memory() helper? That's all I really need anyways :)
> 

How about kvm_for_each_memslot_hva_range()?  That can useful in
kvm_handle_hva_range().  For your use case, you just do you stuff and
return immediately.




-- 
error compiling committee.c: too many arguments to function
--
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