From: "Michael S. Tsirkin" <mst@redhat.com>
To: Amit Shah <amit.shah@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
virtualization@lists.linux-foundation.org,
Matt Redfearn <matt.redfearn@imgtec.com>
Subject: Re: [PATCH] virtio: console: Unlock vqs while freeing buffers
Date: Tue, 25 Oct 2016 16:19:03 +0300 [thread overview]
Message-ID: <20161025161247-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20161025071803.GG2138@amit-lp.rh>
On Tue, Oct 25, 2016 at 12:48:03PM +0530, Amit Shah wrote:
> On (Tue) 11 Oct 2016 [12:05:15], Matt Redfearn wrote:
> > Commit c6017e793b93 ("virtio: console: add locks around buffer removal
> > in port unplug path") added locking around the freeing of buffers in the
> > vq. However, when free_buf() is called with can_sleep = true and rproc
> > is enabled, it calls dma_free_coherent() directly, requiring interrupts
> > to be enabled. Currently a WARNING is triggered due to the spin locking
> > around free_buf, with a call stack like this:
> >
> > WARNING: CPU: 3 PID: 121 at ./include/linux/dma-mapping.h:433
> > free_buf+0x1a8/0x288
> > Call Trace:
> > [<8040c538>] show_stack+0x74/0xc0
> > [<80757240>] dump_stack+0xd0/0x110
> > [<80430d98>] __warn+0xfc/0x130
> > [<80430ee0>] warn_slowpath_null+0x2c/0x3c
> > [<807e7c6c>] free_buf+0x1a8/0x288
> > [<807ea590>] remove_port_data+0x50/0xac
> > [<807ea6a0>] unplug_port+0xb4/0x1bc
> > [<807ea858>] virtcons_remove+0xb0/0xfc
> > [<807b6734>] virtio_dev_remove+0x58/0xc0
> > [<807f918c>] __device_release_driver+0xac/0x134
> > [<807f924c>] device_release_driver+0x38/0x50
> > [<807f7edc>] bus_remove_device+0xfc/0x130
> > [<807f4b74>] device_del+0x17c/0x21c
> > [<807f4c38>] device_unregister+0x24/0x38
> > [<807b6b50>] unregister_virtio_device+0x28/0x44
> >
> > Fix this by restructuring the loops to allow the locks to only be taken
> > where it is necessary to protect the vqs, and release it while the
> > buffer is being freed.
> >
> > Fixes: c6017e793b93 ("virtio: console: add locks around buffer removal in port unplug path")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
>
> Reviewed-by: Amit Shah <amit.shah@redhat.com>
>
> Michael, can you pick this up?
>
> Thanks,
>
> Amit
Sure.
next prev parent reply other threads:[~2016-10-25 13:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1476183915-13625-1-git-send-email-matt.redfearn@imgtec.com>
2016-10-25 7:18 ` [PATCH] virtio: console: Unlock vqs while freeing buffers Amit Shah
[not found] ` <20161025071803.GG2138@amit-lp.rh>
2016-10-25 13:19 ` Michael S. Tsirkin [this message]
2016-10-11 11:05 Matt Redfearn
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=20161025161247-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=amit.shah@redhat.com \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matt.redfearn@imgtec.com \
--cc=stable@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
/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).