All of lore.kernel.org
 help / color / mirror / Atom feed
From: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
To: Guillaume Thouvenin <guillaume.thouvenin@bull.net>
Cc: Andrew Morton <akpm@osdl.org>, Greg KH <greg@kroah.com>,
	lkml <linux-kernel@vger.kernel.org>,
	elsa-devel <elsa-devel@lists.sourceforge.net>,
	Gerrit Huizenga <gh@us.ibm.com>,
	Erich Focht <efocht@hpce.nec.com>
Subject: Re: [PATCH 2.6.11-rc3-mm2] connector: Add a fork connector
Date: Thu, 24 Feb 2005 12:17:42 +0300	[thread overview]
Message-ID: <1109236662.6728.40.camel@uganda> (raw)
In-Reply-To: <1109227265.16029.154.camel@frecb000711.frec.bull.fr>

[-- Attachment #1: Type: text/plain, Size: 3004 bytes --]

On Thu, 2005-02-24 at 07:41 +0100, Guillaume Thouvenin wrote:
> On Wed, 2005-02-23 at 14:41 +0300, Evgeniy Polyakov wrote:
> > > Please assume that <whatever secret application the connector stuff was
> > > originally written for> will always be listening.
> > >
> > > > > What happened to the idea of sending an on/off message down the netlink
> > > > > socket?
> > > ...
> > > Arrange for the userspace daemon to send a message to the fork_connector
> > > subsystem turning it on or off.  So we can bypass all this code in the
> > > common case where <secret application> is listening, but your daemon is
> > > not.
> > 
> > Ok, now I see(I'm not a fork connector author, so I did not receive them).
> > That will require to add real fork connector with callback routing.
> > Guillaume?
> 
> Yes the connector's callback is a good solution. I will add a fork
> enable/disable callback in drivers/connector/connector.c that will
> switch a global variable when called from user space. It will be
> something like:
> 
> void cn_fork_callback(void)
> {
> 	if (cn_already_initialized) 
> 		cn_fork_enable = cn_fork_enable ? 0 : 1 ;
> } 
> 
> With cn_fork_enable set to 0 by default. In the do_fork() I will replace
> the statement "if (cn_already_initialized)" by "if (cn_fork_enable)"

Yes, it is right solution, but I do not think generic connector should
have it.
Create your own module that will "depend on CONNECTOR=y", which will
register
callback and export some function that will be called from do_fork() if
FORK_CONNECTOR is defined and do nothing otherwise.
I think you even need to create some simple protocol over connector,
i.e.:

void cn_fork_callback(void *data)
{
	struct cn_msg *msg = (struct cn_msg *)data;

	if (msg->len != sizeof(cn_fork_enable))
		return;

           memcpy(&cn_fork_enable, msg->data, sizeof(cn_fork_enable));
}

And register cn_for_callback() with the connector.

By default cn_fork_enable is zero and fork_connector() called from
do_fork()
will do nothing, otherwise cn_netlink_send(data, 0);
Since something is registered with connector then "0" here will select
appropriate group.
Or you may still use CN_IDX_FORK.

Userspace daemod, which is bound to the CN_IDX_FORK group will send
cn_msg with the appropriate
enable/disable message.

Or you can even create more complex protocol, which will enable/disable
various fork parameters to be logged...


> > > Without a lock you can have two messages with the same sequence number. 
> > > Even if the daemon which you're planning on implementing can handle that,
> > > we shouldn't allow it.
> > 
> > Yes, they can have the same number, but does it cost atomic/lock overhead?
> > Anyway, simple spin_lock() should be enough in do_fork() context.
> > Guillaume?
> 
> I will protect the incrementation by a spin_lock(&fork_cn_lock).
> 
> Guillaume
-- 
        Evgeniy Polyakov

Crash is better than data corruption -- Arthur Grabowski

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2005-02-24  9:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1108649153.8379.137.camel@frecb000711.frec.bull.fr>
2005-02-23  8:52 ` [PATCH 2.6.11-rc3-mm2] connector: Add a fork connector Guillaume Thouvenin
2005-02-23  9:07   ` Andrew Morton
2005-02-23 11:08     ` Evgeniy Polyakov
2005-02-23 10:58       ` Andrew Morton
2005-02-23 11:41         ` Evgeniy Polyakov
2005-02-24  6:41           ` Guillaume Thouvenin
2005-02-24  9:17             ` Evgeniy Polyakov [this message]
2005-02-17 14:55 Guillaume Thouvenin
2005-02-17 15:50 ` Evgeniy Polyakov
2005-02-21  7:07   ` Guillaume Thouvenin
2005-02-21  8:41     ` Evgeniy Polyakov
2005-02-21  9:47     ` Paul Jackson
2005-02-21 10:33       ` Guillaume Thouvenin
2005-02-21 11:58         ` Paul Jackson
2005-02-21 14:43           ` Guillaume Thouvenin
2005-02-21 16:55             ` Erich Focht
2005-02-21 17:54             ` Paul Jackson

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=1109236662.6728.40.camel@uganda \
    --to=johnpol@2ka.mipt.ru \
    --cc=akpm@osdl.org \
    --cc=efocht@hpce.nec.com \
    --cc=elsa-devel@lists.sourceforge.net \
    --cc=gh@us.ibm.com \
    --cc=greg@kroah.com \
    --cc=guillaume.thouvenin@bull.net \
    --cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.