All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI / device_sysfs: Use OF_MODALIAS for "compatible" modalias
@ 2021-01-19  8:15 Kai-Heng Feng
  2021-01-19  8:26 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 7+ messages in thread
From: Kai-Heng Feng @ 2021-01-19  8:15 UTC (permalink / raw)
  To: rjw
  Cc: Kai-Heng Feng, AceLan Kao, Rafael J. Wysocki, Greg Kroah-Hartman,
	Mika Westerberg, Andy Shevchenko, Len Brown, open list:ACPI,
	open list

Commit 8765c5ba1949 ("ACPI / scan: Rework modalias creation when
"compatible" is present") may create two "MODALIAS=" in uevent file if
conditions are met.

This breaks systemd-udevd, which assumes each "key" in uevent file is
unique. The internal implementation of systemd-udevd overwrites the
first MODALIAS with the second one, so its kmod rule doesn't load driver
for the first MODALIAS.

Right now it doesn't seem to have any user relies on the second
MODALIAS, so change it to OF_MODALIAS to workaround the issue.

Reference: https://github.com/systemd/systemd/pull/18163
Fixes: 8765c5ba1949 ("ACPI / scan: Rework modalias creation when "compatible" is present")
Cc: AceLan Kao <acelan.kao@canonical.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>,
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/acpi/device_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c
index 96869f1538b9..c92b671cb816 100644
--- a/drivers/acpi/device_sysfs.c
+++ b/drivers/acpi/device_sysfs.c
@@ -260,7 +260,7 @@ int __acpi_device_uevent_modalias(struct acpi_device *adev,
 	if (!adev->data.of_compatible)
 		return 0;
 
-	if (len > 0 && add_uevent_var(env, "MODALIAS="))
+	if (len > 0 && add_uevent_var(env, "OF_MODALIAS="))
 		return -ENOMEM;
 
 	len = create_of_modalias(adev, &env->buf[env->buflen - 1],
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] ACPI / device_sysfs: Use OF_MODALIAS for "compatible" modalias
  2021-01-19  8:15 [PATCH] ACPI / device_sysfs: Use OF_MODALIAS for "compatible" modalias Kai-Heng Feng
@ 2021-01-19  8:26 ` Greg Kroah-Hartman
  2021-01-19  8:41   ` Kai-Heng Feng
  0 siblings, 1 reply; 7+ messages in thread
From: Greg Kroah-Hartman @ 2021-01-19  8:26 UTC (permalink / raw)
  To: Kai-Heng Feng
  Cc: rjw, AceLan Kao, Rafael J. Wysocki, Mika Westerberg,
	Andy Shevchenko, Len Brown, open list:ACPI, open list

On Tue, Jan 19, 2021 at 04:15:13PM +0800, Kai-Heng Feng wrote:
> Commit 8765c5ba1949 ("ACPI / scan: Rework modalias creation when
> "compatible" is present") may create two "MODALIAS=" in uevent file if
> conditions are met.
> 
> This breaks systemd-udevd, which assumes each "key" in uevent file is
> unique. The internal implementation of systemd-udevd overwrites the
> first MODALIAS with the second one, so its kmod rule doesn't load driver
> for the first MODALIAS.
> 
> Right now it doesn't seem to have any user relies on the second
> MODALIAS, so change it to OF_MODALIAS to workaround the issue.
> 
> Reference: https://github.com/systemd/systemd/pull/18163
> Fixes: 8765c5ba1949 ("ACPI / scan: Rework modalias creation when "compatible" is present")
> Cc: AceLan Kao <acelan.kao@canonical.com>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>,
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> ---
>  drivers/acpi/device_sysfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c
> index 96869f1538b9..c92b671cb816 100644
> --- a/drivers/acpi/device_sysfs.c
> +++ b/drivers/acpi/device_sysfs.c
> @@ -260,7 +260,7 @@ int __acpi_device_uevent_modalias(struct acpi_device *adev,
>  	if (!adev->data.of_compatible)
>  		return 0;
>  
> -	if (len > 0 && add_uevent_var(env, "MODALIAS="))
> +	if (len > 0 && add_uevent_var(env, "OF_MODALIAS="))

Who will use OF_MODALIAS and where have you documented it?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ACPI / device_sysfs: Use OF_MODALIAS for "compatible" modalias
  2021-01-19  8:26 ` Greg Kroah-Hartman
@ 2021-01-19  8:41   ` Kai-Heng Feng
  2021-01-19  9:41     ` Andy Shevchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Kai-Heng Feng @ 2021-01-19  8:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Rafael J. Wysocki, AceLan Kao, Rafael J. Wysocki,
	Mika Westerberg, Andy Shevchenko, Len Brown, open list:ACPI,
	open list

On Tue, Jan 19, 2021 at 4:27 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Tue, Jan 19, 2021 at 04:15:13PM +0800, Kai-Heng Feng wrote:
> > Commit 8765c5ba1949 ("ACPI / scan: Rework modalias creation when
> > "compatible" is present") may create two "MODALIAS=" in uevent file if
> > conditions are met.
> >
> > This breaks systemd-udevd, which assumes each "key" in uevent file is
> > unique. The internal implementation of systemd-udevd overwrites the
> > first MODALIAS with the second one, so its kmod rule doesn't load driver
> > for the first MODALIAS.
> >
> > Right now it doesn't seem to have any user relies on the second
> > MODALIAS, so change it to OF_MODALIAS to workaround the issue.
> >
> > Reference: https://github.com/systemd/systemd/pull/18163
> > Fixes: 8765c5ba1949 ("ACPI / scan: Rework modalias creation when "compatible" is present")
> > Cc: AceLan Kao <acelan.kao@canonical.com>
> > Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
> > Cc: Mika Westerberg <mika.westerberg@linux.intel.com>,
> > Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> > ---
> >  drivers/acpi/device_sysfs.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c
> > index 96869f1538b9..c92b671cb816 100644
> > --- a/drivers/acpi/device_sysfs.c
> > +++ b/drivers/acpi/device_sysfs.c
> > @@ -260,7 +260,7 @@ int __acpi_device_uevent_modalias(struct acpi_device *adev,
> >       if (!adev->data.of_compatible)
> >               return 0;
> >
> > -     if (len > 0 && add_uevent_var(env, "MODALIAS="))
> > +     if (len > 0 && add_uevent_var(env, "OF_MODALIAS="))
>
> Who will use OF_MODALIAS and where have you documented it?

After this lands in mainline, I'll modify the pull request for systemd
to add a new rule for OF_MODALIAS.
I'll modify the comment on the function to document the change.

Kai-Heng

>
> thanks,
>
> greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ACPI / device_sysfs: Use OF_MODALIAS for "compatible" modalias
  2021-01-19  8:41   ` Kai-Heng Feng
@ 2021-01-19  9:41     ` Andy Shevchenko
  2021-01-19 10:34       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2021-01-19  9:41 UTC (permalink / raw)
  To: Kai-Heng Feng
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, AceLan Kao,
	Rafael J. Wysocki, Mika Westerberg, Len Brown, open list:ACPI,
	open list

On Tue, Jan 19, 2021 at 04:41:48PM +0800, Kai-Heng Feng wrote:
> On Tue, Jan 19, 2021 at 4:27 PM Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> > On Tue, Jan 19, 2021 at 04:15:13PM +0800, Kai-Heng Feng wrote:

...

> > Who will use OF_MODALIAS and where have you documented it?
> 
> After this lands in mainline, I'll modify the pull request for systemd
> to add a new rule for OF_MODALIAS.
> I'll modify the comment on the function to document the change.

I'm wondering why to have two fixes in two places instead of fixing udev to
understand multiple MODALIAS= events?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ACPI / device_sysfs: Use OF_MODALIAS for "compatible" modalias
  2021-01-19  9:41     ` Andy Shevchenko
@ 2021-01-19 10:34       ` Greg Kroah-Hartman
  2021-01-21  6:22         ` Kai-Heng Feng
  0 siblings, 1 reply; 7+ messages in thread
From: Greg Kroah-Hartman @ 2021-01-19 10:34 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Kai-Heng Feng, Rafael J. Wysocki, AceLan Kao, Rafael J. Wysocki,
	Mika Westerberg, Len Brown, open list:ACPI, open list

On Tue, Jan 19, 2021 at 11:41:59AM +0200, Andy Shevchenko wrote:
> On Tue, Jan 19, 2021 at 04:41:48PM +0800, Kai-Heng Feng wrote:
> > On Tue, Jan 19, 2021 at 4:27 PM Greg Kroah-Hartman
> > <gregkh@linuxfoundation.org> wrote:
> > > On Tue, Jan 19, 2021 at 04:15:13PM +0800, Kai-Heng Feng wrote:
> 
> ...
> 
> > > Who will use OF_MODALIAS and where have you documented it?
> > 
> > After this lands in mainline, I'll modify the pull request for systemd
> > to add a new rule for OF_MODALIAS.
> > I'll modify the comment on the function to document the change.
> 
> I'm wondering why to have two fixes in two places instead of fixing udev to
> understand multiple MODALIAS= events?

It's not a matter of multiple events, it's a single event with a
key/value pair with duplicate keys and different values.

What is this event with different values supposed to be doing in
userspace?  Do you want multiple invocations of `modprobe` or something
else?

Usually a "device" only has a single "signature" that modprobe uses to
look up the correct module for.  Modules can support any number of
device signatures, but traditionally it is odd to think that a device
itself can be supported by multiple modules, which is what you are
saying is happening here.

So what should userspace do with this, and why does a device need to
have multiple module alias signatures?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ACPI / device_sysfs: Use OF_MODALIAS for "compatible" modalias
  2021-01-19 10:34       ` Greg Kroah-Hartman
@ 2021-01-21  6:22         ` Kai-Heng Feng
  2021-01-21 10:49           ` Mika Westerberg
  0 siblings, 1 reply; 7+ messages in thread
From: Kai-Heng Feng @ 2021-01-21  6:22 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Andy Shevchenko, Rafael J. Wysocki, AceLan Kao,
	Rafael J. Wysocki, Mika Westerberg, Len Brown, open list:ACPI,
	open list

On Tue, Jan 19, 2021 at 6:34 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Tue, Jan 19, 2021 at 11:41:59AM +0200, Andy Shevchenko wrote:
> > On Tue, Jan 19, 2021 at 04:41:48PM +0800, Kai-Heng Feng wrote:
> > > On Tue, Jan 19, 2021 at 4:27 PM Greg Kroah-Hartman
> > > <gregkh@linuxfoundation.org> wrote:
> > > > On Tue, Jan 19, 2021 at 04:15:13PM +0800, Kai-Heng Feng wrote:
> >
> > ...
> >
> > > > Who will use OF_MODALIAS and where have you documented it?
> > >
> > > After this lands in mainline, I'll modify the pull request for systemd
> > > to add a new rule for OF_MODALIAS.
> > > I'll modify the comment on the function to document the change.
> >
> > I'm wondering why to have two fixes in two places instead of fixing udev to
> > understand multiple MODALIAS= events?
>
> It's not a matter of multiple events, it's a single event with a
> key/value pair with duplicate keys and different values.
>
> What is this event with different values supposed to be doing in
> userspace?  Do you want multiple invocations of `modprobe` or something
> else?
>
> Usually a "device" only has a single "signature" that modprobe uses to
> look up the correct module for.  Modules can support any number of
> device signatures, but traditionally it is odd to think that a device
> itself can be supported by multiple modules, which is what you are
> saying is happening here.
>
> So what should userspace do with this, and why does a device need to
> have multiple module alias signatures?

From the original use case [1], I think the "compatible" modalias
should be enough.
Andy and Mika, what do you think? Can we remove the ACPI modalias for this case?

[1] https://lwn.net/Articles/612062/

Kai-Heng

>
> thanks,
>
> greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ACPI / device_sysfs: Use OF_MODALIAS for "compatible" modalias
  2021-01-21  6:22         ` Kai-Heng Feng
@ 2021-01-21 10:49           ` Mika Westerberg
  0 siblings, 0 replies; 7+ messages in thread
From: Mika Westerberg @ 2021-01-21 10:49 UTC (permalink / raw)
  To: Kai-Heng Feng
  Cc: Greg Kroah-Hartman, Andy Shevchenko, Rafael J. Wysocki,
	AceLan Kao, Rafael J. Wysocki, Len Brown, open list:ACPI,
	open list

On Thu, Jan 21, 2021 at 02:22:43PM +0800, Kai-Heng Feng wrote:
> On Tue, Jan 19, 2021 at 6:34 PM Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> >
> > On Tue, Jan 19, 2021 at 11:41:59AM +0200, Andy Shevchenko wrote:
> > > On Tue, Jan 19, 2021 at 04:41:48PM +0800, Kai-Heng Feng wrote:
> > > > On Tue, Jan 19, 2021 at 4:27 PM Greg Kroah-Hartman
> > > > <gregkh@linuxfoundation.org> wrote:
> > > > > On Tue, Jan 19, 2021 at 04:15:13PM +0800, Kai-Heng Feng wrote:
> > >
> > > ...
> > >
> > > > > Who will use OF_MODALIAS and where have you documented it?
> > > >
> > > > After this lands in mainline, I'll modify the pull request for systemd
> > > > to add a new rule for OF_MODALIAS.
> > > > I'll modify the comment on the function to document the change.
> > >
> > > I'm wondering why to have two fixes in two places instead of fixing udev to
> > > understand multiple MODALIAS= events?
> >
> > It's not a matter of multiple events, it's a single event with a
> > key/value pair with duplicate keys and different values.
> >
> > What is this event with different values supposed to be doing in
> > userspace?  Do you want multiple invocations of `modprobe` or something
> > else?
> >
> > Usually a "device" only has a single "signature" that modprobe uses to
> > look up the correct module for.  Modules can support any number of
> > device signatures, but traditionally it is odd to think that a device
> > itself can be supported by multiple modules, which is what you are
> > saying is happening here.
> >
> > So what should userspace do with this, and why does a device need to
> > have multiple module alias signatures?
> 
> >From the original use case [1], I think the "compatible" modalias
> should be enough.
> Andy and Mika, what do you think? Can we remove the ACPI modalias for this case?

Yes, I think that should work. After all we want the match to happen
through the DT compatible string if the property is present, not through
ACPI IDs.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-01-21 10:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-19  8:15 [PATCH] ACPI / device_sysfs: Use OF_MODALIAS for "compatible" modalias Kai-Heng Feng
2021-01-19  8:26 ` Greg Kroah-Hartman
2021-01-19  8:41   ` Kai-Heng Feng
2021-01-19  9:41     ` Andy Shevchenko
2021-01-19 10:34       ` Greg Kroah-Hartman
2021-01-21  6:22         ` Kai-Heng Feng
2021-01-21 10:49           ` Mika Westerberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.