public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <felipe.balbi@linux.intel.com>
To: Oliver Neukum <oneukum@suse.com>
Cc: Bin Gao <bin.gao@linux.intel.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	Bin Gao <bin.gao@intel.com>,
	Chandra Sekhar Anagani <chandra.sekhar.anagani@intel.com>
Subject: Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support
Date: Fri, 15 Jul 2016 16:13:01 +0300	[thread overview]
Message-ID: <87d1mfgi3m.fsf@linux.intel.com> (raw)
In-Reply-To: <87poqfgpmm.fsf@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 1752 bytes --]


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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

  reply	other threads:[~2016-07-15 13:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-15  2:14 [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support Bin Gao
2016-07-15  6:31 ` Oliver Neukum
2016-07-15 22:33   ` Bin Gao
2016-07-15  7:25 ` Felipe Balbi
2016-07-15  8:44   ` Oliver Neukum
2016-07-15 10:30     ` Felipe Balbi
2016-07-15 13:13       ` Felipe Balbi [this message]
2016-07-15 23:49   ` Bin Gao
2016-07-18  7:07     ` Felipe Balbi
2016-07-19  5:39       ` Bin Gao
2016-07-19  8:29         ` Felipe Balbi
2016-07-15 10:38 ` Felipe Balbi
2016-07-15 11:11   ` Greg Kroah-Hartman
2016-07-15 11:21     ` Felipe Balbi
2016-07-15 22:41       ` Bin Gao
2016-07-15 23:49         ` Greg Kroah-Hartman
2016-07-19  5:30           ` Bin Gao
2016-07-19  8:30             ` Felipe Balbi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d1mfgi3m.fsf@linux.intel.com \
    --to=felipe.balbi@linux.intel.com \
    --cc=bin.gao@intel.com \
    --cc=bin.gao@linux.intel.com \
    --cc=chandra.sekhar.anagani@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=oneukum@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox