Steven Rostedt
2006-Sep-28 14:03 UTC
[Xen-devel] [PATCH] have udev create the device for blktap
This patch makes blktap Do The Right Thing(TM). It allows udev to create the /dev/xen/blktap[0-9] devices. It creates a sysfs class called "xen". This part may later be placed someplace else, but currently blktap is the only user so it is placed in the blktap code. When blktap is initialized, a blktap0 sysfs class device is made. The other devices blktapX (X > 0) are made when the BLKTAP_IOCTL_NEWINTF ioctl is called. This way we don''t flood the sysfs and /dev/xen with unnecessary devices. I added a rule in the xen-backend.rules to allow for udev to create the blktap devices. With this, we can really remove the code to search and create the /dev/xen/blktap[0-9]*, but I''ll leave it in for now. With the use of udev, we really should remove that code as well as the code for creating the evtchn device. udev works for both of these now. But that removal will have to be in another patch. -- Steve _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Andrew Warfield
2006-Sep-28 20:23 UTC
[Xen-devel] Re: [PATCH] have udev create the device for blktap
I''m wondering about this one a bit, as I''m not so familiar with the class stuff. This patch isn''t changing any of the device creation code -- it''s just adding calls to publish the existence of the tap-related device nodes through sysfs so that udev creates them for us, right? Can you explain what the new ''xen'' class does -- is it just to keep things organized within /sys? the /dev/xen subdirectory is created through the udev rules, and not implicitly through having the class, isn''t it? Assuming this is true, I wonder if it''s worth broadening this patch slightly to also incorporate the event channel driver, and to pull the xen class stuff out into drivers/xen/core/sysfs_class.c or similar. Also, on the blocktap side, it would be nice (in a later patch) to kill the static allocation of the data-path devices and allocate them on demand, as you do with the associed sysfs entries. a. On 9/28/06, Steven Rostedt <srostedt@redhat.com> wrote:> This patch makes blktap Do The Right Thing(TM). It allows udev to > create the /dev/xen/blktap[0-9] devices. > > It creates a sysfs class called "xen". This part may later be placed > someplace else, but currently blktap is the only user so it is placed in > the blktap code. > > When blktap is initialized, a blktap0 sysfs class device is made. The > other devices blktapX (X > 0) are made when the BLKTAP_IOCTL_NEWINTF > ioctl is called. This way we don''t flood the sysfs and /dev/xen with > unnecessary devices. > > I added a rule in the xen-backend.rules to allow for udev to create the > blktap devices. > > > With this, we can really remove the code to search and create the > /dev/xen/blktap[0-9]*, but I''ll leave it in for now. With the use of > udev, we really should remove that code as well as the code for creating > the evtchn device. udev works for both of these now. But that removal > will have to be in another patch. > > -- Steve > > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Andrew Warfield
2006-Sep-28 20:47 UTC
[Xen-devel] Re: [PATCH] have udev create the device for blktap
New plan -- after looking at the sysfs stuff a bit more and chatting to Keir, I''ve applied the patch as-is. the event channel is probably okay for the moment as a misc device, and we can abstract out the xen class from blktap if/when there''s something else that wants to use it. Pretty much as you said in your original submission. ;) cheers, a. On 9/28/06, Andrew Warfield <andrew.warfield@cl.cam.ac.uk> wrote:> I''m wondering about this one a bit, as I''m not so familiar with the > class stuff. This patch isn''t changing any of the device creation > code -- it''s just adding calls to publish the existence of the > tap-related device nodes through sysfs so that udev creates them for > us, right? > > Can you explain what the new ''xen'' class does -- is it just to keep > things organized within /sys? the /dev/xen subdirectory is created > through the udev rules, and not implicitly through having the class, > isn''t it? > > Assuming this is true, I wonder if it''s worth broadening this patch > slightly to also incorporate the event channel driver, and to pull the > xen class stuff out into drivers/xen/core/sysfs_class.c or similar. > > Also, on the blocktap side, it would be nice (in a later patch) to > kill the static allocation of the data-path devices and allocate them > on demand, as you do with the associed sysfs entries. > > a. > > On 9/28/06, Steven Rostedt <srostedt@redhat.com> wrote: > > This patch makes blktap Do The Right Thing(TM). It allows udev to > > create the /dev/xen/blktap[0-9] devices. > > > > It creates a sysfs class called "xen". This part may later be placed > > someplace else, but currently blktap is the only user so it is placed in > > the blktap code. > > > > When blktap is initialized, a blktap0 sysfs class device is made. The > > other devices blktapX (X > 0) are made when the BLKTAP_IOCTL_NEWINTF > > ioctl is called. This way we don''t flood the sysfs and /dev/xen with > > unnecessary devices. > > > > I added a rule in the xen-backend.rules to allow for udev to create the > > blktap devices. > > > > > > With this, we can really remove the code to search and create the > > /dev/xen/blktap[0-9]*, but I''ll leave it in for now. With the use of > > udev, we really should remove that code as well as the code for creating > > the evtchn device. udev works for both of these now. But that removal > > will have to be in another patch. > > > > -- Steve > > > > > > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Steven Rostedt
2006-Sep-28 20:59 UTC
[Xen-devel] Re: [PATCH] have udev create the device for blktap
Andrew Warfield wrote:> I''m wondering about this one a bit, as I''m not so familiar with the > class stuff. This patch isn''t changing any of the device creation > code -- it''s just adding calls to publish the existence of the > tap-related device nodes through sysfs so that udev creates them for > us, right?Yep.> > Can you explain what the new ''xen'' class does -- is it just to keep > things organized within /sys? the /dev/xen subdirectory is created > through the udev rules, and not implicitly through having the class, > isn''t it?The class seemed the most reasonable way to organize it in sysfs. The directory is still created by the udev rules, but that is still the norm.> > Assuming this is true, I wonder if it''s worth broadening this patch > slightly to also incorporate the event channel driver, and to pull the > xen class stuff out into drivers/xen/core/sysfs_class.c or similar.That can be done. I was going to do something with the evtchn but since it was a misc device, it is automatically registered in the sysfs system. And udev uses that to create it. Although we should probably have the evtchn grab a dynamic minor from the misc system. And for those systems without udev, we could have the daemon read the sysfs system to find the minor. (I should probably change the blktapctrl to read sysfs instead of /proc/devices). As noted in the code, I would have put it else where (perhaps it''s own file), but since blktap was the only user (so far) I kept it there. Hmm, I guess I can through that code into its own file. Would be a small file though :) Would that be the preferred method?> > Also, on the blocktap side, it would be nice (in a later patch) to > kill the static allocation of the data-path devices and allocate them > on demand, as you do with the associed sysfs entries.That would not be a problem. The tap devices could be stored in a link list. The only time you would need to search the list to find the tap device, is really on open. You would also do it to look for a free device, but that search is already done. I''ll take a look into that too. -- Steve _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Andrew Warfield
2006-Sep-28 21:04 UTC
[Xen-devel] Re: [PATCH] have udev create the device for blktap
Ships in the night, and so on -- as I posted concurrently with this, I applied the patch. ;) Anyhow, thanks for the clarifications, and I agree with your points about evntchn moving to a dynamic minor and the tap interrogation moving from /proc/devices to /sys -- that would all be great.> > Also, on the blocktap side, it would be nice (in a later patch) to > > kill the static allocation of the data-path devices and allocate them > > on demand, as you do with the associed sysfs entries. > > That would not be a problem. The tap devices could be stored in a link > list. The only time you would need to search the list to find the tap > device, is really on open. You would also do it to look for a free > device, but that search is already done. > > I''ll take a look into that too.Perfect -- this would be a very welcome patch. Thanks again! a. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel