* [PATCH v3][for 4.14] xhci: allow TRACE to work with EVENT ring dequeue
@ 2017-09-25 12:26 Adam Wallis
2017-09-25 16:09 ` David Laight
0 siblings, 1 reply; 6+ messages in thread
From: Adam Wallis @ 2017-09-25 12:26 UTC (permalink / raw)
To: linux-arm-kernel
inc_deq() currently bails earlier for EVENT rings than the common return
point of the function, due to the fact that EVENT rings do not have
link TRBs. The unfortunate side effect of this is that the very useful
trace_xhci_inc_deq() function is not called/usable for EVENT ring
debug.
This patch provides a refactor by removing the multiple return exit
points into a single return which additionally allows for all rings to
use the trace function.
Signed-off-by: Adam Wallis <awallis@codeaurora.org>
---
Changes in v2: undo accidental line removal at end of patch
Changes in v3: reduced complexity by using goto as recommended by Mathias
drivers/usb/host/xhci-ring.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index a944365..8d3df2f 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -171,13 +171,13 @@ static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring)
if (ring->type == TYPE_EVENT) {
if (!last_trb_on_seg(ring->deq_seg, ring->dequeue)) {
ring->dequeue++;
- return;
+ goto out;
}
if (last_trb_on_ring(ring, ring->deq_seg, ring->dequeue))
ring->cycle_state ^= 1;
ring->deq_seg = ring->deq_seg->next;
ring->dequeue = ring->deq_seg->trbs;
- return;
+ goto out;
}
/* All other rings have link trbs */
@@ -190,6 +190,7 @@ static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring)
ring->dequeue = ring->deq_seg->trbs;
}
+out:
trace_xhci_inc_deq(ring);
return;
--
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v3][for 4.14] xhci: allow TRACE to work with EVENT ring dequeue
2017-09-25 12:26 [PATCH v3][for 4.14] xhci: allow TRACE to work with EVENT ring dequeue Adam Wallis
@ 2017-09-25 16:09 ` David Laight
2017-09-25 17:03 ` Adam Wallis
2017-09-26 6:44 ` Mathias Nyman
0 siblings, 2 replies; 6+ messages in thread
From: David Laight @ 2017-09-25 16:09 UTC (permalink / raw)
To: linux-arm-kernel
From: Adam Wallis
> Sent: 25 September 2017 13:26
> inc_deq() currently bails earlier for EVENT rings than the common return
> point of the function, due to the fact that EVENT rings do not have
> link TRBs. The unfortunate side effect of this is that the very useful
> trace_xhci_inc_deq() function is not called/usable for EVENT ring
> debug.
Is it actually worth using different functions for the different
ring types?
>From what I remember there are conditionals in a lot of the functions
but they are fixed for most of the call sites.
David
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3][for 4.14] xhci: allow TRACE to work with EVENT ring dequeue
2017-09-25 16:09 ` David Laight
@ 2017-09-25 17:03 ` Adam Wallis
2017-09-26 6:44 ` Mathias Nyman
1 sibling, 0 replies; 6+ messages in thread
From: Adam Wallis @ 2017-09-25 17:03 UTC (permalink / raw)
To: linux-arm-kernel
On 9/25/2017 12:09 PM, David Laight wrote:
> From: Adam Wallis
>> Sent: 25 September 2017 13:26
>> inc_deq() currently bails earlier for EVENT rings than the common return
>> point of the function, due to the fact that EVENT rings do not have
>> link TRBs. The unfortunate side effect of this is that the very useful
>> trace_xhci_inc_deq() function is not called/usable for EVENT ring
>> debug.
>
> Is it actually worth using different functions for the different
> ring types?
David, that is what this patch attempts to add/fix. Instead of adding another
TRACE function for event rings, it hooks the existing trace functionality
already used in inc_deq()
> From what I remember there are conditionals in a lot of the functions
> but they are fixed for most of the call sites.
That's basically all this patch is...fixing a conditional. Thanks for the
feedback, let me know if I misunderstood your comments!
>
> David
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
--
Adam Wallis
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3][for 4.14] xhci: allow TRACE to work with EVENT ring dequeue
2017-09-25 16:09 ` David Laight
2017-09-25 17:03 ` Adam Wallis
@ 2017-09-26 6:44 ` Mathias Nyman
2017-10-04 16:07 ` Adam Wallis
1 sibling, 1 reply; 6+ messages in thread
From: Mathias Nyman @ 2017-09-26 6:44 UTC (permalink / raw)
To: linux-arm-kernel
On 25.09.2017 19:09, David Laight wrote:
> From: Adam Wallis
>> Sent: 25 September 2017 13:26
>> inc_deq() currently bails earlier for EVENT rings than the common return
>> point of the function, due to the fact that EVENT rings do not have
>> link TRBs. The unfortunate side effect of this is that the very useful
>> trace_xhci_inc_deq() function is not called/usable for EVENT ring
>> debug.
>
> Is it actually worth using different functions for the different
> ring types?
> From what I remember there are conditionals in a lot of the functions
> but they are fixed for most of the call sites.
>
There's some restructuring and refactoring that could be done in xhci,
but that's not part of this patch.
This will just enable better debugging.
Applying this patch
Thanks
-Mathias
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3][for 4.14] xhci: allow TRACE to work with EVENT ring dequeue
2017-09-26 6:44 ` Mathias Nyman
@ 2017-10-04 16:07 ` Adam Wallis
2017-10-05 9:52 ` Mathias Nyman
0 siblings, 1 reply; 6+ messages in thread
From: Adam Wallis @ 2017-10-04 16:07 UTC (permalink / raw)
To: linux-arm-kernel
On 9/26/2017 2:44 AM, Mathias Nyman wrote:
> On 25.09.2017 19:09, David Laight wrote:
>> From: Adam Wallis
>>> Sent: 25 September 2017 13:26
>>> inc_deq() currently bails earlier for EVENT rings than the common return
>>> point of the function, due to the fact that EVENT rings do not have
>>> link TRBs. The unfortunate side effect of this is that the very useful
>>> trace_xhci_inc_deq() function is not called/usable for EVENT ring
>>> debug.
>>
>> Is it actually worth using different functions for the different
>> ring types?
>> ?From what I remember there are conditionals in a lot of the functions
>> but they are fixed for most of the call sites.
>>
>
> There's some restructuring and refactoring that could be done in xhci,
> but that's not part of this patch.
>
> This will just enable better debugging.
>
> Applying this patch
Sounds great, thanks! Will this be going in on 4.14 sometime shortly? I hadn't
seen it in your tree and was curious since we are tracking internally. Thanks!
>
> Thanks
> -Mathias
--
Adam Wallis
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3][for 4.14] xhci: allow TRACE to work with EVENT ring dequeue
2017-10-04 16:07 ` Adam Wallis
@ 2017-10-05 9:52 ` Mathias Nyman
0 siblings, 0 replies; 6+ messages in thread
From: Mathias Nyman @ 2017-10-05 9:52 UTC (permalink / raw)
To: linux-arm-kernel
On 04.10.2017 19:07, Adam Wallis wrote:
> On 9/26/2017 2:44 AM, Mathias Nyman wrote:
>> On 25.09.2017 19:09, David Laight wrote:
>>> From: Adam Wallis
>>>> Sent: 25 September 2017 13:26
>>>> inc_deq() currently bails earlier for EVENT rings than the common return
>>>> point of the function, due to the fact that EVENT rings do not have
>>>> link TRBs. The unfortunate side effect of this is that the very useful
>>>> trace_xhci_inc_deq() function is not called/usable for EVENT ring
>>>> debug.
>>>
>>> Is it actually worth using different functions for the different
>>> ring types?
>>> From what I remember there are conditionals in a lot of the functions
>>> but they are fixed for most of the call sites.
>>>
>>
>> There's some restructuring and refactoring that could be done in xhci,
>> but that's not part of this patch.
>>
>> This will just enable better debugging.
>>
>> Applying this patch
> Sounds great, thanks! Will this be going in on 4.14 sometime shortly? I hadn't
> seen it in your tree and was curious since we are tracking internally. Thanks!
>
Now pushed to my for-usb-next branch and sent forward to Greg.
On its way to 4.15
-Mathias
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-10-05 9:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-25 12:26 [PATCH v3][for 4.14] xhci: allow TRACE to work with EVENT ring dequeue Adam Wallis
2017-09-25 16:09 ` David Laight
2017-09-25 17:03 ` Adam Wallis
2017-09-26 6:44 ` Mathias Nyman
2017-10-04 16:07 ` Adam Wallis
2017-10-05 9:52 ` Mathias Nyman
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).