From: Amit Shah <amit.shah@redhat.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
Linus Walleij <linus.walleij@linaro.org>,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
sjur.brandeland@stericsson.com
Subject: Re: [PATCHv7 4/4] virtio_console: Add support for remoteproc serial
Date: Fri, 2 Nov 2012 15:50:47 +0530 [thread overview]
Message-ID: <20121102102047.GE10483@amit.redhat.com> (raw)
In-Reply-To: <87r4oc52ov.fsf@rustcorp.com.au>
On (Fri) 02 Nov 2012 [09:52:08], Rusty Russell wrote:
> Amit Shah <amit.shah@redhat.com> writes:
> > On (Tue) 23 Oct 2012 [12:17:49], Rusty Russell wrote:
> >> sjur.brandeland@stericsson.com writes:
> >> > From: Sjur Brændeland <sjur.brandeland@stericsson.com>
> >
> >> > @@ -1415,7 +1524,16 @@ static void remove_port_data(struct port *port)
> >> >
> >> > /* Remove buffers we queued up for the Host to send us data in. */
> >> > while ((buf = virtqueue_detach_unused_buf(port->in_vq)))
> >> > - free_buf(buf);
> >> > + free_buf(buf, true);
> >> > +
> >> > + /*
> >> > + * Remove buffers from out queue for rproc-serial. We cannot afford
> >> > + * to leak any DMA mem, so reclaim this memory even if this might be
> >> > + * racy for the remote processor.
> >> > + */
> >> > + if (is_rproc_serial(port->portdev->vdev))
> >> > + while ((buf = virtqueue_detach_unused_buf(port->out_vq)))
> >> > + free_buf(buf, true);
> >> > }
> >>
> >> This seems wrong; either this is needed even if !is_rproc_serial(), or
> >> it's not necessary as the out_vq is empty.
> >>
> >> Every path I can see has the device reset (in which case the queues
> >> should not be active), or we got a VIRTIO_CONSOLE_PORT_REMOVE event (in
> >> which case, the same).
> >>
> >> I think we can have non-blocking writes which could leave buffers in
> >> out_vq: Amit?
> >
> > Those get 'reclaimed' just above this hunk:
> >
> >
> > static void remove_port_data(struct port *port)
> > {
> > struct port_buffer *buf;
> >
> > /* Remove unused data this port might have received. */
> > discard_port_data(port);
> >
> > reclaim_consumed_buffers(port);
> >
> > /* Remove buffers we queued up for the Host to send us data in. */
> > while ((buf = virtqueue_detach_unused_buf(port->in_vq)))
> > free_buf(buf, true);
>
> No, that's pending input buffers, not output buffers.
You're right. Nice catch.
Sjur, can you remove the WARN_ON in your latest series, even generic
ports may have buffers in the outq.
It'll also need to be done in the port_fops_release() function. Let
me know if you prefer I send a patch instead.
Thanks,
Amit
next prev parent reply other threads:[~2012-11-02 10:20 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-15 7:57 [PATCHv7 0/4] virtio_console: Add rproc_serial driver sjur.brandeland
2012-10-15 7:57 ` [PATCHv7 1/4] virtio_console: Free buffer if splice fails sjur.brandeland
2012-10-15 7:57 ` [PATCHv7 2/4] virtio_console: Use kmalloc instead of kzalloc sjur.brandeland
2012-10-23 1:36 ` Rusty Russell
2012-10-15 7:57 ` [PATCHv7 3/4] virtio_console: Merge struct buffer_token into struct port_buffer sjur.brandeland
2012-10-23 0:19 ` Rusty Russell
2012-10-15 7:57 ` [PATCHv7 4/4] virtio_console: Add support for remoteproc serial sjur.brandeland
2012-10-23 1:47 ` Rusty Russell
[not found] ` <878vayhsca.fsf@rustcorp.com.au>
2012-10-28 21:58 ` Sjur Brændeland
2012-11-01 7:39 ` Amit Shah
[not found] ` <20121101073951.GA17012@amit.redhat.com>
2012-11-01 23:22 ` Rusty Russell
2012-11-02 10:20 ` Amit Shah [this message]
2012-11-02 10:44 ` Sjur BRENDELAND
2012-11-07 14:22 ` sjur.brandeland
2012-11-07 13:43 ` [PATCH resend] virtio_console: Free buffers from out-queue upon close sjur.brandeland
2012-11-07 23:58 ` Rusty Russell
[not found] ` <87sj8l2cea.fsf@rustcorp.com.au>
2012-11-08 8:59 ` Amit Shah
2012-11-08 9:25 ` Sjur Brændeland
2012-10-22 13:00 ` [PATCHv7 0/4] virtio_console: Add rproc_serial driver Amit Shah
[not found] ` <1350287856-5284-2-git-send-email-sjur.brandeland@stericsson.com>
2012-10-23 0:12 ` [PATCHv7 1/4] virtio_console: Free buffer if splice fails Rusty Russell
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=20121102102047.GE10483@amit.redhat.com \
--to=amit.shah@redhat.com \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mst@redhat.com \
--cc=rusty@rustcorp.com.au \
--cc=sjur.brandeland@stericsson.com \
--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).