Netdev List
 help / color / mirror / Atom feed
* [PATCH 1/1]core:Change a wrong explain about dev_get_by_name
@ 2013-03-20  9:33 tingwei liu
  2013-03-20 15:32 ` Eric Dumazet
  0 siblings, 1 reply; 8+ messages in thread
From: tingwei liu @ 2013-03-20  9:33 UTC (permalink / raw)
  To: netdev, Alexey Kuznetsov, davem

>From 5d787e8c3725efa6af3036eeb52aba1905c70de9 Mon Sep 17 00:00:00 2001
From: root <root@linux-19.site>
Date: Wed, 20 Mar 2013 17:39:59 +0800
Subject: [PATCH] Change a wrong explain about dev_get_by_name


Signed-off-by: Tingwei Liu <tingw.liu@gmail.com>
---
 net/core/dev.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index d540ced..20c5c7c 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -700,10 +700,10 @@ EXPORT_SYMBOL(dev_get_by_name_rcu);
  *     @name: name to find
  *
  *     Find an interface by name. This can be called from any
- *     context and does its own locking. The returned handle has
- *     the usage count incremented and the caller must use dev_put() to
- *     release it when it is no longer needed. %NULL is returned if no
- *     matching device is found.
+ *     context except hard irq context and does its own locking.
+ *     The returned handle has the usage count incremented and the
+ *     caller must use dev_put() to release it when it is no longer
+ *     needed. %NULL is returned if no matching device is found.
  */

 struct net_device *dev_get_by_name(struct net *net, const char *name)
--
1.6.0.2

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1]core:Change a wrong explain about dev_get_by_name
  2013-03-20  9:33 [PATCH 1/1]core:Change a wrong explain about dev_get_by_name tingwei liu
@ 2013-03-20 15:32 ` Eric Dumazet
  2013-03-20 17:10   ` Ben Hutchings
  2013-03-23  1:33   ` tingwei liu
  0 siblings, 2 replies; 8+ messages in thread
From: Eric Dumazet @ 2013-03-20 15:32 UTC (permalink / raw)
  To: tingwei liu; +Cc: netdev, Alexey Kuznetsov, davem

On Wed, 2013-03-20 at 17:33 +0800, tingwei liu wrote:
> From 5d787e8c3725efa6af3036eeb52aba1905c70de9 Mon Sep 17 00:00:00 2001
> From: root <root@linux-19.site>
> Date: Wed, 20 Mar 2013 17:39:59 +0800
> Subject: [PATCH] Change a wrong explain about dev_get_by_name
> 

No changelog ? This patch really needs a changelog.

I have no idea why we should document this function being not safe in
irq context.

Most part of networking stack is non safe in hard irq context.

Should we add a comment in front of all possible entry points ?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1]core:Change a wrong explain about dev_get_by_name
  2013-03-20 15:32 ` Eric Dumazet
@ 2013-03-20 17:10   ` Ben Hutchings
  2013-03-20 17:43     ` Eric Dumazet
  2013-03-23  1:33   ` tingwei liu
  1 sibling, 1 reply; 8+ messages in thread
From: Ben Hutchings @ 2013-03-20 17:10 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: tingwei liu, netdev, Alexey Kuznetsov, davem

On Wed, 2013-03-20 at 08:32 -0700, Eric Dumazet wrote:
> On Wed, 2013-03-20 at 17:33 +0800, tingwei liu wrote:
> > From 5d787e8c3725efa6af3036eeb52aba1905c70de9 Mon Sep 17 00:00:00 2001
> > From: root <root@linux-19.site>
> > Date: Wed, 20 Mar 2013 17:39:59 +0800
> > Subject: [PATCH] Change a wrong explain about dev_get_by_name
> > 
> 
> No changelog ? This patch really needs a changelog.
> 
> I have no idea why we should document this function being not safe in
> irq context.
> 
> Most part of networking stack is non safe in hard irq context.
> 
> Should we add a comment in front of all possible entry points ?

If they are wrongly documented as 'can be called from any context', yes.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1]core:Change a wrong explain about dev_get_by_name
  2013-03-20 17:10   ` Ben Hutchings
@ 2013-03-20 17:43     ` Eric Dumazet
  2013-03-23  1:24       ` tingwei liu
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Dumazet @ 2013-03-20 17:43 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: tingwei liu, netdev, Alexey Kuznetsov, davem

On Wed, 2013-03-20 at 17:10 +0000, Ben Hutchings wrote:

> If they are wrongly documented as 'can be called from any context', yes.

Wow, thats really useful.

Why is this function not allowed from hard irq context, we have no idea.

Why someone would like to call it from hard irq context, we have no
idea.

I hope to get a clear explanation here, not only playing with words.

Thanks

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1]core:Change a wrong explain about dev_get_by_name
  2013-03-20 17:43     ` Eric Dumazet
@ 2013-03-23  1:24       ` tingwei liu
  2013-03-23  1:32         ` Eric Dumazet
  0 siblings, 1 reply; 8+ messages in thread
From: tingwei liu @ 2013-03-23  1:24 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Ben Hutchings, netdev, Alexey Kuznetsov, davem

On Thu, Mar 21, 2013 at 1:43 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Wed, 2013-03-20 at 17:10 +0000, Ben Hutchings wrote:
>
>> If they are wrongly documented as 'can be called from any context', yes.
>
> Wow, thats really useful.
>
> Why is this function not allowed from hard irq context, we have no idea.
When function "list_netdevice" get write lock "dev_base_lock" only
disable soft interrupt. So dev_get_by_name get read lock
"dev_base_lock", can not called on interrupt context.
>
> Why someone would like to call it from hard irq context, we have no
> idea.
>
> I hope to get a clear explanation here, not only playing with words.
>
> Thanks
>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1]core:Change a wrong explain about dev_get_by_name
  2013-03-23  1:24       ` tingwei liu
@ 2013-03-23  1:32         ` Eric Dumazet
  2013-03-24  7:07           ` tingwei liu
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Dumazet @ 2013-03-23  1:32 UTC (permalink / raw)
  To: tingwei liu; +Cc: Ben Hutchings, netdev, Alexey Kuznetsov, davem

On Sat, 2013-03-23 at 09:24 +0800, tingwei liu wrote:
> On Thu, Mar 21, 2013 at 1:43 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > On Wed, 2013-03-20 at 17:10 +0000, Ben Hutchings wrote:
> >
> >> If they are wrongly documented as 'can be called from any context', yes.
> >
> > Wow, thats really useful.
> >
> > Why is this function not allowed from hard irq context, we have no idea.
> When function "list_netdevice" get write lock "dev_base_lock" only
> disable soft interrupt. So dev_get_by_name get read lock
> "dev_base_lock", can not called on interrupt context.


dev_get_by_name() doesn't read lock dev_base_lock
since commit 72c9528bab94cc052

This was back to linux-2.6.33

Are you sending patches for older kernel versions per chance ?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1]core:Change a wrong explain about dev_get_by_name
  2013-03-20 15:32 ` Eric Dumazet
  2013-03-20 17:10   ` Ben Hutchings
@ 2013-03-23  1:33   ` tingwei liu
  1 sibling, 0 replies; 8+ messages in thread
From: tingwei liu @ 2013-03-23  1:33 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: netdev, Alexey Kuznetsov, davem

On Wed, Mar 20, 2013 at 11:32 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Wed, 2013-03-20 at 17:33 +0800, tingwei liu wrote:
>> From 5d787e8c3725efa6af3036eeb52aba1905c70de9 Mon Sep 17 00:00:00 2001
>> From: root <root@linux-19.site>
>> Date: Wed, 20 Mar 2013 17:39:59 +0800
>> Subject: [PATCH] Change a wrong explain about dev_get_by_name
>>
>
> No changelog ? This patch really needs a changelog.
>
How to get the lastest commit about this comment?
Thanks a lot.
> I have no idea why we should document this function being not safe in
> irq context.
>
> Most part of networking stack is non safe in hard irq context.
>
> Should we add a comment in front of all possible entry points ?
>
>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1]core:Change a wrong explain about dev_get_by_name
  2013-03-23  1:32         ` Eric Dumazet
@ 2013-03-24  7:07           ` tingwei liu
  0 siblings, 0 replies; 8+ messages in thread
From: tingwei liu @ 2013-03-24  7:07 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Ben Hutchings, netdev, Alexey Kuznetsov, davem

On Sat, Mar 23, 2013 at 9:32 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Sat, 2013-03-23 at 09:24 +0800, tingwei liu wrote:
>> On Thu, Mar 21, 2013 at 1:43 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>> > On Wed, 2013-03-20 at 17:10 +0000, Ben Hutchings wrote:
>> >
>> >> If they are wrongly documented as 'can be called from any context', yes.
>> >
>> > Wow, thats really useful.
>> >
>> > Why is this function not allowed from hard irq context, we have no idea.
>> When function "list_netdevice" get write lock "dev_base_lock" only
>> disable soft interrupt. So dev_get_by_name get read lock
>> "dev_base_lock", can not called on interrupt context.
>
>
> dev_get_by_name() doesn't read lock dev_base_lock
> since commit 72c9528bab94cc052
>
> This was back to linux-2.6.33
>
> Are you sending patches for older kernel versions per chance ?
No. I only sending patch for lastest kernel. I don't know which kernel
should be patched.
Thanks.
>
>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-03-24  7:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-20  9:33 [PATCH 1/1]core:Change a wrong explain about dev_get_by_name tingwei liu
2013-03-20 15:32 ` Eric Dumazet
2013-03-20 17:10   ` Ben Hutchings
2013-03-20 17:43     ` Eric Dumazet
2013-03-23  1:24       ` tingwei liu
2013-03-23  1:32         ` Eric Dumazet
2013-03-24  7:07           ` tingwei liu
2013-03-23  1:33   ` tingwei liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox