From: Jike Song <jike.song@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: alex.williamson@redhat.com, guangrong.xiao@linux.intel.com,
kwankhede@nvidia.com, cjia@nvidia.com, kevin.tian@intel.com,
kvm@vger.kernel.org
Subject: Re: [v2 4/5] vfio: implement APIs to set/put kvm to/from vfio group
Date: Mon, 31 Oct 2016 10:12:35 +0800 [thread overview]
Message-ID: <5816A893.8090007@intel.com> (raw)
In-Reply-To: <01dc22a2-b221-a50c-ad25-9f1456e4aa6a@redhat.com>
On 10/30/2016 04:52 PM, Paolo Bonzini wrote:
> On 29/10/2016 22:05, Jike Song wrote:
>> + mutex_lock(&group->udata.lock);
>> +
>> + if (!group->udata.kvm)
>> + goto out;
>> +
>> + kvm_get_kvm(group->udata.kvm);
>> + mutex_unlock(&group->udata.lock);
>> + return group->udata.kvm;
>
> There is still a very small race window, so you need to assign
> group->udata.kvm to a local variable inside the mutex, and then return.
Ok, will do that, thanks :)
--
Thanks,
Jike
next prev parent reply other threads:[~2016-10-31 2:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-29 20:05 [v2 0/5] plumb kvm/vfio to allow getting kvm from vfio_group Jike Song
2016-10-29 20:05 ` [v2 1/5] vfio: Rearrange functions to get vfio_group from dev Jike Song
2016-10-29 20:05 ` [v2 2/5] vfio: export functions to get vfio_group from device and put it Jike Song
2016-10-29 20:05 ` [v2 3/5] KVM: move kvm_{get|put}_kvm to kvm_host.h Jike Song
2016-10-30 8:53 ` Paolo Bonzini
2016-10-31 1:40 ` Jike Song
2016-10-29 20:05 ` [v2 4/5] vfio: implement APIs to set/put kvm to/from vfio group Jike Song
2016-10-29 22:15 ` kbuild test robot
2016-10-30 8:52 ` Paolo Bonzini
2016-10-31 2:12 ` Jike Song [this message]
2016-10-29 20:05 ` [v2 5/5] KVM: set/clear kvm to/from vfio group during add/delete Jike Song
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=5816A893.8090007@intel.com \
--to=jike.song@intel.com \
--cc=alex.williamson@redhat.com \
--cc=cjia@nvidia.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 \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).