Re: System crashes when usb_free_streams API used

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

 



Dear Sarah,

Thanks for the information.

>> The driver seems to be working fine and there is no system crash when
>> I comment the API named, xhci_free_streams_info(), in the
>> xhci_free_streams() routine which is defined in the xhci.c file.
>
> What version of the code are you working with?  My xhci-streams branch
> does not have a function named xhci_free_streams_info().

It is xhci_free_stream_info(), but NOT xhci_free_streams_info(). Sorry
for the TYPO.

>> This
>> is because, the same API is called from xhci_free_virt_device()
>> routine which is defined in xhci-mem.c file. When it is called twice,
>> I saw the following messages (3 times) in the kernel log.
>
> I'm confused.  If xhci_free_virt_device() got to freeing the streams, it
> should also set xhci->devs[slot_id] to NULL.  All calls to
> xhci_free_virt_device() should be made while holding the xhci->lock.
> With that assumption, xhci_free_streams() would exit early after
> grabbing the lock and calling xhci_calculate_no_streams_bitmask(), which
> will return early when it sees xhci->devs[slot_id] to be NULL.

The API xhci_free_stream_info() is called from xhci_free_streams() API
first, then it is called from xhci_free_virt_device(). I guess, the
xhci_free_streams() would not exit early as the return value from the
xhci_calculate_no_streams_bitmask() is not 0 as it does not see
xhci->devs[slot_id] equals to NULL.

>> xhci_hcd 0000:06:00.0: dma_pool_free xHCI input/output contexts,
>> 7269762f/6c617574 (bad dma)
>>
>> If I do not call usb_free_streams API, the xhci_free_streams_info() is
>> called only one time from the from xhci_free_virt_device() routine.
>> This time, I did not see any "bad dma" messages in the kernel log. So,
>> I just commented the xhci_free_streams_info() API call in the
>> xhci_free_streams() routine. After, commenting this, every thing seems
>> to be working fine.
>>
>> Please let me know If this is the right way of doing it.
>
> Please update to the latest streams branch and see if you still have
> this issue.  If you do, send me a patch that implements your fix
> described above.

I checked out the xhci-streams branch today with the following commands.

# git clone git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci.git
# cd xhci
# git checkout –b xhci-streams origin/xhci-streams

The latest kernel version is 2.6.34-rc4. I saw the system crash with
this kernel version also as the xhci_free_stream_info() API is called
twice. Then, I commented the xhci_free_stream_info() API call in the
xhci_free_streams() routine which is defined in the xhci.c file. After
commenting this, everything seems to be working fine and I do not see
any system crash. Please find the attached patch.

Please let me know if there is anything wrong.

Thanks and Regards,
Ramya.

Attachment: xhci_free_stream_info-API-Commenting.patch
Description: Binary data


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

  Powered by Linux