[RFC][PATCH v2 -mm 0/9] netconsole: Multiple targets and dynamic reconfigurability

Previous thread: -mm merge plans for 2.6.23 by Andrew Morton on Tuesday, July 10, 2007 - 4:31 am. (452 messages)

Next thread: [PATCH 1/1] [2.6.22] USB devices misc: Trivial patch to build the IOWARRIOR when it is selected in Kconfig by Juergen Beisert on Tuesday, July 10, 2007 - 4:58 am. (1 message)
To: Linux Kernel Mailing List <linux-kernel@...>
Cc: Matt Mackall <mpm@...>, Keiichi Kii <k-keiichi@...>, Satyam Sharma <ssatyam@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Tuesday, July 10, 2007 - 5:19 am

[0/9] netconsole: Multiple targets and dynamic reconfigurability

This patchset is a rework of the original idea and patches posted by
Keiichi Kii and Takayoshi Kochi at: http://lkml.org/lkml/2007/6/13/72

This is v2 of the patchset, the previous version is available at:
http://lkml.org/lkml/2007/7/4/107

This is diffed against 2.6.22-rc6-mm1 + the earlier netpoll fixlet and the
configfs cleanup patches (those are already merged in -mm AFAIK, and hence
not reproduced here).

[1/9] netconsole: Cleanups, codingstyle, prettyfication
[2/9] netconsole: Remove bogus check
[3/9] netconsole: Simplify boot/module option setup logic
[4/9] netconsole: Add some useful tips to documentation
[5/9] netconsole: Introduce netconsole_target
[6/9] netconsole: Introduce netconsole_netdev_notifier
[7/9] netconsole: Use netif_running() in write_msg()
[8/9] netconsole: Support multiple logging targets
[9/9] netconsole: Support dynamic reconfiguration using configfs

Changes since v1:
=================

* Split / merge various patches in the patchset as suggested in reviews.

* Get rid of redundant "id" and "dev_status" fields.

* Use netif_running() instead of IFF_UP.

* Explain the boot/module option setup simplification and the netdev
notifier patches in more detail (justify why they're good / required).

* Get rid of possible trailing newline from echo(1) in store_dev_name().

* Fix a panic bug -- now, when no boot/module option is specified, we
skip only the part that creates and inserts param string-created
targets. Rest of the initialization (notifier, configfs subsystem)
is done as usual.

* Get rid of lock-skipping special-casing where possible.

* Use config_item_name() instead of "empty_item".

* Introduce netpoll_print_options() in netpoll and use it.

* Style cleanups (reduce #ifdefs, indentation, whitespace fixes, etc).

* Miscellaneous fixes in documentation (as suggested in reviews).

About this patchset:
====================

What?

Support multiple remote ...

To: Satyam Sharma <ssatyam@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Matt Mackall <mpm@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Friday, July 13, 2007 - 9:39 am

I tested your v2 patches on the x86/IA64 architecture.
There was no problem on my tests.

Signed-off-by: Keiichi Kii <k-keiichi@bx.jp.nec.com>

Thanks
--
Keiichi KII
NEC Corporation OSS Platform Development Division
E-mail: k-keiichi@bx.jp.nec.com
-

To: KII Keiichi <k-keiichi@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Matt Mackall <mpm@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Friday, July 13, 2007 - 1:30 pm

Hi Keiichi,

Ok, thanks! I'll send out the next series (with the various few
fixes and cleanups suggested this time) with your Sign-offs/Acks.

Satyam
-

To: Satyam Sharma <ssatyam@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Matt Mackall <mpm@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Wednesday, July 11, 2007 - 5:59 am

Hi Satyam,

I'm going to test/review these patches and report the result of tests

Thanks
--
Keiichi KII
NEC Corporation OSS Platform Development Division
E-mail: k-keiichi@bx.jp.nec.com
-

To: Linux Kernel Mailing List <linux-kernel@...>
Cc: Matt Mackall <mpm@...>, Keiichi Kii <k-keiichi@...>, Satyam Sharma <ssatyam@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Tuesday, July 10, 2007 - 5:19 am

From: Satyam Sharma <ssatyam@cse.iitk.ac.in>

[6/9] netconsole: Introduce netconsole_netdev_notifier

To update fields of underlying netpoll structure at runtime on
corresponding NETDEV_CHANGEADDR or NETDEV_CHANGENAME notifications.

ioctl(SIOCSIFHWADDR) {or ioctl(SIOCSIFNAME)} could be used to change the
hardware/MAC address {or name} of the local interface that our netpoll is
attached to. Whenever this happens, netdev notifier chain is called out
with the NETDEV_CHANGEADDR {or NETDEV_CHANGENAME} event message. We respond
to that and update the local_mac {or dev_name} field of the struct netpoll.
This makes sense anyway, but is especially required for dynamic netconsole
because the netpoll structure's internal members become user visible files
when either sysfs or configfs are used. So this helps us to keep up with the
MAC address / name changes and keep the values in struct netpoll uptodate.

Signed-off-by: Satyam Sharma <ssatyam@cse.iitk.ac.in>
Cc: Keiichi Kii <k-keiichi@bx.jp.nec.com>

---

drivers/net/netconsole.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)

---

diff -ruNp a/drivers/net/netconsole.c b/drivers/net/netconsole.c
--- a/drivers/net/netconsole.c 2007-07-10 06:57:44.000000000 +0530
+++ b/drivers/net/netconsole.c 2007-07-10 07:24:27.000000000 +0530
@@ -80,6 +80,33 @@ static struct netconsole_target default_
},
};

+/* Handle network interface device notifications */
+static int netconsole_netdev_event(struct notifier_block *this,
+ unsigned long event,
+ void *ptr)
+{
+ struct net_device *dev = ptr;
+ struct netconsole_target *nt = &default_target;
+
+ if (nt->np.dev == dev) {
+ switch (event) {
+ case NETDEV_CHANGEADDR:
+ memcpy(nt->np.local_mac, dev->dev_addr, ETH_ALEN);
+ break;
+
+ case NETDEV_CHANGENAME:
+ strlcpy(nt->np.dev_name, dev->name, IFNAMSIZ);
+ break;
+ }
+ }
+
+ return NOTIFY_DONE;
+}
+
+static struct notifier_block netconsole_netde...

To: Satyam Sharma <ssatyam@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Matt Mackall <mpm@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Friday, July 13, 2007 - 9:47 am

Signed-off-by: Keiichi Kii <k-keiichi@bx.jp.nec.com>

Thanks
--
Keiichi KII
NEC Corporation OSS Platform Development Division
E-mail: k-keiichi@bx.jp.nec.com

-

To: Linux Kernel Mailing List <linux-kernel@...>
Cc: Matt Mackall <mpm@...>, Keiichi Kii <k-keiichi@...>, Satyam Sharma <ssatyam@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Tuesday, July 10, 2007 - 5:20 am

From: Satyam Sharma <ssatyam@cse.iitk.ac.in>

[8/9] netconsole: Support multiple logging targets

This patch introduces support for multiple targets:

Let's keep this out of CONFIG_NETCONSOLE_DYNAMIC as well -- this is useful
even in the default case and (including the infrastructure introduced in
previous patches) doesn't really add too many bytes to module text. All the
complexity (and size) comes with the dynamic reconfigurability / userspace
interface patch, and so it's plausible users may want to keep this enabled
but that disabled (say to avoid a dep on CONFIG_CONFIGFS_FS too).

Also update documentation to mention the use of ";" separator to specify
multiple logging targets in the boot/module option string.

Brief overview:

We maintain a target_list (and corresponding lock). Get rid of the static
"default_target" and introduce allocation and release functions for our
netconsole_target objects (but keeping sure to preserve previous behaviour
such as default values). During init_netconsole(), ";" is used as the
separator to identify multiple target specifications in the boot/module
option string. The target specifications are parsed and netpolls setup.
During exit, the target_list is torn down and all items released.

Signed-off-by: Satyam Sharma <ssatyam@cse.iitk.ac.in>
Cc: Keiichi Kii <k-keiichi@bx.jp.nec.com>

---

Documentation/networking/netconsole.txt | 6 +
drivers/net/netconsole.c | 173 ++++++++++++++++++++++++--------
2 files changed, 139 insertions(+), 40 deletions(-)

---

diff -ruNp a/Documentation/networking/netconsole.txt b/Documentation/networking/netconsole.txt
--- a/Documentation/networking/netconsole.txt 2007-07-10 07:35:17.000000000 +0530
+++ b/Documentation/networking/netconsole.txt 2007-07-10 08:25:17.000000000 +0530
@@ -34,6 +34,12 @@ Examples:

insmod netconsole netconsole=@/,@10.0.0.2/

+It also supports logging to multiple remote agents by specifying
+parameters for the multiple agents separated ...

To: Satyam Sharma <ssatyam@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Matt Mackall <mpm@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Friday, July 13, 2007 - 9:49 am

Signed-off-by: Keiichi Kii <k-keiichi@bx.jp.nec.com>

Thanks
--
Keiichi KII
NEC Corporation OSS Platform Development Division
E-mail: k-keiichi@bx.jp.nec.com

-

To: Satyam Sharma <ssatyam@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Matt Mackall <mpm@...>, Keiichi Kii <k-keiichi@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Tuesday, July 10, 2007 - 6:23 am

Is the unlikely a good idea here? Not having any targets may be
unusual but it isn't ridiculous. It might even be a sensible default
for distros. My (very limited) understanding of unlikely is that it
could impose a very large penalty in that case and would make a very
marginal difference at best in the common case.

Cheers,
Duane.

--
"I never could learn to drink that blood and call it wine" - Bob Dylan
-

To: Duane Griffin <duaneg@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Matt Mackall <mpm@...>, Keiichi Kii <k-keiichi@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Tuesday, July 10, 2007 - 6:17 pm

Hi,

Hmm, I put it in there because I expected that the user must have had
at least one target configured (added to target_list) if he's got the
module loaded/built-in (and netconsole registered), which is when this

I wouldn't call it a large penalty, but yeah, probably the unlikely()
there isn't all that important either.

Satyam
-

To: Satyam Sharma <ssatyam@...>
Cc: Duane Griffin <duaneg@...>, Linux Kernel Mailing List <linux-kernel@...>, Matt Mackall <mpm@...>, Keiichi Kii <k-keiichi@...>, Netdev <netdev@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Wednesday, July 11, 2007 - 12:29 am

Loading the module won't happen without a config, but there's no
requirement that a built-in netconsole has a kernel command-line
argument. I always build netconsole for my kernels. Sure, I usually do
it as a module, but if I build a monolithic kernel I compile it in.

Joel

--

"When choosing between two evils, I always like to try the one
I've never tried before."
- Mae West

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127
-

To: Joel Becker <Joel.Becker@...>
Cc: Duane Griffin <duaneg@...>, Linux Kernel Mailing List <linux-kernel@...>, Matt Mackall <mpm@...>, Keiichi Kii <k-keiichi@...>, Netdev <netdev@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Wednesday, July 11, 2007 - 2:24 am

Hi Joel,

That's no longer the case (doesn't need to be enforced actually) now
with being able to add logging targets _after_ the module has loaded
and initialized / registered itself. It's plausible a user may simply
want to load netconsole without any "netconsole=" option, and then

The above is applicable for the built-in case too, with
CONFIG_NETCONSOLE_DYNAMIC. So now built-in netconsole will initialize
(configfs subsystem, etc) and register itself (register_console) even
if no "netconsole=" was provided, again for the same reason.

And I now notice that CONFIG_NETCONSOLE=y in the defconfig's of
most arch's. So I think I did get the common case wrong there ...
ok, I'll get rid of the unlikely() in that case.

Satyam
-

To: Linux Kernel Mailing List <linux-kernel@...>
Cc: Matt Mackall <mpm@...>, Keiichi Kii <k-keiichi@...>, Satyam Sharma <ssatyam@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Tuesday, July 10, 2007 - 5:19 am

From: Satyam Sharma <ssatyam@cse.iitk.ac.in>

[5/9] netconsole: Introduce netconsole_target

Introduce a wrapper structure over netpoll to represent logging targets
configured in netconsole. This will get extended with other members in
further patches.

The original patchset did this along with (and inside the #ifdef) of
CONFIG_NETCONSOLE_DYNAMIC itself. I decided otherwise, and was able to
drastically cut down on the #ifdef-complexity of final netconsole.c.
Also, struct netconsole_target would be required for multiple targets
support also, and not just dynamic reconfigurability. Previously these
two things were coupled, but I want to de-link that (more on this later).

Note that this patch in itself looks quite redundant / stupid, but it is
purposefully made this way, so further patches are more readable.

Signed-off-by: Satyam Sharma <ssatyam@cse.iitk.ac.in>
Cc: Keiichi Kii <k-keiichi@bx.jp.nec.com>

---

drivers/net/netconsole.c | 34 ++++++++++++++++++++++++----------
1 file changed, 24 insertions(+), 10 deletions(-)

---

diff -ruNp a/drivers/net/netconsole.c b/drivers/net/netconsole.c
--- a/drivers/net/netconsole.c 2007-07-10 06:42:11.000000000 +0530
+++ b/drivers/net/netconsole.c 2007-07-10 06:50:46.000000000 +0530
@@ -62,24 +62,35 @@ static int __init option_setup(char *opt
__setup("netconsole=", option_setup);
#endif /* MODULE */

-static struct netpoll np = {
- .name = "netconsole",
- .dev_name = "eth0",
- .local_port = 6665,
- .remote_port = 6666,
- .remote_mac = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+/**
+ * struct netconsole_target - Represents a configured netconsole target.
+ * @np: The netpoll structure for this target.
+ */
+struct netconsole_target {
+ struct netpoll np;
+};
+
+static struct netconsole_target default_target = {
+ .np = {
+ .name = "netconsole",
+ .dev_name = "eth0",
+ .local_port = 6665,
+ .remote_port = 6666,
+ .remote_mac = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ },
};

static void ...

To: Satyam Sharma <ssatyam@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Matt Mackall <mpm@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Friday, July 13, 2007 - 9:46 am

Signed-off-by: Keiichi Kii <k-keiichi@bx.jp.nec.com>

Thanks
--
Keiichi KII
NEC Corporation OSS Platform Development Division
E-mail: k-keiichi@bx.jp.nec.com
-

To: Linux Kernel Mailing List <linux-kernel@...>
Cc: Matt Mackall <mpm@...>, Keiichi Kii <k-keiichi@...>, Satyam Sharma <ssatyam@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Tuesday, July 10, 2007 - 5:19 am

From: Satyam Sharma <ssatyam@cse.iitk.ac.in>

[7/9] netconsole: Use netif_running() in write_msg()

Avoid unnecessarily disabling interrupts and calling netpoll_send_udp()
if the corresponding local interface is not up.

Signed-off-by: Satyam Sharma <ssatyam@cse.iitk.ac.in>
Cc: Keiichi Kii <k-keiichi@bx.jp.nec.com>

---

drivers/net/netconsole.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

---

diff -ruNp a/drivers/net/netconsole.c b/drivers/net/netconsole.c
--- a/drivers/net/netconsole.c 2007-07-10 07:26:47.000000000 +0530
+++ b/drivers/net/netconsole.c 2007-07-10 07:45:51.000000000 +0530
@@ -113,16 +113,16 @@ static void write_msg(struct console *co
unsigned long flags;
struct netconsole_target *nt = &default_target;

- local_irq_save(flags);
-
- for (left = len; left;) {
- frag = min(left, MAX_PRINT_CHUNK);
- netpoll_send_udp(&nt->np, msg, frag);
- msg += frag;
- left -= frag;
+ if (netif_running(nt->np.dev)) {
+ local_irq_save(flags);
+ for (left = len; left;) {
+ frag = min(left, MAX_PRINT_CHUNK);
+ netpoll_send_udp(&nt->np, msg, frag);
+ msg += frag;
+ left -= frag;
+ }
+ local_irq_restore(flags);
}
-
- local_irq_restore(flags);
}

static struct console netconsole = {
-

To: Satyam Sharma <ssatyam@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Matt Mackall <mpm@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Friday, July 13, 2007 - 9:48 am

Acked-by: Keiichi Kii <k-keiichi@bx.jp.nec.com>

Thanks
--
Keiichi KII
NEC Corporation OSS Platform Development Division
E-mail: k-keiichi@bx.jp.nec.com

-

To: Linux Kernel Mailing List <linux-kernel@...>
Cc: Matt Mackall <mpm@...>, Keiichi Kii <k-keiichi@...>, Satyam Sharma <ssatyam@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Tuesday, July 10, 2007 - 5:19 am

From: Satyam Sharma <ssatyam@cse.iitk.ac.in>

[2/9] netconsole: Remove bogus check

The (!np.dev) check in write_msg() is bogus (always false), because:
np.dev is set by netpoll_setup(), which is called by the target init
code in init_netconsole() _before_ register_console() => write_msg() cannot
be triggered unless netpoll_setup() returns with success. And that will not
happen if netpoll_setup() failed to set np.dev. Also np.dev cannot go from
under us while netconsole is loaded. This is because netpoll_setup() grabs
a reference for us on that dev. So let's remove the pointless check.

Signed-off-by: Satyam Sharma <ssatyam@cse.iitk.ac.in>
Cc: Keiichi Kii <k-keiichi@bx.jp.nec.com>

---

drivers/net/netconsole.c | 3 ---
1 file changed, 3 deletions(-)

---

diff -ruNp a/drivers/net/netconsole.c b/drivers/net/netconsole.c
--- a/drivers/net/netconsole.c 2007-07-10 05:53:42.000000000 +0530
+++ b/drivers/net/netconsole.c 2007-07-10 05:55:00.000000000 +0530
@@ -67,9 +67,6 @@ static void write_msg(struct console *co
int frag, left;
unsigned long flags;

- if (!np.dev)
- return;
-
local_irq_save(flags);

for (left = len; left;) {
-

To: Satyam Sharma <ssatyam@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Matt Mackall <mpm@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Friday, July 13, 2007 - 9:41 am

Acked-by: Keiichi Kii <k-keiichi@bx.jp.nec.com>

Thanks
--
Keiichi KII
NEC Corporation OSS Platform Development Division
E-mail: k-keiichi@bx.jp.nec.com
-

To: Satyam Sharma <ssatyam@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Keiichi Kii <k-keiichi@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Tuesday, July 10, 2007 - 5:05 am

Acked-by: Matt Mackall <mpm@selenic.com>

--
Mathematics is the supreme nostalgia of our time.
-

To: Linux Kernel Mailing List <linux-kernel@...>
Cc: Matt Mackall <mpm@...>, Keiichi Kii <k-keiichi@...>, Satyam Sharma <ssatyam@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Tuesday, July 10, 2007 - 5:19 am

From: Satyam Sharma <ssatyam@cse.iitk.ac.in>

[3/9] netconsole: Simplify boot/module option setup logic

Presently, for built-in netconsole:

__setup(..., option_setup) ensures that the option_setup() function is
called at boot-time from obsolete_checksetup() with the string matching
"netconsole=" passed to it from the kernel's command line. We call the
netpoll_parse_options() from in there, and populate the netpoll struct
with the passed values. Then, when init_netconsole() is called during the
initcall phase, strlen(config) fails, thus skipping option_setup().

For modular netconsole:

module_param_string() ensures that the string corresponding to the
"netconsole" module parameter passed from the modprobe command line is
copied into the "config" static variable. This time, when the module is
being initialized, strlen(config) is true and so option_setup() is called
on "config" from init_netconsole() and the input string is parsed and the
netpoll struct populated.

Hence, quite different things happen in the copying and parsing of the
passed netpoll parameters for the modular / built-in cases. This patch
makes both of them similar by doing exactly the equivalent of a
module_param_string() in option_setup() also -- just copying the param
string passed from the kernel command line into the "config" static
variable. So, init_netconsole() parses (using netpoll_parse_options())
it in both the cases, and makes the logic somewhat simpler.

Now, option_setup() is only ever called / used for the built-in case,
so we put it inside a #ifndef MODULE, otherwise gcc will complain about
option_setup() being "defined but not used".

Also, the "configured" variable is redundant with this patch and so removed.

Signed-off-by: Satyam Sharma <ssatyam@cse.iitk.ac.in>
Cc: Keiichi Kii <k-keiichi@bx.jp.nec.com>

---

drivers/net/netconsole.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)

---

diff -ruNp a/drivers/net/netconsole.c b/d...

To: Satyam Sharma <ssatyam@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Matt Mackall <mpm@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Friday, July 13, 2007 - 9:42 am

Signed-off-by: Keiichi Kii <k-keiichi@bx.jp.nec.com>

Thanks
--
Keiichi KII
NEC Corporation OSS Platform Development Division
E-mail: k-keiichi@bx.jp.nec.com
-

To: Satyam Sharma <ssatyam@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Keiichi Kii <k-keiichi@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Tuesday, July 10, 2007 - 5:23 am

Acked-by: Matt Mackall <mpm@selenic.com>

--
Mathematics is the supreme nostalgia of our time.
-

To: Linux Kernel Mailing List <linux-kernel@...>
Cc: Matt Mackall <mpm@...>, Keiichi Kii <k-keiichi@...>, Satyam Sharma <ssatyam@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Tuesday, July 10, 2007 - 5:20 am

From: Satyam Sharma <ssatyam@cse.iitk.ac.in>

[9/9] netconsole: Support dynamic reconfiguration using configfs

This patch introduces support for dynamic reconfiguration (adding, removing
and/or modifying parameters of netconsole targets at runtime) using a
userspace interface exported via configfs. Documentation is also updated
accordingly.

Issues and brief design overview:

(1) Kernel-initiated creation / destruction of kernel objects is not
possible with configfs -- the lifetimes of the "config items" is managed
exclusively from userspace. But netconsole must support boot/module params
too, and these are parsed in kernel and hence netpolls must be setup from
the kernel. Joel Becker suggested to separately manage the lifetimes of
the two kinds of netconsole_target objects -- those created via configfs
mkdir(2) from userspace and those specified from the boot/module option
string. This adds complexity and some redundancy here and also means that
boot/module param-created targets are not exposed through the configfs
namespace (and hence cannot be updated / destroyed dynamically). However,
this saves us from locking / refcounting complexities that would need to
be introduced in configfs to support kernel-initiated item creation /
destroy there. Also, this is similar to present behaviour in any case so
not really a problem.

(2) In configfs, item creation takes place in the call chain of the mkdir(2)
syscall in the driver subsystem. If we used an ioctl(2) to create / destroy
objects from userspace, the special userspace program is able to fill out
the structure to be passed into the ioctl and hence specify attributes such
as local interface that are required at the time we set up the netpoll.
For configfs, this information is not available at the time of mkdir(2).
So, we keep all newly-created targets (via configfs) disabled by default.
The user is expected to set various attributes appropriately (including the
local network interface if required) and then write(2) "1" to th...

To: Satyam Sharma <ssatyam@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Matt Mackall <mpm@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Friday, July 13, 2007 - 9:50 am

Acked-by: Keiichi Kii <k-keiichi@bx.jp.nec.com>

Thanks
--
Keiichi KII
NEC Corporation OSS Platform Development Division
E-mail: k-keiichi@bx.jp.nec.com

-

To: Satyam Sharma <ssatyam@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Matt Mackall <mpm@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Thursday, July 12, 2007 - 6:04 am

If CONFIG_NETCONSOLE_DYNAMIC is unset, we can't access to the "enabled" member.
So, the compile errors occur because the following functions make use of

I created the following patch for performing some tests.
If there is nothing wrong with the patch, I'm going to continue to test.

Signed-off-by: Keiichi Kii <k-keiichi@bx.jp.nec.com>

Index: mm/drivers/net/netconsole.c
===================================================================
--- mm.orig/drivers/net/netconsole.c
+++ mm/drivers/net/netconsole.c
@@ -94,8 +94,8 @@ struct netconsole_target {
struct list_head list;
#ifdef CONFIG_NETCONSOLE_DYNAMIC
struct config_item item;
- int enabled;
#endif
+ int enabled;
struct netpoll np;
};

Thanks
--
Keiichi KII
NEC Corporation OSS Platform Development Division
E-mail: k-keiichi@bx.jp.nec.com
-

To: Keiichi KII <k-keiichi@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Matt Mackall <mpm@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Thursday, July 12, 2007 - 1:08 pm

Hi,

Yup, enabled should be out of CONFIG_NETCONSOLE_DYNAMIC. I'll include this
change in the next version as well.

Thanks,
Satyam
-

To: Linux Kernel Mailing List <linux-kernel@...>
Cc: Matt Mackall <mpm@...>, Keiichi Kii <k-keiichi@...>, Satyam Sharma <ssatyam@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Tuesday, July 10, 2007 - 5:19 am

From: Satyam Sharma <ssatyam@cse.iitk.ac.in>

[1/9] netconsole: Cleanups, codingstyle, prettyfication

(1) Remove unwanted headers.
(2) Mark __init and __exit as appropriate.
(3) Various trivial codingstyle and prettification stuff.

Signed-off-by: Satyam Sharma <ssatyam@cse.iitk.ac.in>
Cc: Keiichi Kii <k-keiichi@bx.jp.nec.com>

---

drivers/net/netconsole.c | 55 +++++++++++++++++++++++------------------------
1 file changed, 27 insertions(+), 28 deletions(-)

---

diff -ruNp a/drivers/net/netconsole.c b/drivers/net/netconsole.c
--- a/drivers/net/netconsole.c 2007-04-26 08:38:32.000000000 +0530
+++ b/drivers/net/netconsole.c 2007-07-03 20:27:17.000000000 +0530
@@ -35,35 +35,32 @@
****************************************************************/

#include <linux/mm.h>
-#include <linux/tty.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/console.h>
-#include <linux/tty_driver.h>
#include <linux/moduleparam.h>
#include <linux/string.h>
-#include <linux/sysrq.h>
-#include <linux/smp.h>
#include <linux/netpoll.h>

MODULE_AUTHOR("Maintainer: Matt Mackall <mpm@selenic.com>");
MODULE_DESCRIPTION("Console driver for network interfaces");
MODULE_LICENSE("GPL");

-static char config[256];
-module_param_string(netconsole, config, 256, 0);
+#define MAX_PARAM_LENGTH 256
+#define MAX_PRINT_CHUNK 1000
+
+static char config[MAX_PARAM_LENGTH];
+module_param_string(netconsole, config, MAX_PARAM_LENGTH, 0);
MODULE_PARM_DESC(netconsole, " netconsole=[src-port]@[src-ip]/[dev],[tgt-port]@<tgt-ip>/[tgt-macaddr]\n");

static struct netpoll np = {
- .name = "netconsole",
- .dev_name = "eth0",
- .local_port = 6665,
- .remote_port = 6666,
- .remote_mac = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ .name = "netconsole",
+ .dev_name = "eth0",
+ .local_port = 6665,
+ .remote_port = 6666,
+ .remote_mac = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
};
-stat...

To: Satyam Sharma <ssatyam@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Matt Mackall <mpm@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Friday, July 13, 2007 - 9:40 am

Signed-off-by: Keiichi Kii <k-keiichi@bx.jp.nec.com>

Thanks
--
Keiichi KII
NEC Corporation OSS Platform Development Division
E-mail: k-keiichi@bx.jp.nec.com
-

To: Satyam Sharma <ssatyam@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Keiichi Kii <k-keiichi@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Tuesday, July 10, 2007 - 5:02 am

I don't much like what you've done in (3) because I personally think
tabs should never appear anywhere but at the beginning of a line.
Which is why we consistently ask for people not to mix codingstyle
bits with substantive changes.

But what the hell..

Acked-by: Matt Mackall <mpm@selenic.com>

--
Mathematics is the supreme nostalgia of our time.
-

To: Linux Kernel Mailing List <linux-kernel@...>
Cc: Matt Mackall <mpm@...>, Keiichi Kii <k-keiichi@...>, Satyam Sharma <ssatyam@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Tuesday, July 10, 2007 - 5:19 am

From: Satyam Sharma <ssatyam@cse.iitk.ac.in>

[4/9] netconsole: Add some useful tips to documentation

Add some useful general-purpose tips.

Signed-off-by: Satyam Sharma <ssatyam@cse.iitk.ac.in>
Cc: Keiichi Kii <k-keiichi@bx.jp.nec.com>

---

Documentation/networking/netconsole.txt | 13 +++++++++++++
1 file changed, 13 insertions(+)

---

diff -ruNp a/Documentation/networking/netconsole.txt b/Documentation/networking/netconsole.txt
--- a/Documentation/networking/netconsole.txt 2007-04-26 08:38:32.000000000 +0530
+++ b/Documentation/networking/netconsole.txt 2007-07-10 07:31:12.000000000 +0530
@@ -44,6 +44,19 @@ WARNING: the default target ethernet set
ethernet address to send packets, which can cause increased load on
other systems on the same ethernet segment.

+TIP: some LAN switches may be configured to suppress ethernet broadcasts
+so it is advised to explicitly specify the remote agents' MAC addresses
+from the config parameters passed to netconsole.
+
+TIP: to find out the MAC address of, say, 10.0.0.2, you may try using:
+
+ ping -c 1 10.0.0.2 ; /sbin/arp -n | grep 10.0.0.2
+
+TIP: in case the remote logging agent is on a separate LAN subnet than
+the sender, it is suggested to try specifying the MAC address of the
+default gateway (you may use /sbin/route -n to find it out) as the
+remote MAC address instead.
+
NOTE: the network device (eth1 in the above case) can run any kind
of other network traffic, netconsole is not intrusive. Netconsole
might cause slight delays in other traffic if the volume of kernel
-

To: Satyam Sharma <ssatyam@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Keiichi Kii <k-keiichi@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Tuesday, July 10, 2007 - 5:41 am

Acked-by: Matt Mackall <mpm@selenic.com>

As long as we're on the subject, I've been meaning to add a note
telling people to set their console log level to something useful, as
having that set too low is the most common problem people encounter.

--
Mathematics is the supreme nostalgia of our time.
-

To: Matt Mackall <mpm@...>
Cc: Satyam Sharma <ssatyam@...>, Linux Kernel Mailing List <linux-kernel@...>, Keiichi Kii <k-keiichi@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>, Jesper Juhl <jesper.juhl@...>
Date: Tuesday, July 10, 2007 - 8:34 am

How about this?

From: Satyam Sharma <ssatyam@cse.iitk.ac.in>

Add some useful general-purpose tips.

Signed-off-by: Satyam Sharma <ssatyam@cse.iitk.ac.in>
Cc: Keiichi Kii <k-keiichi@bx.jp.nec.com>
Acked-by: Matt Mackall <mpm@selenic.com>
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>

---

Documentation/networking/netconsole.txt | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/Documentation/networking/netconsole.txt b/Documentation/networking/netconsole.txt
index 1caa6c7..ffd5058 100644
--- a/Documentation/networking/netconsole.txt
+++ b/Documentation/networking/netconsole.txt
@@ -44,11 +44,29 @@ WARNING: the default target ethernet setting uses the broadcast
ethernet address to send packets, which can cause increased load on
other systems on the same ethernet segment.

+TIP: some LAN switches may be configured to suppress ethernet broadcasts
+so it is advised to explicitly specify the remote agents' MAC addresses
+from the config parameters passed to netconsole.
+
+TIP: to find out the MAC address of, say, 10.0.0.2, you may try using:
+
+ ping -c 1 10.0.0.2 ; /sbin/arp -n | grep 10.0.0.2
+
+TIP: in case the remote logging agent is on a separate LAN subnet than
+the sender, it is suggested to try specifying the MAC address of the
+default gateway (you may use /sbin/route -n to find it out) as the
+remote MAC address instead.
+
NOTE: the network device (eth1 in the above case) can run any kind
of other network traffic, netconsole is not intrusive. Netconsole
might cause slight delays in other traffic if the volume of kernel
messages is high, but should have no other impact.

+Some people forget to raise the kernels log_level to an
+appropriate level and thus don't see all the kernel log messages they
+expect. You can add the kernel boot option "ignore_loglevel" to see all
+messages or you can use SysRq to set the log level to a specific value.
+
Netconsole was designed to be as ...

To: Jesper Juhl <jesper.juhl@...>
Cc: Matt Mackall <mpm@...>, Linux Kernel Mailing List <linux-kernel@...>, Keiichi Kii <k-keiichi@...>, Netdev <netdev@...>, Joel Becker <joel.becker@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Tuesday, July 10, 2007 - 6:10 pm

Hi Jesper,

IMHO something that mentions /proc/sys/kernel/printk would be better.

You don't need to have built with SysRq support for that, it's clearly
more flexible than the ignore_loglevel option and wouldn't require a
reboot either. I'll send out an updated patch shortly.

Satyam
-

To: Satyam Sharma <ssatyam@...>
Cc: Jesper Juhl <jesper.juhl@...>, Matt Mackall <mpm@...>, Linux Kernel Mailing List <linux-kernel@...>, Keiichi Kii <k-keiichi@...>, Netdev <netdev@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Wednesday, July 11, 2007 - 12:20 am

Why not dmesg -n? We've been using that for years. Or is there
some extra change in /proc/sys/kernel/printk?

Joel

--

"Against stupidity the Gods themselves contend in vain."
- Friedrich von Schiller

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127
-

To: Joel Becker <Joel.Becker@...>
Cc: Jesper Juhl <jesper.juhl@...>, Matt Mackall <mpm@...>, Linux Kernel Mailing List <linux-kernel@...>, Keiichi Kii <k-keiichi@...>, Netdev <netdev@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Wednesday, July 11, 2007 - 2:05 am

Yes, "dmesg -n" sounds the most straightforward. There are multiple ways
of course, for some reason I've always used /proc/sys/kernel/printk for
this (which has the extra "feature" that it accepts values greater than
8 too :-)

Satyam
-

To: Satyam Sharma <ssatyam@...>
Cc: Joel Becker <Joel.Becker@...>, Matt Mackall <mpm@...>, Linux Kernel Mailing List <linux-kernel@...>, Keiichi Kii <k-keiichi@...>, Netdev <netdev@...>, Stephen Hemminger <shemminger@...>, Andrew Morton <akpm@...>, David Miller <davem@...>
Date: Wednesday, July 11, 2007 - 7:56 am

Why not mention all the various methods, dmesg -n,
/proc/sys/kernel/printk, SysRq, ignore_loglevel ??

--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
-

Previous thread: -mm merge plans for 2.6.23 by Andrew Morton on Tuesday, July 10, 2007 - 4:31 am. (452 messages)

Next thread: [PATCH 1/1] [2.6.22] USB devices misc: Trivial patch to build the IOWARRIOR when it is selected in Kconfig by Juergen Beisert on Tuesday, July 10, 2007 - 4:58 am. (1 message)