2007-09-08 17:08:20

by Anssi Hannula

[permalink] [raw]
Subject: sysfs change of input/event devices in 2.6.23rc breaks udev

Hi!

There seem to be changes in sysfs input structure between 2.6.22 and
2.6.23-rc5 which cause some breakage.

With 2.6.22:

> # LC_ALL=C ls -l /sys/class/input/input4
> total 0
> drwxr-xr-x 2 root root 0 Sep 8 12:51 capabilities/
> lrwxrwxrwx 1 root root 0 Sep 8 19:48 device -> ../../../devices/platform/pcspkr/
> drwxr-xr-x 2 root root 0 Sep 8 12:51 event4/
> drwxr-xr-x 2 root root 0 Sep 8 12:51 id/
> -r--r--r-- 1 root root 4096 Sep 8 19:48 modalias
> -r--r--r-- 1 root root 4096 Sep 8 19:48 name
> -r--r--r-- 1 root root 4096 Sep 8 19:48 phys
> lrwxrwxrwx 1 root root 0 Sep 8 19:48 subsystem -> ../../../class/input/
> --w------- 1 root root 4096 Sep 8 19:48 uevent
> -r--r--r-- 1 root root 4096 Sep 8 19:48 uniq

> # ls -l /sys/class/input/event4
> lrwxrwxrwx 1 root root 0 Sep 8 19:48 /sys/class/input/event4 -> ../../class/input/input4/event4/
> # ls -l /sys/class/input/event4/
> total 0
> -r--r--r-- 1 root root 4096 Sep 8 19:58 dev
> lrwxrwxrwx 1 root root 0 Sep 8 19:58 device -> ../../../../devices/platform/pcspkr/
> lrwxrwxrwx 1 root root 0 Sep 8 19:58 subsystem -> ../../../../class/input/
> --w------- 1 root root 4096 Sep 8 19:58 uevent

With 2.6.23-rc5:

> # ls -l /sys/class/input/input5
> total 0
> drwxr-xr-x 2 root root 0 Sep 8 19:47 capabilities/
> lrwxrwxrwx 1 root root 0 Sep 8 19:03 device -> ../../../devices/platform/pcspkr/
> drwxr-xr-x 2 root root 0 Sep 8 19:47 id/
> lrwxrwxrwx 1 root root 0 Sep 8 19:47 input:event5 -> ../../../class/input/event5/
> -r--r--r-- 1 root root 4096 Sep 8 19:03 modalias
> -r--r--r-- 1 root root 4096 Sep 8 19:03 name
> -r--r--r-- 1 root root 4096 Sep 8 19:47 phys
> drwxr-xr-x 2 root root 0 Sep 8 19:47 power/
> lrwxrwxrwx 1 root root 0 Sep 8 19:03 subsystem -> ../../../class/input/
> -rw-r--r-- 1 root root 4096 Sep 8 19:03 uevent
> -r--r--r-- 1 root root 4096 Sep 8 19:47 uniq

> # ls -l /sys/class/input/event5
> total 0
> -r--r--r-- 1 root root 4096 Sep 8 19:03 dev
> lrwxrwxrwx 1 root root 0 Sep 8 19:03 device -> ../../../class/input/input5/
> drwxr-xr-x 2 root root 0 Sep 8 19:48 power/
> lrwxrwxrwx 1 root root 0 Sep 8 19:03 subsystem -> ../../../class/input/
> -rw-r--r-- 1 root root 4096 Sep 8 19:03 uevent

There are a few changes.

There is no longer:
/sys/class/input/eventX => /sys/class/input/inputX/eventX
instead there is:
/sys/class/inputX/input:eventX => /sys/class/input/eventX
Notice the added "input:". I don't know if any software depends on this,
though.

However, the change that broke id_path of udev is that
/sys/class/input/event5/device is now a symlink to the inputX directory
instead of being the same as the device symlink in inputX directory,
i.e. to ../../../devices/platform/pcspkr in this case.

Udev id_path uses that directory to construct the ID_PATH variable.
Should the sysfs structure be reverted or should udev be adapted to
handle traversing /device symlink twice? I think the former, as there
should be considerably more time to adapt udev for coming changes in sysfs.

--
Anssi Hannula


2007-09-08 18:38:14

by Andrey Borzenkov

[permalink] [raw]
Subject: Re: sysfs change of input/event devices in 2.6.23rc breaks udev

Anssi Hannula wrote:

> Hi!
>
> There seem to be changes in sysfs input structure between 2.6.22 and
> 2.6.23-rc5 which cause some breakage.
>

I'm running 2.6.23-rc5 in up-to-date cooker.

> With 2.6.22:
>
>> # LC_ALL=C ls -l /sys/class/input/input4
>> total 0
>> drwxr-xr-x 2 root root 0 Sep 8 12:51 capabilities/
>> lrwxrwxrwx 1 root root 0 Sep 8 19:48 device ->
>> ../../../devices/platform/pcspkr/
>> drwxr-xr-x 2 root root 0 Sep 8 12:51 event4/
>> drwxr-xr-x 2 root root 0 Sep 8 12:51 id/
>> -r--r--r-- 1 root root 4096 Sep 8 19:48 modalias
>> -r--r--r-- 1 root root 4096 Sep 8 19:48 name
>> -r--r--r-- 1 root root 4096 Sep 8 19:48 phys
>> lrwxrwxrwx 1 root root 0 Sep 8 19:48 subsystem ->
>> ../../../class/input/
>> --w------- 1 root root 4096 Sep 8 19:48 uevent
>> -r--r--r-- 1 root root 4096 Sep 8 19:48 uniq
>
>> # ls -l /sys/class/input/event4
>> lrwxrwxrwx 1 root root 0 Sep 8 19:48 /sys/class/input/event4 ->
>> ../../class/input/input4/event4/
>> # ls -l /sys/class/input/event4/
>> total 0
>> -r--r--r-- 1 root root 4096 Sep 8 19:58 dev
>> lrwxrwxrwx 1 root root 0 Sep 8 19:58 device ->
>> ../../../../devices/platform/pcspkr/
>> lrwxrwxrwx 1 root root 0 Sep 8 19:58 subsystem ->
>> ../../../../class/input/
>> --w------- 1 root root 4096 Sep 8 19:58 uevent
>
> With 2.6.23-rc5:
>
>> # ls -l /sys/class/input/input5
>> total 0
>> drwxr-xr-x 2 root root 0 Sep 8 19:47 capabilities/
>> lrwxrwxrwx 1 root root 0 Sep 8 19:03 device ->
>> ../../../devices/platform/pcspkr/
>> drwxr-xr-x 2 root root 0 Sep 8 19:47 id/
>> lrwxrwxrwx 1 root root 0 Sep 8 19:47 input:event5 ->
>> ../../../class/input/event5/

I do not have this

>> -r--r--r-- 1 root root 4096 Sep 8 19:03 modalias
>> -r--r--r-- 1 root root 4096 Sep 8 19:03 name
>> -r--r--r-- 1 root root 4096 Sep 8 19:47 phys
>> drwxr-xr-x 2 root root 0 Sep 8 19:47 power/
>> lrwxrwxrwx 1 root root 0 Sep 8 19:03 subsystem ->
>> ../../../class/input/
>> -rw-r--r-- 1 root root 4096 Sep 8 19:03 uevent
>> -r--r--r-- 1 root root 4096 Sep 8 19:47 uniq
>
>> # ls -l /sys/class/input/event5
>> total 0
>> -r--r--r-- 1 root root 4096 Sep 8 19:03 dev
>> lrwxrwxrwx 1 root root 0 Sep 8 19:03 device ->
>> ../../../class/input/input5/
>> drwxr-xr-x 2 root root 0 Sep 8 19:48 power/
>> lrwxrwxrwx 1 root root 0 Sep 8 19:03 subsystem ->
>> ../../../class/input/
>> -rw-r--r-- 1 root root 4096 Sep 8 19:03 uevent
>
> There are a few changes.
>
> There is no longer:
> /sys/class/input/eventX => /sys/class/input/inputX/eventX
> instead there is:
> /sys/class/inputX/input:eventX => /sys/class/input/eventX
> Notice the added "input:". I don't know if any software depends on this,
> though.
>
> However, the change that broke id_path of udev is that
> /sys/class/input/event5/device is now a symlink to the inputX directory
> instead of being the same as the device symlink in inputX directory,
> i.e. to ../../../devices/platform/pcspkr in this case.
>
> Udev id_path uses that directory to construct the ID_PATH variable.
> Should the sysfs structure be reverted or should udev be adapted to
> handle traversing /device symlink twice? I think the former, as there
> should be considerably more time to adapt udev for coming changes in
> sysfs.
>

I am using 2.6.23-rc5 in current cooker and I did not notice any breakage;
could you please show example of wrong path? E.g. I have

{pts/0}% LC_ALL=C ll /dev/input/by-path
total 0
lrwxrwxrwx 1 root root 9 Sep 2 15:00
platform-i8042-serio-0-event-kbd -> ../event0
lrwxrwxrwx 1 root root 9 Sep 2 15:00
platform-i8042-serio-1-event-mouse -> ../event1
lrwxrwxrwx 1 root root 9 Sep 2 15:00
platform-i8042-serio-1-mouse -> ../mouse0

and it looks pretty sane for me.

Oh, and I do not have CONFIG_SYSFS_DEPRECATED which probably explains why it
works for me :)

{pts/0}% LC_ALL=C ll /sys/class/input/input2/
total 0
drwxr-xr-x 2 root root 0 Sep 8 22:25 capabilities/
drwxr-xr-x 3 root root 0 Sep 8 22:22 event2/
drwxr-xr-x 2 root root 0 Sep 8 22:25 id/
-r--r--r-- 1 root root 4096 Sep 8 22:25 modalias
-r--r--r-- 1 root root 4096 Sep 8 22:25 name
-r--r--r-- 1 root root 4096 Sep 8 22:25 phys
drwxr-xr-x 2 root root 0 Sep 8 22:25 power/
lrwxrwxrwx 1 root root 0 Sep 8 22:25
subsystem -> ../../../../class/input/
-rw-r--r-- 1 root root 4096 Sep 8 22:25 uevent
-r--r--r-- 1 root root 4096 Sep 8 22:25 uniq

this implies that SYSFS_DEPRECATED may be broken w.r.t. udev; OTOH it *is*
deprecated, is not it?

-andrey

2007-09-08 19:38:30

by Anssi Hannula

[permalink] [raw]
Subject: Re: sysfs change of input/event devices in 2.6.23rc breaks udev

Andrey Borzenkov wrote:
> Anssi Hannula wrote:
>
>> Hi!
>>
>> There seem to be changes in sysfs input structure between 2.6.22 and
>> 2.6.23-rc5 which cause some breakage.
>>
[...]
>> There is no longer:
>> /sys/class/input/eventX => /sys/class/input/inputX/eventX
>> instead there is:
>> /sys/class/inputX/input:eventX => /sys/class/input/eventX
>> Notice the added "input:". I don't know if any software depends on this,
>> though.
>>
>> However, the change that broke id_path of udev is that
>> /sys/class/input/event5/device is now a symlink to the inputX directory
>> instead of being the same as the device symlink in inputX directory,
>> i.e. to ../../../devices/platform/pcspkr in this case.
>>
>> Udev id_path uses that directory to construct the ID_PATH variable.
>> Should the sysfs structure be reverted or should udev be adapted to
>> handle traversing /device symlink twice? I think the former, as there
>> should be considerably more time to adapt udev for coming changes in
>> sysfs.
>>
>
> I am using 2.6.23-rc5 in current cooker

Same kernel here, but on an older system (MDV2007.1). I tested with a
path_id from a recent udev as well, though, but the problem was there as
well.

> and I did not notice any breakage;
> could you please show example of wrong path? E.g. I have
>
> {pts/0}% LC_ALL=C ll /dev/input/by-path
> total 0
> lrwxrwxrwx 1 root root 9 Sep 2 15:00
> platform-i8042-serio-0-event-kbd -> ../event0
> lrwxrwxrwx 1 root root 9 Sep 2 15:00
> platform-i8042-serio-1-event-mouse -> ../event1
> lrwxrwxrwx 1 root root 9 Sep 2 15:00
> platform-i8042-serio-1-mouse -> ../mouse0
>
> and it looks pretty sane for me.

I don't have anything under /dev/input/by-path as the lookup in path_id
fails.

> Oh, and I do not have CONFIG_SYSFS_DEPRECATED which probably explains why it
> works for me :)

Probably.

> {pts/0}% LC_ALL=C ll /sys/class/input/input2/
> total 0
> drwxr-xr-x 2 root root 0 Sep 8 22:25 capabilities/
> drwxr-xr-x 3 root root 0 Sep 8 22:22 event2/
> drwxr-xr-x 2 root root 0 Sep 8 22:25 id/
> -r--r--r-- 1 root root 4096 Sep 8 22:25 modalias
> -r--r--r-- 1 root root 4096 Sep 8 22:25 name
> -r--r--r-- 1 root root 4096 Sep 8 22:25 phys
> drwxr-xr-x 2 root root 0 Sep 8 22:25 power/
> lrwxrwxrwx 1 root root 0 Sep 8 22:25
> subsystem -> ../../../../class/input/
> -rw-r--r-- 1 root root 4096 Sep 8 22:25 uevent
> -r--r--r-- 1 root root 4096 Sep 8 22:25 uniq

What does this print as devpath for you:
$ udevinfo -q all --name=input/event0

For me on 2.6.23rc5 it prints:
P: /class/input/event0
and on 2.6.22:
P: /class/input/input0/event0

Both are detected as "old sysfs layout" by path_id, but only on 2.6.22
is there a /device symlink pointing to the expected location.

I suspect it prints something like /devices/xyz for you, right?
That seems to be detected as "new sysfs layout" by path_id and handled
differently.

> this implies that SYSFS_DEPRECATED may be broken w.r.t. udev; OTOH it *is*
> deprecated, is not it?

Indeed, at least regarding input subsystem, for which there was a recent
switchover [1] from class_device.

[1]
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=9657d75c5f0f7d0a9cb507521d3ad1436aea28c9

--
Anssi Hannula

2007-09-08 19:47:10

by Andrey Borzenkov

[permalink] [raw]
Subject: Re: sysfs change of input/event devices in 2.6.23rc breaks udev

On Saturday 08 September 2007, Anssi Hannula wrote:
> Andrey Borzenkov wrote:
> > Anssi Hannula wrote:
> >> Hi!
> >>
> >> There seem to be changes in sysfs input structure between 2.6.22 and
> >> 2.6.23-rc5 which cause some breakage.
>
> [...]
>
> >> There is no longer:
> >> /sys/class/input/eventX => /sys/class/input/inputX/eventX
> >> instead there is:
> >> /sys/class/inputX/input:eventX => /sys/class/input/eventX
> >> Notice the added "input:". I don't know if any software depends on this,
> >> though.
> >>
> >> However, the change that broke id_path of udev is that
> >> /sys/class/input/event5/device is now a symlink to the inputX directory
> >> instead of being the same as the device symlink in inputX directory,
> >> i.e. to ../../../devices/platform/pcspkr in this case.
> >>
> >> Udev id_path uses that directory to construct the ID_PATH variable.
> >> Should the sysfs structure be reverted or should udev be adapted to
> >> handle traversing /device symlink twice? I think the former, as there
> >> should be considerably more time to adapt udev for coming changes in
> >> sysfs.
> >
> > I am using 2.6.23-rc5 in current cooker
>
> Same kernel here, but on an older system (MDV2007.1). I tested with a
> path_id from a recent udev as well, though, but the problem was there as
> well.
>
> > and I did not notice any breakage;
> > could you please show example of wrong path? E.g. I have
> >
> > {pts/0}% LC_ALL=C ll /dev/input/by-path
> > total 0
> > lrwxrwxrwx 1 root root 9 Sep 2 15:00
> > platform-i8042-serio-0-event-kbd -> ../event0
> > lrwxrwxrwx 1 root root 9 Sep 2 15:00
> > platform-i8042-serio-1-event-mouse -> ../event1
> > lrwxrwxrwx 1 root root 9 Sep 2 15:00
> > platform-i8042-serio-1-mouse -> ../mouse0
> >
> > and it looks pretty sane for me.
>
> I don't have anything under /dev/input/by-path as the lookup in path_id
> fails.
>
> > Oh, and I do not have CONFIG_SYSFS_DEPRECATED which probably explains why
> > it works for me :)
>
> Probably.
>
> > {pts/0}% LC_ALL=C ll /sys/class/input/input2/
> > total 0
> > drwxr-xr-x 2 root root 0 Sep 8 22:25 capabilities/
> > drwxr-xr-x 3 root root 0 Sep 8 22:22 event2/
> > drwxr-xr-x 2 root root 0 Sep 8 22:25 id/
> > -r--r--r-- 1 root root 4096 Sep 8 22:25 modalias
> > -r--r--r-- 1 root root 4096 Sep 8 22:25 name
> > -r--r--r-- 1 root root 4096 Sep 8 22:25 phys
> > drwxr-xr-x 2 root root 0 Sep 8 22:25 power/
> > lrwxrwxrwx 1 root root 0 Sep 8 22:25
> > subsystem -> ../../../../class/input/
> > -rw-r--r-- 1 root root 4096 Sep 8 22:25 uevent
> > -r--r--r-- 1 root root 4096 Sep 8 22:25 uniq
>
> What does this print as devpath for you:
> $ udevinfo -q all --name=input/event0
>

{pts/1}% udevinfo -q all --name input/event0
P: /devices/platform/i8042/serio0/input/input0/event0
N: input/event0
S: input/by-path/platform-i8042-serio-0-event-kbd
E: ID_CLASS=kbd
E: ID_SERIAL=noserial
E: ID_PATH=platform-i8042-serio-0

> For me on 2.6.23rc5 it prints:
> P: /class/input/event0
> and on 2.6.22:
> P: /class/input/input0/event0
>
> Both are detected as "old sysfs layout" by path_id, but only on 2.6.22
> is there a /device symlink pointing to the expected location.
>
> I suspect it prints something like /devices/xyz for you, right?
> That seems to be detected as "new sysfs layout" by path_id and handled
> differently.
>
> > this implies that SYSFS_DEPRECATED may be broken w.r.t. udev; OTOH it
> > *is* deprecated, is not it?
>
> Indeed, at least regarding input subsystem, for which there was a recent
> switchover [1] from class_device.
>

If this does not work with current udev this can be considred kernel
regression as far as I can tell.

-andrey

> [1]
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdi
>ff;h=9657d75c5f0f7d0a9cb507521d3ad1436aea28c9



Attachments:
(No filename) (3.71 kB)
signature.asc (189.00 B)
This is a digitally signed message part.
Download all attachments

2007-09-09 23:03:43

by Kay Sievers

[permalink] [raw]
Subject: Re: sysfs change of input/event devices in 2.6.23rc breaks udev

On 9/8/07, Anssi Hannula <[email protected]> wrote:
> There seem to be changes in sysfs input structure between 2.6.22 and
> 2.6.23-rc5 which cause some breakage.
>
> With 2.6.22:
>
> > # LC_ALL=C ls -l /sys/class/input/input4
> > total 0
> > drwxr-xr-x 2 root root 0 Sep 8 12:51 capabilities/
> > lrwxrwxrwx 1 root root 0 Sep 8 19:48 device -> ../../../devices/platform/pcspkr/
> > drwxr-xr-x 2 root root 0 Sep 8 12:51 event4/
> > drwxr-xr-x 2 root root 0 Sep 8 12:51 id/
> > -r--r--r-- 1 root root 4096 Sep 8 19:48 modalias
> > -r--r--r-- 1 root root 4096 Sep 8 19:48 name
> > -r--r--r-- 1 root root 4096 Sep 8 19:48 phys
> > lrwxrwxrwx 1 root root 0 Sep 8 19:48 subsystem -> ../../../class/input/
> > --w------- 1 root root 4096 Sep 8 19:48 uevent
> > -r--r--r-- 1 root root 4096 Sep 8 19:48 uniq
>
> > # ls -l /sys/class/input/event4
> > lrwxrwxrwx 1 root root 0 Sep 8 19:48 /sys/class/input/event4 -> ../../class/input/input4/event4/
> > # ls -l /sys/class/input/event4/
> > total 0
> > -r--r--r-- 1 root root 4096 Sep 8 19:58 dev
> > lrwxrwxrwx 1 root root 0 Sep 8 19:58 device -> ../../../../devices/platform/pcspkr/
> > lrwxrwxrwx 1 root root 0 Sep 8 19:58 subsystem -> ../../../../class/input/
> > --w------- 1 root root 4096 Sep 8 19:58 uevent
>
> With 2.6.23-rc5:
>
> > # ls -l /sys/class/input/input5
> > total 0
> > drwxr-xr-x 2 root root 0 Sep 8 19:47 capabilities/
> > lrwxrwxrwx 1 root root 0 Sep 8 19:03 device -> ../../../devices/platform/pcspkr/
> > drwxr-xr-x 2 root root 0 Sep 8 19:47 id/
> > lrwxrwxrwx 1 root root 0 Sep 8 19:47 input:event5 -> ../../../class/input/event5/
> > -r--r--r-- 1 root root 4096 Sep 8 19:03 modalias
> > -r--r--r-- 1 root root 4096 Sep 8 19:03 name
> > -r--r--r-- 1 root root 4096 Sep 8 19:47 phys
> > drwxr-xr-x 2 root root 0 Sep 8 19:47 power/
> > lrwxrwxrwx 1 root root 0 Sep 8 19:03 subsystem -> ../../../class/input/
> > -rw-r--r-- 1 root root 4096 Sep 8 19:03 uevent
> > -r--r--r-- 1 root root 4096 Sep 8 19:47 uniq
>
> > # ls -l /sys/class/input/event5
> > total 0
> > -r--r--r-- 1 root root 4096 Sep 8 19:03 dev
> > lrwxrwxrwx 1 root root 0 Sep 8 19:03 device -> ../../../class/input/input5/
> > drwxr-xr-x 2 root root 0 Sep 8 19:48 power/
> > lrwxrwxrwx 1 root root 0 Sep 8 19:03 subsystem -> ../../../class/input/
> > -rw-r--r-- 1 root root 4096 Sep 8 19:03 uevent
>
> There are a few changes.
>
> There is no longer:
> /sys/class/input/eventX => /sys/class/input/inputX/eventX
> instead there is:
> /sys/class/inputX/input:eventX => /sys/class/input/eventX
> Notice the added "input:". I don't know if any software depends on this,
> though.
>
> However, the change that broke id_path of udev is that
> /sys/class/input/event5/device is now a symlink to the inputX directory
> instead of being the same as the device symlink in inputX directory,
> i.e. to ../../../devices/platform/pcspkr in this case.
>
> Udev id_path uses that directory to construct the ID_PATH variable.
> Should the sysfs structure be reverted or should udev be adapted to
> handle traversing /device symlink twice? I think the former, as there
> should be considerably more time to adapt udev for coming changes in sysfs.

Udev's path_id script is too dumb to follow the "device" link of
stacked class devices in the CONFIG_SYSFS_DEPRECATED=y layout. Does
this change fix it for you?
http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff_plain;h=b1ac36ff5e3756cefc79967a26280056da31bf6f

Thanks,
Kay

2007-09-10 02:41:16

by Andrey Borzenkov

[permalink] [raw]
Subject: Re: sysfs change of input/event devices in 2.6.23rc breaks udev

Kay Sievers wrote:

> On 9/8/07, Anssi Hannula <[email protected]> wrote:
>> There seem to be changes in sysfs input structure between 2.6.22 and
>> 2.6.23-rc5 which cause some breakage.
>>
>> With 2.6.22:
>>
>> > # LC_ALL=C ls -l /sys/class/input/input4
>> > total 0
>> > drwxr-xr-x 2 root root 0 Sep 8 12:51 capabilities/
>> > lrwxrwxrwx 1 root root 0 Sep 8 19:48 device ->
>> > ../../../devices/platform/pcspkr/
>> > drwxr-xr-x 2 root root 0 Sep 8 12:51 event4/
>> > drwxr-xr-x 2 root root 0 Sep 8 12:51 id/
>> > -r--r--r-- 1 root root 4096 Sep 8 19:48 modalias
>> > -r--r--r-- 1 root root 4096 Sep 8 19:48 name
>> > -r--r--r-- 1 root root 4096 Sep 8 19:48 phys
>> > lrwxrwxrwx 1 root root 0 Sep 8 19:48 subsystem ->
>> > ../../../class/input/
>> > --w------- 1 root root 4096 Sep 8 19:48 uevent
>> > -r--r--r-- 1 root root 4096 Sep 8 19:48 uniq
>>
>> > # ls -l /sys/class/input/event4
>> > lrwxrwxrwx 1 root root 0 Sep 8 19:48 /sys/class/input/event4 ->
>> > ../../class/input/input4/event4/
>> > # ls -l /sys/class/input/event4/
>> > total 0
>> > -r--r--r-- 1 root root 4096 Sep 8 19:58 dev
>> > lrwxrwxrwx 1 root root 0 Sep 8 19:58 device ->
>> > ../../../../devices/platform/pcspkr/
>> > lrwxrwxrwx 1 root root 0 Sep 8 19:58 subsystem ->
>> > ../../../../class/input/
>> > --w------- 1 root root 4096 Sep 8 19:58 uevent
>>
>> With 2.6.23-rc5:
>>
>> > # ls -l /sys/class/input/input5
>> > total 0
>> > drwxr-xr-x 2 root root 0 Sep 8 19:47 capabilities/
>> > lrwxrwxrwx 1 root root 0 Sep 8 19:03 device ->
>> > ../../../devices/platform/pcspkr/
>> > drwxr-xr-x 2 root root 0 Sep 8 19:47 id/
>> > lrwxrwxrwx 1 root root 0 Sep 8 19:47 input:event5 ->
>> > ../../../class/input/event5/
>> > -r--r--r-- 1 root root 4096 Sep 8 19:03 modalias
>> > -r--r--r-- 1 root root 4096 Sep 8 19:03 name
>> > -r--r--r-- 1 root root 4096 Sep 8 19:47 phys
>> > drwxr-xr-x 2 root root 0 Sep 8 19:47 power/
>> > lrwxrwxrwx 1 root root 0 Sep 8 19:03 subsystem ->
>> > ../../../class/input/
>> > -rw-r--r-- 1 root root 4096 Sep 8 19:03 uevent
>> > -r--r--r-- 1 root root 4096 Sep 8 19:47 uniq
>>
>> > # ls -l /sys/class/input/event5
>> > total 0
>> > -r--r--r-- 1 root root 4096 Sep 8 19:03 dev
>> > lrwxrwxrwx 1 root root 0 Sep 8 19:03 device ->
>> > ../../../class/input/input5/
>> > drwxr-xr-x 2 root root 0 Sep 8 19:48 power/
>> > lrwxrwxrwx 1 root root 0 Sep 8 19:03 subsystem ->
>> > ../../../class/input/
>> > -rw-r--r-- 1 root root 4096 Sep 8 19:03 uevent
>>
>> There are a few changes.
>>
>> There is no longer:
>> /sys/class/input/eventX => /sys/class/input/inputX/eventX
>> instead there is:
>> /sys/class/inputX/input:eventX => /sys/class/input/eventX
>> Notice the added "input:". I don't know if any software depends on this,
>> though.
>>
>> However, the change that broke id_path of udev is that
>> /sys/class/input/event5/device is now a symlink to the inputX directory
>> instead of being the same as the device symlink in inputX directory,
>> i.e. to ../../../devices/platform/pcspkr in this case.
>>
>> Udev id_path uses that directory to construct the ID_PATH variable.
>> Should the sysfs structure be reverted or should udev be adapted to
>> handle traversing /device symlink twice? I think the former, as there
>> should be considerably more time to adapt udev for coming changes in
>> sysfs.
>
> Udev's path_id script is too dumb to follow the "device" link of
> stacked class devices in the CONFIG_SYSFS_DEPRECATED=y layout. Does
> this change fix it for you?
>
http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff_plain;h=b1ac36ff5e3756cefc79967a26280056da31bf6f
>

This just delays the issue until we have 3 levels of indirection :)

2007-09-10 05:29:00

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: sysfs change of input/event devices in 2.6.23rc breaks udev

On Sunday 09 September 2007 19:03, Kay Sievers wrote:
> On 9/8/07, Anssi Hannula <[email protected]> wrote:
> >
> > However, the change that broke id_path of udev is that
> > /sys/class/input/event5/device is now a symlink to the inputX directory
> > instead of being the same as the device symlink in inputX directory,
> > i.e. to ../../../devices/platform/pcspkr in this case.
> >
> > Udev id_path uses that directory to construct the ID_PATH variable.
> > Should the sysfs structure be reverted or should udev be adapted to
> > handle traversing /device symlink twice? I think the former, as there
> > should be considerably more time to adapt udev for coming changes in sysfs.
>
> Udev's path_id script is too dumb to follow the "device" link of
> stacked class devices in the CONFIG_SYSFS_DEPRECATED=y layout. Does
> this change fix it for you?
> http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff_plain;h=b1ac36ff5e3756cefc79967a26280056da31bf6f
>

Hmm, fixing udev is good but users will not get the change in time. I think we
need to adjust SYSFS_DEPRECATED code to produce old results. Something like the
patch below. I wonder what Greg would think...

--
Dmitry

Driver core: fix deprectated sysfs structure for nested class devices

Nested class devices used to have 'device' symlink point to a real
(physical) device instead of a parent class device. When converting
subsystems to struct device we need to keep doing what class devices
did if CONFIG_SYSFS_DEPRECATED is Y, otherwise parts of udev break.

Signed-off-by: Dmitry Torokhov <[email protected]>
---
drivers/base/core.c | 29 +++++++++++++++++++++++------
1 file changed, 23 insertions(+), 6 deletions(-)

Index: work/drivers/base/core.c
===================================================================
--- work.orig/drivers/base/core.c
+++ work/drivers/base/core.c
@@ -679,14 +679,26 @@ static int device_add_class_symlinks(str
goto out_subsys;
}
if (dev->parent) {
- error = sysfs_create_link(&dev->kobj, &dev->parent->kobj,
- "device");
- if (error)
- goto out_busid;
#ifdef CONFIG_SYSFS_DEPRECATED
{
- char * class_name = make_class_name(dev->class->name,
- &dev->kobj);
+ struct device *parent = dev->parent;
+ char *class_name;
+
+ /*
+ * In old sysfs stacked class devices had 'device'
+ * link pointing to real device instead of parent
+ */
+ while (parent->class && !parent->bus && parent->parent)
+ parent = parent->parent;
+
+ error = sysfs_create_link(&dev->kobj,
+ &parent->kobj,
+ "device");
+ if (error)
+ goto out_busid;
+
+ class_name = make_class_name(dev->class->name,
+ &dev->kobj);
if (class_name)
error = sysfs_create_link(&dev->parent->kobj,
&dev->kobj, class_name);
@@ -694,6 +706,11 @@ static int device_add_class_symlinks(str
if (error)
goto out_device;
}
+#else
+ error = sysfs_create_link(&dev->kobj, &dev->parent->kobj,
+ "device");
+ if (error)
+ goto out_busid;
#endif
}
return 0;

2007-09-10 05:41:54

by Greg KH

[permalink] [raw]
Subject: Re: sysfs change of input/event devices in 2.6.23rc breaks udev

On Mon, Sep 10, 2007 at 01:28:47AM -0400, Dmitry Torokhov wrote:
> On Sunday 09 September 2007 19:03, Kay Sievers wrote:
> > On 9/8/07, Anssi Hannula <[email protected]> wrote:
> > >
> > > However, the change that broke id_path of udev is that
> > > /sys/class/input/event5/device is now a symlink to the inputX directory
> > > instead of being the same as the device symlink in inputX directory,
> > > i.e. to ../../../devices/platform/pcspkr in this case.
> > >
> > > Udev id_path uses that directory to construct the ID_PATH variable.
> > > Should the sysfs structure be reverted or should udev be adapted to
> > > handle traversing /device symlink twice? I think the former, as there
> > > should be considerably more time to adapt udev for coming changes in sysfs.
> >
> > Udev's path_id script is too dumb to follow the "device" link of
> > stacked class devices in the CONFIG_SYSFS_DEPRECATED=y layout. Does
> > this change fix it for you?
> > http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff_plain;h=b1ac36ff5e3756cefc79967a26280056da31bf6f
> >
>
> Hmm, fixing udev is good but users will not get the change in time. I think we
> need to adjust SYSFS_DEPRECATED code to produce old results. Something like the
> patch below. I wonder what Greg would think...

Hm, I don't understand. Didn't the original conversion of the input
layer by Kay not have this kind of problem? What did your changes do
differently to cause this driver core change to be needed?

thanks,

greg k-h

2007-09-10 13:24:17

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: sysfs change of input/event devices in 2.6.23rc breaks udev

On 9/10/07, Greg KH <[email protected]> wrote:
> On Mon, Sep 10, 2007 at 01:28:47AM -0400, Dmitry Torokhov wrote:
> > On Sunday 09 September 2007 19:03, Kay Sievers wrote:
> > > On 9/8/07, Anssi Hannula <[email protected]> wrote:
> > > >
> > > > However, the change that broke id_path of udev is that
> > > > /sys/class/input/event5/device is now a symlink to the inputX directory
> > > > instead of being the same as the device symlink in inputX directory,
> > > > i.e. to ../../../devices/platform/pcspkr in this case.
> > > >
> > > > Udev id_path uses that directory to construct the ID_PATH variable.
> > > > Should the sysfs structure be reverted or should udev be adapted to
> > > > handle traversing /device symlink twice? I think the former, as there
> > > > should be considerably more time to adapt udev for coming changes in sysfs.
> > >
> > > Udev's path_id script is too dumb to follow the "device" link of
> > > stacked class devices in the CONFIG_SYSFS_DEPRECATED=y layout. Does
> > > this change fix it for you?
> > > http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff_plain;h=b1ac36ff5e3756cefc79967a26280056da31bf6f
> > >
> >
> > Hmm, fixing udev is good but users will not get the change in time. I think we
> > need to adjust SYSFS_DEPRECATED code to produce old results. Something like the
> > patch below. I wonder what Greg would think...
>
> Hm, I don't understand. Didn't the original conversion of the input
> layer by Kay not have this kind of problem? What did your changes do
> differently to cause this driver core change to be needed?
>

If I understand it correctly Kay's convesion had the same issue. With
class devices "device" link points to class_dev->device instead of
class_dev->parent. If you want to keep compatibility with old sysfs
layout when moving from class devices to regular devices then you need
to "skip" couple of parents till you get to "real" device. This only
matters for input because this was the only subsystem with class
devices stacked.

--
Dmitry

2007-09-15 08:05:48

by Andrew Morton

[permalink] [raw]
Subject: Re: sysfs change of input/event devices in 2.6.23rc breaks udev

On Mon, 10 Sep 2007 09:24:04 -0400 "Dmitry Torokhov" <[email protected]> wrote:

> On 9/10/07, Greg KH <[email protected]> wrote:
> > On Mon, Sep 10, 2007 at 01:28:47AM -0400, Dmitry Torokhov wrote:
> > > On Sunday 09 September 2007 19:03, Kay Sievers wrote:
> > > > On 9/8/07, Anssi Hannula <[email protected]> wrote:
> > > > >
> > > > > However, the change that broke id_path of udev is that
> > > > > /sys/class/input/event5/device is now a symlink to the inputX directory
> > > > > instead of being the same as the device symlink in inputX directory,
> > > > > i.e. to ../../../devices/platform/pcspkr in this case.
> > > > >
> > > > > Udev id_path uses that directory to construct the ID_PATH variable.
> > > > > Should the sysfs structure be reverted or should udev be adapted to
> > > > > handle traversing /device symlink twice? I think the former, as there
> > > > > should be considerably more time to adapt udev for coming changes in sysfs.
> > > >
> > > > Udev's path_id script is too dumb to follow the "device" link of
> > > > stacked class devices in the CONFIG_SYSFS_DEPRECATED=y layout. Does
> > > > this change fix it for you?
> > > > http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff_plain;h=b1ac36ff5e3756cefc79967a26280056da31bf6f
> > > >
> > >
> > > Hmm, fixing udev is good but users will not get the change in time. I think we
> > > need to adjust SYSFS_DEPRECATED code to produce old results. Something like the
> > > patch below. I wonder what Greg would think...
> >
> > Hm, I don't understand. Didn't the original conversion of the input
> > layer by Kay not have this kind of problem? What did your changes do
> > differently to cause this driver core change to be needed?
> >
>
> If I understand it correctly Kay's convesion had the same issue. With
> class devices "device" link points to class_dev->device instead of
> class_dev->parent. If you want to keep compatibility with old sysfs
> layout when moving from class devices to regular devices then you need
> to "skip" couple of parents till you get to "real" device. This only
> matters for input because this was the only subsystem with class
> devices stacked.
>

<wonders where the rest of this thread went to>

Did this userspace-visible post-2.6.22 regression get fixed?

2007-09-15 14:18:27

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: sysfs change of input/event devices in 2.6.23rc breaks udev

On Saturday 15 September 2007 04:05, Andrew Morton wrote:
> On Mon, 10 Sep 2007 09:24:04 -0400 "Dmitry Torokhov" <[email protected]> wrote:
>
> > On 9/10/07, Greg KH <[email protected]> wrote:
> > > On Mon, Sep 10, 2007 at 01:28:47AM -0400, Dmitry Torokhov wrote:
> > > > On Sunday 09 September 2007 19:03, Kay Sievers wrote:
> > > > > On 9/8/07, Anssi Hannula <[email protected]> wrote:
> > > > > >
> > > > > > However, the change that broke id_path of udev is that
> > > > > > /sys/class/input/event5/device is now a symlink to the inputX directory
> > > > > > instead of being the same as the device symlink in inputX directory,
> > > > > > i.e. to ../../../devices/platform/pcspkr in this case.
> > > > > >
> > > > > > Udev id_path uses that directory to construct the ID_PATH variable.
> > > > > > Should the sysfs structure be reverted or should udev be adapted to
> > > > > > handle traversing /device symlink twice? I think the former, as there
> > > > > > should be considerably more time to adapt udev for coming changes in sysfs.
> > > > >
> > > > > Udev's path_id script is too dumb to follow the "device" link of
> > > > > stacked class devices in the CONFIG_SYSFS_DEPRECATED=y layout. Does
> > > > > this change fix it for you?
> > > > > http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff_plain;h=b1ac36ff5e3756cefc79967a26280056da31bf6f
> > > > >
> > > >
> > > > Hmm, fixing udev is good but users will not get the change in time. I think we
> > > > need to adjust SYSFS_DEPRECATED code to produce old results. Something like the
> > > > patch below. I wonder what Greg would think...
> > >
> > > Hm, I don't understand. Didn't the original conversion of the input
> > > layer by Kay not have this kind of problem? What did your changes do
> > > differently to cause this driver core change to be needed?
> > >
> >
> > If I understand it correctly Kay's convesion had the same issue. With
> > class devices "device" link points to class_dev->device instead of
> > class_dev->parent. If you want to keep compatibility with old sysfs
> > layout when moving from class devices to regular devices then you need
> > to "skip" couple of parents till you get to "real" device. This only
> > matters for input because this was the only subsystem with class
> > devices stacked.
> >
>
> <wonders where the rest of this thread went to>

Limbo ;)

Anssi, could you please tell me if the patch fixes the issue on your box?

>
> Did this userspace-visible post-2.6.22 regression get fixed?
>

I'd like the patch to go through Greg if he is OK with it.

--
Dmitry

2007-09-15 16:55:51

by Anssi Hannula

[permalink] [raw]
Subject: Re: sysfs change of input/event devices in 2.6.23rc breaks udev

Dmitry Torokhov wrote:
> On Saturday 15 September 2007 04:05, Andrew Morton wrote:
>> On Mon, 10 Sep 2007 09:24:04 -0400 "Dmitry Torokhov" <[email protected]> wrote:
>>
>>> On 9/10/07, Greg KH <[email protected]> wrote:
>>>> On Mon, Sep 10, 2007 at 01:28:47AM -0400, Dmitry Torokhov wrote:
>>>>> On Sunday 09 September 2007 19:03, Kay Sievers wrote:
>>>>>> On 9/8/07, Anssi Hannula <[email protected]> wrote:
>>>>>>> However, the change that broke id_path of udev is that
>>>>>>> /sys/class/input/event5/device is now a symlink to the inputX directory
>>>>>>> instead of being the same as the device symlink in inputX directory,
>>>>>>> i.e. to ../../../devices/platform/pcspkr in this case.
>>>>>>>
>>>>>>> Udev id_path uses that directory to construct the ID_PATH variable.
>>>>>>> Should the sysfs structure be reverted or should udev be adapted to
>>>>>>> handle traversing /device symlink twice? I think the former, as there
>>>>>>> should be considerably more time to adapt udev for coming changes in sysfs.
>>>>>> Udev's path_id script is too dumb to follow the "device" link of
>>>>>> stacked class devices in the CONFIG_SYSFS_DEPRECATED=y layout. Does
>>>>>> this change fix it for you?
>>>>>> http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff_plain;h=b1ac36ff5e3756cefc79967a26280056da31bf6f
>>>>>>
>>>>> Hmm, fixing udev is good but users will not get the change in time. I think we
>>>>> need to adjust SYSFS_DEPRECATED code to produce old results. Something like the
>>>>> patch below. I wonder what Greg would think...
>>>> Hm, I don't understand. Didn't the original conversion of the input
>>>> layer by Kay not have this kind of problem? What did your changes do
>>>> differently to cause this driver core change to be needed?
>>>>
>>> If I understand it correctly Kay's convesion had the same issue. With
>>> class devices "device" link points to class_dev->device instead of
>>> class_dev->parent. If you want to keep compatibility with old sysfs
>>> layout when moving from class devices to regular devices then you need
>>> to "skip" couple of parents till you get to "real" device. This only
>>> matters for input because this was the only subsystem with class
>>> devices stacked.
>>>
>> <wonders where the rest of this thread went to>
>
> Limbo ;)
>
> Anssi, could you please tell me if the patch fixes the issue on your box?

It does.

>> Did this userspace-visible post-2.6.22 regression get fixed?
>>
>
> I'd like the patch to go through Greg if he is OK with it.
>


--
Anssi Hannula