lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <534D9981.4030607@redhat.com>
Date:	Tue, 15 Apr 2014 22:41:37 +0200
From:	Hans de Goede <hdegoede@...hat.com>
To:	Julius Werner <jwerner@...omium.org>,
	Mathias Nyman <mathias.nyman@...ux.intel.com>
CC:	"Nyman, Mathias" <mathias.nyman@...el.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
	Sarah Sharp <sarah.a.sharp@...ux.intel.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Vincent Palatin <vpalatin@...omium.org>,
	Luigi Semenzato <semenzato@...omium.org>
Subject: Re: [PATCH] usb: xhci: Prefer endpoint context dequeue pointer over
 stopped_trb

Hi,

On 04/15/2014 09:42 PM, Julius Werner wrote:
> +hdegoede
>
>> I tried to apply this patch on top of 3.15-rc1, but it fails because of the
>> streams support added to xhci_find_new_dequeue_state()
>>
>> After some manual editing the interesting parts of
>> xhci_find_new_dequeue_state() looks like this:
>>
>> @@ -577,46 +568,57 @@ void xhci_find_new_dequeue_state(struct xhci_hcd
>> *xhci,
>>          if (ep->ep_state & EP_HAS_STREAMS) {
>>                  struct xhci_stream_ctx *ctx =
>>                          &ep->stream_info->stream_ctx_array[stream_id];
>> -               state->new_cycle_state = 0x1 &
>> le64_to_cpu(ctx->stream_ring);
>> +               hw_dequeue = le64_to_cpu(ctx->stream_ring);
>>          } else {
>>                  struct xhci_ep_ctx *ep_ctx
>>
>>                          = xhci_get_ep_ctx(xhci, dev->out_ctx, ep_index);
>> -               state->new_cycle_state = 0x1 & le64_to_cpu(ep_ctx->deq);
>> +               hw_dequeue = le64_to_cpu(ep_ctx->deq);
>>          }
>>
>> +       /* Find virtual address and segment of hardware dequeue pointer */
>>
>> +       state->new_deq_seg = ep_ring->deq_seg;
>> +       state->new_deq_ptr = ep_ring->dequeue;
>> +       while (xhci_trb_virt_to_dma(state->new_deq_seg, state->new_deq_ptr)
>> +                       != (dma_addr_t)(hw_dequeue & ~0x1)) {
>> +               next_trb(xhci, ep_ring, &state->new_deq_seg,
>> +                                       &state->new_deq_ptr);
>> +               if (state->new_deq_ptr == ep_ring->dequeue) {
>> +                       WARN_ON(1);
>> +                       return;
>> +               }
>> +       }
>>
>> Also the comparison of the dequeue pointers, using (hw_dequeue & ~0x1) might
>> have some troubles with streams. Endpoint context TR dequeue pointer LO
>> field has bits 3:1 reserved (probably zero) but stream context uses those
>> bits. Would it make sense to use (hw_dequeue & ~0xf) here instead?
>
> Ah, yes, looks like that patch wasn't in Linus' tree yet back when I
> wrote this. I think your merge looks pretty good... just use
> (hw_dequeue & ~0xf) instead of (hw_dequeue & ~0x1) to get the pointer
> as you said, and this should work fine.
>
>> But I'm still concerned about the dequeue pointer in the streams case.
>> streams may be nested, we might be pointing at another stream context
>> instead of the dequeue pointer.

Since I've not followed the entire discussion previously to this I cannot
really provide any useful feedback on this patch. Other then 2 remarks:

1) We don't use nested streams, so no need to worry about those
2) You're right that for streams to get the dequeue address you need
to mask with ~0xf

Regards,

Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ