Linux USB
 help / color / mirror / Atom feed
From: Christian Ehrhardt <lk@c--e.de>
To: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>
Cc: heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org,
	neil.armstrong@linaro.org, quic_prashk@quicinc.com,
	dmitry.baryshkov@linaro.org, fabrice.gasnier@foss.st.com,
	saranya.gopal@intel.com, linux-usb@vger.kernel.org
Subject: Re: [RFC PATCH] usb: typec: ucsi: ack connector change after all tasks finish
Date: Wed, 27 Mar 2024 17:06:38 +0100	[thread overview]
Message-ID: <ZgREDo9tYAmdBcUc@cae.in-ulm.de> (raw)
In-Reply-To: <vuh25ueep3rwcmthlkvhb2avpkqzc6lsbee3qdmerolijq7azq@rwmakgznqvmq>


Hi,

thanks for bringing this to my attention.

On Wed, Mar 27, 2024 at 12:39:04PM +0000, Diogo Ivo wrote:
> The UCSI specification mentions that when the OPM is notified by the
> PPM of an asynchronous event it should first send all the commands it
> needs to get the details of the event and only after acknowledge it by
> sending ACK_CC_CI with the Connector Change bit set, while the current
> code sends this ack immediately after scheduling all the partner_tasks.
> Move this ACK_CC_CI command to the end of all partner_tasks.

I think this is reading too much into the spec. The only thing we
really need to know about the event itself is what we get from
the initial UCSI_GET_CONNECTOR_STATUS command. I was planning to
send a change that acks the connector change directly along with this.

All of the problems that I saw in this area were due to the fact
that the connector change indicator was cleared too late and not
too early.

Moreover, it can take quite some time to handle a connector change on
one connector. This would block any progress on a different connector,
too.

> This fixes a problem with some LG Gram laptops where the PPM sometimes
> notifies the OPM with the Connector Change Indicator field set in the
> CCI after an ACK_CC_CI command is sent,causing the UCSI stack to check
> the connector status indefinitely since the EVENT_PENDING bit is already
> cleared. This causes an interrupt storm and an artificial high load on
> these platforms.

If the PPM does this for a connector change ACK_CC_CI command it is
IMHO violating the spec (unless there is a _new_ event).
When I saw this type of loops the connector change indicator was set
in response to an ACK_CC_CI command for a command (sent by a different
thread for a different connector) between clearing the EVENT_PENDING
bit and acquiring the PPM lock.

Can you test if the changes that already are in usb-linus are
sufficient to fix your issues?

      regards    Christian



  parent reply	other threads:[~2024-03-27 16:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27 12:39 [RFC PATCH] usb: typec: ucsi: ack connector change after all tasks finish Diogo Ivo
2024-03-27 13:06 ` Dmitry Baryshkov
2024-03-27 14:37   ` Diogo Ivo
2024-03-27 16:06 ` Christian Ehrhardt [this message]
2024-03-28 15:42   ` Diogo Ivo
2024-03-28 22:40     ` Christian Ehrhardt
2024-04-24 11:23       ` Diogo Ivo
2024-04-25 18:05         ` Christian Ehrhardt
2024-03-27 16:42 ` Christian Ehrhardt
2024-03-28 16:04   ` Diogo Ivo

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=ZgREDo9tYAmdBcUc@cae.in-ulm.de \
    --to=lk@c--e.de \
    --cc=diogo.ivo@tecnico.ulisboa.pt \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=fabrice.gasnier@foss.st.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=quic_prashk@quicinc.com \
    --cc=saranya.gopal@intel.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