netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Veaceslav Falico <vfalico@gmail.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Jason Baron <jbaron@akamai.com>,
	Eric Dumazet <edumazet@google.com>,
	Vlad Yasevich <vyasevic@redhat.com>,
	stephen hemminger <stephen@networkplumber.org>,
	Jerry Chu <hkchu@google.com>,
	Ben Hutchings <bhutchings@solarflare.com>,
	Tom Gundersen <teg@jklm.no>
Subject: Re: [PATCH v2 net-next 0/2] net: print net_device name/state more often
Date: Thu, 17 Jul 2014 17:24:18 +0200	[thread overview]
Message-ID: <20140717152418.GC28357@mikrodark.usersys.redhat.com> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D17276E6E@AcuExch.aculab.com>

On Thu, Jul 17, 2014 at 02:48:17PM +0000, David Laight wrote:
>From: Veaceslav Falico
>> Currently we use net_device->name only if it's the NETREG_REGISTERED
>> reg_state, otherwise we return "(unregistered device)".
>>
>> However, we always populate net_device->name on creation, so it's always
>> available to us for use. The only caveat is that we might have a name like
>> "eth%d", in which case we cannot use it as it might change in the future.
>
>While you've got this code out on the operating table what about:

I don't think these ideas fit into the current patchset, as it's somehow
unrelated to the "lets give the real name/state when possible".

However, I like them, see below.

>1) Tracing the renames into the kernel message buffer.

I think you can enable it already. dev_change_name() (net's function to
change net_device name) calls device_rename(), which handles the device
renaming, and it has:

1805         dev_dbg(dev, "renaming to %s\n", new_name);

It can be easily enabled if you have dynamic debug compiled in.

However, indeed, it might be a good info to watch for, and a pretty simple
patch, which might be useful.

diff --git a/net/core/dev.c b/net/core/dev.c
index 239722a..d14ebf0 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1113,6 +1113,9 @@ int dev_change_name(struct net_device *dev, const char *newname)
 		return err;
 	}
 
+	if (oldname[0] && !strchr(oldname, '%'))
+		netdev_info(dev, "renamed from %s\n", oldname);
+
 	old_assign_type = dev->name_assign_type;
 	dev->name_assign_type = NET_NAME_RENAMED;
 

>2) Including the original name in some of the kernel traces.

The only possible use-case of that, from what I can see (with the patch
from 1) ) - is in the renaming functions themselves, which have already
quite a few output sources and, tbh, it's a really rare situation to
implenment tracking of renames in-kernel.

>
>I've been trying to diagnose some issues on a system that renames
>its interfaces, and it can get tricky working out which interface
>messages refer to.
>
>	David
>
>
>

  reply	other threads:[~2014-07-17 15:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-17 14:09 [PATCH v2 net-next 0/2] net: print net_device name/state more often Veaceslav Falico
2014-07-17 14:09 ` [PATCH v2 net-next 1/2] net: use dev->name in netdev_pr* when it's available Veaceslav Falico
2014-07-17 16:18   ` Joe Perches
2014-07-17 16:25     ` Veaceslav Falico
2014-07-17 16:36       ` Joe Perches
2014-07-17 16:38         ` Veaceslav Falico
2014-07-17 16:58           ` Joe Perches
2014-07-17 16:58             ` Veaceslav Falico
2014-07-17 14:09 ` [PATCH v2 net-next 2/2] net: print net_device reg_state in netdev_* unless it's registered Veaceslav Falico
2014-07-17 17:00   ` Joe Perches
2014-07-17 17:27     ` Veaceslav Falico
2014-07-17 14:48 ` [PATCH v2 net-next 0/2] net: print net_device name/state more often David Laight
2014-07-17 15:24   ` Veaceslav Falico [this message]
2014-07-17 15:25   ` Tom Gundersen
2014-07-17 15:27     ` David Laight

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=20140717152418.GC28357@mikrodark.usersys.redhat.com \
    --to=vfalico@gmail.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkchu@google.com \
    --cc=jbaron@akamai.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    --cc=teg@jklm.no \
    --cc=vyasevic@redhat.com \
    /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).