linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Serge Semin <fancer.lancer@gmail.com>
To: John Stultz <john.stultz@linaro.org>
Cc: Krzysztof Kozlowski <krzk@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Rob Herring <robh+dt@kernel.org>, Felipe Balbi <balbi@kernel.org>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
	<devicetree@vger.kernel.org>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	Linux USB List <linux-usb@vger.kernel.org>,
	lkml <linux-kernel@vger.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	Amit Pundir <amit.pundir@linaro.org>
Subject: Re: [PATCH 29/29] arm64: dts: qcom: Harmonize DWC USB3 DT nodes name
Date: Thu, 22 Jul 2021 21:12:21 +0300	[thread overview]
Message-ID: <20210722181221.xh3r5kyu7zlcojjx@mobilestation> (raw)
In-Reply-To: <CALAqxLViEqSO17P3JGRGYJh-wDoHaJiQQV48zeoRgnar4Xd5Bg@mail.gmail.com>

On Wed, Jul 21, 2021 at 11:08:08AM -0700, John Stultz wrote:
> On Wed, Jul 21, 2021 at 4:25 AM Serge Semin <fancer.lancer@gmail.com> wrote:
> > On Wed, Jul 21, 2021 at 01:10:19PM +0200, Krzysztof Kozlowski wrote:
> > > It's not good example. The configfs entries (file names) are
> > > user-visible however the USB gadget exposes specific value for specific
> > > one device. It encodes device specific DT node name and HW address and
> > > gives it to user-space. It is valid only on this one HW, all other
> > > devices will have different values.
> > >
> > > User-space has hard-coded this value (DT node name and hardware
> > > address). This value was never part of configfs ABI, maybe except of its
> > > format "[a-z]+\.[0-9a-f]+". Format is not broken. Just the value changes
> > > for a specific device/hardware.
> > >
> > > It's like you depend that lsusb will always report:
> > >   Bus 003 Device 008: ID 046d:c52b Logitech, Inc. Unifying Receiver
> > > and then probing order changed and this Logitech ends as Device 009.
> > > Then AOSP guys come, wait, we hard-coded that Logitech on our device
> > > will be always Device 008, not 009. Please revert it, we depend on
> > > specific value of Device number. It must be always 009...
> > >
> > > For the record - the change discussed here it's nothing like USB VID/PID. :)
> >
> > Right I was wrong referring to the configfs names in this context.
> > That must have mislead Greg.
> >
> > Getting back to the topic AFAICS from what John said in here
> > https://lore.kernel.org/lkml/CALAqxLWGujgR7p8Vb5S_RimRVYxwm5XF-c4NkKgMH-43wEBaWg@mail.gmail.com/
> >
> > AOSP developers somehow hardcoded a USB-controller UDC name in the
> > internal property called "sys.usb.controller" with a value
> > "ff100000.dwc3". That value is generated by the kernel based on the
> > corresponding DT-node name. The property is then used to
> > pre-initialize the system like it's done here:
> > https://android.googlesource.com/platform/system/core/+/master/rootdir/init.usb.configfs.rc
> >
> > Since we changed the DT-node name in the recent kernel, we thus changed the
> > UDC controller name so AOSP init procedure now fails to bring up the Linux
> > USB-gadget using on the older UDC name. UDC is supposed to be ff100000.usb now
> > (after this patch has been merged in).
> >
> > What problems I see here:
> > 1) the AOSP developers shouldn't have hard-coded the value but read
> > from the /sys/class/udc/* directory and then decided which controller
> > to use. As it's described for instance here:
> > https://www.kernel.org/doc/Documentation/usb/gadget_configfs.txt
> 

> The problem with this is there may be multiple USB controllers on a
> system (not all exposed outside the case - and also the dummy
> controller is often present). How can we configure the system to know
> which controller is which?

How did you distinguish them before this change? It has nothing really
related with the patch in topic.

> 
> The only name we have for distinguishing the controllers is the DTS
> node. So it seems inherent that changes to that name will break the
> config.

No, it's not the only way you have. I say it was the easiest way for
you to find a corresponding device. The DT-node name never was a part
of ABI for at least up until we finally get the DT-node names
consistent with DT spec. Only then it would be possible to consider
them as such. One more time I'll quote what @Krzisztof has already
told you twice:

On Jul 21, 2021, 1:45 PM +0200, Krzysztof Kozlowski wrote:
> I had impression that kernel defines interfaces which should be used and
> are stable (e.g. syscalls, sysfs and so on). This case is example of
> user-space relying on something not being marked as part of ABI. Instead
> they found something working for them and now it is being used in "we
> cannot break existing systems". Basically, AOSP unilaterally created a
> stable ABI and now kernel has to stick to it.
> 
> Really, all normal systems depend on aliases or names and here we have
> dependency on device address. I proposed way how AOSP should be fixed.
> Anything happened? Nope.

First time he sent a possible solution for the problem:
https://lore.kernel.org/lkml/20201221210423.GA2504@kozik-lap/

To sum up you could have used one of the more portable approaches
1. add an udc alias to the controller and use it then to refer to the
corresponding USB controller
2. search through DT-nodes looking for a specific compatible/reg
DT-properties.

Of course it was easier to revert the patch. But if we always chose
such approach, the kernel would have been filled with tons of
workarounds and legacy parts without possibility to move forward to
having more unified interfaces.

> 
> That said, this issue reminded me of the /dev/hda -> /dev/sda device
> name or the eth0 -> enp3s0 switch which both also had the potential to
> break configurations or scripts.  I get that having a standard naming
> scheme is important (I'm very sympathetic to this point)! I can
> imagine UI trying to show possible controllers for a user to select
> needs a simple way to determine if a device is a usb controller - but
> again this just shows that the node names are an ABI.
> 
> So I'm not the one to judge if this change is useful enough to push
> through the pain, but it did seem to be done a bit casually.
> 
> > 2) even if they hard-coded the value, then they should have used an
> > older dts file for their platform, since DTS is more
> > platform-specific, but not the kernel one. Even if a dts-file is
> > supplied in the kernel it isn't supposed to have the node names
> > unchanged from release to release.
> 
> DTS changes are a constant source of regressions in my experience. We
> mostly just have to roll with it, but it feels never ending. :)  I'd
> personally rather folks in general be more thoughtful about what DTS
> changes they make and accept, understanding that they do have impact
> on userland.  And I'd imagine If updates to linux-firmware broke the
> most recent LTS kernel, that would be seen as a regression too, and
> folks wouldn't be told to just keep the old firmware.

> But all the
> same, I'd also be happy for suggestions to remove any such
> dependencies userland has on specific dts naming, where possible, to
> make the constant pain go away. :)

Well, @Krzisztof has already given you such suggestions regarding this
issue not once. But you tend to ignore them.

Anyway this patch doesn't break LTS kernel and doesn't break the
linux-firmware either. It changes DT-node name, which happens to
change the device name, which isn't guaranteed to be stable as it's
not part of the kernel ABI. If you think otherwise please provide some
proves to that. I didn't find any in the official Linux ABI docs.

-Sergey

> 
> thanks
> -john

  reply	other threads:[~2021-07-22 18:12 UTC|newest]

Thread overview: 110+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-20 11:59 [PATCH 00/29] dt-bindings: usb: Harmonize xHCI/EHCI/OHCI/DWC3 nodes name Serge Semin
2020-10-20 11:59 ` [PATCH 01/29] usb: dwc3: Discard synopsys,dwc3 compatibility string Serge Semin
2020-10-20 12:15   ` Andy Shevchenko
2020-10-20 12:28     ` Krzysztof Kozlowski
2020-10-20 12:33       ` Serge Semin
2020-10-20 12:27   ` Felipe Balbi
2020-10-20 11:59 ` [PATCH 02/29] arm: dts: keystone: Correct DWC USB3 compatible string Serge Semin
2020-10-20 12:30   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 03/29] arm: dts: am437x: " Serge Semin
2020-10-20 12:31   ` Krzysztof Kozlowski
2020-11-10 13:17     ` Tony Lindgren
2020-10-20 11:59 ` [PATCH 04/29] arm: dts: exynos: " Serge Semin
2020-10-26 18:55   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 05/29] arm64: dts: amlogic: meson-g12: Set FL-adj property value Serge Semin
2020-10-20 12:34   ` Krzysztof Kozlowski
2020-10-20 12:44     ` Serge Semin
2020-10-20 12:46       ` Krzysztof Kozlowski
2020-10-20 13:06   ` Neil Armstrong
2020-10-20 19:38   ` Martin Blumenstingl
2020-10-20 11:59 ` [PATCH 06/29] arc: dts: Harmonize EHCI/OHCI DT nodes name Serge Semin
2020-10-20 12:35   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 07/29] arm: dts: bcm53x: " Serge Semin
2020-10-20 12:34   ` Krzysztof Kozlowski
2020-10-22 20:43   ` Florian Fainelli
2020-10-20 11:59 ` [PATCH 08/29] arm: dts: stm32: " Serge Semin
2020-10-20 12:36   ` Krzysztof Kozlowski
2020-11-09 10:43     ` Alexandre Torgue
2020-10-20 11:59 ` [PATCH 09/29] arm: dts: hisi-x5hd2: " Serge Semin
2020-10-20 12:36   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 10/29] arm: dts: lpc18xx: " Serge Semin
2020-10-20 12:37   ` Krzysztof Kozlowski
2020-10-21 19:02   ` Vladimir Zapolskiy
2020-10-20 11:59 ` [PATCH 11/29] arm64: dts: hisi: " Serge Semin
2020-10-20 12:37   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 12/29] mips: dts: jz47x: " Serge Semin
2020-10-20 12:40   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 13/29] mips: dts: sead3: " Serge Semin
2020-10-20 12:37   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 14/29] mips: dts: ralink: mt7628a: " Serge Semin
2020-10-20 12:38   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 15/29] powerpc: dts: akebono: " Serge Semin
2020-10-20 12:38   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 16/29] arm: dts: bcm5301x: Harmonize xHCI " Serge Semin
2020-10-20 12:38   ` Krzysztof Kozlowski
2020-10-22 20:44   ` Florian Fainelli
2020-10-20 11:59 ` [PATCH 17/29] arm64: dts: marvell: cp11x: " Serge Semin
2020-10-20 12:40   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 18/29] arm: dts: marvell: armada-375: Harmonize DWC USB3 " Serge Semin
2020-10-20 12:43   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 19/29] arm: dts: exynos: " Serge Semin
2020-10-26 18:56   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 20/29] arm: dts: keystone: " Serge Semin
2020-10-20 12:41   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 21/29] arm: dts: ls1021a: " Serge Semin
2020-10-20 12:46   ` Krzysztof Kozlowski
2020-11-01  7:37   ` Shawn Guo
2020-10-20 11:59 ` [PATCH 22/29] arm: dts: omap5: " Serge Semin
2020-10-20 12:41   ` Krzysztof Kozlowski
2020-11-10 13:18     ` Tony Lindgren
2020-10-20 11:59 ` [PATCH 23/29] arm: dts: stih407-family: " Serge Semin
2020-10-20 12:41   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 24/29] arm64: dts: allwinner: h6: " Serge Semin
2020-10-20 12:42   ` Krzysztof Kozlowski
2020-10-22 16:13   ` Maxime Ripard
2020-10-20 11:59 ` [PATCH 25/29] arm64: dts: apm: " Serge Semin
2020-10-20 12:42   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 26/29] arm64: dts: exynos: " Serge Semin
2020-10-20 12:43   ` Krzysztof Kozlowski
2020-10-22 11:25     ` Serge Semin
2020-10-26 18:57   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 27/29] arm64: dts: layerscape: " Serge Semin
2020-10-20 12:47   ` Krzysztof Kozlowski
2020-11-01  7:37   ` Shawn Guo
2020-10-20 11:59 ` [PATCH 28/29] arm64: dts: hi3660: " Serge Semin
2020-10-20 12:44   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 29/29] arm64: dts: qcom: " Serge Semin
2020-10-20 12:44   ` Krzysztof Kozlowski
2020-11-02  7:34   ` Jun Li
2020-11-03 23:23     ` Bjorn Andersson
2020-11-10 12:12       ` Serge Semin
2021-07-14  0:07   ` John Stultz
2021-07-14  2:27     ` Bjorn Andersson
2021-07-21  7:39       ` Greg Kroah-Hartman
2021-07-14 12:48     ` Serge Semin
2021-07-14 14:59       ` Bjorn Andersson
2021-07-21  7:38       ` Greg Kroah-Hartman
2021-07-21 10:02         ` Serge Semin
2021-07-21 10:29           ` Greg Kroah-Hartman
2021-07-21 10:45             ` Krzysztof Kozlowski
2021-07-21 11:02               ` Greg Kroah-Hartman
2021-07-21 11:10                 ` Krzysztof Kozlowski
2021-07-21 11:25                   ` Serge Semin
2021-07-21 18:08                     ` John Stultz
2021-07-22 18:12                       ` Serge Semin [this message]
2021-07-22 19:17                         ` Bjorn Andersson
2021-07-22 20:09                           ` John Stultz
2021-07-22 22:09                             ` Serge Semin
2021-08-14  1:06                               ` John Stultz
2021-08-15 19:46                                 ` Serge Semin
2021-08-18  3:44                                   ` Bjorn Andersson
2021-08-19 11:03                                     ` Serge Semin
2021-07-22 21:54                           ` Serge Semin
2021-07-23  8:17                             ` Greg Kroah-Hartman
2021-07-21 20:09             ` Bjorn Andersson
2021-07-23  8:18               ` Greg Kroah-Hartman
2021-07-23 14:34                 ` Bjorn Andersson
2021-07-23 15:54                   ` Greg Kroah-Hartman
2021-07-23 19:54                     ` Bjorn Andersson
2021-07-24  7:50                       ` Greg Kroah-Hartman
2021-07-21  7:37     ` Greg Kroah-Hartman

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=20210722181221.xh3r5kyu7zlcojjx@mobilestation \
    --to=fancer.lancer@gmail.com \
    --cc=agross@kernel.org \
    --cc=amit.pundir@linaro.org \
    --cc=balbi@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=john.stultz@linaro.org \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=robh+dt@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;
as well as URLs for NNTP newsgroup(s).