linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kay Sievers <kay.sievers@vrfy.org>
To: linux-hotplug@vger.kernel.org
Subject: Re: [patch] udevd - cleanup and better timeout handling
Date: Thu, 29 Jan 2004 01:52:32 +0000	[thread overview]
Message-ID: <20040129015232.GA16558@vrfy.org> (raw)
In-Reply-To: <20040125200314.GA8376@vrfy.org>

On Wed, Jan 28, 2004 at 10:47:36PM +0100, Kay Sievers wrote:
> On Tue, Jan 27, 2004 at 11:13:09AM -0800, Greg KH wrote:
> > On Tue, Jan 27, 2004 at 08:08:09PM +0100, Kay Sievers wrote:
> > > On Tue, Jan 27, 2004 at 07:56:04AM +0100, Kay Sievers wrote:
> > > > On Mon, Jan 26, 2004 at 11:28:19AM -0800, Greg KH wrote:
> > > > > On Mon, Jan 26, 2004 at 08:11:10PM +0100, Kay Sievers wrote:
> > > > > > On Mon, Jan 26, 2004 at 10:22:34AM -0800, Greg KH wrote:
> > > > > > > On Sun, Jan 25, 2004 at 09:03:14PM +0100, Kay Sievers wrote:
> > > > > > > >   1. We are much too slow.
> > > > > > > >      We want to exec the  real udev in the background, but a 'remove'
> > > > > > > >      is much much faster than a 'add', so we have a problem.
> > > > > > > >      Question: is it neccessary to order events for different devpath's?
> > > > > > > >      If no, we may wait_pid() for the exec only if we have another udev
> > > > > > > >      working on the same devpath.
> > > > > > > 
> > > > > > > But how will we keep track of that?  It's probably easier just to wait
> > > > > > > for each one to finish, right?
> > > > > > 
> > > > > > We leave the message in the queue until we reach the SIGCHLD for this
> > > > > > pid. So we can search the queue if we are already working on this devpath,
> > > > > > and delay the new exec until the former exec comes back.
> > > > > 
> > > > > Ok, if that isn't too much trouble.
> > > > > 
> > > > > > Is it feasible to run in parallel for different paths, or can you think
> > > > > > of any problem?
> > > > > 
> > > > > I can't think of any problem with that.
> > > > 
> > > > Here is the next round. We have three queues now. All incoming messages
> > > > are queued in msg_list and if nothing is missing we move it to the
> > > > running_list and exec in the background.
> > > > If the exec comes back, it removes the message from the running_list and
> > > > frees the message.
> > > > 
> > > > Before we exec, we check the running_list if there is a udev running on
> > > > the same device path. If yes, we move the message to the delay_list. If
> > > > the former exec comes back, we move the message to the running_list and
> > > > exec it.
> > > 
> > > Oh, sorry forget about it now.
> > > I will come up with something better tested.
> > 
> > Oops, I just applied this version :)
> > 
> > I'll try testing this later on today.
> 
> Oh, couldn't resist to try threads.
> It's a multithreaded udevd that communicates through a localhost socket.
> The message includes a magic with the udev version, so we don't accept
> older udevsend's.
> 
> No need for locking, cause we can't bind two sockets on the same address.
> The daemon tries to connect and if it fails it starts the daemon.
> 
> We create a thread for every incoming connection, handle over the socket,
> sort the messages in the global message queue and exit the thread.
> Huh, that was easy with threads :)
> 
> With the addition of a message we wakeup the queue manager thread and
> handle timeouts or move the message to the global exec list. This wakes
> up the exec list manager who looks if a process is already running for this
> device path.
> If yes, the exec is delayed otherwise we create a thread that execs udev.
> n the background. With the return of udev we free the message and wakeup
> the exec list manager to look if something is pending.
> 
> It is just a quick shot, cause I couldn't solve the problems with fork an
> scheduling and I wanted to see if I'm to stupid  :)
> But if anybody with a better idea or more experience with I/O scheduling
> we may go another way. The remaining problem is that klibc doesn't support
> threads.
> 
> By now, we don't exec anything, it's just a sleep 3 for every exec,
> but you can see the queue management by watching syslog and do:
> 
>   DEVPATH=/abc ACTION­d SEQNUM=0 ./udevsend /abc

Here is the next version, that also does the exec.
Please have a look.

thanks,
Kay


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

  parent reply	other threads:[~2004-01-29  1:52 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-25 20:03 [patch] udevd - cleanup and better timeout handling Kay Sievers
2004-01-26 18:22 ` Greg KH
2004-01-26 19:11 ` Kay Sievers
2004-01-26 19:28 ` Greg KH
2004-01-26 19:42 ` Kay Sievers
2004-01-26 22:26 ` Greg KH
2004-01-26 22:56 ` Kay Sievers
2004-01-27  6:56 ` Kay Sievers
2004-01-27 18:55 ` Greg KH
2004-01-27 19:08 ` Kay Sievers
2004-01-27 19:13 ` Greg KH
2004-01-28 21:47 ` Kay Sievers
2004-01-29  1:52 ` Kay Sievers [this message]
2004-01-29  1:56 ` Kay Sievers
2004-01-29 15:55 ` Kay Sievers
2004-01-31  2:42 ` Kay Sievers
2004-02-01  9:08 ` Greg KH
2004-02-01 18:16 ` Kay Sievers
2004-02-02  2:19 ` Kay Sievers
2004-02-02  8:21 ` Greg KH
2004-02-02 11:50 ` Kay Sievers
2004-02-02 18:45 ` Greg KH
2004-02-02 21:36 ` Kay Sievers
2004-02-03  1:26 ` Greg KH
2004-02-03  6:43 ` Ling, Xiaofeng
2004-02-03 20:12 ` Kay Sievers
2004-02-04  0:56 ` Greg KH
2004-02-08  9:43 ` Olaf Hering
2004-02-08 15:22 ` Kay Sievers
2004-02-08 15:40 ` Olaf Hering
2004-02-08 15:57 ` Kay Sievers
2004-02-08 16:09 ` Olaf Hering

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040129015232.GA16558@vrfy.org \
    --to=kay.sievers@vrfy.org \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).