Re: [PATCHv7 4/4] virtio_console: Add support for remoteproc serial

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Amit Shah <amit.shah@xxxxxxxxxx> writes:
> On (Tue) 23 Oct 2012 [12:17:49], Rusty Russell wrote:
>> sjur.brandeland@xxxxxxxxxxxxxx writes:
>> > From: Sjur Brændeland <sjur.brandeland@xxxxxxxxxxxxxx>
>
>> > @@ -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.

Cheers,
Rusty.
_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization



[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux