From: Zhenyu Wang <zhenyuw@linux.intel.com>
To: Jike Song <jike.song@intel.com>
Cc: Alex Williamson <alex.williamson@redhat.com>,
intel-gvt-dev@lists.freedesktop.org, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org#v4.10,
Paolo Bonzini <pbonzini@redhat.com>,
Zhi Wang <zhi.a.wang@intel.com>
Subject: Re: [PATCH] kvmgt: Hold struct kvm reference
Date: Mon, 20 Mar 2017 15:05:47 +0800 [thread overview]
Message-ID: <20170320070547.whyfdsr76ji7lexe@zhen-hp.sh.intel.com> (raw)
In-Reply-To: <58CF7D7E.6010006@intel.com>
[-- Attachment #1: Type: text/plain, Size: 2198 bytes --]
On 2017.03.20 14:58:06 +0800, Jike Song wrote:
> On 03/20/2017 10:38 AM, Alex Williamson wrote:
> > The kvmgt code keeps a pointer to the struct kvm associated with the
> > device, but doesn't actually hold a reference to it. If we do unclean
> > shutdown testing (ie. killing the user process), then we can see the
> > kvm association to the device unset, which causes kvmgt to trigger a
> > device release via a work queue. Naturally we cannot guarantee that
> > the cached struct kvm pointer is still valid at this point without
> > holding a reference. The observed failure in this case is a stuck
> > cpu trying to acquire the spinlock from the invalid reference, but
> > other failure modes are clearly possible. Hold a reference to avoid
> > this.
> >
> > Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> > Cc: stable@vger.kernel.org #v4.10
> > Cc: Jike Song <jike.song@intel.com>
> > Cc: Paolo Bonzini <pbonzini@redhat.com>
> > Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
> > Cc: Zhi Wang <zhi.a.wang@intel.com>
> > ---
>
> Reviewed-by: Jike Song <jike.song@intel.com>
>
> Thanks for the fix!
>
queued in fixes tree, thanks!
>
> > drivers/gpu/drm/i915/gvt/kvmgt.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
> > index 84d801638ede..142b8bd4ba6b 100644
> > --- a/drivers/gpu/drm/i915/gvt/kvmgt.c
> > +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
> > @@ -1324,6 +1324,7 @@ static int kvmgt_guest_init(struct mdev_device *mdev)
> > vgpu->handle = (unsigned long)info;
> > info->vgpu = vgpu;
> > info->kvm = kvm;
> > + kvm_get_kvm(info->kvm);
> >
> > kvmgt_protect_table_init(info);
> > gvt_cache_init(vgpu);
> > @@ -1343,6 +1344,7 @@ static bool kvmgt_guest_exit(struct kvmgt_guest_info *info)
> > }
> >
> > kvm_page_track_unregister_notifier(info->kvm, &info->track_node);
> > + kvm_put_kvm(info->kvm);
> > kvmgt_protect_table_destroy(info);
> > gvt_cache_destroy(info->vgpu);
> > vfree(info);
> >
--
Open Source Technology Center, Intel ltd.
$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 163 bytes --]
prev parent reply other threads:[~2017-03-20 7:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-20 2:38 Alex Williamson
2017-03-20 6:58 ` Jike Song
2017-03-20 7:05 ` Zhenyu Wang [this message]
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=20170320070547.whyfdsr76ji7lexe@zhen-hp.sh.intel.com \
--to=zhenyuw@linux.intel.com \
--cc=alex.williamson@redhat.com \
--cc=intel-gvt-dev@lists.freedesktop.org \
--cc=jike.song@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=stable@vger.kernel.org#v4.10 \
--cc=zhi.a.wang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®