Re: [PATCHSET 3/4] sysfs: divorce sysfs from kobject and driver model

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Tejun Heo <htejun@...>
Cc: <ebiederm@...>, <cornelia.huck@...>, <stern@...>, <kay.sievers@...>, <linux-kernel@...>
Date: Tuesday, October 9, 2007 - 6:48 pm

On Fri, Oct 05, 2007 at 05:00:48PM +0900, Tejun Heo wrote:

heh :)


I agree.


And for kobjects too.  They need a way to show categories and heirachy.


I think you must be misunderstanding what I mean here.

In the past, to add something like "userspace notification of hotplug"
to different kernel subsystems, we had to add it all over the place.
Now, with a unified way to represent objects in the kernel (kobjects and
then 'struct device') we only have to add the logic in one place for the
core code, and all subsystems have automatic access to it.  That's one
of the main benefits of this core code.


No, kobjects need to do this, not just the driver model.  What about
things that do not currently use the driver model (like block devices).
Are you going to tell them they can't have attributes?  :)


Well, that's what struct kref does, as Cornelia pointed out.  That's
even lower down than a kobject.


I think the block layer would disagree with you :)


Sorry, struct kref does that.  You want a kobject to show hierarchy and
classification of types.


The "original" argument was that I don't want to allow users of sysfs
who are not using a struct kobject.  Perhaps we should just focus on
that issue instead of debating the relative merits of kobject and struct
device for right now.


But as long as we stick with using kobjects for the sysfs interface, it
should not really matter, right?


Um, no, I strongly disagree here.


I don't think that things under /sys/fs/ or /sys/module/ or /sys/kernel/
or /sys/firmware/ should be forced to use the driver model.  Instead,
they should use kobjects, which make much more sense there to show the
heirachy involved.


Well, what is the probem with the current driver core code (becides the
whole scsi mess which I think is now cleaned up a bunch) that is keeping
libata from doing what it wants to do?

It might be easier to focus on this, than debating the relative merits
of splitting sysfs away from kobjects, as specific examples are much
better to work with.


Heh, ok :)

I really don't want the kobject interface to be such an obfuscated mess,
and am trying to fix that.  It's just taking time, as it is such a gross
mess in places.  But we have the framework layed out for where we want
to go, so at least we have a known direction.


The rules for sysfs files are the following:
	- one value, in text format, per file.
	- no action apon open/close
	- binary files are only allowed for "pass-through" type files
	  that the kernel does not touch (like for firmware and pci
	  config space)
	- directories should be associated with a kobject where it makes
	  sense (no nesting deep subdirectories without a kobject
	  present)
	- when a directory is created/removed, a uevent should happen
	  declaring what type of device was created/removed.

There are probably some more.

The main thing that your split apart of the sysfs and kobjects would be
that you could easily create files in sysfs that are not associated with
a kobject.  That is what I want to stay away from as that is not what
sysfs is for.


For an explaination of how the usage of the layout of the usage of sysfs
for userspace programs, see the file, Documentation/sysfs-rules.txt


see my above directory examples of why the driver model would not work
for them, but kobjects are still needed.


"well defined policies" are tough to enforce over the years.  Trust me,
I've found this out the hard way.  People will do things with the
interface that you never notice until it's too late and the
userspace-visable interface has been there for 3 kernel versions and
you can't change it.  By removing the kobject requirement, we open
ourselves up to a lot of different usages of sysfs beyond what I think
we really want/need.


I don't see how any of the current in-kernel usages of kobjects/sysfs
could be cleaned up by your added apis.  Do you have an idea of a
current user of sysfs that could benifit from these api changes?


I think I understand why you are doing all of this, and I hope I can
convince you that we still need kobjects, and we need to limit sysfs
usage to kobjects only.  I don't see the need to remove that
requirement.

If there are things in sysfs that we can not / are not handling properly
with kobjects, perhaps they belong in a different virtual filesystem?
sysfs isn't for everything :)

thanks,

greg k-h
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCHSET 3/4] sysfs: divorce sysfs from kobject and dri..., Greg KH, (Tue Oct 9, 6:48 pm)
Re: [PATCHSET 3/4] sysfs: divorce sysfs from kobject and dri..., Eric W. Biederman, (Thu Sep 27, 3:25 pm)
Re: [PATCHSET 3/4] sysfs: divorce sysfs from kobject and dri..., Eric W. Biederman, (Wed Oct 10, 9:16 am)
Re: [PATCHSET 3/4] sysfs: divorce sysfs from kobject and dri..., Eric W. Biederman, (Tue Oct 16, 7:54 pm)
Re: [PATCHSET 3/4] sysfs: divorce sysfs from kobject and dri..., Eric W. Biederman, (Wed Oct 10, 5:16 pm)
[PATCH 21/22] sysfs: kill sysfs_hash_and_remove(), Tejun Heo, (Thu Sep 20, 4:05 am)
[PATCH 05/22] sysfs: implement sysfs_find_child(), Tejun Heo, (Thu Sep 20, 4:05 am)
[PATCH 14/22] sysfs: s/symlink/link/g, Tejun Heo, (Thu Sep 20, 4:05 am)
[PATCH 06/22] sysfs: restructure addrm helpers, Tejun Heo, (Thu Sep 20, 4:05 am)
[PATCH 01/22] sysfs: make sysfs_root a pointer, Tejun Heo, (Thu Sep 20, 4:05 am)
[PATCH 04/22] sysfs: make SYSFS_COPY_NAME a flag, Tejun Heo, (Thu Sep 20, 4:05 am)