From: igorm@etf.rs
To: netdev@vger.kernel.org
Cc: eric.dumazet@gmail.com, Igor Maravic <igorm@etf.rs>
Subject: [PATCH 1/1] netstamp_needed shouldn't be jump_label_key
Date: Mon, 28 Nov 2011 21:23:16 +0100 [thread overview]
Message-ID: <1322511796-6908-2-git-send-email-igorm@etf.rs> (raw)
In-Reply-To: <1322511796-6908-1-git-send-email-igorm@etf.rs>
From: Igor Maravic <igorm@etf.rs>
Problem with setting netstamp_needed as jump_label_key is that
it inc/dec, functions net_enable_timestamp/net_disable_timestamp,
are called from interrupts.
That can cause DEADLOCK, because jump_label_{inc, dec} are using mutex locking,
that may sleep.
Signed-off-by: Igor Maravic <igorm@etf.rs>
:100644 100644 d1f1071... 4d88cac... M net/core/dev.c
diff --git a/net/core/dev.c b/net/core/dev.c
index d1f1071..4d88cac 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1442,29 +1442,29 @@ int call_netdevice_notifiers(unsigned long val, struct net_device *dev)
}
EXPORT_SYMBOL(call_netdevice_notifiers);
-static struct jump_label_key netstamp_needed __read_mostly;
+static atomic_t netstamp_needed = ATOMIC_INIT(0);
void net_enable_timestamp(void)
{
- jump_label_inc(&netstamp_needed);
+ atomic_inc(&netstamp_needed);
}
EXPORT_SYMBOL(net_enable_timestamp);
void net_disable_timestamp(void)
{
- jump_label_dec(&netstamp_needed);
+ atomic_dec(&netstamp_needed);
}
EXPORT_SYMBOL(net_disable_timestamp);
static inline void net_timestamp_set(struct sk_buff *skb)
{
skb->tstamp.tv64 = 0;
- if (static_branch(&netstamp_needed))
+ if (atomic_read(&netstamp_needed))
__net_timestamp(skb);
}
#define net_timestamp_check(COND, SKB) \
- if (static_branch(&netstamp_needed)) { \
+ if (atomic_read(&netstamp_needed)) { \
if ((COND) && !(SKB)->tstamp.tv64) \
__net_timestamp(SKB); \
} \
--
1.7.5.4
next prev parent reply other threads:[~2011-11-28 20:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-28 20:23 [PATCH 0/1] jump_label logic fixing in dev.c igorm
2011-11-28 20:23 ` igorm [this message]
2011-11-28 20:33 ` [PATCH 1/1] netstamp_needed shouldn't be jump_label_key Eric Dumazet
2011-11-28 21:16 ` Eric Dumazet
2011-11-28 21:31 ` Stephen Hemminger
2011-11-28 21:45 ` Eric Dumazet
2011-11-28 22:23 ` Eric Dumazet
2011-11-29 6:22 ` David Miller
2011-11-29 9:03 ` "Igor Maravić"
2011-11-29 9:31 ` Eric Dumazet
2011-11-29 9:48 ` "Igor Maravić"
2011-11-29 10:27 ` Eric Dumazet
2011-11-29 10:32 ` Igor Maravić
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=1322511796-6908-2-git-send-email-igorm@etf.rs \
--to=igorm@etf.rs \
--cc=eric.dumazet@gmail.com \
--cc=netdev@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 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).