From: Jike Song <jike.song@intel.com>
To: "Xiao, Guangrong" <guangrong.xiao@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Xiao Guangrong <guangrong.xiao@linux.intel.com>,
Alex Williamson <alex.williamson@redhat.com>,
"Tian, Kevin" <kevin.tian@intel.com>, Neo Jia <cjia@nvidia.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
qemu-devel <qemu-devel@nongnu.org>,
"Chen, Xiaoguang" <xiaoguang.chen@intel.com>,
Kirti Wankhede <kwankhede@nvidia.com>
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 [thread overview]
Message-ID: <580981AD.6010205@intel.com> (raw)
In-Reply-To: <3FF9A87CC29019478F02EAECEB93CDC838D28085@shsmsx102.ccr.corp.intel.com>
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
WARNING: multiple messages have this Message-ID (diff)
From: Jike Song <jike.song@intel.com>
To: "Xiao, Guangrong" <guangrong.xiao@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Xiao Guangrong <guangrong.xiao@linux.intel.com>,
Alex Williamson <alex.williamson@redhat.com>,
"Tian, Kevin" <kevin.tian@intel.com>, Neo Jia <cjia@nvidia.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
qemu-devel <qemu-devel@nongnu.org>,
"Chen, Xiaoguang" <xiaoguang.chen@intel.com>,
Kirti Wankhede <kwankhede@nvidia.com>
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 [thread overview]
Message-ID: <580981AD.6010205@intel.com> (raw)
In-Reply-To: <3FF9A87CC29019478F02EAECEB93CDC838D28085@shsmsx102.ccr.corp.intel.com>
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
next prev parent reply other threads:[~2016-10-21 2:50 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-09 7:41 [PATCH 0/2] page track add notifier type track_flush_slot Xiaoguang Chen
2016-10-09 7:41 ` [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot Xiaoguang Chen
2016-10-09 8:31 ` Neo Jia
2016-10-09 8:56 ` Chen, Xiaoguang
2016-10-10 17:06 ` Paolo Bonzini
2016-10-10 18:01 ` Neo Jia
2016-10-10 18:32 ` Paolo Bonzini
2016-10-11 2:39 ` Xiao Guangrong
2016-10-11 8:54 ` Paolo Bonzini
2016-10-11 9:21 ` Xiao Guangrong
2016-10-11 9:47 ` Paolo Bonzini
2016-10-14 10:37 ` Jike Song
2016-10-14 10:37 ` [Qemu-devel] " Jike Song
2016-10-14 10:43 ` Paolo Bonzini
2016-10-14 10:43 ` [Qemu-devel] " Paolo Bonzini
2016-10-14 12:26 ` Jike Song
2016-10-14 12:26 ` [Qemu-devel] " Jike Song
2016-10-14 14:41 ` Alex Williamson
2016-10-14 14:46 ` Alex Williamson
2016-10-14 14:46 ` [Qemu-devel] " Alex Williamson
2016-10-14 16:35 ` Neo Jia
2016-10-14 16:35 ` Neo Jia
2016-10-14 16:51 ` Alex Williamson
2016-10-14 16:51 ` Alex Williamson
2016-10-14 22:19 ` Neo Jia
2016-10-14 22:19 ` Neo Jia
2016-10-17 16:02 ` Alex Williamson
2016-10-17 16:02 ` Alex Williamson
2016-10-18 12:38 ` Jike Song
2016-10-18 14:59 ` Alex Williamson
2016-10-19 2:32 ` Jike Song
2016-10-19 5:45 ` Xiao Guangrong
2016-10-19 11:56 ` Paolo Bonzini
2016-10-19 11:56 ` [Qemu-devel] " Paolo Bonzini
2016-10-19 13:39 ` Xiao Guangrong
2016-10-19 13:39 ` [Qemu-devel] " Xiao Guangrong
2016-10-19 14:14 ` Paolo Bonzini
2016-10-19 14:14 ` [Qemu-devel] " Paolo Bonzini
2016-10-20 1:48 ` Xiao Guangrong
2016-10-20 17:06 ` Paolo Bonzini
2016-10-20 17:19 ` Xiao, Guangrong
2016-10-20 17:19 ` [Qemu-devel] " Xiao, Guangrong
2016-10-21 2:47 ` Jike Song [this message]
2016-10-21 2:47 ` Jike Song
2016-10-26 13:44 ` Jike Song
2016-10-26 13:44 ` Jike Song
2016-10-26 14:45 ` Paolo Bonzini
2016-10-29 4:07 ` Jike Song
2016-10-29 4:07 ` Jike Song
2016-10-19 13:56 ` Eric Blake
2016-10-19 13:56 ` [Qemu-devel] " Eric Blake
2016-10-24 6:32 ` Jike Song
2016-10-12 20:48 ` Radim Krčmář
2016-10-09 7:41 ` [PATCH 2/2] KVM: MMU: apply page track notifier type track_flush_slot Xiaoguang Chen
2016-10-10 17:06 ` [PATCH 0/2] page track add " Paolo Bonzini
2016-10-11 2:43 ` Xiao Guangrong
2016-10-11 8:55 ` Paolo Bonzini
2016-10-12 20:52 ` Radim Krčmář
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=580981AD.6010205@intel.com \
--to=jike.song@intel.com \
--cc=alex.williamson@redhat.com \
--cc=cjia@nvidia.com \
--cc=guangrong.xiao@intel.com \
--cc=guangrong.xiao@linux.intel.com \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=kwankhede@nvidia.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=xiaoguang.chen@intel.com \
/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.