Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1444309

Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support

From Felipe Balbi <felipe.balbi@linux.intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support
Date 2016-07-15 15:20 +0200
Message-ID <rVbc5-7mF-7@gated-at.bofh.it> (permalink)
References <rV0Tn-ZV-7@gated-at.bofh.it> <rV5Jn-40F-17@gated-at.bofh.it> <rV6YO-4Gq-13@gated-at.bofh.it> <rV8Hf-5Li-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Hi again,

Felipe Balbi <felipe.balbi@linux.intel.com> writes:
> Oliver Neukum <oneukum@suse.com> writes:
>> On Fri, 2016-07-15 at 10:25 +0300, Felipe Balbi wrote:
>>> > +int pd_sink_queue_msg(struct pd_sink_msg *msg)
>>> > +{
>>> > +     unsigned long flags;
>>> > +     struct pd_sink_port *port;
>>> > +
>>> > +     if (msg->port < 0 || msg->port >= MAX_NR_SINK_PORTS) {
>>> > +             pr_err("Invalid port number\n");
>>> > +             return -EINVAL;
>>> > +     }
>>> > +
>>> > +     port = sink_ports[msg->port];
>>> > +
>>> > +     spin_lock_irqsave(&port->rx_lock, flags);
>>> > +     list_add_tail(&msg->list, &port->rx_list);
>>> > +     spin_unlock_irqrestore(&port->rx_lock, flags);
>>> > +
>>> > +     queue_work(port->rx_wq, &port->rx_work);
>>> 
>>> can we really queue several messages at a time? It seems unfeasible to
>>> me. It's not like we can queue several power request in a role. Why do
>>> you need this workqueue? Why don't you process message here, in place?
>>
>> A reset can come at any time.
>
> right, but that's not how this is being used. IMHO, rx_work is a
> misnomer. If you look at how typec_wcove (patch 2 in this series) uses
> it, you'll see that pd_sink_queue_msg() is called to queue a reply to a
> message that was *already* received. We can't have two replies, right?
>
> In any case, this is a minor problem.

oh wait, it's not a minor problem. If CPU is busy, this workqueue might
take longer than 30ms to get scheduled. This is another problem I just
reproduced, even after changing that pr_info() in print_message() to a
pr_debug().

Everything worked fine when I called rx_msg_worker() directly, instead
of queueing it to the workqueue.

-- 
balbi

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support Felipe Balbi <felipe.balbi@linux.intel.com> - 2016-07-15 09:30 +0200
  Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support Oliver Neukum <oneukum@suse.com> - 2016-07-15 10:50 +0200
    Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support Felipe Balbi <felipe.balbi@linux.intel.com> - 2016-07-15 12:40 +0200
      Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support Felipe Balbi <felipe.balbi@linux.intel.com> - 2016-07-15 15:20 +0200
  Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support Bin Gao <bin.gao@linux.intel.com> - 2016-07-16 01:50 +0200
    Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support Felipe Balbi <felipe.balbi@linux.intel.com> - 2016-07-18 09:10 +0200
      Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support Bin Gao <bin.gao@linux.intel.com> - 2016-07-19 07:40 +0200
        Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support Felipe Balbi <felipe.balbi@linux.intel.com> - 2016-07-19 10:40 +0200

csiph-web