Re: [RFC][PATCH -mm take4 2/6] support multiple logging

2007-04-25 Thread David Miller
From: Keiichi KII <[EMAIL PROTECTED]>
Date: Thu, 26 Apr 2007 13:02:04 +0900

> Stephen Hemminger said "The configuration of netconsole's looks like the 
> configuration of routes".
> I think so too.
> So I think ioctl commands for adding/removing port and the following userland 
> application like route(8) command by using the ioctl.

Like the route command itself, the route changing ioctl()s are
old deprecated BSD compatible functionality.

All current routing configuration is done using netlink and the 'ip'
utility.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH -mm take4 2/6] support multiple logging

2007-04-25 Thread Keiichi KII

Well..  before you can finish this work we need to decide upon what the
interface to userspace will be.

- The miscdev isn't appropriate

Why isn't miscdev appropriate? 
We just shouldn't use miscdev for networking conventionally?



Yes it's rather odd, especially for networking.

What does the miscdev _do_ anyway?  Is it purely a target for the ioctls?


Yes, I purely use miscdev for the ioctls.

I want to use sysfs and ioctl to implement the dynamic configurabillity.
The sysfs shows/changes netconsole configurations(IP address, port and so on).
A userland application using the ioctl adds/removes netconsole port.

I thought that the dynamic configurability could be realized without a 
userland application. in the kernel only.

(e.g. only sysfs, no userland application)
But I think we need the function to automatically resolve the destination 
MAC address from IP address because of the resolving cost and 
I should implement a userland application, not netconsole kernel module.

The netconsle will become more useful by implementing the above function.


Some other speculations:
1. Would it be possible to add ioctl's to /dev/console? This would be more in
keeping with older Unix style model.

2. Using sysfs makes sense if there is a device object that exists to
   add the sysfs attributes to.

3. Procfs is handy for summary type tables.

4. Netlink does feel like overkill for this. Although newer generic netlink
   makes it easier.


If I use sysfs, Is it proper location that adds each attributes of netconsole 
port in "/sys/class/misc/netconsole/port[0-9]*", or another locations in /sys/?


Stephen Hemminger said "The configuration of netconsole's looks like the 
configuration of routes".

I think so too.
So I think ioctl commands for adding/removing port and the following userland 
application like route(8) command by using the ioctl.


e.g.
1. add port
# netconfig add 192.168.0.10 

2. remove port
# netconfig remove 1

3. show port info
# netconfig
id status  Source IP   Source Port Destination IP Destination Port Destination 
MAC
1  enable  192.168.0.1 6665192.168.0.10    
00:11:22:33:44:55
2  disable 192.168.0.1 6665192.168.0.20    
00:11:22:33:44:66

route(8) command uses ioctl for Netlink.
But, I'm going to implement ioctl's to /dev/console because of the above 
comments.

Thank you for your comments.
Any comments very welcome.
--
Keiichi KII
NEC Corporation OSS Promotion Center
E-mail: [EMAIL PROTECTED]

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH -mm take4 2/6] support multiple logging

2007-04-24 Thread Stephen Hemminger
On Tue, 24 Apr 2007 01:29:02 -0700
Andrew Morton <[EMAIL PROTECTED]> wrote:

> On Tue, 24 Apr 2007 17:14:28 +0900 Keiichi KII <[EMAIL PROTECTED]> wrote:
> 
> > > On Fri, 20 Apr 2007 18:51:13 +0900
> > > Keiichi KII <[EMAIL PROTECTED]> wrote:
> > > 
> > >>> I started to do some cleanups and fixups here, but abandoned it when it 
> > >>> was
> > >>> all getting a bit large.
> > >>>
> > >>> Here are some fixes against this patch:
> > >> I'm going to fix my patches by following your reviews and send new 
> > >> patches 
> > >> on the LKML and the netdev ML in a few days.
> > >>
> > > 
> > > Well..  before you can finish this work we need to decide upon what the
> > > interface to userspace will be.
> > > 
> > > - The miscdev isn't appropriate
> > > 
> > 
> > Why isn't miscdev appropriate? 
> > We just shouldn't use miscdev for networking conventionally?
> > 
> 
> Yes it's rather odd, especially for networking.
> 
> What does the miscdev _do_ anyway?  Is it purely a target for the ioctls?

Some other speculations:
1. Would it be possible to add ioctl's to /dev/console? This would be more in
keeping with older Unix style model.

2. Using sysfs makes sense if there is a device object that exists to
   add the sysfs attributes to.

3. Procfs is handy for summary type tables.

4. Netlink does feel like overkill for this. Although newer generic netlink
   makes it easier.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH -mm take4 2/6] support multiple logging

2007-04-24 Thread Andrew Morton
On Tue, 24 Apr 2007 17:14:28 +0900 Keiichi KII <[EMAIL PROTECTED]> wrote:

> > On Fri, 20 Apr 2007 18:51:13 +0900
> > Keiichi KII <[EMAIL PROTECTED]> wrote:
> > 
> >>> I started to do some cleanups and fixups here, but abandoned it when it 
> >>> was
> >>> all getting a bit large.
> >>>
> >>> Here are some fixes against this patch:
> >> I'm going to fix my patches by following your reviews and send new patches 
> >> on the LKML and the netdev ML in a few days.
> >>
> > 
> > Well..  before you can finish this work we need to decide upon what the
> > interface to userspace will be.
> > 
> > - The miscdev isn't appropriate
> > 
> 
> Why isn't miscdev appropriate? 
> We just shouldn't use miscdev for networking conventionally?
> 

Yes it's rather odd, especially for networking.

What does the miscdev _do_ anyway?  Is it purely a target for the ioctls?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH -mm take4 2/6] support multiple logging

2007-04-24 Thread Keiichi KII

We don't really have anything that corresponds to netpoll's
connections at higher levels.

I'm tempted to say we should make this work more like the dummy
network device. ie:

modprobe netconsole -o netcon1 [params]
modprobe netconsole -o netcon2 [params]


The configuration of netconsole's looks like the configuration of routes.
Granted you probably have more routes than netconsoles, but the interface
issues are similar.  Netlink with a small application wouldn't be nice.
And having /proc/net/netconsole (read-only) would be good for the netlink
impaired.


Do you say that we had better use procfs instead of sysfs to show the 
configurations of netconsole?


If so, I have a question.
I thought that "procfs use things related to process as far as possible".
Is it no problem to use procfs here? 


--
Keiichi KII
NEC Corporation OSS Promotion Center
E-mail: [EMAIL PROTECTED]


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH -mm take4 2/6] support multiple logging

2007-04-24 Thread Keiichi KII

On Fri, 20 Apr 2007 18:51:13 +0900
Keiichi KII <[EMAIL PROTECTED]> wrote:


I started to do some cleanups and fixups here, but abandoned it when it was
all getting a bit large.

Here are some fixes against this patch:
I'm going to fix my patches by following your reviews and send new patches 
on the LKML and the netdev ML in a few days.




Well..  before you can finish this work we need to decide upon what the
interface to userspace will be.

- The miscdev isn't appropriate



Why isn't miscdev appropriate? 
We just shouldn't use miscdev for networking conventionally?


--
Keiichi KII
NEC Corporation OSS Promotion Center
E-mail: [EMAIL PROTECTED]





-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH -mm take4 2/6] support multiple logging

2007-04-20 Thread Stephen Hemminger
On Fri, 20 Apr 2007 13:21:10 -0500
Matt Mackall <[EMAIL PROTECTED]> wrote:

> On Fri, Apr 20, 2007 at 11:15:26AM -0700, Andrew Morton wrote:
> > On Fri, 20 Apr 2007 18:51:13 +0900
> > Keiichi KII <[EMAIL PROTECTED]> wrote:
> > 
> > > > I started to do some cleanups and fixups here, but abandoned it when it 
> > > > was
> > > > all getting a bit large.
> > > > 
> > > > Here are some fixes against this patch:
> > > 
> > > I'm going to fix my patches by following your reviews and send new 
> > > patches 
> > > on the LKML and the netdev ML in a few days.
> > > 
> > 
> > Well..  before you can finish this work we need to decide upon what the
> > interface to userspace will be.
> > 
> > - The miscdev isn't appropriate
> > 
> > - netlink remains a possibility
> > 
> > - Stephen suggests an ioctl against a socket and davem suggests socket
> >   options, but it's unclear to me how that socket will get bound to
> >   netconsole?
> 
> Yeah, that's a bit of a head-scratcher.
> 
> > either way, I agree with the overall thrust of this work: netconsole is
> > useful in production environments, can become more useful and will need
> > runtime configurability.
> > 
> > 
> > I wonder if we're approaching this in the right way, however...
> > 
> > At a high level, netconsole is just a flow of UDP packets between two
> > machines.  The kernel already has rich and well-understood ways of creating
> > and configuring such flows.
> > 
> > So...  instead of creating a brand new way of configuring such a flow via
> > sysfs and ioctl, could we instead create a flow using the existing
> > mechanisms (presumably the socket API) and then "transfer" the information
> > from that flow over to netconsole by some means??
> 
> We don't really have anything that corresponds to netpoll's
> connections at higher levels.
> 
> I'm tempted to say we should make this work more like the dummy
> network device. ie:
> 
> modprobe netconsole -o netcon1 [params]
> modprobe netconsole -o netcon2 [params]

The configuration of netconsole's looks like the configuration of routes.
Granted you probably have more routes than netconsoles, but the interface
issues are similar.  Netlink with a small application wouldn't be nice.
And having /proc/net/netconsole (read-only) would be good for the netlink
impaired.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH -mm take4 2/6] support multiple logging

2007-04-20 Thread Matt Mackall
On Fri, Apr 20, 2007 at 11:15:26AM -0700, Andrew Morton wrote:
> On Fri, 20 Apr 2007 18:51:13 +0900
> Keiichi KII <[EMAIL PROTECTED]> wrote:
> 
> > > I started to do some cleanups and fixups here, but abandoned it when it 
> > > was
> > > all getting a bit large.
> > > 
> > > Here are some fixes against this patch:
> > 
> > I'm going to fix my patches by following your reviews and send new patches 
> > on the LKML and the netdev ML in a few days.
> > 
> 
> Well..  before you can finish this work we need to decide upon what the
> interface to userspace will be.
> 
> - The miscdev isn't appropriate
> 
> - netlink remains a possibility
> 
> - Stephen suggests an ioctl against a socket and davem suggests socket
>   options, but it's unclear to me how that socket will get bound to
>   netconsole?

Yeah, that's a bit of a head-scratcher.

> either way, I agree with the overall thrust of this work: netconsole is
> useful in production environments, can become more useful and will need
> runtime configurability.
> 
> 
> I wonder if we're approaching this in the right way, however...
> 
> At a high level, netconsole is just a flow of UDP packets between two
> machines.  The kernel already has rich and well-understood ways of creating
> and configuring such flows.
> 
> So...  instead of creating a brand new way of configuring such a flow via
> sysfs and ioctl, could we instead create a flow using the existing
> mechanisms (presumably the socket API) and then "transfer" the information
> from that flow over to netconsole by some means??

We don't really have anything that corresponds to netpoll's
connections at higher levels.

I'm tempted to say we should make this work more like the dummy
network device. ie:

modprobe netconsole -o netcon1 [params]
modprobe netconsole -o netcon2 [params]

-- 
Mathematics is the supreme nostalgia of our time.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH -mm take4 2/6] support multiple logging

2007-04-20 Thread Andrew Morton
On Fri, 20 Apr 2007 18:51:13 +0900
Keiichi KII <[EMAIL PROTECTED]> wrote:

> > I started to do some cleanups and fixups here, but abandoned it when it was
> > all getting a bit large.
> > 
> > Here are some fixes against this patch:
> 
> I'm going to fix my patches by following your reviews and send new patches 
> on the LKML and the netdev ML in a few days.
> 

Well..  before you can finish this work we need to decide upon what the
interface to userspace will be.

- The miscdev isn't appropriate

- netlink remains a possibility

- Stephen suggests an ioctl against a socket and davem suggests socket
  options, but it's unclear to me how that socket will get bound to
  netconsole?


either way, I agree with the overall thrust of this work: netconsole is
useful in production environments, can become more useful and will need
runtime configurability.


I wonder if we're approaching this in the right way, however...

At a high level, netconsole is just a flow of UDP packets between two
machines.  The kernel already has rich and well-understood ways of creating
and configuring such flows.

So...  instead of creating a brand new way of configuring such a flow via
sysfs and ioctl, could we instead create a flow using the existing
mechanisms (presumably the socket API) and then "transfer" the information
from that flow over to netconsole by some means??
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH -mm take4 2/6] support multiple logging

2007-04-20 Thread Keiichi KII

Please include an update to Documentation/networking/netconsole.txt


OK, I update the documnet for the added functions in next patches.

Thank you for your comments.
--
Keiichi KII
NEC Corporation OSS Promotion Center
E-mail: [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH -mm take4 2/6] support multiple logging

2007-04-20 Thread Keiichi KII

I started to do some cleanups and fixups here, but abandoned it when it was
all getting a bit large.

Here are some fixes against this patch:


I'm going to fix my patches by following your reviews and send new patches 
on the LKML and the netdev ML in a few days.


Thank you for your comments and reviews.
--
Keiichi KII
NEC Corporation OSS Promotion Center
E-mail: [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH -mm take4 2/6] support multiple logging

2007-04-19 Thread Andrew Morton
On Wed, 18 Apr 2007 21:06:41 +0900 Keiichi KII <[EMAIL PROTECTED]> wrote:

> From: Keiichi KII <[EMAIL PROTECTED]>
> 
> This patch contains the following changes for supporting multiple logging
>  agents.
> 
> 1. extend netconsole to multiple netpolls
>To send kernel messages to multiple logging agents, extend netcosnole
> to be able to use multiple netpolls. Each netpoll sends kernel messages
> to its own logging agent.
> 
> 2. change config parameter format
>We change config parameter format from single configuration to multiple 
>configurations separated by ';'.
> 
>ex) sending kernel messages to destination1 and destination2 using eth0.
> modprobe netconsole \
> netconsole="@/eth0,@[destination1]/;@/eth0,@[destination2]/"
> 
> 3. introduce CONFIG_NETCONSOLE_DYNCON config to change between 
>existing netconsole and netconsole applying the above function.
> 
> Signed-off-by: Keiichi KII <[EMAIL PROTECTED]>
> Signed-off-by: Takayoshi Kochi <[EMAIL PROTECTED]>
> ---
> Index: mm/drivers/net/netconsole.c
> ===
> --- mm.orig/drivers/net/netconsole.c
> +++ mm/drivers/net/netconsole.c
> @@ -61,15 +61,102 @@ static struct netpoll np = {
>   .remote_port = ,
>   .remote_mac = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
>  };
> -static int configured = 0;
>  
>  #define MAX_PRINT_CHUNK 1000
>  
> +#ifdef CONFIG_NETCONSOLE_DYNCON
> +struct netconsole_target {
> + struct list_head list;
> + int id;
> + struct netpoll np;
> +};
> +
> +static LIST_HEAD(target_list);
> +static DEFINE_SPINLOCK(target_list_lock);
> +
> +static int add_target(char* target_config);
> +static void remove_target(struct netconsole_target *nt);
> +static void cleanup_netconsole(void);

I started to do some cleanups and fixups here, but abandoned it when it was
all getting a bit large.

Here are some fixes against this patch:


- Fix Kconfig

- Avoid need for forward-declared statics

- Coding style:

fix `if' layout
unneeded braces

- use spin_lock_irqsave() and _restore()



diff -puN drivers/net/Kconfig~netconsole-support-multiple-logging-fix 
drivers/net/Kconfig
--- a/drivers/net/Kconfig~netconsole-support-multiple-logging-fix
+++ a/drivers/net/Kconfig
@@ -2965,9 +2965,11 @@ config NETCONSOLE_DYNCON
bool "Support for multiple logging and UI for netconsole"
depends on NETCONSOLE
---help---
-   This option enables multiple logging and changing dynamically
-configurations (e.g. IP adderss, port number and so on)
-by using sysfs and ioctl.
+ This option enables multiple logging and changing dynamically
+ configurations (e.g. IP address, port number and so on)
+ by using sysfs and ioctl.
+ See  for details.
+
 endif #NETDEVICES
 
 config NETPOLL
diff -puN drivers/net/netconsole.c~netconsole-support-multiple-logging-fix 
drivers/net/netconsole.c
--- a/drivers/net/netconsole.c~netconsole-support-multiple-logging-fix
+++ a/drivers/net/netconsole.c
@@ -74,10 +74,6 @@ struct netconsole_target {
 static LIST_HEAD(target_list);
 static DEFINE_SPINLOCK(target_list_lock);
 
-static int add_target(char* target_config);
-static void remove_target(struct netconsole_target *nt);
-static void cleanup_netconsole(void);
-
 static int add_target(char* target_config)
 {
int retval = 0;
@@ -142,27 +138,24 @@ static void write_msg(struct console *co
if (list_empty(&target_list))
return;
 
-   local_irq_save(flags);
-   spin_lock(&target_list_lock);
+   spin_lock_irqsave(&target_list_lock, flags);
 
-   for(left = len; left; ) {
+   for (left = len; left; ) {
frag = min(left, MAX_PRINT_CHUNK);
-   list_for_each_entry(target, &target_list, list) {
+   list_for_each_entry(target, &target_list, list)
netpoll_send_udp(&target->np, msg, frag);
-   }
msg += frag;
left -= frag;
}
 
-   spin_unlock(&target_list_lock);
-   local_irq_restore(flags);
+   spin_unlock_irqrestore(&target_list_lock, flags);
 #else
if (!np.dev)
return;
 
local_irq_save(flags);
 
-   for(left = len; left; ) {
+   for (left = len; left; ) {
frag = min(left, MAX_PRINT_CHUNK);
netpoll_send_udp(&np, msg, frag);
msg += frag;
@@ -189,6 +182,20 @@ static int __init option_setup(char *opt
 __setup("netconsole=", option_setup);
 #endif
 
+static void cleanup_netconsole(void)
+{
+#ifdef CONFIG_NETCONSOLE_DYNCON
+   struct netconsole_target *nt, *tmp;
+
+   unregister_console(&netconsole);
+   list_for_each_entry_safe(nt, tmp, &target_list, list)
+   remove_target(nt);
+#else
+   unregister_console(&netconsole);
+   netpoll_cleanup(&np);
+#endif /* CONFIG_NETCONSOLE_DYNCON */
+}
+
 static int __init in

Re: [RFC][PATCH -mm take4 2/6] support multiple logging

2007-04-18 Thread Stephen Hemminger
On Wed, 18 Apr 2007 21:06:41 +0900
Keiichi KII <[EMAIL PROTECTED]> wrote:

> From: Keiichi KII <[EMAIL PROTECTED]>
> 
> This patch contains the following changes for supporting multiple logging
>  agents.
> 
> 1. extend netconsole to multiple netpolls
>To send kernel messages to multiple logging agents, extend netcosnole
> to be able to use multiple netpolls. Each netpoll sends kernel messages
> to its own logging agent.
> 
> 2. change config parameter format
>We change config parameter format from single configuration to multiple 
>configurations separated by ';'.
> 
>ex) sending kernel messages to destination1 and destination2 using eth0.
> modprobe netconsole \
> netconsole="@/eth0,@[destination1]/;@/eth0,@[destination2]/"

Please include an update to Documentation/networking/netconsole.txt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/