Linux USB
 help / color / mirror / Atom feed
From: huangwei <huangwei@kylinos.cn>
To: "Jacob Riff" <jacob@riff.dk>,
	 "Heikki Krogerus" <heikki.krogerus@linux.intel.com>
Cc: 黄伟 <huangwei@kylinos.cn>, linux-usb <linux-usb@vger.kernel.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Subject: Re: Re: [RFC PATCH] usb: typec: ucsi: retry init when the PPM answers early commands incorrectly
Date: Mon, 17 Aug 2026 17:01:11 +0800	[thread overview]
Message-ID: <202608171701083146745@kylinos.cn> (raw)
In-Reply-To: 20260817043746.1449099-1-jacob@riff.dk

Hi Jacob,

Thanks - that resolves my concern. I had missed that the "possible
UCSI driver bug" dev_err in ucsi_read_error() is untouched by your
patch, so first-occurrence visibility is preserved and the bounded
retry only delays the final verdict by ~10s. Restricting the retry
to the ucsi_init_work() path is a reasonable discriminator, given
the error codes really are identical between the two cases.

No further comments from my side. Good luck with the RFC.

Best regards,
Huang Wei




于 2026-08-17 12:37, Jacob Riff 写道: 



On Mon, 17 Aug 2026 11:19:24 +0800, huangwei wrote:



> There the commands do complete, but the EC takes longer than the 5s



> hardcoded wait in ucsi_sync_control_common(). The fix for that case is



> already reviewed [1] (thanks Heikki, Fedor), so both failure modes of



> the "PPM not ready during boot" window would be covered:



>



>   - slow answers  -> longer completion timeout [1]



>   - wrong answers -> init retry (this RFC)



 



Hi Huang Wei,



 



Thanks for taking a look, and good to see the two failure modes of



the boot window end up with complementary fixes.



 



> One small question on the -EINVAL retry: ucsi_read_error() also



> returns -EINVAL for UCSI_ERROR_INVALID_CON_NUM / UNREGONIZED_CMD /



> INVALID_CMD_ARGUMENT, which are logged as "possible UCSI driver bug".



> Retrying those is harmless in practice (debug-level logging, bounded



> attempts), but it delays the report of a genuine driver bug from the



> first occurrence to the 100th. Did you consider distinguishing the



> PPM-not-ready case from the real error case, or is the simplicity of



> retrying both worth that trade-off?



 



I considered it, but by error code the two cases are identical. On



this machine the not-ready PPM answers a valid standard init command



with UNREGONIZED_CMD / INVALID_CMD_ARGUMENT - exactly the codes



ucsi_read_error() maps to "possible UCSI driver bug". So the only



discriminators left are context and persistence, which is what the



patch relies on: the retry exists only in the ucsi_init_work() path



(a runtime -EINVAL is unaffected), the not-ready window has cleared



after a single retry in every boot observed here, and a genuine bug



fails deterministically, exhausts the bounded attempts (100 x 100ms



= 10s with the role switch constants) and still ends in the loud



"PPM init failed, stop trying".



 



On delaying the report: the "possible UCSI driver bug" message is



dev_err in ucsi_read_error() and this patch does not touch it, so it



still fires on the first occurrence. With the retries a deterministic



bug would print it on every attempt before the final error, so the



cost is a 10 second delay of the final verdict rather than a hidden



report. That seemed a fair price for reusing the existing role switch



retry machinery unchanged.



 



Best regards,



Jacob







2026-08-17



公司:麒麟软件有限公司



姓名:黄伟 (Daway.Huang)



地址:上海市徐汇区番禺路1028号数娱大厦12楼



邮编:200030



电话:021-51098866-6033



手机:13814996575



Email:huangwei@kylinos.cn



      reply	other threads:[~2026-08-17  9:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <202608171119200877083@kylinos.cn>
2026-08-17  4:37 ` [RFC PATCH] usb: typec: ucsi: retry init when the PPM answers early commands incorrectly Jacob Riff
2026-08-17  9:01   ` huangwei [this message]

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=202608171701083146745@kylinos.cn \
    --to=huangwei@kylinos.cn \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=jacob@riff.dk \
    --cc=linux-usb@vger.kernel.org \
    /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