[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: t
From: |
Jike Song |
Subject: |
Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot |
Date: |
Fri, 21 Oct 2016 10:47:09 +0800 |
User-agent: |
Mozilla/5.0 (X11; Linux i686 on x86_64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 |
On 10/21/2016 01:19 AM, Xiao, Guangrong wrote:
>> On 10/19/2016 10:14 PM, Paolo Bonzini wrote:
>>> On 19/10/2016 15:39, Xiao Guangrong wrote:
>>>
>>>
>>> I understood that KVM side is safe, however, vfio side is independent
>>> with kvm and the user of usrdata can fetch kvm struct at any time,
>>> consider this scenario:
>>>
>>> CPU 0 CPU 1
>>> KVM: VFIO/userdata user
>>> kvm_ioctl_create_device
>>> get_kvm()
>>> vfio_group_get_usrdata(vfio_group)
>>> kvm_device_release
>>> put_kvm()
>>> !!! kvm refcount has gone
>>> use KVM struct
>>>
>>> Then, the user of userdata have fetched kvm struct but the refcount
>>> has already gone.
>>
>> vfio_group_set_usrdata (actually) kvm_vfio_group_set_kvm has called
>>kvm_get_kvm too, however. What you need is a mutex that is taken by
>>vfio_group_set_usrdata and by the callers of vfio_group_get_usrdata.
>
> Yes, mutex can fix it and is good to me. :)
Thanks everyone, I'll cook another patch according to your guidance.
--
Thanks,
Jike
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot, (continued)
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot, Jike Song, 2016/10/18
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot, Alex Williamson, 2016/10/18
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot, Jike Song, 2016/10/18
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot, Xiao Guangrong, 2016/10/19
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot, Paolo Bonzini, 2016/10/19
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot, Xiao Guangrong, 2016/10/19
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot, Paolo Bonzini, 2016/10/19
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot, Xiao Guangrong, 2016/10/19
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot, Paolo Bonzini, 2016/10/20
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot, Xiao, Guangrong, 2016/10/20
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot,
Jike Song <=
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot, Jike Song, 2016/10/26
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot, Paolo Bonzini, 2016/10/26
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot, Jike Song, 2016/10/29
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot, Eric Blake, 2016/10/19
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot, Jike Song, 2016/10/24