Re: [PATCH 8/9 v5 resend] xHCI: Allocate 2 segments for transfer ring

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

 



On 03/06/2012 01:41 AM, Sarah Sharp wrote:
> I'm pretty sure you want this patch before the patch to change the sg
> table size.  Otherwise people could run into issues with mass storage
> devices running out of room on the ring when they're doing a git-bisect,
> because you've told that driver you can handle an infinite transfer
> size, but then you can't always expand the ring.
> 

OK.

> BTW, which patch prevents the enqueue pointer from going into the
> dequeue segment?  Even though you allocate two segments initially here,
> we can still run into problems after one ring expansion unless the
> room_on_ring check prevents the enqueue pointer from going into the
> dequeue segment.
> 

The patch9 is doing this. It modifies room_on_ring() check, and return 0
if the enqueue pointer is going into dequeue segment.

In fact, with patch9, I think patch8 is not necessary. With one segment,
at the beginning the enqueue pointer is always ahead of dequeue pointer,
and when it wants to pass link TRB, it will find it's forbidden to
advance into the dequeue segment(same as enqueue segment), the
room_on_ring() check fails and allocate new segments. With patch8, we
can avoid this ring expansion.

Thanks,
Andiry

> 
> On Mon, Mar 05, 2012 at 05:49:39PM +0800, Andiry Xu wrote:
>> Allocate 2 segments for transfer ring by default, so we can expand the ring
>> when the enqueue pointer and dequeue pointer are in different segments.
>>
>> Signed-off-by: Andiry Xu <andiry.xu@xxxxxxx>
>> ---
>>  drivers/usb/host/xhci-mem.c |    6 +++---
>>  1 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
>> index c37aa1b..cae4c6f 100644
>> --- a/drivers/usb/host/xhci-mem.c
>> +++ b/drivers/usb/host/xhci-mem.c
>> @@ -642,7 +642,7 @@ struct xhci_stream_info *xhci_alloc_stream_info(struct xhci_hcd *xhci,
>>  	 */
>>  	for (cur_stream = 1; cur_stream < num_streams; cur_stream++) {
>>  		stream_info->stream_rings[cur_stream] =
>> -			xhci_ring_alloc(xhci, 1, 1, TYPE_STREAM, mem_flags);
>> +			xhci_ring_alloc(xhci, 2, 1, TYPE_STREAM, mem_flags);
>>  		cur_ring = stream_info->stream_rings[cur_stream];
>>  		if (!cur_ring)
>>  			goto cleanup_rings;
>> @@ -976,7 +976,7 @@ int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id,
>>  	}
>>  
>>  	/* Allocate endpoint 0 ring */
>> -	dev->eps[0].ring = xhci_ring_alloc(xhci, 1, 1, TYPE_CTRL, flags);
>> +	dev->eps[0].ring = xhci_ring_alloc(xhci, 2, 1, TYPE_CTRL, flags);
>>  	if (!dev->eps[0].ring)
>>  		goto fail;
>>  
>> @@ -1423,7 +1423,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
>>  	type = usb_endpoint_type(&ep->desc);
>>  	/* Set up the endpoint ring */
>>  	virt_dev->eps[ep_index].new_ring =
>> -		xhci_ring_alloc(xhci, 1, 1, type, mem_flags);
>> +		xhci_ring_alloc(xhci, 2, 1, type, mem_flags);
>>  	if (!virt_dev->eps[ep_index].new_ring) {
>>  		/* Attempt to use the ring cache */
>>  		if (virt_dev->num_rings_cached == 0)
>> -- 
>> 1.7.4.1
>>
>>
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux