From: Jian Jun Chen <jian.jun.chen@intel.com>
To: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Cc: kraxel@redhat.com, mst@redhat.com, jasowang@redhat.com,
yu1.wang@intel.com, shuo.a.liu@intel.com, jie.deng@intel.com,
conghui.chen@intel.com, Jian Jun Chen <jian.jun.chen@intel.com>
Subject: [PATCH] virtio-input: reset device when going to sleep
Date: Tue, 7 Aug 2018 11:02:10 +0800 [thread overview]
Message-ID: <20180807030210.16543-1-jian.jun.chen@intel.com> (raw)
When going to sleep all virtqueues are deleted, memory used for
descriptor table entries are freed. Device reset is required in
this case to notify the backend driver.
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
---
drivers/virtio/virtio_input.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/virtio/virtio_input.c b/drivers/virtio/virtio_input.c
index 3a0468f2ceb0..20ea660bf1fc 100644
--- a/drivers/virtio/virtio_input.c
+++ b/drivers/virtio/virtio_input.c
@@ -332,12 +332,16 @@ static void virtinput_remove(struct virtio_device *vdev)
static int virtinput_freeze(struct virtio_device *vdev)
{
struct virtio_input *vi = vdev->priv;
+ void *buf;
unsigned long flags;
spin_lock_irqsave(&vi->lock, flags);
vi->ready = false;
spin_unlock_irqrestore(&vi->lock, flags);
+ vdev->config->reset(vdev);
+ while ((buf = virtqueue_detach_unused_buf(vi->sts)) != NULL)
+ kfree(buf);
vdev->config->del_vqs(vdev);
return 0;
}
--
2.17.1
reply other threads:[~2018-08-07 2:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20180807030210.16543-1-jian.jun.chen@intel.com \
--to=jian.jun.chen@intel.com \
--cc=conghui.chen@intel.com \
--cc=jasowang@redhat.com \
--cc=jie.deng@intel.com \
--cc=kraxel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=shuo.a.liu@intel.com \
--cc=virtualization@lists.linux-foundation.org \
--cc=yu1.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®