Allow subsystems to avoid using sysdevs for defining "core" PM callbacks
Subsystems (12)
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Kay SieversQuoted 63 lines · Kay Sievers
Quoted 62 lines · Rafael J. Wysocki
Quoted 48 lines · Kay Sievers
Quoted 34 lines · Paul Mundt
Quoted 20 lines · Rafael J. Wysocki
Quoted 19 lines · Paul Mundt
Quoted 17 lines · R. J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Convert the SuperH clocks framework and shared interrupt handling code to using struct
syscore_opsinstead of a sysdev classes and sysdevs for power managment.This reduces the code size significantly and simplifies it. The optimizations causing things not to be restored after creating a hibernation image are removed, but they might lead to undesirable effects during resume from hibernation (e.g. the clocks would be left as the boot kernel set them, which might be not the same way as the hibernated kernel had seen them before the hibernation).
This also is necessary for removing sysdevs from the kernel entirely in the future.
Signed-off-by Rafael J. Wysocki <[email protected]>Quoted 8 lines
Quoted 2 lines
This misses the use of the sysdev class by the userimask code, though I'm open to suggestions for alternatives.
For now, I'd simply move the sysdev class definition to
userimask.c, like in the patch below. The current goal is to eliminate the suspend/resume and shutdown operations from sysdevs (and sysdev drivers), the next step will be to replace the remaining sysdevs with alternative mechanisms.It's not quite that straightforward, you've also killed off the name attribute for each of the intc sysdevs, so we no longer have a visible way to map a given intc controller number to the controller name in a user visible way.
Quoted 8 lines
I'm not opposed to the syscore thing for suspend/resume ops, but I'm not willing to trash the userimask and name mapping interface in the process with no alternatives.
userimask was the first global configuration item I added, but there are other per-controller and global configuration knobs that I plan to export through the interface, so there really needs to be a compelling reason for moving off of sysdevs.
Yes, they don't fit into the model. They have been a dumb hack from the first day, and never integrated into the kenrel driver core or hotplug properly.
Quoted 6 lines
If you need the userspace visibility, better just add a "struct
bus_type" with a proper name for your subsystem and register a "struct device" with thebus_typeassigned for all of them, instead of using the broken concept of sydevs. You can even make them show up
in /sys/devices/system/<bus_type name>/<struct device name>/ if you want to.I don't really think that's going to be useful in this particular case. The reason is, first, because the struct device would cause lots of other stuff to show up in sysfs which would be totally redundant and confusing and, second, because the things exported here are simply static attributes, pretty much like the stuff in
/sys/power/.
Quoted 7 lines
Quoted 3 lines
Perhaps there's a more straightforward way to make some files show up in sysfs on a specific path than defininig an otherwise useless bus type and device object?
That's absolutely not the point. Please don't get yourself into that thinking. If people want to "export stuff to userspace", they must not invent new things. We need to get rid of the silly special cases.
Why exactly? Do they actually hurt anyone and if so then how?
Quoted 2 lines
Userspace is not meant to learn subsystem specific rules for every new thing.
That depends a good deal of who's writing the user space in question. If that's the same person who's working on the particular part of the kernel, I don't see a big problem.
Quoted 5 lines
There is _one_ way to export device attributes, and that is "struct device" today.
If that's to expensive for anybody, just don't use sysfs. It's the rule we have today. :)
Oh, good to know. It's changed a bit since I last heard. Never mind.
Still, I won't let you change the things in /sys/power to struct devices, sorry about that. ;-)
And I wonder how are you going to deal with clocksource exporting things via the sysdev interface right now. I'd simply create two directories and put the two files into them and be done with that, but I guess that wouldn't fit into the model somehow, right?
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
That way userspace can properly enumerate them in a flat list in /sys/bus/<bus_type name>/devices/*, and gets proper events on module load and during system coldplug, and can hook into the usual hotplug pathes to set/get these values instead of crawling magicly defined and decoupled locations in /sys which can not express proper hierarchy, classicication, or anything else that all other devices can just do.
Quoted 7 lines
Quoted 3 lines
There's no hotplug involved or anything remotely like that AFAICS. There are simply static files as I said above, they are created early during system initialization and simply stay there.
That's not the point. It's about a single way to retrieve information about devices, extendability, and coldplug during bootup, where existing devices need to be handled only after userspace is up.
I'd say the case at hand has nothing to do with that.
Quoted 2 lines
That is just a case of "hotplug" that has the same codepath for userspace, even when the devices can never really come and go.
My impression is that when you say "user space", you actually mean some _specific_ user space, don't you?
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
There is really no reason for any device being a magic and conceptually broken sysdev today - just to be different from any other device the kernel exports to userspace.
It's not a "device being a sysdev", it's sysdevs being used for creating a user space interface, which isn't broken by itself.
Yeah , absolutely. But if any device wants to export anything is _must_ be a "struct device" today. If that does not fit, it must not use sysfs at all.
Well, it's not a "device wants to export something". It's platform code wanting to export some information related to the platform and I really don't see a reason why it should create bus types and device objects _specifically_ for that. It's just too wasteful, both in terms of memory and time needed for handling that in the device core.
Thanks,
Rafael
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Kay SieversQuoted 63 lines · Kay Sievers
Quoted 62 lines · Rafael J. Wysocki
Quoted 48 lines · Kay Sievers
Quoted 34 lines · Paul Mundt
Quoted 20 lines · Rafael J. Wysocki
Quoted 19 lines · Paul Mundt
Quoted 17 lines · R. J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Convert the SuperH clocks framework and shared interrupt handling code to using struct
syscore_opsinstead of a sysdev classes and sysdevs for power managment.This reduces the code size significantly and simplifies it. The optimizations causing things not to be restored after creating a hibernation image are removed, but they might lead to undesirable effects during resume from hibernation (e.g. the clocks would be left as the boot kernel set them, which might be not the same way as the hibernated kernel had seen them before the hibernation).
This also is necessary for removing sysdevs from the kernel entirely in the future.
Signed-off-by Rafael J. Wysocki <[email protected]>Quoted 8 lines
Quoted 2 lines
This misses the use of the sysdev class by the userimask code, though I'm open to suggestions for alternatives.
For now, I'd simply move the sysdev class definition to
userimask.c, like in the patch below. The current goal is to eliminate the suspend/resume and shutdown operations from sysdevs (and sysdev drivers), the next step will be to replace the remaining sysdevs with alternative mechanisms.It's not quite that straightforward, you've also killed off the name attribute for each of the intc sysdevs, so we no longer have a visible way to map a given intc controller number to the controller name in a user visible way.
Quoted 8 lines
I'm not opposed to the syscore thing for suspend/resume ops, but I'm not willing to trash the userimask and name mapping interface in the process with no alternatives.
userimask was the first global configuration item I added, but there are other per-controller and global configuration knobs that I plan to export through the interface, so there really needs to be a compelling reason for moving off of sysdevs.
Yes, they don't fit into the model. They have been a dumb hack from the first day, and never integrated into the kenrel driver core or hotplug properly.
Quoted 6 lines
If you need the userspace visibility, better just add a "struct
bus_type" with a proper name for your subsystem and register a "struct device" with thebus_typeassigned for all of them, instead of using the broken concept of sydevs. You can even make them show up
in /sys/devices/system/<bus_type name>/<struct device name>/ if you want to.I don't really think that's going to be useful in this particular case. The reason is, first, because the struct device would cause lots of other stuff to show up in sysfs which would be totally redundant and confusing and, second, because the things exported here are simply static attributes, pretty much like the stuff in
/sys/power/.
Quoted 7 lines
Quoted 3 lines
Perhaps there's a more straightforward way to make some files show up in sysfs on a specific path than defininig an otherwise useless bus type and device object?
That's absolutely not the point. Please don't get yourself into that thinking. If people want to "export stuff to userspace", they must not invent new things. We need to get rid of the silly special cases.
Why exactly? Do they actually hurt anyone and if so then how?
Quoted 2 lines
Userspace is not meant to learn subsystem specific rules for every new thing.
That depends a good deal of who's writing the user space in question. If that's the same person who's working on the particular part of the kernel, I don't see a big problem.
Quoted 5 lines
There is _one_ way to export device attributes, and that is "struct device" today.
If that's to expensive for anybody, just don't use sysfs. It's the rule we have today. :)
Oh, good to know. It's changed a bit since I last heard. Never mind.
Still, I won't let you change the things in /sys/power to struct devices, sorry about that. ;-)
And I wonder how are you going to deal with clocksource exporting things via the sysdev interface right now. I'd simply create two directories and put the two files into them and be done with that, but I guess that wouldn't fit into the model somehow, right?
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
That way userspace can properly enumerate them in a flat list in /sys/bus/<bus_type name>/devices/*, and gets proper events on module load and during system coldplug, and can hook into the usual hotplug pathes to set/get these values instead of crawling magicly defined and decoupled locations in /sys which can not express proper hierarchy, classicication, or anything else that all other devices can just do.
Quoted 7 lines
Quoted 3 lines
There's no hotplug involved or anything remotely like that AFAICS. There are simply static files as I said above, they are created early during system initialization and simply stay there.
That's not the point. It's about a single way to retrieve information about devices, extendability, and coldplug during bootup, where existing devices need to be handled only after userspace is up.
I'd say the case at hand has nothing to do with that.
Quoted 2 lines
That is just a case of "hotplug" that has the same codepath for userspace, even when the devices can never really come and go.
My impression is that when you say "user space", you actually mean some _specific_ user space, don't you?
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
There is really no reason for any device being a magic and conceptually broken sysdev today - just to be different from any other device the kernel exports to userspace.
It's not a "device being a sysdev", it's sysdevs being used for creating a user space interface, which isn't broken by itself.
Yeah , absolutely. But if any device wants to export anything is _must_ be a "struct device" today. If that does not fit, it must not use sysfs at all.
Well, it's not a "device wants to export something". It's platform code wanting to export some information related to the platform and I really don't see a reason why it should create bus types and device objects _specifically_ for that. It's just too wasteful, both in terms of memory and time needed for handling that in the device core.
Thanks,
Rafael
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Rafael J. WysockiQuoted 7 lines · Rafael J. Wysocki
Quoted 6 lines · Kay Sievers
Quoted 4 lines · Rafael J. Wysocki
Perhaps there's a more straightforward way to make some files show up in sysfs on a specific path than defininig an otherwise useless bus type and device object?
Quoted 5 lines
Quoted 3 lines
That's absolutely not the point. Please don't get yourself into that thinking. If people want to "export stuff to userspace", they must not invent new things. We need to get rid of the silly special cases.
Why exactly? Do they actually hurt anyone and if so then how?
Sure, "devices" are devices, and devices have well-defines set of properties, not some magic directory, people can mess around with the way they like.
Quoted 6 lines
Quoted 2 lines
Userspace is not meant to learn subsystem specific rules for every new thing.
That depends a good deal of who's writing the user space in question. If that's the same person who's working on the particular part of the kernel, I don't see a big problem.
Not for "devices". There are rules for devices, which are defined by the driver core, and the sysdev stuff needs to go, because it does not fit into that model.
Quoted 7 lines
Quoted 5 lines
There is _one_ way to export device attributes, and that is "struct device" today.
If that's to expensive for anybody, just don't use sysfs. It's the rule we have today. :)
Oh, good to know. It's changed a bit since I last heard. Never mind.
Oh, don't get me wrong, this is all is about "devices" not any other controls.
Quoted 2 lines
Still, I won't let you change the things in
/sys/powerto struct devices, sorry about that. ;-)
Fine as long as they are power specific things, and not "devices". You don't have sysdevs there, right? :)
Quoted 4 lines
And I wonder how are you going to deal with clocksource exporting things via the sysdev interface right now. I'd simply create two directories and put the two files into them and be done with that, but I guess that wouldn't fit into the model somehow, right?
Nope, register a bus_type, and use struct device for all of them, Parent them to /sys/devices/system/ if they should keep their location and layout.
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
That way userspace can properly enumerate them in a flat list in /sys/bus/<bus_type name>/devices/*, and gets proper events on module load and during system coldplug, and can hook into the usual hotplug pathes to set/get these values instead of crawling magicly defined and decoupled locations in /sys which can not express proper hierarchy, classicication, or anything else that all other devices can just do.
There's no hotplug involved or anything remotely like that AFAICS. There are simply static files as I said above, they are created early during system initialization and simply stay there.
Quoted 5 lines
Quoted 3 lines
That's not the point. It's about a single way to retrieve information about devices, extendability, and coldplug during bootup, where existing devices need to be handled only after userspace is up.
I'd say the case at hand has nothing to do with that.
It has. As for CPUs. We can not do proper CPU-dependent module autoloading, because the events happen before userspace runs, and clodplug can not see the broken sysdevs, because they have no events to re-trigger, like all others have.
Quoted 5 lines
Quoted 2 lines
That is just a case of "hotplug" that has the same codepath for userspace, even when the devices can never really come and go.
My impression is that when you say "user space", you actually mean some _specific_ user space, don't you?
On usual boxes it's udev/libudev and all the stuff around it. But andreoid has the same stuff in their own way of doing it. So it's not about an implementation in userspace, it's about a sane event and classification interface for kernel-exported devices. Again tis is not about any other stuff in /sys, only the "devices", and we want to have only a single type, and a single way to handle it in userspace.
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
There is really no reason for any device being a magic and conceptually broken sysdev today - just to be different from any other device the kernel exports to userspace.
It's not a "device being a sysdev", it's sysdevs being used for creating a user space interface, which isn't broken by itself.
Yeah , absolutely. But if any device wants to export anything is _must_ be a "struct device" today. If that does not fit, it must not use sysfs at all.
Quoted 5 lines
Well, it's not a "device wants to export something". It's platform code wanting to export some information related to the platform and I really don't see a reason why it should create bus types and device objects _specifically_ for that. It's just too wasteful, both in terms of memory and time needed for handling that in the device core.
Because they are devices, and there is a lot to win, if the kernel exports all "devices" in the same way. This is not about saving an inode in /sys, it's the ability to do runtime device configuration with common tools.
Kay
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Rafael J. WysockiQuoted 7 lines · Rafael J. Wysocki
Quoted 6 lines · Kay Sievers
Quoted 4 lines · Rafael J. Wysocki
Perhaps there's a more straightforward way to make some files show up in sysfs on a specific path than defininig an otherwise useless bus type and device object?
Quoted 5 lines
Quoted 3 lines
That's absolutely not the point. Please don't get yourself into that thinking. If people want to "export stuff to userspace", they must not invent new things. We need to get rid of the silly special cases.
Why exactly? Do they actually hurt anyone and if so then how?
Sure, "devices" are devices, and devices have well-defines set of properties, not some magic directory, people can mess around with the way they like.
Quoted 6 lines
Quoted 2 lines
Userspace is not meant to learn subsystem specific rules for every new thing.
That depends a good deal of who's writing the user space in question. If that's the same person who's working on the particular part of the kernel, I don't see a big problem.
Not for "devices". There are rules for devices, which are defined by the driver core, and the sysdev stuff needs to go, because it does not fit into that model.
Quoted 7 lines
Quoted 5 lines
There is _one_ way to export device attributes, and that is "struct device" today.
If that's to expensive for anybody, just don't use sysfs. It's the rule we have today. :)
Oh, good to know. It's changed a bit since I last heard. Never mind.
Oh, don't get me wrong, this is all is about "devices" not any other controls.
Quoted 2 lines
Still, I won't let you change the things in
/sys/powerto struct devices, sorry about that. ;-)
Fine as long as they are power specific things, and not "devices". You don't have sysdevs there, right? :)
Quoted 4 lines
And I wonder how are you going to deal with clocksource exporting things via the sysdev interface right now. I'd simply create two directories and put the two files into them and be done with that, but I guess that wouldn't fit into the model somehow, right?
Nope, register a bus_type, and use struct device for all of them, Parent them to /sys/devices/system/ if they should keep their location and layout.
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
That way userspace can properly enumerate them in a flat list in /sys/bus/<bus_type name>/devices/*, and gets proper events on module load and during system coldplug, and can hook into the usual hotplug pathes to set/get these values instead of crawling magicly defined and decoupled locations in /sys which can not express proper hierarchy, classicication, or anything else that all other devices can just do.
There's no hotplug involved or anything remotely like that AFAICS. There are simply static files as I said above, they are created early during system initialization and simply stay there.
Quoted 5 lines
Quoted 3 lines
That's not the point. It's about a single way to retrieve information about devices, extendability, and coldplug during bootup, where existing devices need to be handled only after userspace is up.
I'd say the case at hand has nothing to do with that.
It has. As for CPUs. We can not do proper CPU-dependent module autoloading, because the events happen before userspace runs, and clodplug can not see the broken sysdevs, because they have no events to re-trigger, like all others have.
Quoted 5 lines
Quoted 2 lines
That is just a case of "hotplug" that has the same codepath for userspace, even when the devices can never really come and go.
My impression is that when you say "user space", you actually mean some _specific_ user space, don't you?
On usual boxes it's udev/libudev and all the stuff around it. But andreoid has the same stuff in their own way of doing it. So it's not about an implementation in userspace, it's about a sane event and classification interface for kernel-exported devices. Again tis is not about any other stuff in /sys, only the "devices", and we want to have only a single type, and a single way to handle it in userspace.
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
There is really no reason for any device being a magic and conceptually broken sysdev today - just to be different from any other device the kernel exports to userspace.
It's not a "device being a sysdev", it's sysdevs being used for creating a user space interface, which isn't broken by itself.
Yeah , absolutely. But if any device wants to export anything is _must_ be a "struct device" today. If that does not fit, it must not use sysfs at all.
Quoted 5 lines
Well, it's not a "device wants to export something". It's platform code wanting to export some information related to the platform and I really don't see a reason why it should create bus types and device objects _specifically_ for that. It's just too wasteful, both in terms of memory and time needed for handling that in the device core.
Because they are devices, and there is a lot to win, if the kernel exports all "devices" in the same way. This is not about saving an inode in /sys, it's the ability to do runtime device configuration with common tools.
Kay
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Kay SieversQuoted 12 lines · Kay Sievers
Quoted 11 lines · Rafael J. Wysocki
Quoted 9 lines · Kay Sievers
Quoted 4 lines · Rafael J. Wysocki
Perhaps there's a more straightforward way to make some files show up in sysfs on a specific path than defininig an otherwise useless bus type and device object?
That's absolutely not the point. Please don't get yourself into that thinking. If people want to "export stuff to userspace", they must not invent new things. We need to get rid of the silly special cases.
Quoted 6 lines
Quoted 1 line
Why exactly? Do they actually hurt anyone and if so then how?
Sure, "devices" are devices, and devices have well-defines set of properties, not some magic directory, people can mess around with the way they like.
This is starting to get silly. In the case of interrupt controllers as with clocksources the bus abstraction is completely meaningless. I could register a type of "system" bus, but how would that be any different from what we have from sysdevs already today? All it does is force people to duplicate crap all over the place instead and pretend like extra busses exist in order to fit some arbitrary definition of how the driver model should work.
You talk about inventing special interfaces to bypass the device model, but that's not the case here. Rolling my own interface with kobjects and attribute groups as with /sys/power or making an arbitrary bus type for a single class of system devices seems infinitely more hackish than the current sysdev model.
The comment at the top of sys.c says:
* sys.c - pseudo-bus for system 'devices' (cpus, PICs, timers, etc)
Which is precisely where I would expect interrupt controllers and timers and CPUs to go. I'm not going to make an IRQ bus or a timer bus and arbitrarily map some things there and some things somewhere else in the name of some abstraction insanity. These interrupt controllers all have consistent attributes that make the sysdev class model work well, but there are also many other types of interrupt controllers on the same CPUs that use a different abstraction.
Beyond that, we also have sysdev class utilization for DMA controllers, per-CPU store queues, etc, etc. all of which would need to be converted to something else (see for example arch/sh/kernel/cpu/sh4/sq.c -- which in turn was modelled after the cpufreq code, which also would need to change to something else). It's not entirely obvious how to convert these things, or why one should even bother. I can live with the struct device overhead even if I find it to be a meaningless abstraction in this case, but what sort of bus/class model to shoe horn these things in to is rather beyond me.
Indeed it seems to me that these are precisely the sorts of things that sysdevs are intended for, which is why I elected to use them from the onset. Simply saying "don't use sysdevs" and "pretend like you have some sort of a magical pseudo-bus that's not a system bus" doesn't quite do it for me.
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Kay SieversQuoted 12 lines · Kay Sievers
Quoted 11 lines · Rafael J. Wysocki
Quoted 9 lines · Kay Sievers
Quoted 4 lines · Rafael J. Wysocki
Perhaps there's a more straightforward way to make some files show up in sysfs on a specific path than defininig an otherwise useless bus type and device object?
That's absolutely not the point. Please don't get yourself into that thinking. If people want to "export stuff to userspace", they must not invent new things. We need to get rid of the silly special cases.
Quoted 6 lines
Quoted 1 line
Why exactly? Do they actually hurt anyone and if so then how?
Sure, "devices" are devices, and devices have well-defines set of properties, not some magic directory, people can mess around with the way they like.
This is starting to get silly. In the case of interrupt controllers as with clocksources the bus abstraction is completely meaningless. I could register a type of "system" bus, but how would that be any different from what we have from sysdevs already today? All it does is force people to duplicate crap all over the place instead and pretend like extra busses exist in order to fit some arbitrary definition of how the driver model should work.
You talk about inventing special interfaces to bypass the device model, but that's not the case here. Rolling my own interface with kobjects and attribute groups as with /sys/power or making an arbitrary bus type for a single class of system devices seems infinitely more hackish than the current sysdev model.
The comment at the top of sys.c says:
* sys.c - pseudo-bus for system 'devices' (cpus, PICs, timers, etc)
Which is precisely where I would expect interrupt controllers and timers and CPUs to go. I'm not going to make an IRQ bus or a timer bus and arbitrarily map some things there and some things somewhere else in the name of some abstraction insanity. These interrupt controllers all have consistent attributes that make the sysdev class model work well, but there are also many other types of interrupt controllers on the same CPUs that use a different abstraction.
Beyond that, we also have sysdev class utilization for DMA controllers, per-CPU store queues, etc, etc. all of which would need to be converted to something else (see for example arch/sh/kernel/cpu/sh4/sq.c -- which in turn was modelled after the cpufreq code, which also would need to change to something else). It's not entirely obvious how to convert these things, or why one should even bother. I can live with the struct device overhead even if I find it to be a meaningless abstraction in this case, but what sort of bus/class model to shoe horn these things in to is rather beyond me.
Indeed it seems to me that these are precisely the sorts of things that sysdevs are intended for, which is why I elected to use them from the onset. Simply saying "don't use sysdevs" and "pretend like you have some sort of a magical pseudo-bus that's not a system bus" doesn't quite do it for me.
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Paul MundtQuoted 33 lines · Paul Mundt
Quoted 12 lines · Kay Sievers
Quoted 11 lines · Rafael J. Wysocki
Quoted 9 lines · Kay Sievers
Quoted 4 lines · Rafael J. Wysocki
Perhaps there's a more straightforward way to make some files show up in sysfs on a specific path than defininig an otherwise useless bus type and device object?
That's absolutely not the point. Please don't get yourself into that thinking. If people want to "export stuff to userspace", they must not invent new things. We need to get rid of the silly special cases.
Quoted 6 lines
Quoted 1 line
Why exactly? Do they actually hurt anyone and if so then how?
Sure, "devices" are devices, and devices have well-defines set of properties, not some magic directory, people can mess around with the way they like.
This is starting to get silly. In the case of interrupt controllers as with clocksources the bus abstraction is completely meaningless. I could register a type of "system" bus, but how would that be any different from what we have from sysdevs already today? All it does is force people to duplicate crap all over the place instead and pretend like extra busses exist in order to fit some arbitrary definition of how the driver model should work.
You talk about inventing special interfaces to bypass the device model, but that's not the case here. Rolling my own interface with kobjects and attribute groups as with
/sys/poweror making an arbitrary bus type for a single class of system devices seems infinitely more hackish than the current sysdev model.
Quoted 3 lines
The comment at the top of
sys.csays:*
sys.c- pseudo-bus for system 'devices' (cpus, PICs, timers, etc)
Which is what we need to get rid of. It does not make any sense on the global picture to have anything like that exported to userspace.
Quoted 18 lines
Which is precisely where I would expect interrupt controllers and timers and CPUs to go. I'm not going to make an IRQ bus or a timer bus and arbitrarily map some things there and some things somewhere else in the name of some abstraction insanity. These interrupt controllers all have consistent attributes that make the sysdev class model work well, but there are also many other types of interrupt controllers on the same CPUs that use a different abstraction.
Beyond that, we also have sysdev class utilization for DMA controllers, per-CPU store queues, etc, etc. all of which would need to be converted to something else (see for example
arch/sh/kernel/cpu/sh4/sq.c-- which in turn was modelled after the cpufreq code, which also would need to change to something else). It's not entirely obvious how to convert these things, or why one should even bother. I can live with the struct device overhead even if I find it to be a meaningless abstraction in this case, but what sort of bus/class model to shoe horn these things in to is rather beyond me.
Quoted 5 lines
Indeed it seems to me that these are precisely the sorts of things that sysdevs are intended for, which is why I elected to use them from the onset. Simply saying "don't use sysdevs" and "pretend like you have some sort of a magical pseudo-bus that's not a system bus" doesn't quite do it for me.
Nope, a device has a "name", a "subsystem" and a "devpath", has well-defined core-maintained properties at the device directory. It is not some random custom directory which people can put where they like it. Userspace has expectations about devices which need to be met, and that can only happen if these devices are "struct device".
All real devices sort into a hierarchy, possibly in different parent locations, and have a single point of classification which is the devices/ directory and contains symlinks. Only that way we can cope with it in userspace.
People should really stop messing around in /sys for optimization purposes. We have a common device model, and need to use it. Sysdevs do not fit into that model.
I can't tell how that fits into your use case, but please use something else than sysfs, if you need device information exported, but you can't use "struct device".
Thanks,
Kay
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Paul MundtQuoted 33 lines · Paul Mundt
Quoted 12 lines · Kay Sievers
Quoted 11 lines · Rafael J. Wysocki
Quoted 9 lines · Kay Sievers
Quoted 4 lines · Rafael J. Wysocki
Perhaps there's a more straightforward way to make some files show up in sysfs on a specific path than defininig an otherwise useless bus type and device object?
That's absolutely not the point. Please don't get yourself into that thinking. If people want to "export stuff to userspace", they must not invent new things. We need to get rid of the silly special cases.
Quoted 6 lines
Quoted 1 line
Why exactly? Do they actually hurt anyone and if so then how?
Sure, "devices" are devices, and devices have well-defines set of properties, not some magic directory, people can mess around with the way they like.
This is starting to get silly. In the case of interrupt controllers as with clocksources the bus abstraction is completely meaningless. I could register a type of "system" bus, but how would that be any different from what we have from sysdevs already today? All it does is force people to duplicate crap all over the place instead and pretend like extra busses exist in order to fit some arbitrary definition of how the driver model should work.
You talk about inventing special interfaces to bypass the device model, but that's not the case here. Rolling my own interface with kobjects and attribute groups as with
/sys/poweror making an arbitrary bus type for a single class of system devices seems infinitely more hackish than the current sysdev model.
Quoted 3 lines
The comment at the top of
sys.csays:*
sys.c- pseudo-bus for system 'devices' (cpus, PICs, timers, etc)
Which is what we need to get rid of. It does not make any sense on the global picture to have anything like that exported to userspace.
Quoted 18 lines
Which is precisely where I would expect interrupt controllers and timers and CPUs to go. I'm not going to make an IRQ bus or a timer bus and arbitrarily map some things there and some things somewhere else in the name of some abstraction insanity. These interrupt controllers all have consistent attributes that make the sysdev class model work well, but there are also many other types of interrupt controllers on the same CPUs that use a different abstraction.
Beyond that, we also have sysdev class utilization for DMA controllers, per-CPU store queues, etc, etc. all of which would need to be converted to something else (see for example
arch/sh/kernel/cpu/sh4/sq.c-- which in turn was modelled after the cpufreq code, which also would need to change to something else). It's not entirely obvious how to convert these things, or why one should even bother. I can live with the struct device overhead even if I find it to be a meaningless abstraction in this case, but what sort of bus/class model to shoe horn these things in to is rather beyond me.
Quoted 5 lines
Indeed it seems to me that these are precisely the sorts of things that sysdevs are intended for, which is why I elected to use them from the onset. Simply saying "don't use sysdevs" and "pretend like you have some sort of a magical pseudo-bus that's not a system bus" doesn't quite do it for me.
Nope, a device has a "name", a "subsystem" and a "devpath", has well-defined core-maintained properties at the device directory. It is not some random custom directory which people can put where they like it. Userspace has expectations about devices which need to be met, and that can only happen if these devices are "struct device".
All real devices sort into a hierarchy, possibly in different parent locations, and have a single point of classification which is the devices/ directory and contains symlinks. Only that way we can cope with it in userspace.
People should really stop messing around in /sys for optimization purposes. We have a common device model, and need to use it. Sysdevs do not fit into that model.
I can't tell how that fits into your use case, but please use something else than sysfs, if you need device information exported, but you can't use "struct device".
Thanks,
Kay
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Kay SieversQuoted 12 lines · Kay Sievers
Quoted 11 lines · Rafael J. Wysocki
Quoted 9 lines · Kay Sievers
Quoted 4 lines · Rafael J. Wysocki
Perhaps there's a more straightforward way to make some files show up in sysfs on a specific path than defininig an otherwise useless bus type and device object?
That's absolutely not the point. Please don't get yourself into that thinking. If people want to "export stuff to userspace", they must not invent new things. We need to get rid of the silly special cases.
Quoted 5 lines
Quoted 1 line
Why exactly? Do they actually hurt anyone and if so then how?
Sure, "devices" are devices, and devices have well-defines set of properties, not some magic directory, people can mess around with the way they like.
So it looks like the the problem is that the exported attributes happen to be under /sys/devices/. Would it still be a problem if they were somewhere else?
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
Userspace is not meant to learn subsystem specific rules for every new thing.
That depends a good deal of who's writing the user space in question. If that's the same person who's working on the particular part of the kernel, I don't see a big problem.
Not for "devices". There are rules for devices, which are defined by the driver core, and the sysdev stuff needs to go, because it does not fit into that model.
OK, I understand that.
Now, there's stuff that doesn't really match the "device" model. Where is the right place to export that? Perhaps we should add something like /sys/platform/ (in analogy with /sys/firmware/)?
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
There is _one_ way to export device attributes, and that is "struct device" today.
If that's to expensive for anybody, just don't use sysfs. It's the rule we have today. :)
Oh, good to know. It's changed a bit since I last heard. Never mind.
Quoted 8 lines
Oh, don't get me wrong, this is all is about "devices" not any other controls.
Quoted 2 lines
Still, I won't let you change the things in
/sys/powerto struct devices, sorry about that. ;-)Fine as long as they are power specific things, and not "devices". You don't have sysdevs there, right? :)
No, I don't.
Quoted 8 lines
Quoted 4 lines
And I wonder how are you going to deal with clocksource exporting things via the sysdev interface right now. I'd simply create two directories and put the two files into them and be done with that, but I guess that wouldn't fit into the model somehow, right?
Nope, register a
bus_type, and use struct device for all of them, Parent them to/sys/devices/system/if they should keep their location and layout.
Well, I'll be watching what happens to the patch trying to do that, but I'm not going to bet anything on its success. ;-)
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 10 lines
Quoted 6 lines
That way userspace can properly enumerate them in a flat list in /sys/bus/<bus_type name>/devices/*, and gets proper events on module load and during system coldplug, and can hook into the usual hotplug pathes to set/get these values instead of crawling magicly defined and decoupled locations in /sys which can not express proper hierarchy, classicication, or anything else that all other devices can just do.
There's no hotplug involved or anything remotely like that AFAICS. There are simply static files as I said above, they are created early during system initialization and simply stay there.
That's not the point. It's about a single way to retrieve information about devices, extendability, and coldplug during bootup, where existing devices need to be handled only after userspace is up.
Quoted 6 lines
Quoted 1 line
I'd say the case at hand has nothing to do with that.
It has. As for CPUs. We can not do proper CPU-dependent module autoloading, because the events happen before userspace runs, and clodplug can not see the broken sysdevs, because they have no events to re-trigger, like all others have.
Well, as I said, would it be OK if the things in question happened to be located somewhere outside of /sys/devices/ ?
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
That is just a case of "hotplug" that has the same codepath for userspace, even when the devices can never really come and go.
My impression is that when you say "user space", you actually mean some _specific_ user space, don't you?
Quoted 6 lines
On usual boxes it's udev/libudev and all the stuff around it. But andreoid has the same stuff in their own way of doing it. So it's not about an implementation in userspace, it's about a sane event and classification interface for kernel-exported devices. Again tis is not about any other stuff in /sys, only the "devices", and we want to have only a single type, and a single way to handle it in userspace.
OK
Quoted 17 lines
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
There is really no reason for any device being a magic and conceptually broken sysdev today - just to be different from any other device the kernel exports to userspace.
It's not a "device being a sysdev", it's sysdevs being used for creating a user space interface, which isn't broken by itself.
Yeah , absolutely. But if any device wants to export anything is _must_ be a "struct device" today. If that does not fit, it must not use sysfs at all.
Quoted 5 lines
Well, it's not a "device wants to export something". It's platform code wanting to export some information related to the platform and I really don't see a reason why it should create bus types and device objects _specifically_ for that. It's just too wasteful, both in terms of memory and time needed for handling that in the device core.
Quoted 4 lines
Because they are devices, and there is a lot to win, if the kernel exports all "devices" in the same way. This is not about saving an inode in /sys, it's the ability to do runtime device configuration with common tools.
If I understand you correctly, the goal is to have everything under /sys/devices/ been represented by struct device objects and there are good reasons to do that.
In that case we either have to move the things exported via sysdevs somewhere else (presumably having to create that "somewhere" before), or we have to introduce struct device objects specifically for exporting them. I don't really think the latter approach will be very popular, so quite likely we'll need to have a plan for moving those things to different locations.
Thanks,
Rafael
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Kay SieversQuoted 12 lines · Kay Sievers
Quoted 11 lines · Rafael J. Wysocki
Quoted 9 lines · Kay Sievers
Quoted 4 lines · Rafael J. Wysocki
Perhaps there's a more straightforward way to make some files show up in sysfs on a specific path than defininig an otherwise useless bus type and device object?
That's absolutely not the point. Please don't get yourself into that thinking. If people want to "export stuff to userspace", they must not invent new things. We need to get rid of the silly special cases.
Quoted 5 lines
Quoted 1 line
Why exactly? Do they actually hurt anyone and if so then how?
Sure, "devices" are devices, and devices have well-defines set of properties, not some magic directory, people can mess around with the way they like.
So it looks like the the problem is that the exported attributes happen to be under /sys/devices/. Would it still be a problem if they were somewhere else?
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
Userspace is not meant to learn subsystem specific rules for every new thing.
That depends a good deal of who's writing the user space in question. If that's the same person who's working on the particular part of the kernel, I don't see a big problem.
Not for "devices". There are rules for devices, which are defined by the driver core, and the sysdev stuff needs to go, because it does not fit into that model.
OK, I understand that.
Now, there's stuff that doesn't really match the "device" model. Where is the right place to export that? Perhaps we should add something like /sys/platform/ (in analogy with /sys/firmware/)?
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
There is _one_ way to export device attributes, and that is "struct device" today.
If that's to expensive for anybody, just don't use sysfs. It's the rule we have today. :)
Oh, good to know. It's changed a bit since I last heard. Never mind.
Quoted 8 lines
Oh, don't get me wrong, this is all is about "devices" not any other controls.
Quoted 2 lines
Still, I won't let you change the things in
/sys/powerto struct devices, sorry about that. ;-)Fine as long as they are power specific things, and not "devices". You don't have sysdevs there, right? :)
No, I don't.
Quoted 8 lines
Quoted 4 lines
And I wonder how are you going to deal with clocksource exporting things via the sysdev interface right now. I'd simply create two directories and put the two files into them and be done with that, but I guess that wouldn't fit into the model somehow, right?
Nope, register a
bus_type, and use struct device for all of them, Parent them to/sys/devices/system/if they should keep their location and layout.
Well, I'll be watching what happens to the patch trying to do that, but I'm not going to bet anything on its success. ;-)
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 10 lines
Quoted 6 lines
That way userspace can properly enumerate them in a flat list in /sys/bus/<bus_type name>/devices/*, and gets proper events on module load and during system coldplug, and can hook into the usual hotplug pathes to set/get these values instead of crawling magicly defined and decoupled locations in /sys which can not express proper hierarchy, classicication, or anything else that all other devices can just do.
There's no hotplug involved or anything remotely like that AFAICS. There are simply static files as I said above, they are created early during system initialization and simply stay there.
That's not the point. It's about a single way to retrieve information about devices, extendability, and coldplug during bootup, where existing devices need to be handled only after userspace is up.
Quoted 6 lines
Quoted 1 line
I'd say the case at hand has nothing to do with that.
It has. As for CPUs. We can not do proper CPU-dependent module autoloading, because the events happen before userspace runs, and clodplug can not see the broken sysdevs, because they have no events to re-trigger, like all others have.
Well, as I said, would it be OK if the things in question happened to be located somewhere outside of /sys/devices/ ?
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
That is just a case of "hotplug" that has the same codepath for userspace, even when the devices can never really come and go.
My impression is that when you say "user space", you actually mean some _specific_ user space, don't you?
Quoted 6 lines
On usual boxes it's udev/libudev and all the stuff around it. But andreoid has the same stuff in their own way of doing it. So it's not about an implementation in userspace, it's about a sane event and classification interface for kernel-exported devices. Again tis is not about any other stuff in /sys, only the "devices", and we want to have only a single type, and a single way to handle it in userspace.
OK
Quoted 17 lines
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
There is really no reason for any device being a magic and conceptually broken sysdev today - just to be different from any other device the kernel exports to userspace.
It's not a "device being a sysdev", it's sysdevs being used for creating a user space interface, which isn't broken by itself.
Yeah , absolutely. But if any device wants to export anything is _must_ be a "struct device" today. If that does not fit, it must not use sysfs at all.
Quoted 5 lines
Well, it's not a "device wants to export something". It's platform code wanting to export some information related to the platform and I really don't see a reason why it should create bus types and device objects _specifically_ for that. It's just too wasteful, both in terms of memory and time needed for handling that in the device core.
Quoted 4 lines
Because they are devices, and there is a lot to win, if the kernel exports all "devices" in the same way. This is not about saving an inode in /sys, it's the ability to do runtime device configuration with common tools.
If I understand you correctly, the goal is to have everything under /sys/devices/ been represented by struct device objects and there are good reasons to do that.
In that case we either have to move the things exported via sysdevs somewhere else (presumably having to create that "somewhere" before), or we have to introduce struct device objects specifically for exporting them. I don't really think the latter approach will be very popular, so quite likely we'll need to have a plan for moving those things to different locations.
Thanks,
Rafael
Re: [PATCH 3/6] PCI / Intel IOMMU: Use syscore_ops instead of sysdev class and sysdev
In reply to Joerg RoedelQuoted 5 lines · Joerg Roedel
Quoted 2 lines · Rafael J. Wysocki
drivers/pci/intel-iommu.c | 38 +++++++++----------------------------- 1 file changed, 9 insertions(+), 29 deletions(-)Looks good.
May I take that as an ACK?
Quoted 1 line
I prepare a patch to convert AMD IOMMU to
syscore_opstoo.
Already done. :-)
It's a part of patch [1/6].
Thanks,
Rafael
Re: [PATCH 3/6] PCI / Intel IOMMU: Use syscore_ops instead of sysdev class and sysdev
In reply to Joerg RoedelQuoted 5 lines · Joerg Roedel
Quoted 2 lines · Rafael J. Wysocki
drivers/pci/intel-iommu.c | 38 +++++++++----------------------------- 1 file changed, 9 insertions(+), 29 deletions(-)Looks good.
May I take that as an ACK?
Quoted 1 line
I prepare a patch to convert AMD IOMMU to
syscore_opstoo.
Already done. :-)
It's a part of patch [1/6].
Thanks,
Rafael
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Rafael J. WysockiQuoted 15 lines · Rafael J. Wysocki
Quoted 14 lines · Kay Sievers
Quoted 12 lines · Rafael J. Wysocki
Quoted 9 lines · Kay Sievers
Quoted 4 lines · Rafael J. Wysocki
Perhaps there's a more straightforward way to make some files show up in sysfs on a specific path than defininig an otherwise useless bus type and device object?
That's absolutely not the point. Please don't get yourself into that thinking. If people want to "export stuff to userspace", they must not invent new things. We need to get rid of the silly special cases.
Why exactly? Do they actually hurt anyone and if so then how?
Quoted 7 lines
Quoted 3 lines
Sure, "devices" are devices, and devices have well-defines set of properties, not some magic directory, people can mess around with the way they like.
So it looks like the the problem is that the exported attributes happen to be under
/sys/devices/. Would it still be a problem if they were somewhere else?
We are not going to invent another location for any devices. They need to stay in /devices if they are devices. And all devices need to be "struct device".
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
Userspace is not meant to learn subsystem specific rules for every new thing.
That depends a good deal of who's writing the user space in question. If that's the same person who's working on the particular part of the kernel, I don't see a big problem.
Not for "devices". There are rules for devices, which are defined by the driver core, and the sysdev stuff needs to go, because it does not fit into that model.
Quoted 5 lines
OK, I understand that.
Now, there's stuff that doesn't really match the "device" model. Where is the right place to export that? Perhaps we should add something like
/sys/platform/(in analogy with/sys/firmware/)?
No, add a subsystem (bus_type) for any of them, and register them. There is no such thing as "devices which do not fit the device model", they are all fine there. Please stop optimizing single bytes and creating a mess in /sys. Every device is a "struct device".
Think of "struct bus_type" as "struct subsystem", we will rename that when we are ready. It is just a group of devices which are of the same type, it has nothing to do with a bus in the sense of hardware.
We need unified exports of _all devices to userspace, not custom layouts in /sys.
There's is a pretty much outdated Documentation/sysfs-rules.txt, wich covers part of the history and the plans.
Quoted 11 lines
Quoted 11 lines
Quoted 7 lines
Quoted 5 lines
There is _one_ way to export device attributes, and that is "struct device" today.
If that's to expensive for anybody, just don't use sysfs. It's the rule we have today. :)
Oh, good to know. It's changed a bit since I last heard. Never mind.
Oh, don't get me wrong, this is all is about "devices" not any other controls.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Still, I won't let you change the things in
/sys/powerto struct devices, sorry about that. ;-)Fine as long as they are power specific things, and not "devices". You don't have sysdevs there, right? :)
No, I don't.
Then all is fine. All other stuff is more like /proc, and can never be really unified. All we care about is devices, which have common methods for userspace to trigger and consume, and need to be unified. Power specific control files seems all fine in its kobject use.
Quoted 11 lines
Quoted 8 lines
Quoted 4 lines
And I wonder how are you going to deal with clocksource exporting things via the sysdev interface right now. I'd simply create two directories and put the two files into them and be done with that, but I guess that wouldn't fit into the model somehow, right?
Nope, register a
bus_type, and use struct device for all of them, Parent them to/sys/devices/system/if they should keep their location and layout.Well, I'll be watching what happens to the patch trying to do that, but I'm not going to bet anything on its success. ;-)
It should be pretty straight-forward. We will need to do that for CPUs I guess, because the interface is kinda commonly used.
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
That way userspace can properly enumerate them in a flat list in /sys/bus/<bus_type name>/devices/*, and gets proper events on module load and during system coldplug, and can hook into the usual hotplug pathes to set/get these values instead of crawling magicly defined and decoupled locations in /sys which can not express proper hierarchy, classicication, or anything else that all other devices can just do.
Quoted 7 lines
Quoted 3 lines
There's no hotplug involved or anything remotely like that AFAICS. There are simply static files as I said above, they are created early during system initialization and simply stay there.
That's not the point. It's about a single way to retrieve information about devices, extendability, and coldplug during bootup, where existing devices need to be handled only after userspace is up.
I'd say the case at hand has nothing to do with that.
Quoted 7 lines
Quoted 4 lines
It has. As for CPUs. We can not do proper CPU-dependent module autoloading, because the events happen before userspace runs, and clodplug can not see the broken sysdevs, because they have no events to re-trigger, like all others have.
Well, as I said, would it be OK if the things in question happened to be located somewhere outside of
/sys/devices/?
No, no device directory can be outside of /sys/devices.
Quoted 41 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
That is just a case of "hotplug" that has the same codepath for userspace, even when the devices can never really come and go.
My impression is that when you say "user space", you actually mean some _specific_ user space, don't you?
Quoted 6 lines
On usual boxes it's udev/libudev and all the stuff around it. But andreoid has the same stuff in their own way of doing it. So it's not about an implementation in userspace, it's about a sane event and classification interface for kernel-exported devices. Again tis is not about any other stuff in /sys, only the "devices", and we want to have only a single type, and a single way to handle it in userspace.
OK
Quoted 17 lines
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
There is really no reason for any device being a magic and conceptually broken sysdev today - just to be different from any other device the kernel exports to userspace.
It's not a "device being a sysdev", it's sysdevs being used for creating a user space interface, which isn't broken by itself.
Yeah , absolutely. But if any device wants to export anything is _must_ be a "struct device" today. If that does not fit, it must not use sysfs at all.
Quoted 5 lines
Well, it's not a "device wants to export something". It's platform code wanting to export some information related to the platform and I really don't see a reason why it should create bus types and device objects _specifically_ for that. It's just too wasteful, both in terms of memory and time needed for handling that in the device core.
Quoted 4 lines
Because they are devices, and there is a lot to win, if the kernel exports all "devices" in the same way. This is not about saving an inode in /sys, it's the ability to do runtime device configuration with common tools.
If I understand you correctly, the goal is to have everything under
/sys/devices/been represented by struct device objects and there are good reasons to do that.
Quoted 5 lines
In that case we either have to move the things exported via sysdevs somewhere else (presumably having to create that "somewhere" before), or we have to introduce struct device objects specifically for exporting them. I don't really think the latter approach will be very popular, so quite likely we'll need to have a plan for moving those things to different locations.
We can just keep the same location for anything that is expected to be in /sys/devices/system. All outside visible difference is that these devices (then struct device) also have a "subsystem" (bus_type) which carries the flat list of devices, the devices have a "uevent" file and with that they are coldpluggable, event re-triggerable, could have modalias, ... and all the other 1000 things that just work today, and what we need for many of them. They are then just handled like any other exported device too.
Kay
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Rafael J. WysockiQuoted 15 lines · Rafael J. Wysocki
Quoted 14 lines · Kay Sievers
Quoted 12 lines · Rafael J. Wysocki
Quoted 9 lines · Kay Sievers
Quoted 4 lines · Rafael J. Wysocki
Perhaps there's a more straightforward way to make some files show up in sysfs on a specific path than defininig an otherwise useless bus type and device object?
That's absolutely not the point. Please don't get yourself into that thinking. If people want to "export stuff to userspace", they must not invent new things. We need to get rid of the silly special cases.
Why exactly? Do they actually hurt anyone and if so then how?
Quoted 7 lines
Quoted 3 lines
Sure, "devices" are devices, and devices have well-defines set of properties, not some magic directory, people can mess around with the way they like.
So it looks like the the problem is that the exported attributes happen to be under
/sys/devices/. Would it still be a problem if they were somewhere else?
We are not going to invent another location for any devices. They need to stay in /devices if they are devices. And all devices need to be "struct device".
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
Userspace is not meant to learn subsystem specific rules for every new thing.
That depends a good deal of who's writing the user space in question. If that's the same person who's working on the particular part of the kernel, I don't see a big problem.
Not for "devices". There are rules for devices, which are defined by the driver core, and the sysdev stuff needs to go, because it does not fit into that model.
Quoted 5 lines
OK, I understand that.
Now, there's stuff that doesn't really match the "device" model. Where is the right place to export that? Perhaps we should add something like
/sys/platform/(in analogy with/sys/firmware/)?
No, add a subsystem (bus_type) for any of them, and register them. There is no such thing as "devices which do not fit the device model", they are all fine there. Please stop optimizing single bytes and creating a mess in /sys. Every device is a "struct device".
Think of "struct bus_type" as "struct subsystem", we will rename that when we are ready. It is just a group of devices which are of the same type, it has nothing to do with a bus in the sense of hardware.
We need unified exports of _all devices to userspace, not custom layouts in /sys.
There's is a pretty much outdated Documentation/sysfs-rules.txt, wich covers part of the history and the plans.
Quoted 11 lines
Quoted 11 lines
Quoted 7 lines
Quoted 5 lines
There is _one_ way to export device attributes, and that is "struct device" today.
If that's to expensive for anybody, just don't use sysfs. It's the rule we have today. :)
Oh, good to know. It's changed a bit since I last heard. Never mind.
Oh, don't get me wrong, this is all is about "devices" not any other controls.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Still, I won't let you change the things in
/sys/powerto struct devices, sorry about that. ;-)Fine as long as they are power specific things, and not "devices". You don't have sysdevs there, right? :)
No, I don't.
Then all is fine. All other stuff is more like /proc, and can never be really unified. All we care about is devices, which have common methods for userspace to trigger and consume, and need to be unified. Power specific control files seems all fine in its kobject use.
Quoted 11 lines
Quoted 8 lines
Quoted 4 lines
And I wonder how are you going to deal with clocksource exporting things via the sysdev interface right now. I'd simply create two directories and put the two files into them and be done with that, but I guess that wouldn't fit into the model somehow, right?
Nope, register a
bus_type, and use struct device for all of them, Parent them to/sys/devices/system/if they should keep their location and layout.Well, I'll be watching what happens to the patch trying to do that, but I'm not going to bet anything on its success. ;-)
It should be pretty straight-forward. We will need to do that for CPUs I guess, because the interface is kinda commonly used.
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
That way userspace can properly enumerate them in a flat list in /sys/bus/<bus_type name>/devices/*, and gets proper events on module load and during system coldplug, and can hook into the usual hotplug pathes to set/get these values instead of crawling magicly defined and decoupled locations in /sys which can not express proper hierarchy, classicication, or anything else that all other devices can just do.
Quoted 7 lines
Quoted 3 lines
There's no hotplug involved or anything remotely like that AFAICS. There are simply static files as I said above, they are created early during system initialization and simply stay there.
That's not the point. It's about a single way to retrieve information about devices, extendability, and coldplug during bootup, where existing devices need to be handled only after userspace is up.
I'd say the case at hand has nothing to do with that.
Quoted 7 lines
Quoted 4 lines
It has. As for CPUs. We can not do proper CPU-dependent module autoloading, because the events happen before userspace runs, and clodplug can not see the broken sysdevs, because they have no events to re-trigger, like all others have.
Well, as I said, would it be OK if the things in question happened to be located somewhere outside of
/sys/devices/?
No, no device directory can be outside of /sys/devices.
Quoted 41 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
That is just a case of "hotplug" that has the same codepath for userspace, even when the devices can never really come and go.
My impression is that when you say "user space", you actually mean some _specific_ user space, don't you?
Quoted 6 lines
On usual boxes it's udev/libudev and all the stuff around it. But andreoid has the same stuff in their own way of doing it. So it's not about an implementation in userspace, it's about a sane event and classification interface for kernel-exported devices. Again tis is not about any other stuff in /sys, only the "devices", and we want to have only a single type, and a single way to handle it in userspace.
OK
Quoted 17 lines
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
There is really no reason for any device being a magic and conceptually broken sysdev today - just to be different from any other device the kernel exports to userspace.
It's not a "device being a sysdev", it's sysdevs being used for creating a user space interface, which isn't broken by itself.
Yeah , absolutely. But if any device wants to export anything is _must_ be a "struct device" today. If that does not fit, it must not use sysfs at all.
Quoted 5 lines
Well, it's not a "device wants to export something". It's platform code wanting to export some information related to the platform and I really don't see a reason why it should create bus types and device objects _specifically_ for that. It's just too wasteful, both in terms of memory and time needed for handling that in the device core.
Quoted 4 lines
Because they are devices, and there is a lot to win, if the kernel exports all "devices" in the same way. This is not about saving an inode in /sys, it's the ability to do runtime device configuration with common tools.
If I understand you correctly, the goal is to have everything under
/sys/devices/been represented by struct device objects and there are good reasons to do that.
Quoted 5 lines
In that case we either have to move the things exported via sysdevs somewhere else (presumably having to create that "somewhere" before), or we have to introduce struct device objects specifically for exporting them. I don't really think the latter approach will be very popular, so quite likely we'll need to have a plan for moving those things to different locations.
We can just keep the same location for anything that is expected to be in /sys/devices/system. All outside visible difference is that these devices (then struct device) also have a "subsystem" (bus_type) which carries the flat list of devices, the devices have a "uevent" file and with that they are coldpluggable, event re-triggerable, could have modalias, ... and all the other 1000 things that just work today, and what we need for many of them. They are then just handled like any other exported device too.
Kay
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Kay SieversQuoted 1 line · Kay Sievers
On Wed, 2011-03-23 at 06:49 +0900, Paul Mundt wrote:
...
Quoted 18 lines
Quoted 18 lines
You talk about inventing special interfaces to bypass the device model, but that's not the case here. Rolling my own interface with kobjects and attribute groups as with
/sys/poweror making an arbitrary bus type for a single class of system devices seems infinitely more hackish than the current sysdev model.The comment at the top of
sys.csays:*
sys.c- pseudo-bus for system 'devices' (cpus, PICs, timers, etc)Which is precisely where I would expect interrupt controllers and timers and CPUs to go. I'm not going to make an IRQ bus or a timer bus and arbitrarily map some things there and some things somewhere else in the name of some abstraction insanity. These interrupt controllers all have consistent attributes that make the sysdev class model work well, but there are also many other types of interrupt controllers on the same CPUs that use a different abstraction.
Quoted 6 lines
Quoted 6 lines
Beyond that, we also have sysdev class utilization for DMA controllers, per-CPU store queues, etc, etc. all of which would need to be converted to something else (see for example
arch/sh/kernel/cpu/sh4/sq.c-- which in turn was modelled after the cpufreq code, which also would need to change to something else). It's not entirely obvious how to convert these things, or why one should even bother.
The reason why is, if I understand it correctly, because user space tools generally expect /sys/devices/ to be consistent in terms of the representation of things and /sys/devices/system/ currently violates that expectation which leads to all sorts of problems with device discovery, hotplug etc.
Now, whether or not to convert all the things currently exported through sysdevs to struct device objects is not too obvious to me. I think it simply may be better to move them into a different direcory in sysfs (presumably creating one for this purpose).
Quoted 21 lines
Quoted 9 lines
I can live with the struct device overhead even if I find it to be a meaningless abstraction in this case, but what sort of bus/class model to shoe horn these things in to is rather beyond me.
Indeed it seems to me that these are precisely the sorts of things that sysdevs are intended for, which is why I elected to use them from the onset. Simply saying "don't use sysdevs" and "pretend like you have some sort of a magical pseudo-bus that's not a system bus" doesn't quite do it for me.
Nope, a device has a "name", a "subsystem" and a "devpath", has well-defined core-maintained properties at the device directory. It is not some random custom directory which people can put where they like it. Userspace has expectations about devices which need to be met, and that can only happen if these devices are "struct device".
All real devices sort into a hierarchy, possibly in different parent locations, and have a single point of classification which is the devices/ directory and contains symlinks. Only that way we can cope with it in userspace.
Quoted 7 lines
People should really stop messing around in /sys for optimization purposes. We have a common device model, and need to use it. Sysdevs do not fit into that model.
I can't tell how that fits into your use case, but please use something else than sysfs, if you need device information exported, but you can't use "struct device".
I really think you shouldn't say "sysfs" when you in fact you mean "/sys/devices/". :-)
Now, I can easily understand arguments about representing everything under /sys/devices/ by struct device objects, no question about that. However, I also think there should be a place for things like those mentioned in the comment in sys.c, presumably outside of /sys/devices/.
Thanks,
Rafael
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Kay SieversQuoted 1 line · Kay Sievers
On Wed, 2011-03-23 at 06:49 +0900, Paul Mundt wrote:
...
Quoted 18 lines
Quoted 18 lines
You talk about inventing special interfaces to bypass the device model, but that's not the case here. Rolling my own interface with kobjects and attribute groups as with
/sys/poweror making an arbitrary bus type for a single class of system devices seems infinitely more hackish than the current sysdev model.The comment at the top of
sys.csays:*
sys.c- pseudo-bus for system 'devices' (cpus, PICs, timers, etc)Which is precisely where I would expect interrupt controllers and timers and CPUs to go. I'm not going to make an IRQ bus or a timer bus and arbitrarily map some things there and some things somewhere else in the name of some abstraction insanity. These interrupt controllers all have consistent attributes that make the sysdev class model work well, but there are also many other types of interrupt controllers on the same CPUs that use a different abstraction.
Quoted 6 lines
Quoted 6 lines
Beyond that, we also have sysdev class utilization for DMA controllers, per-CPU store queues, etc, etc. all of which would need to be converted to something else (see for example
arch/sh/kernel/cpu/sh4/sq.c-- which in turn was modelled after the cpufreq code, which also would need to change to something else). It's not entirely obvious how to convert these things, or why one should even bother.
The reason why is, if I understand it correctly, because user space tools generally expect /sys/devices/ to be consistent in terms of the representation of things and /sys/devices/system/ currently violates that expectation which leads to all sorts of problems with device discovery, hotplug etc.
Now, whether or not to convert all the things currently exported through sysdevs to struct device objects is not too obvious to me. I think it simply may be better to move them into a different direcory in sysfs (presumably creating one for this purpose).
Quoted 21 lines
Quoted 9 lines
I can live with the struct device overhead even if I find it to be a meaningless abstraction in this case, but what sort of bus/class model to shoe horn these things in to is rather beyond me.
Indeed it seems to me that these are precisely the sorts of things that sysdevs are intended for, which is why I elected to use them from the onset. Simply saying "don't use sysdevs" and "pretend like you have some sort of a magical pseudo-bus that's not a system bus" doesn't quite do it for me.
Nope, a device has a "name", a "subsystem" and a "devpath", has well-defined core-maintained properties at the device directory. It is not some random custom directory which people can put where they like it. Userspace has expectations about devices which need to be met, and that can only happen if these devices are "struct device".
All real devices sort into a hierarchy, possibly in different parent locations, and have a single point of classification which is the devices/ directory and contains symlinks. Only that way we can cope with it in userspace.
Quoted 7 lines
People should really stop messing around in /sys for optimization purposes. We have a common device model, and need to use it. Sysdevs do not fit into that model.
I can't tell how that fits into your use case, but please use something else than sysfs, if you need device information exported, but you can't use "struct device".
I really think you shouldn't say "sysfs" when you in fact you mean "/sys/devices/". :-)
Now, I can easily understand arguments about representing everything under /sys/devices/ by struct device objects, no question about that. However, I also think there should be a place for things like those mentioned in the comment in sys.c, presumably outside of /sys/devices/.
Thanks,
Rafael
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Kay SieversQuoted 8 lines · Kay Sievers
Quoted 3 lines · Paul Mundt
The comment at the top of
sys.csays:*
sys.c- pseudo-bus for system 'devices' (cpus, PICs, timers, etc)Which is what we need to get rid of. It does not make any sense on the global picture to have anything like that exported to userspace.
So far I haven't heard any rationale for why it doesn't. Exporting CPU state to userspace certainly makes sense, and the sysdev model has worked reasonably for CPUs, memory nodes, etc.
Quoted 8 lines
People should really stop messing around in /sys for optimization purposes. We have a common device model, and need to use it. Sysdevs do not fit into that model.
I can't tell how that fits into your use case, but please use something else than sysfs, if you need device information exported, but you can't use "struct device".
As long as CPU state is present in sysfs people will be tied to it for per-CPU kobjects and the like, and until something concrete is proposed for what to do about these cases there's not much chance of sysdevs going away.
Once cpufreq, timekeeping, and NUMA node state have migrated to whatever the driver model folks find acceptable, I'll happily follow suit.
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Kay SieversQuoted 8 lines · Kay Sievers
Quoted 3 lines · Paul Mundt
The comment at the top of
sys.csays:*
sys.c- pseudo-bus for system 'devices' (cpus, PICs, timers, etc)Which is what we need to get rid of. It does not make any sense on the global picture to have anything like that exported to userspace.
So far I haven't heard any rationale for why it doesn't. Exporting CPU state to userspace certainly makes sense, and the sysdev model has worked reasonably for CPUs, memory nodes, etc.
Quoted 8 lines
People should really stop messing around in /sys for optimization purposes. We have a common device model, and need to use it. Sysdevs do not fit into that model.
I can't tell how that fits into your use case, but please use something else than sysfs, if you need device information exported, but you can't use "struct device".
As long as CPU state is present in sysfs people will be tied to it for per-CPU kobjects and the like, and until something concrete is proposed for what to do about these cases there's not much chance of sysdevs going away.
Once cpufreq, timekeeping, and NUMA node state have migrated to whatever the driver model folks find acceptable, I'll happily follow suit.
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Kay SieversQuoted 20 lines · Kay Sievers
Quoted 19 lines · Rafael J. Wysocki
Quoted 17 lines · Kay Sievers
Quoted 7 lines · Rafael J. Wysocki
Quoted 6 lines · Kay Sievers
Quoted 4 lines · Rafael J. Wysocki
Perhaps there's a more straightforward way to make some files show up in sysfs on a specific path than defininig an otherwise useless bus type and device object?
Quoted 5 lines
Quoted 3 lines
That's absolutely not the point. Please don't get yourself into that thinking. If people want to "export stuff to userspace", they must not invent new things. We need to get rid of the silly special cases.
Why exactly? Do they actually hurt anyone and if so then how?
Sure, "devices" are devices, and devices have well-defines set of properties, not some magic directory, people can mess around with the way they like.
Quoted 7 lines
Quoted 3 lines
So it looks like the the problem is that the exported attributes happen to be under
/sys/devices/. Would it still be a problem if they were somewhere else?We are not going to invent another location for any devices. They need to stay in /devices if they are devices. And all devices need to be "struct device".
_They_ _are_ _not_ _devices_.
Please take clocksource as an example. It needs to export two attributes, available_clocksource and current_clocksource, which are _useful_ user space interfaces. Why the heck are you trying to convince me it's a good idea to create a special bus type and struct device _specifically_ for exporting them?!
Moreover, is there anything device-alike in those two attributes? I don't really think so.
So please stop arguing this way, because it simply isn't going to fly and people will always say a big fat "no" to such ideas, for a good reason.
Quoted 13 lines
Quoted 13 lines
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
Userspace is not meant to learn subsystem specific rules for every new thing.
That depends a good deal of who's writing the user space in question. If that's the same person who's working on the particular part of the kernel, I don't see a big problem.
Not for "devices". There are rules for devices, which are defined by the driver core, and the sysdev stuff needs to go, because it does not fit into that model.
OK, I understand that.
Quoted 8 lines
Quoted 3 lines
Now, there's stuff that doesn't really match the "device" model. Where is the right place to export that? Perhaps we should add something like
/sys/platform/(in analogy with/sys/firmware/)?No, add a subsystem (
bus_type) for any of them, and register them. There is no such thing as "devices which do not fit the device model", they are all fine there. Please stop optimizing single bytes and creating a mess in /sys. Every device is a "struct device".
Again. Those things are _not_ devices. Am I not clear enough?
Quoted 9 lines
Think of "struct
bus_type" as "struct subsystem", we will rename that when we are ready. It is just a group of devices which are of the same type, it has nothing to do with a bus in the sense of hardware.We need unified exports of
_alldevices to userspace, not custom layouts in /sys.There's is a pretty much outdated
Documentation/sysfs-rules.txt, wich covers part of the history and the plans.
You seem to be thinking that anything exported through sysfs needs to be device, which I don't think is event approximately correct (what about /sys/firmware/ or /sys/kernel/ or /sys/fs/ , for a few examples?).
Think this way: it is useful (and IMHO correct) to export some things to user space that without necessarily regarding them as "devices", physical or not. Some of them _happen_ to be exported through sysdevs, but that doesn't really mean the _are_ devices. They are simply _software_ interfaces to things that have no device representation and don't _need_ one.
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 7 lines
Quoted 5 lines
There is _one_ way to export device attributes, and that is "struct device" today.
If that's to expensive for anybody, just don't use sysfs. It's the rule we have today. :)
Oh, good to know. It's changed a bit since I last heard. Never mind.
Oh, don't get me wrong, this is all is about "devices" not any other controls.
Quoted 2 lines
Still, I won't let you change the things in
/sys/powerto struct devices, sorry about that. ;-)
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Fine as long as they are power specific things, and not "devices". You don't have sysdevs there, right? :)
No, I don't.
Then all is fine. All other stuff is more like /proc, and can never be really unified.
YES! And _that_'s precisely what I'm (and Paul is) talking about.
Quoted 3 lines
All we care about is devices, which have common methods for userspace to trigger and consume, and need to be unified. Power specific control files seems all fine in its kobject use.
I understand that, really.
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
And I wonder how are you going to deal with clocksource exporting things via the sysdev interface right now. I'd simply create two directories and put the two files into them and be done with that, but I guess that wouldn't fit into the model somehow, right?
Nope, register a
bus_type, and use struct device for all of them, Parent them to/sys/devices/system/if they should keep their location and layout.
Quoted 5 lines
Quoted 2 lines
Well, I'll be watching what happens to the patch trying to do that, but I'm not going to bet anything on its success. ;-)
It should be pretty straight-forward. We will need to do that for CPUs I guess, because the interface is kinda commonly used.
No. CPUs are _very_ special.
Quoted 22 lines
Quoted 22 lines
Quoted 21 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
That way userspace can properly enumerate them in a flat list in /sys/bus/<bus_type name>/devices/*, and gets proper events on module load and during system coldplug, and can hook into the usual hotplug pathes to set/get these values instead of crawling magicly defined and decoupled locations in /sys which can not express proper hierarchy, classicication, or anything else that all other devices can just do.
There's no hotplug involved or anything remotely like that AFAICS. There are simply static files as I said above, they are created early during system initialization and simply stay there.
Quoted 5 lines
Quoted 3 lines
That's not the point. It's about a single way to retrieve information about devices, extendability, and coldplug during bootup, where existing devices need to be handled only after userspace is up.
I'd say the case at hand has nothing to do with that.
It has. As for CPUs. We can not do proper CPU-dependent module autoloading, because the events happen before userspace runs, and clodplug can not see the broken sysdevs, because they have no events to re-trigger, like all others have.
Quoted 4 lines
Quoted 2 lines
Well, as I said, would it be OK if the things in question happened to be located somewhere outside of
/sys/devices/?No, no device directory can be outside of
/sys/devices.
Sorry, I'm repeating that for the last time. I'm not talking about devices. I'm talking about _totally_ _random_ _stuff_ which is "like /proc, and can never be really unified" (your own words) which _happens_ to be exported through the sysdev interface, because that happend to be _easy_ at one point. Can we agree on that at least?
Thanks,
Rafael
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Kay SieversQuoted 20 lines · Kay Sievers
Quoted 19 lines · Rafael J. Wysocki
Quoted 17 lines · Kay Sievers
Quoted 7 lines · Rafael J. Wysocki
Quoted 6 lines · Kay Sievers
Quoted 4 lines · Rafael J. Wysocki
Perhaps there's a more straightforward way to make some files show up in sysfs on a specific path than defininig an otherwise useless bus type and device object?
Quoted 5 lines
Quoted 3 lines
That's absolutely not the point. Please don't get yourself into that thinking. If people want to "export stuff to userspace", they must not invent new things. We need to get rid of the silly special cases.
Why exactly? Do they actually hurt anyone and if so then how?
Sure, "devices" are devices, and devices have well-defines set of properties, not some magic directory, people can mess around with the way they like.
Quoted 7 lines
Quoted 3 lines
So it looks like the the problem is that the exported attributes happen to be under
/sys/devices/. Would it still be a problem if they were somewhere else?We are not going to invent another location for any devices. They need to stay in /devices if they are devices. And all devices need to be "struct device".
_They_ _are_ _not_ _devices_.
Please take clocksource as an example. It needs to export two attributes, available_clocksource and current_clocksource, which are _useful_ user space interfaces. Why the heck are you trying to convince me it's a good idea to create a special bus type and struct device _specifically_ for exporting them?!
Moreover, is there anything device-alike in those two attributes? I don't really think so.
So please stop arguing this way, because it simply isn't going to fly and people will always say a big fat "no" to such ideas, for a good reason.
Quoted 13 lines
Quoted 13 lines
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
Userspace is not meant to learn subsystem specific rules for every new thing.
That depends a good deal of who's writing the user space in question. If that's the same person who's working on the particular part of the kernel, I don't see a big problem.
Not for "devices". There are rules for devices, which are defined by the driver core, and the sysdev stuff needs to go, because it does not fit into that model.
OK, I understand that.
Quoted 8 lines
Quoted 3 lines
Now, there's stuff that doesn't really match the "device" model. Where is the right place to export that? Perhaps we should add something like
/sys/platform/(in analogy with/sys/firmware/)?No, add a subsystem (
bus_type) for any of them, and register them. There is no such thing as "devices which do not fit the device model", they are all fine there. Please stop optimizing single bytes and creating a mess in /sys. Every device is a "struct device".
Again. Those things are _not_ devices. Am I not clear enough?
Quoted 9 lines
Think of "struct
bus_type" as "struct subsystem", we will rename that when we are ready. It is just a group of devices which are of the same type, it has nothing to do with a bus in the sense of hardware.We need unified exports of
_alldevices to userspace, not custom layouts in /sys.There's is a pretty much outdated
Documentation/sysfs-rules.txt, wich covers part of the history and the plans.
You seem to be thinking that anything exported through sysfs needs to be device, which I don't think is event approximately correct (what about /sys/firmware/ or /sys/kernel/ or /sys/fs/ , for a few examples?).
Think this way: it is useful (and IMHO correct) to export some things to user space that without necessarily regarding them as "devices", physical or not. Some of them _happen_ to be exported through sysdevs, but that doesn't really mean the _are_ devices. They are simply _software_ interfaces to things that have no device representation and don't _need_ one.
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 7 lines
Quoted 5 lines
There is _one_ way to export device attributes, and that is "struct device" today.
If that's to expensive for anybody, just don't use sysfs. It's the rule we have today. :)
Oh, good to know. It's changed a bit since I last heard. Never mind.
Oh, don't get me wrong, this is all is about "devices" not any other controls.
Quoted 2 lines
Still, I won't let you change the things in
/sys/powerto struct devices, sorry about that. ;-)
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Fine as long as they are power specific things, and not "devices". You don't have sysdevs there, right? :)
No, I don't.
Then all is fine. All other stuff is more like /proc, and can never be really unified.
YES! And _that_'s precisely what I'm (and Paul is) talking about.
Quoted 3 lines
All we care about is devices, which have common methods for userspace to trigger and consume, and need to be unified. Power specific control files seems all fine in its kobject use.
I understand that, really.
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
And I wonder how are you going to deal with clocksource exporting things via the sysdev interface right now. I'd simply create two directories and put the two files into them and be done with that, but I guess that wouldn't fit into the model somehow, right?
Nope, register a
bus_type, and use struct device for all of them, Parent them to/sys/devices/system/if they should keep their location and layout.
Quoted 5 lines
Quoted 2 lines
Well, I'll be watching what happens to the patch trying to do that, but I'm not going to bet anything on its success. ;-)
It should be pretty straight-forward. We will need to do that for CPUs I guess, because the interface is kinda commonly used.
No. CPUs are _very_ special.
Quoted 22 lines
Quoted 22 lines
Quoted 21 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
That way userspace can properly enumerate them in a flat list in /sys/bus/<bus_type name>/devices/*, and gets proper events on module load and during system coldplug, and can hook into the usual hotplug pathes to set/get these values instead of crawling magicly defined and decoupled locations in /sys which can not express proper hierarchy, classicication, or anything else that all other devices can just do.
There's no hotplug involved or anything remotely like that AFAICS. There are simply static files as I said above, they are created early during system initialization and simply stay there.
Quoted 5 lines
Quoted 3 lines
That's not the point. It's about a single way to retrieve information about devices, extendability, and coldplug during bootup, where existing devices need to be handled only after userspace is up.
I'd say the case at hand has nothing to do with that.
It has. As for CPUs. We can not do proper CPU-dependent module autoloading, because the events happen before userspace runs, and clodplug can not see the broken sysdevs, because they have no events to re-trigger, like all others have.
Quoted 4 lines
Quoted 2 lines
Well, as I said, would it be OK if the things in question happened to be located somewhere outside of
/sys/devices/?No, no device directory can be outside of
/sys/devices.
Sorry, I'm repeating that for the last time. I'm not talking about devices. I'm talking about _totally_ _random_ _stuff_ which is "like /proc, and can never be really unified" (your own words) which _happens_ to be exported through the sysdev interface, because that happend to be _easy_ at one point. Can we agree on that at least?
Thanks,
Rafael
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Rafael J. WysockiQuoted 67 lines · Rafael J. Wysocki
Quoted 1 line · Kay Sievers
On Wed, 2011-03-23 at 06:49 +0900, Paul Mundt wrote:
...
Quoted 18 lines
Quoted 18 lines
You talk about inventing special interfaces to bypass the device model, but that's not the case here. Rolling my own interface with kobjects and attribute groups as with
/sys/poweror making an arbitrary bus type for a single class of system devices seems infinitely more hackish than the current sysdev model.The comment at the top of
sys.csays:*
sys.c- pseudo-bus for system 'devices' (cpus, PICs, timers, etc)Which is precisely where I would expect interrupt controllers and timers and CPUs to go. I'm not going to make an IRQ bus or a timer bus and arbitrarily map some things there and some things somewhere else in the name of some abstraction insanity. These interrupt controllers all have consistent attributes that make the sysdev class model work well, but there are also many other types of interrupt controllers on the same CPUs that use a different abstraction.
Quoted 6 lines
Quoted 6 lines
Beyond that, we also have sysdev class utilization for DMA controllers, per-CPU store queues, etc, etc. all of which would need to be converted to something else (see for example
arch/sh/kernel/cpu/sh4/sq.c-- which in turn was modelled after the cpufreq code, which also would need to change to something else). It's not entirely obvious how to convert these things, or why one should even bother.The reason why is, if I understand it correctly, because user space tools generally expect
/sys/devices/to be consistent in terms of the representation of things and/sys/devices/system/currently violates that expectation which leads to all sorts of problems with device discovery, hotplug etc.Now, whether or not to convert all the things currently exported through sysdevs to struct device objects is not too obvious to me. I think it simply may be better to move them into a different direcory in sysfs (presumably creating one for this purpose).
Quoted 21 lines
Quoted 9 lines
I can live with the struct device overhead even if I find it to be a meaningless abstraction in this case, but what sort of bus/class model to shoe horn these things in to is rather beyond me.
Indeed it seems to me that these are precisely the sorts of things that sysdevs are intended for, which is why I elected to use them from the onset. Simply saying "don't use sysdevs" and "pretend like you have some sort of a magical pseudo-bus that's not a system bus" doesn't quite do it for me.
Nope, a device has a "name", a "subsystem" and a "devpath", has well-defined core-maintained properties at the device directory. It is not some random custom directory which people can put where they like it. Userspace has expectations about devices which need to be met, and that can only happen if these devices are "struct device".
All real devices sort into a hierarchy, possibly in different parent locations, and have a single point of classification which is the devices/ directory and contains symlinks. Only that way we can cope with it in userspace.
Quoted 7 lines
People should really stop messing around in /sys for optimization purposes. We have a common device model, and need to use it. Sysdevs do not fit into that model.
I can't tell how that fits into your use case, but please use something else than sysfs, if you need device information exported, but you can't use "struct device".
Quoted 7 lines
I really think you shouldn't say "sysfs" when you in fact you mean "
/sys/devices/". :-)Now, I can easily understand arguments about representing everything under
/sys/devices/by struct device objects, no question about that. However, I also think there should be a place for things like those mentioned in the comment insys.c, presumably outside of/sys/devices/.
No, please. We have all we need. Let's do one example, which you might apply to any other thing, because you never know what's the next big thing in hardware. We need to be a future-proof-as-possible, and that's not some second-class out-of-scope sysfs directory.
Lets' take CPUs:
- they send events when registered
- they want to export device specific properties
- userspace wants to take actions when such devices are available
That all fits properly into the driver model in theory. Unless you do coldplug and bootup a box.
These devices are already there before userspace even starts, hence we find all these devices and "trigger" an fake uevent for all of them at bootup. That will match execute all the rules specified for that device, just as it would be hotplugges in that moment, hence we call it coldplug, which works for all devices with the hotplug code, even when they are never hot-pluggable.
What we do for coldplug is that we iterate over all flat lists of subsystems and find the devices lists and trigger the event by poking in the "uevent" sysfs file. Now all the sysdevs do not have a subsystem to find, and do not have a standard "uevent" file.
Back to the CPUs, we have all the nice device directories which could have all the CPU features in properties we need to make autoloading of cpufreq, governer, kvm possible (patch exists from Andi Kleen already)
But these dumb CPU sysfs device directories are completely invisible for the *usual* logic, and should just join the model and all will just work out-of-the-box.
When we started to clean up /sys (again only talking about devices, not other stuff) we had:
/block/*
/class/<subsys>/*
/bus/<subsys>/devices/*
/devices/system/<subsys>/*
which are 4 different exports of exactly the same thing, a "device". "Block" we converted to "class" already, "class" will be converted to "bus", and "bus" will be renamed to "subsystem". All the current names will be kept as compat symlinks, just as we did for "block". After that, _all_ devices have a "subsystem" and a subsystem global directory where people can add custom stuff shared by all devices-of-the-same-type. Ev
You can also argument from the other side, if a kernel device export is not worth the few bytes of /sys/devices/ and a "subsystem" (struct bus_type) it should not be in /sys at all, especially not hidden somehwere outside of /sys/devices when it is something remotely close to a device.
Kay
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Rafael J. WysockiQuoted 67 lines · Rafael J. Wysocki
Quoted 1 line · Kay Sievers
On Wed, 2011-03-23 at 06:49 +0900, Paul Mundt wrote:
...
Quoted 18 lines
Quoted 18 lines
You talk about inventing special interfaces to bypass the device model, but that's not the case here. Rolling my own interface with kobjects and attribute groups as with
/sys/poweror making an arbitrary bus type for a single class of system devices seems infinitely more hackish than the current sysdev model.The comment at the top of
sys.csays:*
sys.c- pseudo-bus for system 'devices' (cpus, PICs, timers, etc)Which is precisely where I would expect interrupt controllers and timers and CPUs to go. I'm not going to make an IRQ bus or a timer bus and arbitrarily map some things there and some things somewhere else in the name of some abstraction insanity. These interrupt controllers all have consistent attributes that make the sysdev class model work well, but there are also many other types of interrupt controllers on the same CPUs that use a different abstraction.
Quoted 6 lines
Quoted 6 lines
Beyond that, we also have sysdev class utilization for DMA controllers, per-CPU store queues, etc, etc. all of which would need to be converted to something else (see for example
arch/sh/kernel/cpu/sh4/sq.c-- which in turn was modelled after the cpufreq code, which also would need to change to something else). It's not entirely obvious how to convert these things, or why one should even bother.The reason why is, if I understand it correctly, because user space tools generally expect
/sys/devices/to be consistent in terms of the representation of things and/sys/devices/system/currently violates that expectation which leads to all sorts of problems with device discovery, hotplug etc.Now, whether or not to convert all the things currently exported through sysdevs to struct device objects is not too obvious to me. I think it simply may be better to move them into a different direcory in sysfs (presumably creating one for this purpose).
Quoted 21 lines
Quoted 9 lines
I can live with the struct device overhead even if I find it to be a meaningless abstraction in this case, but what sort of bus/class model to shoe horn these things in to is rather beyond me.
Indeed it seems to me that these are precisely the sorts of things that sysdevs are intended for, which is why I elected to use them from the onset. Simply saying "don't use sysdevs" and "pretend like you have some sort of a magical pseudo-bus that's not a system bus" doesn't quite do it for me.
Nope, a device has a "name", a "subsystem" and a "devpath", has well-defined core-maintained properties at the device directory. It is not some random custom directory which people can put where they like it. Userspace has expectations about devices which need to be met, and that can only happen if these devices are "struct device".
All real devices sort into a hierarchy, possibly in different parent locations, and have a single point of classification which is the devices/ directory and contains symlinks. Only that way we can cope with it in userspace.
Quoted 7 lines
People should really stop messing around in /sys for optimization purposes. We have a common device model, and need to use it. Sysdevs do not fit into that model.
I can't tell how that fits into your use case, but please use something else than sysfs, if you need device information exported, but you can't use "struct device".
Quoted 7 lines
I really think you shouldn't say "sysfs" when you in fact you mean "
/sys/devices/". :-)Now, I can easily understand arguments about representing everything under
/sys/devices/by struct device objects, no question about that. However, I also think there should be a place for things like those mentioned in the comment insys.c, presumably outside of/sys/devices/.
No, please. We have all we need. Let's do one example, which you might apply to any other thing, because you never know what's the next big thing in hardware. We need to be a future-proof-as-possible, and that's not some second-class out-of-scope sysfs directory.
Lets' take CPUs:
- they send events when registered
- they want to export device specific properties
- userspace wants to take actions when such devices are available
That all fits properly into the driver model in theory. Unless you do coldplug and bootup a box.
These devices are already there before userspace even starts, hence we find all these devices and "trigger" an fake uevent for all of them at bootup. That will match execute all the rules specified for that device, just as it would be hotplugges in that moment, hence we call it coldplug, which works for all devices with the hotplug code, even when they are never hot-pluggable.
What we do for coldplug is that we iterate over all flat lists of subsystems and find the devices lists and trigger the event by poking in the "uevent" sysfs file. Now all the sysdevs do not have a subsystem to find, and do not have a standard "uevent" file.
Back to the CPUs, we have all the nice device directories which could have all the CPU features in properties we need to make autoloading of cpufreq, governer, kvm possible (patch exists from Andi Kleen already)
But these dumb CPU sysfs device directories are completely invisible for the *usual* logic, and should just join the model and all will just work out-of-the-box.
When we started to clean up /sys (again only talking about devices, not other stuff) we had:
/block/*
/class/<subsys>/*
/bus/<subsys>/devices/*
/devices/system/<subsys>/*
which are 4 different exports of exactly the same thing, a "device". "Block" we converted to "class" already, "class" will be converted to "bus", and "bus" will be renamed to "subsystem". All the current names will be kept as compat symlinks, just as we did for "block". After that, _all_ devices have a "subsystem" and a subsystem global directory where people can add custom stuff shared by all devices-of-the-same-type. Ev
You can also argument from the other side, if a kernel device export is not worth the few bytes of /sys/devices/ and a "subsystem" (struct bus_type) it should not be in /sys at all, especially not hidden somehwere outside of /sys/devices when it is something remotely close to a device.
Kay
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Rafael J. WysockiQuoted 25 lines · Rafael J. Wysocki
Quoted 24 lines · Kay Sievers
Quoted 22 lines · Rafael J. Wysocki
Quoted 12 lines · Kay Sievers
Quoted 11 lines · Rafael J. Wysocki
Quoted 9 lines · Kay Sievers
Quoted 4 lines · Rafael J. Wysocki
Perhaps there's a more straightforward way to make some files show up in sysfs on a specific path than defininig an otherwise useless bus type and device object?
That's absolutely not the point. Please don't get yourself into that thinking. If people want to "export stuff to userspace", they must not invent new things. We need to get rid of the silly special cases.
Quoted 5 lines
Quoted 1 line
Why exactly? Do they actually hurt anyone and if so then how?
Sure, "devices" are devices, and devices have well-defines set of properties, not some magic directory, people can mess around with the way they like.
So it looks like the the problem is that the exported attributes happen to be under
/sys/devices/. Would it still be a problem if they were somewhere else?
Quoted 5 lines
Quoted 3 lines
We are not going to invent another location for any devices. They need to stay in /devices if they are devices. And all devices need to be "struct device".
_They_ _are_ _not_ _devices_.
Ah, I see. Then they should not ever have been created as a sysdev in the first place. I thought you did only talk about stuff that needs pm_ops. If they don't do anything like a device, they need to go somewhere else, yes.
Quoted 10 lines
Please take clocksource as an example. It needs to export two attributes,
available_clocksourceandcurrent_clocksource, which are _useful_ user space interfaces. Why the heck are you trying to convince me it's a good idea to create a special bus type and struct device _specifically_ for exporting them?!Moreover, is there anything device-alike in those two attributes? I don't really think so.
So please stop arguing this way, because it simply isn't going to fly and people will always say a big fat "no" to such ideas, for a good reason.
I never expected anything like that to use a sysdev. I'm not tryin gto convince you about anything, I'm just surprised what people do, well I'm not after all the years. :)
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
Userspace is not meant to learn subsystem specific rules for every new thing.
That depends a good deal of who's writing the user space in question. If that's the same person who's working on the particular part of the kernel, I don't see a big problem.
Not for "devices". There are rules for devices, which are defined by the driver core, and the sysdev stuff needs to go, because it does not fit into that model.
OK, I understand that.
Now, there's stuff that doesn't really match the "device" model. Where is the right place to export that? Perhaps we should add something like
/sys/platform/(in analogy with/sys/firmware/)?
Quoted 6 lines
Quoted 4 lines
No, add a subsystem (
bus_type) for any of them, and register them. There is no such thing as "devices which do not fit the device model", they are all fine there. Please stop optimizing single bytes and creating a mess in /sys. Every device is a "struct device".Again. Those things are _not_ devices. Am I not clear enough?
No that wasn't clear. They need to leave the driver core then, if they are not devices. :)
Quoted 7 lines
Quoted 7 lines
Think of "struct
bus_type" as "struct subsystem", we will rename that when we are ready. It is just a group of devices which are of the same type, it has nothing to do with a bus in the sense of hardware.We need unified exports of
_alldevices to userspace, not custom layouts in /sys.
Quoted 6 lines
Quoted 2 lines
There's is a pretty much outdated
Documentation/sysfs-rules.txt, wich covers part of the history and the plans.You seem to be thinking that anything exported through sysfs needs to be device, which I don't think is event approximately correct (what about
/sys/firmware/or/sys/kernel/or/sys/fs/, for a few examples?).
All fine. Again, I'm only talking about "devices", which is class/, block/, bus/, dev/, devices/ in /sys.
Quoted 5 lines
Think this way: it is useful (and IMHO correct) to export some things to user space that without necessarily regarding them as "devices", physical or not. Some of them _happen_ to be exported through sysdevs, but that doesn't really mean the _are_ devices. They are simply _software_ interfaces to things that have no device representation and don't _need_ one.
Fine, they need to leave the driver core stuff alone, and not pretend to be a device.
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 7 lines
Quoted 5 lines
There is _one_ way to export device attributes, and that is "struct device" today.
If that's to expensive for anybody, just don't use sysfs. It's the rule we have today. :)
Oh, good to know. It's changed a bit since I last heard. Never mind.
Oh, don't get me wrong, this is all is about "devices" not any other controls.
Quoted 2 lines
Still, I won't let you change the things in
/sys/powerto struct devices, sorry about that. ;-)Fine as long as they are power specific things, and not "devices". You don't have sysdevs there, right? :)
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
No, I don't.
Then all is fine. All other stuff is more like /proc, and can never be really unified.
YES! And _that_'s precisely what I'm (and Paul is) talking about.
Good.
Quoted 15 lines
Quoted 3 lines
All we care about is devices, which have common methods for userspace to trigger and consume, and need to be unified. Power specific control files seems all fine in its kobject use.
I understand that, really.
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
And I wonder how are you going to deal with clocksource exporting things via the sysdev interface right now. I'd simply create two directories and put the two files into them and be done with that, but I guess that wouldn't fit into the model somehow, right?
Nope, register a
bus_type, and use struct device for all of them, Parent them to/sys/devices/system/if they should keep their location and layout.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Well, I'll be watching what happens to the patch trying to do that, but I'm not going to bet anything on its success. ;-)
It should be pretty straight-forward. We will need to do that for CPUs I guess, because the interface is kinda commonly used.
No. CPUs are _very_ special.
Not in the view of the driver core or the associated user space interfaces. They are just like any other device.
Quoted 25 lines
Quoted 25 lines
Quoted 24 lines
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 10 lines
Quoted 6 lines
That way userspace can properly enumerate them in a flat list in /sys/bus/<bus_type name>/devices/*, and gets proper events on module load and during system coldplug, and can hook into the usual hotplug pathes to set/get these values instead of crawling magicly defined and decoupled locations in /sys which can not express proper hierarchy, classicication, or anything else that all other devices can just do.
There's no hotplug involved or anything remotely like that AFAICS. There are simply static files as I said above, they are created early during system initialization and simply stay there.
That's not the point. It's about a single way to retrieve information about devices, extendability, and coldplug during bootup, where existing devices need to be handled only after userspace is up.
Quoted 6 lines
Quoted 1 line
I'd say the case at hand has nothing to do with that.
It has. As for CPUs. We can not do proper CPU-dependent module autoloading, because the events happen before userspace runs, and clodplug can not see the broken sysdevs, because they have no events to re-trigger, like all others have.
Well, as I said, would it be OK if the things in question happened to be located somewhere outside of
/sys/devices/?
Quoted 7 lines
Quoted 1 line
No, no device directory can be outside of
/sys/devices.Sorry, I'm repeating that for the last time. I'm not talking about devices. I'm talking about _totally_ _random_ _stuff_ which is "like /proc, and can never be really unified" (your own words) which _happens_ to be exported through the sysdev interface, because that happend to be _easy_ at one point. Can we agree on that at least?
Sure, they should leave the driver core alone, and should never been a sysdev or any other device in the first place. We should not create anything for them.
Kay
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Rafael J. WysockiQuoted 25 lines · Rafael J. Wysocki
Quoted 24 lines · Kay Sievers
Quoted 22 lines · Rafael J. Wysocki
Quoted 12 lines · Kay Sievers
Quoted 11 lines · Rafael J. Wysocki
Quoted 9 lines · Kay Sievers
Quoted 4 lines · Rafael J. Wysocki
Perhaps there's a more straightforward way to make some files show up in sysfs on a specific path than defininig an otherwise useless bus type and device object?
That's absolutely not the point. Please don't get yourself into that thinking. If people want to "export stuff to userspace", they must not invent new things. We need to get rid of the silly special cases.
Quoted 5 lines
Quoted 1 line
Why exactly? Do they actually hurt anyone and if so then how?
Sure, "devices" are devices, and devices have well-defines set of properties, not some magic directory, people can mess around with the way they like.
So it looks like the the problem is that the exported attributes happen to be under
/sys/devices/. Would it still be a problem if they were somewhere else?
Quoted 5 lines
Quoted 3 lines
We are not going to invent another location for any devices. They need to stay in /devices if they are devices. And all devices need to be "struct device".
_They_ _are_ _not_ _devices_.
Ah, I see. Then they should not ever have been created as a sysdev in the first place. I thought you did only talk about stuff that needs pm_ops. If they don't do anything like a device, they need to go somewhere else, yes.
Quoted 10 lines
Please take clocksource as an example. It needs to export two attributes,
available_clocksourceandcurrent_clocksource, which are _useful_ user space interfaces. Why the heck are you trying to convince me it's a good idea to create a special bus type and struct device _specifically_ for exporting them?!Moreover, is there anything device-alike in those two attributes? I don't really think so.
So please stop arguing this way, because it simply isn't going to fly and people will always say a big fat "no" to such ideas, for a good reason.
I never expected anything like that to use a sysdev. I'm not tryin gto convince you about anything, I'm just surprised what people do, well I'm not after all the years. :)
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
Userspace is not meant to learn subsystem specific rules for every new thing.
That depends a good deal of who's writing the user space in question. If that's the same person who's working on the particular part of the kernel, I don't see a big problem.
Not for "devices". There are rules for devices, which are defined by the driver core, and the sysdev stuff needs to go, because it does not fit into that model.
OK, I understand that.
Now, there's stuff that doesn't really match the "device" model. Where is the right place to export that? Perhaps we should add something like
/sys/platform/(in analogy with/sys/firmware/)?
Quoted 6 lines
Quoted 4 lines
No, add a subsystem (
bus_type) for any of them, and register them. There is no such thing as "devices which do not fit the device model", they are all fine there. Please stop optimizing single bytes and creating a mess in /sys. Every device is a "struct device".Again. Those things are _not_ devices. Am I not clear enough?
No that wasn't clear. They need to leave the driver core then, if they are not devices. :)
Quoted 7 lines
Quoted 7 lines
Think of "struct
bus_type" as "struct subsystem", we will rename that when we are ready. It is just a group of devices which are of the same type, it has nothing to do with a bus in the sense of hardware.We need unified exports of
_alldevices to userspace, not custom layouts in /sys.
Quoted 6 lines
Quoted 2 lines
There's is a pretty much outdated
Documentation/sysfs-rules.txt, wich covers part of the history and the plans.You seem to be thinking that anything exported through sysfs needs to be device, which I don't think is event approximately correct (what about
/sys/firmware/or/sys/kernel/or/sys/fs/, for a few examples?).
All fine. Again, I'm only talking about "devices", which is class/, block/, bus/, dev/, devices/ in /sys.
Quoted 5 lines
Think this way: it is useful (and IMHO correct) to export some things to user space that without necessarily regarding them as "devices", physical or not. Some of them _happen_ to be exported through sysdevs, but that doesn't really mean the _are_ devices. They are simply _software_ interfaces to things that have no device representation and don't _need_ one.
Fine, they need to leave the driver core stuff alone, and not pretend to be a device.
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 7 lines
Quoted 5 lines
There is _one_ way to export device attributes, and that is "struct device" today.
If that's to expensive for anybody, just don't use sysfs. It's the rule we have today. :)
Oh, good to know. It's changed a bit since I last heard. Never mind.
Oh, don't get me wrong, this is all is about "devices" not any other controls.
Quoted 2 lines
Still, I won't let you change the things in
/sys/powerto struct devices, sorry about that. ;-)Fine as long as they are power specific things, and not "devices". You don't have sysdevs there, right? :)
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
No, I don't.
Then all is fine. All other stuff is more like /proc, and can never be really unified.
YES! And _that_'s precisely what I'm (and Paul is) talking about.
Good.
Quoted 15 lines
Quoted 3 lines
All we care about is devices, which have common methods for userspace to trigger and consume, and need to be unified. Power specific control files seems all fine in its kobject use.
I understand that, really.
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
And I wonder how are you going to deal with clocksource exporting things via the sysdev interface right now. I'd simply create two directories and put the two files into them and be done with that, but I guess that wouldn't fit into the model somehow, right?
Nope, register a
bus_type, and use struct device for all of them, Parent them to/sys/devices/system/if they should keep their location and layout.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Well, I'll be watching what happens to the patch trying to do that, but I'm not going to bet anything on its success. ;-)
It should be pretty straight-forward. We will need to do that for CPUs I guess, because the interface is kinda commonly used.
No. CPUs are _very_ special.
Not in the view of the driver core or the associated user space interfaces. They are just like any other device.
Quoted 25 lines
Quoted 25 lines
Quoted 24 lines
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 10 lines
Quoted 6 lines
That way userspace can properly enumerate them in a flat list in /sys/bus/<bus_type name>/devices/*, and gets proper events on module load and during system coldplug, and can hook into the usual hotplug pathes to set/get these values instead of crawling magicly defined and decoupled locations in /sys which can not express proper hierarchy, classicication, or anything else that all other devices can just do.
There's no hotplug involved or anything remotely like that AFAICS. There are simply static files as I said above, they are created early during system initialization and simply stay there.
That's not the point. It's about a single way to retrieve information about devices, extendability, and coldplug during bootup, where existing devices need to be handled only after userspace is up.
Quoted 6 lines
Quoted 1 line
I'd say the case at hand has nothing to do with that.
It has. As for CPUs. We can not do proper CPU-dependent module autoloading, because the events happen before userspace runs, and clodplug can not see the broken sysdevs, because they have no events to re-trigger, like all others have.
Well, as I said, would it be OK if the things in question happened to be located somewhere outside of
/sys/devices/?
Quoted 7 lines
Quoted 1 line
No, no device directory can be outside of
/sys/devices.Sorry, I'm repeating that for the last time. I'm not talking about devices. I'm talking about _totally_ _random_ _stuff_ which is "like /proc, and can never be really unified" (your own words) which _happens_ to be exported through the sysdev interface, because that happend to be _easy_ at one point. Can we agree on that at least?
Sure, they should leave the driver core alone, and should never been a sysdev or any other device in the first place. We should not create anything for them.
Kay
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Rafael J. WysockiQuoted 11 lines · Rafael J. Wysocki
Quoted 4 lines · Kay Sievers
Quoted 1 line
Because they are devices, and there is a lot to win, if the kernel
exports all "devices" in the same way. This is not about saving an inode in /sys, it's the ability to do runtime device configuration with common tools.
If I understand you correctly, the goal is to have everything under
/sys/devices/been represented by struct device objects and there are good reasons to do that.
Quoted 5 lines
In that case we either have to move the things exported via sysdevs somewhere else (presumably having to create that "somewhere" before), or we have to introduce struct device objects specifically for exporting them. I don't really think the latter approach will be very popular, so quite likely we'll need to have a plan for moving those things to different locations.
Ok, now that we sorted the misunderstanding out, let's start this topic from here again. (I really read your reply as: "let's move the CPUS somewhere else")
What's the list of stuff you discovered using sysdevs, which is not a device at all, and has never more than a single instance of stuff of the same type? The clocksource?
And let's find some place for them to put their properties instead of messing around with device from the driver core.
Kay
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Rafael J. WysockiQuoted 11 lines · Rafael J. Wysocki
Quoted 4 lines · Kay Sievers
Quoted 1 line
Because they are devices, and there is a lot to win, if the kernel
exports all "devices" in the same way. This is not about saving an inode in /sys, it's the ability to do runtime device configuration with common tools.
If I understand you correctly, the goal is to have everything under
/sys/devices/been represented by struct device objects and there are good reasons to do that.
Quoted 5 lines
In that case we either have to move the things exported via sysdevs somewhere else (presumably having to create that "somewhere" before), or we have to introduce struct device objects specifically for exporting them. I don't really think the latter approach will be very popular, so quite likely we'll need to have a plan for moving those things to different locations.
Ok, now that we sorted the misunderstanding out, let's start this topic from here again. (I really read your reply as: "let's move the CPUS somewhere else")
What's the list of stuff you discovered using sysdevs, which is not a device at all, and has never more than a single instance of stuff of the same type? The clocksource?
And let's find some place for them to put their properties instead of messing around with device from the driver core.
Kay
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Kay SieversQuoted 2 lines · Kay Sievers
Quoted 1 line · Rafael J. Wysocki
On Tuesday, March 22, 2011, Kay Sievers wrote:
...
Quoted 31 lines
Quoted 5 lines
Now, I can easily understand arguments about representing everything under
/sys/devices/by struct device objects, no question about that. However, I also think there should be a place for things like those mentioned in the comment insys.c, presumably outside of/sys/devices/.No, please. We have all we need. Let's do one example, which you might apply to any other thing, because you never know what's the next big thing in hardware. We need to be a future-proof-as-possible, and that's not some second-class out-of-scope sysfs directory.
Lets' take CPUs:
- they send events when registered
- they want to export device specific properties
- userspace wants to take actions when such devices are availableThat all fits properly into the driver model in theory. Unless you do coldplug and bootup a box.
These devices are already there before userspace even starts, hence we find all these devices and "trigger" an fake uevent for all of them at bootup. That will match execute all the rules specified for that device, just as it would be hotplugges in that moment, hence we call it coldplug, which works for all devices with the hotplug code, even when they are never hot-pluggable.
What we do for coldplug is that we iterate over all flat lists of subsystems and find the devices lists and trigger the event by poking in the "uevent" sysfs file. Now all the sysdevs do not have a subsystem to find, and do not have a standard "uevent" file.
Quoted 7 lines
Back to the CPUs, we have all the nice device directories which could have all the CPU features in properties we need to make autoloading of cpufreq, governer, kvm possible (patch exists from Andi Kleen already)
But these dumb CPU sysfs device directories are completely invisible for the *usual* logic, and should just join the model and all will just work out-of-the-box.
That all is cool, but I'm not sure how it is related to things like available_clocksource and current_clocksource (which happen to be located under /sys/devices/system/clocksource/clocksource0/ being simply a path in sysfs).
Quoted 4 lines
When we started to clean up /sys (again only talking about devices, not other stuff) we had:
/block/*
/class/<subsys>/*
Quoted 8 lines
/bus/<subsys>/devices/*
/devices/system/<subsys>/*
which are 4 different exports of exactly the same thing, a "device". "Block" we converted to "class" already, "class" will be converted to "bus", and "bus" will be renamed to "subsystem". All the current names will be kept as compat symlinks, just as we did for "block". After that, _all_ devices have a "subsystem" and a subsystem global directory where people can add custom stuff shared by all devices-of-the-same-type. Ev
OK, sounds good.
Quoted 5 lines
You can also argument from the other side, if a kernel device export is not worth the few bytes of
/sys/devices/and a "subsystem" (structbus_type) it should not be in /sys at all, especially not hidden somehwere outside of/sys/deviceswhen it is something remotely close to a device.
Well, Greg apparently thinks that available_clocksource and current_clocksource could be located under /sys/bus/clock/. Perhaps other attributes now exported through sysdevs could be moved to places like this?
Rafael
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Kay SieversQuoted 2 lines · Kay Sievers
Quoted 1 line · Rafael J. Wysocki
On Tuesday, March 22, 2011, Kay Sievers wrote:
...
Quoted 31 lines
Quoted 5 lines
Now, I can easily understand arguments about representing everything under
/sys/devices/by struct device objects, no question about that. However, I also think there should be a place for things like those mentioned in the comment insys.c, presumably outside of/sys/devices/.No, please. We have all we need. Let's do one example, which you might apply to any other thing, because you never know what's the next big thing in hardware. We need to be a future-proof-as-possible, and that's not some second-class out-of-scope sysfs directory.
Lets' take CPUs:
- they send events when registered
- they want to export device specific properties
- userspace wants to take actions when such devices are availableThat all fits properly into the driver model in theory. Unless you do coldplug and bootup a box.
These devices are already there before userspace even starts, hence we find all these devices and "trigger" an fake uevent for all of them at bootup. That will match execute all the rules specified for that device, just as it would be hotplugges in that moment, hence we call it coldplug, which works for all devices with the hotplug code, even when they are never hot-pluggable.
What we do for coldplug is that we iterate over all flat lists of subsystems and find the devices lists and trigger the event by poking in the "uevent" sysfs file. Now all the sysdevs do not have a subsystem to find, and do not have a standard "uevent" file.
Quoted 7 lines
Back to the CPUs, we have all the nice device directories which could have all the CPU features in properties we need to make autoloading of cpufreq, governer, kvm possible (patch exists from Andi Kleen already)
But these dumb CPU sysfs device directories are completely invisible for the *usual* logic, and should just join the model and all will just work out-of-the-box.
That all is cool, but I'm not sure how it is related to things like available_clocksource and current_clocksource (which happen to be located under /sys/devices/system/clocksource/clocksource0/ being simply a path in sysfs).
Quoted 4 lines
When we started to clean up /sys (again only talking about devices, not other stuff) we had:
/block/*
/class/<subsys>/*
Quoted 8 lines
/bus/<subsys>/devices/*
/devices/system/<subsys>/*
which are 4 different exports of exactly the same thing, a "device". "Block" we converted to "class" already, "class" will be converted to "bus", and "bus" will be renamed to "subsystem". All the current names will be kept as compat symlinks, just as we did for "block". After that, _all_ devices have a "subsystem" and a subsystem global directory where people can add custom stuff shared by all devices-of-the-same-type. Ev
OK, sounds good.
Quoted 5 lines
You can also argument from the other side, if a kernel device export is not worth the few bytes of
/sys/devices/and a "subsystem" (structbus_type) it should not be in /sys at all, especially not hidden somehwere outside of/sys/deviceswhen it is something remotely close to a device.
Well, Greg apparently thinks that available_clocksource and current_clocksource could be located under /sys/bus/clock/. Perhaps other attributes now exported through sysdevs could be moved to places like this?
Rafael
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Rafael J. WysockiQuoted 39 lines · Rafael J. Wysocki
Quoted 2 lines · Kay Sievers
Quoted 1 line · Rafael J. Wysocki
On Tuesday, March 22, 2011, Kay Sievers wrote:
...
Quoted 35 lines
Quoted 5 lines
Now, I can easily understand arguments about representing everything under
/sys/devices/by struct device objects, no question about that. However, I also think there should be a place for things like those mentioned in the comment insys.c, presumably outside of/sys/devices/.No, please. We have all we need. Let's do one example, which you might apply to any other thing, because you never know what's the next big thing in hardware. We need to be a future-proof-as-possible, and that's not some second-class out-of-scope sysfs directory.
Lets' take CPUs:
- they send events when registered
- they want to export device specific properties
- userspace wants to take actions when such devices are availableThat all fits properly into the driver model in theory. Unless you do coldplug and bootup a box.
These devices are already there before userspace even starts, hence we find all these devices and "trigger" an fake uevent for all of them at bootup. That will match execute all the rules specified for that device, just as it would be hotplugges in that moment, hence we call it coldplug, which works for all devices with the hotplug code, even when they are never hot-pluggable.
What we do for coldplug is that we iterate over all flat lists of subsystems and find the devices lists and trigger the event by poking in the "uevent" sysfs file. Now all the sysdevs do not have a subsystem to find, and do not have a standard "uevent" file.
Back to the CPUs, we have all the nice device directories which could have all the CPU features in properties we need to make autoloading of cpufreq, governer, kvm possible (patch exists from Andi Kleen already)
Quoted 8 lines
Quoted 3 lines
But these dumb CPU sysfs device directories are completely invisible for the *usual* logic, and should just join the model and all will just work out-of-the-box.
That all is cool, but I'm not sure how it is related to things like
available_clocksourceandcurrent_clocksource(which happen to be located under/sys/devices/system/clocksource/clocksource0/being simply a path in sysfs).
Sure, it isn't related to clocksource at all. I didn't really get the idea that there are users that just fake core devices only to get a place to put a couple of attributes. I was still in the context of the $SUBJECT of this thread.
This stuff should just stay away from devices, not sysdev, not "struct device".
For other things like CPUs, which are fine to be represented as driver core devices, all the above is still valid, and they should be real devices and have their own subsystem, which exposes them to coldplug and usual event handling.
Quoted 3 lines
Well, Greg apparently thinks that
available_clocksourceandcurrent_clocksourcecould be located under/sys/bus/clock/. Perhaps other attributes now exported through sysdevs could be moved to places like this?
Sure, we could do that. All such subsystems have a directory to put subsystem-global stuff. In this case it would be a subsystem without any registered device. But it leaves us open to add real devices to it later, which might be the case for some similar subsystems.
The other option would be /sys/kernel/clocksource/ with the few attributes to create.
We should decide if "clocksource" is kind of "device-related" or not. Do you have any list of subsystems besides "clocksource", which would help to get a bigger picture what we should expect?
Kay
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Rafael J. WysockiQuoted 39 lines · Rafael J. Wysocki
Quoted 2 lines · Kay Sievers
Quoted 1 line · Rafael J. Wysocki
On Tuesday, March 22, 2011, Kay Sievers wrote:
...
Quoted 35 lines
Quoted 5 lines
Now, I can easily understand arguments about representing everything under
/sys/devices/by struct device objects, no question about that. However, I also think there should be a place for things like those mentioned in the comment insys.c, presumably outside of/sys/devices/.No, please. We have all we need. Let's do one example, which you might apply to any other thing, because you never know what's the next big thing in hardware. We need to be a future-proof-as-possible, and that's not some second-class out-of-scope sysfs directory.
Lets' take CPUs:
- they send events when registered
- they want to export device specific properties
- userspace wants to take actions when such devices are availableThat all fits properly into the driver model in theory. Unless you do coldplug and bootup a box.
These devices are already there before userspace even starts, hence we find all these devices and "trigger" an fake uevent for all of them at bootup. That will match execute all the rules specified for that device, just as it would be hotplugges in that moment, hence we call it coldplug, which works for all devices with the hotplug code, even when they are never hot-pluggable.
What we do for coldplug is that we iterate over all flat lists of subsystems and find the devices lists and trigger the event by poking in the "uevent" sysfs file. Now all the sysdevs do not have a subsystem to find, and do not have a standard "uevent" file.
Back to the CPUs, we have all the nice device directories which could have all the CPU features in properties we need to make autoloading of cpufreq, governer, kvm possible (patch exists from Andi Kleen already)
Quoted 8 lines
Quoted 3 lines
But these dumb CPU sysfs device directories are completely invisible for the *usual* logic, and should just join the model and all will just work out-of-the-box.
That all is cool, but I'm not sure how it is related to things like
available_clocksourceandcurrent_clocksource(which happen to be located under/sys/devices/system/clocksource/clocksource0/being simply a path in sysfs).
Sure, it isn't related to clocksource at all. I didn't really get the idea that there are users that just fake core devices only to get a place to put a couple of attributes. I was still in the context of the $SUBJECT of this thread.
This stuff should just stay away from devices, not sysdev, not "struct device".
For other things like CPUs, which are fine to be represented as driver core devices, all the above is still valid, and they should be real devices and have their own subsystem, which exposes them to coldplug and usual event handling.
Quoted 3 lines
Well, Greg apparently thinks that
available_clocksourceandcurrent_clocksourcecould be located under/sys/bus/clock/. Perhaps other attributes now exported through sysdevs could be moved to places like this?
Sure, we could do that. All such subsystems have a directory to put subsystem-global stuff. In this case it would be a subsystem without any registered device. But it leaves us open to add real devices to it later, which might be the case for some similar subsystems.
The other option would be /sys/kernel/clocksource/ with the few attributes to create.
We should decide if "clocksource" is kind of "device-related" or not. Do you have any list of subsystems besides "clocksource", which would help to get a bigger picture what we should expect?
Kay
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Kay SieversQuoted 18 lines · Kay Sievers
Quoted 11 lines · Rafael J. Wysocki
Quoted 4 lines · Kay Sievers
Quoted 1 line
Because they are devices, and there is a lot to win, if the kernel
exports all "devices" in the same way. This is not about saving an inode in /sys, it's the ability to do runtime device configuration with common tools.
If I understand you correctly, the goal is to have everything under
/sys/devices/been represented by struct device objects and there are good reasons to do that.Quoted 5 lines
In that case we either have to move the things exported via sysdevs somewhere else (presumably having to create that "somewhere" before), or we have to introduce struct device objects specifically for exporting them. I don't really think the latter approach will be very popular, so quite likely we'll need to have a plan for moving those things to different locations.
Quoted 3 lines
Ok, now that we sorted the misunderstanding out, let's start this topic from here again. (I really read your reply as: "let's move the CPUS somewhere else")
Well, I didn't mean that. :-)
Quoted 6 lines
What's the list of stuff you discovered using sysdevs, which is not a device at all, and has never more than a single instance of stuff of the same type? The clocksource?
And let's find some place for them to put their properties instead of messing around with device from the driver core.
On x86 the clocksource will be the only remaining one after my changes recently posted. In fact, it will be the only remaining one except for the CPUs. :-)
The other architectures are a mixed bag, though. First, there's some exported stuff similar to the clocksource. For one example, there's the "leds" sysdev in arch/arm/kernel/leds.c that appears to export one attribute (in addition to implementing suspend/resume/shutdown which I'm going to move to syscore_ops). Second, there's some outright abuse here-and-there that may be removed entirely. Finally, there are things that probably may be converted to struct devices, in the powerpc tree in particular IIRC.
IMHO all of these things will have to be considered on the case-by-case basis and discussed with the appropriate maintainers.
Thanks,
Rafael
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Kay SieversQuoted 18 lines · Kay Sievers
Quoted 11 lines · Rafael J. Wysocki
Quoted 4 lines · Kay Sievers
Quoted 1 line
Because they are devices, and there is a lot to win, if the kernel
exports all "devices" in the same way. This is not about saving an inode in /sys, it's the ability to do runtime device configuration with common tools.
If I understand you correctly, the goal is to have everything under
/sys/devices/been represented by struct device objects and there are good reasons to do that.Quoted 5 lines
In that case we either have to move the things exported via sysdevs somewhere else (presumably having to create that "somewhere" before), or we have to introduce struct device objects specifically for exporting them. I don't really think the latter approach will be very popular, so quite likely we'll need to have a plan for moving those things to different locations.
Quoted 3 lines
Ok, now that we sorted the misunderstanding out, let's start this topic from here again. (I really read your reply as: "let's move the CPUS somewhere else")
Well, I didn't mean that. :-)
Quoted 6 lines
What's the list of stuff you discovered using sysdevs, which is not a device at all, and has never more than a single instance of stuff of the same type? The clocksource?
And let's find some place for them to put their properties instead of messing around with device from the driver core.
On x86 the clocksource will be the only remaining one after my changes recently posted. In fact, it will be the only remaining one except for the CPUs. :-)
The other architectures are a mixed bag, though. First, there's some exported stuff similar to the clocksource. For one example, there's the "leds" sysdev in arch/arm/kernel/leds.c that appears to export one attribute (in addition to implementing suspend/resume/shutdown which I'm going to move to syscore_ops). Second, there's some outright abuse here-and-there that may be removed entirely. Finally, there are things that probably may be converted to struct devices, in the powerpc tree in particular IIRC.
IMHO all of these things will have to be considered on the case-by-case basis and discussed with the appropriate maintainers.
Thanks,
Rafael
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Kay SieversQuoted 71 lines · Kay Sievers
Quoted 39 lines · Rafael J. Wysocki
Quoted 2 lines · Kay Sievers
Quoted 1 line · Rafael J. Wysocki
On Tuesday, March 22, 2011, Kay Sievers wrote:
...
Quoted 35 lines
Quoted 5 lines
Now, I can easily understand arguments about representing everything under
/sys/devices/by struct device objects, no question about that. However, I also think there should be a place for things like those mentioned in the comment insys.c, presumably outside of/sys/devices/.No, please. We have all we need. Let's do one example, which you might apply to any other thing, because you never know what's the next big thing in hardware. We need to be a future-proof-as-possible, and that's not some second-class out-of-scope sysfs directory.
Lets' take CPUs:
- they send events when registered
- they want to export device specific properties
- userspace wants to take actions when such devices are availableThat all fits properly into the driver model in theory. Unless you do coldplug and bootup a box.
These devices are already there before userspace even starts, hence we find all these devices and "trigger" an fake uevent for all of them at bootup. That will match execute all the rules specified for that device, just as it would be hotplugges in that moment, hence we call it coldplug, which works for all devices with the hotplug code, even when they are never hot-pluggable.
What we do for coldplug is that we iterate over all flat lists of subsystems and find the devices lists and trigger the event by poking in the "uevent" sysfs file. Now all the sysdevs do not have a subsystem to find, and do not have a standard "uevent" file.
Back to the CPUs, we have all the nice device directories which could have all the CPU features in properties we need to make autoloading of cpufreq, governer, kvm possible (patch exists from Andi Kleen already)
Quoted 8 lines
Quoted 3 lines
But these dumb CPU sysfs device directories are completely invisible for the *usual* logic, and should just join the model and all will just work out-of-the-box.
That all is cool, but I'm not sure how it is related to things like
available_clocksourceandcurrent_clocksource(which happen to be located under/sys/devices/system/clocksource/clocksource0/being simply a path in sysfs).Sure, it isn't related to clocksource at all. I didn't really get the idea that there are users that just fake core devices only to get a place to put a couple of attributes. I was still in the context of the $SUBJECT of this thread.
This stuff should just stay away from devices, not sysdev, not "struct device".
For other things like CPUs, which are fine to be represented as driver core devices, all the above is still valid, and they should be real devices and have their own subsystem, which exposes them to coldplug and usual event handling.
Quoted 3 lines
Well, Greg apparently thinks that
available_clocksourceandcurrent_clocksourcecould be located under/sys/bus/clock/. Perhaps other attributes now exported through sysdevs could be moved to places like this?Sure, we could do that. All such subsystems have a directory to put subsystem-global stuff. In this case it would be a subsystem without any registered device. But it leaves us open to add real devices to it later, which might be the case for some similar subsystems.
Quoted 6 lines
The other option would be
/sys/kernel/clocksource/with the few attributes to create.We should decide if "clocksource" is kind of "device-related" or not. Do you have any list of subsystems besides "clocksource", which would help to get a bigger picture what we should expect?
Not at the moment. I'll prepare one while working on syscore_ops patches for the non-x86 architectures.
Thanks,
Rafael
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Kay SieversQuoted 71 lines · Kay Sievers
Quoted 39 lines · Rafael J. Wysocki
Quoted 2 lines · Kay Sievers
Quoted 1 line · Rafael J. Wysocki
On Tuesday, March 22, 2011, Kay Sievers wrote:
...
Quoted 35 lines
Quoted 5 lines
Now, I can easily understand arguments about representing everything under
/sys/devices/by struct device objects, no question about that. However, I also think there should be a place for things like those mentioned in the comment insys.c, presumably outside of/sys/devices/.No, please. We have all we need. Let's do one example, which you might apply to any other thing, because you never know what's the next big thing in hardware. We need to be a future-proof-as-possible, and that's not some second-class out-of-scope sysfs directory.
Lets' take CPUs:
- they send events when registered
- they want to export device specific properties
- userspace wants to take actions when such devices are availableThat all fits properly into the driver model in theory. Unless you do coldplug and bootup a box.
These devices are already there before userspace even starts, hence we find all these devices and "trigger" an fake uevent for all of them at bootup. That will match execute all the rules specified for that device, just as it would be hotplugges in that moment, hence we call it coldplug, which works for all devices with the hotplug code, even when they are never hot-pluggable.
What we do for coldplug is that we iterate over all flat lists of subsystems and find the devices lists and trigger the event by poking in the "uevent" sysfs file. Now all the sysdevs do not have a subsystem to find, and do not have a standard "uevent" file.
Back to the CPUs, we have all the nice device directories which could have all the CPU features in properties we need to make autoloading of cpufreq, governer, kvm possible (patch exists from Andi Kleen already)
Quoted 8 lines
Quoted 3 lines
But these dumb CPU sysfs device directories are completely invisible for the *usual* logic, and should just join the model and all will just work out-of-the-box.
That all is cool, but I'm not sure how it is related to things like
available_clocksourceandcurrent_clocksource(which happen to be located under/sys/devices/system/clocksource/clocksource0/being simply a path in sysfs).Sure, it isn't related to clocksource at all. I didn't really get the idea that there are users that just fake core devices only to get a place to put a couple of attributes. I was still in the context of the $SUBJECT of this thread.
This stuff should just stay away from devices, not sysdev, not "struct device".
For other things like CPUs, which are fine to be represented as driver core devices, all the above is still valid, and they should be real devices and have their own subsystem, which exposes them to coldplug and usual event handling.
Quoted 3 lines
Well, Greg apparently thinks that
available_clocksourceandcurrent_clocksourcecould be located under/sys/bus/clock/. Perhaps other attributes now exported through sysdevs could be moved to places like this?Sure, we could do that. All such subsystems have a directory to put subsystem-global stuff. In this case it would be a subsystem without any registered device. But it leaves us open to add real devices to it later, which might be the case for some similar subsystems.
Quoted 6 lines
The other option would be
/sys/kernel/clocksource/with the few attributes to create.We should decide if "clocksource" is kind of "device-related" or not. Do you have any list of subsystems besides "clocksource", which would help to get a bigger picture what we should expect?
Not at the moment. I'll prepare one while working on syscore_ops patches for the non-x86 architectures.
Thanks,
Rafael
Re: [PATCH 3/6] PCI / Intel IOMMU: Use syscore_ops instead of sysdev class and sysdev
In reply to Rafael J. WysockiQuoted 8 lines · Rafael J. Wysocki
Quoted 5 lines · Joerg Roedel
Quoted 2 lines · Rafael J. Wysocki
drivers/pci/intel-iommu.c | 38 +++++++++----------------------------- 1 file changed, 9 insertions(+), 29 deletions(-)Looks good.
May I take that as an ACK?
Sure :-)
Quoted 5 lines
Quoted 1 line
I prepare a patch to convert AMD IOMMU to
syscore_opstoo.Already done. :-)
It's a part of patch [1/6].
I see, saves me work, thanks :-)
Joerg
Signature · 5 lines
AMD Operating System Research Center Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach General Managers: Alberto Bozzo, Andrew Bowd Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632
Re: [PATCH 3/6] PCI / Intel IOMMU: Use syscore_ops instead of sysdev class and sysdev
In reply to Rafael J. WysockiQuoted 8 lines · Rafael J. Wysocki
Quoted 5 lines · Joerg Roedel
Quoted 2 lines · Rafael J. Wysocki
drivers/pci/intel-iommu.c | 38 +++++++++----------------------------- 1 file changed, 9 insertions(+), 29 deletions(-)Looks good.
May I take that as an ACK?
Sure :-)
Quoted 5 lines
Quoted 1 line
I prepare a patch to convert AMD IOMMU to
syscore_opstoo.Already done. :-)
It's a part of patch [1/6].
I see, saves me work, thanks :-)
Joerg
Signature · 5 lines
AMD Operating System Research Center Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach General Managers: Alberto Bozzo, Andrew Bowd Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Kay SieversQuoted 10 lines · Kay Sievers
When we started to clean up /sys (again only talking about devices, not other stuff) we had:
/block/*
/class/<subsys>/*
/bus/<subsys>/devices/*
/devices/system/<subsys>/*
which are 4 different exports of exactly the same thing, a "device". "Block" we converted to "class" already, "class" will be converted to "bus", and "bus" will be renamed to "subsystem". All the current names will be kept as compat symlinks, just as we did for "block".
I bet userspace will end up failing with that and need updating yet again, inspite of the symlinks.
While Linus complains about the churn in the ARM subtree, I'd like to officially complain about the pointless churn in sysfs which actively breaks (and sometimes prevents) userspace booting when you upgrade kernels.
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Kay SieversQuoted 10 lines · Kay Sievers
When we started to clean up /sys (again only talking about devices, not other stuff) we had:
/block/*
/class/<subsys>/*
/bus/<subsys>/devices/*
/devices/system/<subsys>/*
which are 4 different exports of exactly the same thing, a "device". "Block" we converted to "class" already, "class" will be converted to "bus", and "bus" will be renamed to "subsystem". All the current names will be kept as compat symlinks, just as we did for "block".
I bet userspace will end up failing with that and need updating yet again, inspite of the symlinks.
While Linus complains about the churn in the ARM subtree, I'd like to officially complain about the pointless churn in sysfs which actively breaks (and sometimes prevents) userspace booting when you upgrade kernels.
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Rafael J. WysockiQuoted 14 lines · Rafael J. Wysocki
Convert the SuperH clocks framework and shared interrupt handling code to using struct
syscore_opsinstead of a sysdev classes and sysdevs for power managment.This reduces the code size significantly and simplifies it. The optimizations causing things not to be restored after creating a hibernation image are removed, but they might lead to undesirable effects during resume from hibernation (e.g. the clocks would be left as the boot kernel set them, which might be not the same way as the hibernated kernel had seen them before the hibernation).
This also is necessary for removing sysdevs from the kernel entirely in the future.
Quoted 7 lines
Signed-off-by Rafael J. Wysocki <[email protected]>--- drivers/sh/clk/core.c | 68 ++++++++----------------------- drivers/sh/intc/core.c | 95 +++++++++++++++++++++----------------------- drivers/sh/intc/internals.h | 1 3 files changed, 65 insertions(+), 99 deletions(-)
This one looks good, and seems to work fine. Applied, thanks.
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Rafael J. WysockiQuoted 14 lines · Rafael J. Wysocki
Convert the SuperH clocks framework and shared interrupt handling code to using struct
syscore_opsinstead of a sysdev classes and sysdevs for power managment.This reduces the code size significantly and simplifies it. The optimizations causing things not to be restored after creating a hibernation image are removed, but they might lead to undesirable effects during resume from hibernation (e.g. the clocks would be left as the boot kernel set them, which might be not the same way as the hibernated kernel had seen them before the hibernation).
This also is necessary for removing sysdevs from the kernel entirely in the future.
Quoted 7 lines
Signed-off-by Rafael J. Wysocki <[email protected]>--- drivers/sh/clk/core.c | 68 ++++++++----------------------- drivers/sh/intc/core.c | 95 +++++++++++++++++++++----------------------- drivers/sh/intc/internals.h | 1 3 files changed, 65 insertions(+), 99 deletions(-)
This one looks good, and seems to work fine. Applied, thanks.
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Paul MundtQuoted 8 lines · Paul Mundt
Quoted 2 lines · Kay Sievers
Which is what we need to get rid of. It does not make any sense on the global picture to have anything like that exported to userspace.
So far I haven't heard any rationale for why it doesn't. Exporting CPU state to userspace certainly makes sense, and the sysdev model has worked reasonably for CPUs, memory nodes, etc.
FWIW it'd be really helpful to have CPUs (or at least SoCs) be regular struct devices for integration with the regulator API so we can have all things that might use a regulator (like DVFS) be struct devices but...
Quoted 2 lines
Once cpufreq, timekeeping, and NUMA node state have migrated to whatever the driver model folks find acceptable, I'll happily follow suit.
...we're not precisely there yet :/
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Paul MundtQuoted 8 lines · Paul Mundt
Quoted 2 lines · Kay Sievers
Which is what we need to get rid of. It does not make any sense on the global picture to have anything like that exported to userspace.
So far I haven't heard any rationale for why it doesn't. Exporting CPU state to userspace certainly makes sense, and the sysdev model has worked reasonably for CPUs, memory nodes, etc.
FWIW it'd be really helpful to have CPUs (or at least SoCs) be regular struct devices for integration with the regulator API so we can have all things that might use a regulator (like DVFS) be struct devices but...
Quoted 2 lines
Once cpufreq, timekeeping, and NUMA node state have migrated to whatever the driver model folks find acceptable, I'll happily follow suit.
...we're not precisely there yet :/
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Mark BrownQuoted 6 lines · Mark Brown
Quoted 4 lines · Paul Mundt
Quoted 2 lines · Kay Sievers
Which is what we need to get rid of. It does not make any sense on the global picture to have anything like that exported to userspace.
Quoted 8 lines
Quoted 3 lines
So far I haven't heard any rationale for why it doesn't. Exporting CPU state to userspace certainly makes sense, and the sysdev model has worked reasonably for CPUs, memory nodes, etc.
FWIW it'd be really helpful to have CPUs (or at least SoCs) be regular struct devices for integration with the regulator API so we can have all things that might use a regulator (like DVFS) be struct devices but...
Sure, that makes sense. The easiest would probably be to just replace the struct cpu sysdev with a struct device pointer and fix up drivers/base/cpu.c accordingly. The linux/cpu.h API is unfortunately rather coupled to the idea of having a sysdev, but this is purely for attributes and attribute groups and primarily impacts powerpc, so the conversion shouldn't be too painful. For simple topology registration the bulk of the architectures ultimately don't care what's backing the struct cpu within the sysfs context.
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Mark BrownQuoted 6 lines · Mark Brown
Quoted 4 lines · Paul Mundt
Quoted 2 lines · Kay Sievers
Which is what we need to get rid of. It does not make any sense on the global picture to have anything like that exported to userspace.
Quoted 8 lines
Quoted 3 lines
So far I haven't heard any rationale for why it doesn't. Exporting CPU state to userspace certainly makes sense, and the sysdev model has worked reasonably for CPUs, memory nodes, etc.
FWIW it'd be really helpful to have CPUs (or at least SoCs) be regular struct devices for integration with the regulator API so we can have all things that might use a regulator (like DVFS) be struct devices but...
Sure, that makes sense. The easiest would probably be to just replace the struct cpu sysdev with a struct device pointer and fix up drivers/base/cpu.c accordingly. The linux/cpu.h API is unfortunately rather coupled to the idea of having a sysdev, but this is purely for attributes and attribute groups and primarily impacts powerpc, so the conversion shouldn't be too painful. For simple topology registration the bulk of the architectures ultimately don't care what's backing the struct cpu within the sysfs context.
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Paul MundtQuoted 15 lines · Paul Mundt
Quoted 14 lines · Rafael J. Wysocki
Convert the SuperH clocks framework and shared interrupt handling code to using struct
syscore_opsinstead of a sysdev classes and sysdevs for power managment.This reduces the code size significantly and simplifies it. The optimizations causing things not to be restored after creating a hibernation image are removed, but they might lead to undesirable effects during resume from hibernation (e.g. the clocks would be left as the boot kernel set them, which might be not the same way as the hibernated kernel had seen them before the hibernation).
This also is necessary for removing sysdevs from the kernel entirely in the future.
Quoted 8 lines
Quoted 7 lines
Signed-off-by Rafael J. Wysocki <[email protected]>--- drivers/sh/clk/core.c | 68 ++++++++----------------------- drivers/sh/intc/core.c | 95 +++++++++++++++++++++----------------------- drivers/sh/intc/internals.h | 1 3 files changed, 65 insertions(+), 99 deletions(-)This one looks good, and seems to work fine. Applied, thanks.
Cool, thanks!
Re: [PATCH 9/10] sh: Use struct syscore_ops instead of sysdev class and sysdev
In reply to Paul MundtQuoted 15 lines · Paul Mundt
Quoted 14 lines · Rafael J. Wysocki
Convert the SuperH clocks framework and shared interrupt handling code to using struct
syscore_opsinstead of a sysdev classes and sysdevs for power managment.This reduces the code size significantly and simplifies it. The optimizations causing things not to be restored after creating a hibernation image are removed, but they might lead to undesirable effects during resume from hibernation (e.g. the clocks would be left as the boot kernel set them, which might be not the same way as the hibernated kernel had seen them before the hibernation).
This also is necessary for removing sysdevs from the kernel entirely in the future.
Quoted 8 lines
Quoted 7 lines
Signed-off-by Rafael J. Wysocki <[email protected]>--- drivers/sh/clk/core.c | 68 ++++++++----------------------- drivers/sh/intc/core.c | 95 +++++++++++++++++++++----------------------- drivers/sh/intc/internals.h | 1 3 files changed, 65 insertions(+), 99 deletions(-)This one looks good, and seems to work fine. Applied, thanks.
Cool, thanks!
[GIT PULL] More power management updates for 2.6.39
In reply to Rafael J. WysockiHi Linus,
Please pull additional power management updates for 2.6.39 from:
git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6.git syscore
They make subsystems that x86 depends on use struct syscore_ops objects instead of sysdevs for "core" power management, which reduces the code size and kernel memory footprint a bit and sipmlifies the "core" suspend/resume and shutdown code paths.
arch/x86/Kconfig | 1 + arch/x86/kernel/amd_iommu_init.c | 26 ++-------- arch/x86/kernel/apic/apic.c | 33 ++++--------- arch/x86/kernel/apic/io_apic.c | 97 ++++++++++++++++++-------------------- arch/x86/kernel/cpu/mcheck/mce.c | 21 +++++---- arch/x86/kernel/cpu/mtrr/main.c | 10 ++-- arch/x86/kernel/i8237.c | 30 +++--------- arch/x86/kernel/i8259.c | 33 ++++--------- arch/x86/kernel/microcode_core.c | 34 ++++++-------- arch/x86/kernel/pci-gart_64.c | 32 +++---------- arch/x86/oprofile/nmi_int.c | 44 +++++------------ drivers/base/Kconfig | 7 +++ drivers/base/sys.c | 3 +- drivers/cpufreq/cpufreq.c | 66 ++++++++++---------------- drivers/pci/intel-iommu.c | 38 ++++----------- include/linux/device.h | 4 ++ include/linux/pm.h | 10 +++- include/linux/sysdev.h | 7 ++- kernel/time/timekeeping.c | 27 +++------- virt/kvm/kvm_main.c | 34 +++---------- 20 files changed, 206 insertions(+), 351 deletions(-)
---------------
Rafael J. Wysocki (6):
x86: Use syscore_ops instead of sysdev classes and sysdevs
timekeeping: Use syscore_ops instead of sysdev class and sysdev PCI / Intel IOMMU: Use syscore_ops instead of sysdev class and sysdev
KVM: Use syscore_ops instead of sysdev class and sysdev
cpufreq: Use syscore_ops for boot CPU suspend/resume (v2) Introduce ARCH_NO_SYSDEV_OPS config option (v2)
[GIT PULL] More power management updates for 2.6.39
In reply to Rafael J. WysockiHi Linus,
Please pull additional power management updates for 2.6.39 from:
git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6.git syscore
They make subsystems that x86 depends on use struct syscore_ops objects instead of sysdevs for "core" power management, which reduces the code size and kernel memory footprint a bit and sipmlifies the "core" suspend/resume and shutdown code paths.
arch/x86/Kconfig | 1 + arch/x86/kernel/amd_iommu_init.c | 26 ++-------- arch/x86/kernel/apic/apic.c | 33 ++++--------- arch/x86/kernel/apic/io_apic.c | 97 ++++++++++++++++++-------------------- arch/x86/kernel/cpu/mcheck/mce.c | 21 +++++---- arch/x86/kernel/cpu/mtrr/main.c | 10 ++-- arch/x86/kernel/i8237.c | 30 +++--------- arch/x86/kernel/i8259.c | 33 ++++--------- arch/x86/kernel/microcode_core.c | 34 ++++++-------- arch/x86/kernel/pci-gart_64.c | 32 +++---------- arch/x86/oprofile/nmi_int.c | 44 +++++------------ drivers/base/Kconfig | 7 +++ drivers/base/sys.c | 3 +- drivers/cpufreq/cpufreq.c | 66 ++++++++++---------------- drivers/pci/intel-iommu.c | 38 ++++----------- include/linux/device.h | 4 ++ include/linux/pm.h | 10 +++- include/linux/sysdev.h | 7 ++- kernel/time/timekeeping.c | 27 +++------- virt/kvm/kvm_main.c | 34 +++---------- 20 files changed, 206 insertions(+), 351 deletions(-)
---------------
Rafael J. Wysocki (6):
x86: Use syscore_ops instead of sysdev classes and sysdevs
timekeeping: Use syscore_ops instead of sysdev class and sysdev PCI / Intel IOMMU: Use syscore_ops instead of sysdev class and sysdev
KVM: Use syscore_ops instead of sysdev class and sysdev
cpufreq: Use syscore_ops for boot CPU suspend/resume (v2) Introduce ARCH_NO_SYSDEV_OPS config option (v2)
Re: [PATCH 5/8] PCI / Intel IOMMU: Use syscore_ops instead of sysdev class and sysdev
In reply to Rafael J. WysockiQuoted 6 lines · Rafael J. Wysocki
drivers/pci/intel-iommu.c +1
-4-static int __init init_iommu_sysfs (void ) -{ - return 0; -} +static inline int init_iommu_pm_ops (void ) { }#endif /*
CONFIG_PM*/
drivers/pci/intel-iommu.c:3391: warning: no return statement in function returning non-void
s/static inline int/static inline void/
-Tony
Re: [PATCH 5/8] PCI / Intel IOMMU: Use syscore_ops instead of sysdev class and sysdev
In reply to Rafael J. WysockiQuoted 6 lines · Rafael J. Wysocki
drivers/pci/intel-iommu.c +1
-4-static int __init init_iommu_sysfs (void ) -{ - return 0; -} +static inline int init_iommu_pm_ops (void ) { }#endif /*
CONFIG_PM*/
drivers/pci/intel-iommu.c:3391: warning: no return statement in function returning non-void
s/static inline int/static inline void/
-Tony
Re: [PATCH 5/8] PCI / Intel IOMMU: Use syscore_ops instead of sysdev class and sysdev
Quoted 11 lines · Tony Luck
Review
Quoted 6 lines · Rafael J. Wysocki
(quoted diff) +1
-4-static int __init init_iommu_sysfs(void) -{ - return 0; -} +static inline int init_iommu_pm_ops(void) { } #endif /* CONFIG_PM */
drivers/pci/intel-iommu.c:3391: warning: no return statement in function returning non-void
Quoted 3 lines
s/static inline int/static inline void/
Reported-by Tony Luck <[email protected]>
I guess you mean the following?
Rafael
---
From: Rafael J. Wysocki <[email protected]>
If CONFIG_PM is not set, init_iommu_pm_ops() introduced by commit 134fac3f457f3dd753ecdb25e6da3e5f6629f696 (PCI / Intel IOMMU: Use syscore_ops instead of sysdev class and sysdev) is not defined appropriately. Fix this issue.
--- drivers/pci/intel-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/intel-iommu.c +1 -1
@@ -3388,7 +3388,7 @@ static void __init init_iommu_pm_ops(voi }#else -static inline int init_iommu_pm_ops (void ) { } +static inline void init_iommu_pm_ops (void ) {}#endif /* CONFIG_PM */ /*
Re: [PATCH 5/8] PCI / Intel IOMMU: Use syscore_ops instead of sysdev class and sysdev
In reply to Tony LuckQuoted 11 lines · Tony Luck
Review
Quoted 6 lines · Rafael J. Wysocki
(quoted diff) +1
-4-static int __init init_iommu_sysfs(void) -{ - return 0; -} +static inline int init_iommu_pm_ops(void) { } #endif /* CONFIG_PM */
drivers/pci/intel-iommu.c:3391: warning: no return statement in function returning non-void
Quoted 3 lines
s/static inline int/static inline void/
Reported-by Tony Luck <[email protected]>
I guess you mean the following?
Rafael
---
From: Rafael J. Wysocki <[email protected]>
If CONFIG_PM is not set, init_iommu_pm_ops() introduced by commit 134fac3f457f3dd753ecdb25e6da3e5f6629f696 (PCI / Intel IOMMU: Use syscore_ops instead of sysdev class and sysdev) is not defined appropriately. Fix this issue.
--- drivers/pci/intel-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/intel-iommu.c +1 -1
@@ -3388,7 +3388,7 @@ static void __init init_iommu_pm_ops(voi }#else -static inline int init_iommu_pm_ops (void ) { } +static inline void init_iommu_pm_ops (void ) {}#endif /* CONFIG_PM */ /*
Re: [PATCH 5/8] PCI / Intel IOMMU: Use syscore_ops instead of sysdev class and sysdev
In reply to Rafael J. WysockiQuoted 1 line
I guess you mean the following?
Rafael
Exactly.
Thanks
-Tony
---
From: Rafael J. Wysocki <[email protected]>
If CONFIG_PM is not set, init_iommu_pm_ops() introduced by commit 134fac3f457f3dd753ecdb25e6da3e5f6629f696 (PCI / Intel IOMMU: Use syscore_ops instead of sysdev class and sysdev) is not defined appropriately. Fix this issue.
--- drivers/pci/intel-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/intel-iommu.c +1 -1
@@ -3388,7 +3388,7 @@ static void __init init_iommu_pm_ops(voi }#else -static inline int init_iommu_pm_ops (void ) { } +static inline void init_iommu_pm_ops (void ) {}#endif /* CONFIG_PM */ /*
RE: [PATCH 5/8] PCI / Intel IOMMU: Use syscore_ops instead of sysdev class and sysdev
In reply to Rafael J. WysockiQuoted 1 line
I guess you mean the following?
Rafael
Exactly.
Thanks
-Tony
---
From: Rafael J. Wysocki <[email protected]>
If CONFIG_PM is not set, init_iommu_pm_ops() introduced by commit 134fac3f457f3dd753ecdb25e6da3e5f6629f696 (PCI / Intel IOMMU: Use syscore_ops instead of sysdev class and sysdev) is not defined appropriately. Fix this issue.
--- drivers/pci/intel-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/intel-iommu.c +1 -1
@@ -3388,7 +3388,7 @@ static void __init init_iommu_pm_ops(voi }#else -static inline int init_iommu_pm_ops (void ) { } +static inline void init_iommu_pm_ops (void ) {}#endif /* CONFIG_PM */ /*