From: Eric Dumazet <eric.dumazet@gmail.com>
To: igorm@etf.rs
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 1/1] netstamp_needed shouldn't be jump_label_key
Date: Tue, 29 Nov 2011 10:31:33 +0100 [thread overview]
Message-ID: <1322559093.2970.102.camel@edumazet-laptop> (raw)
In-Reply-To: <fba9911084786bf04747c0350e774615.squirrel@kondor.etf.bg.ac.rs>
Le mardi 29 novembre 2011 à 10:03 +0100, "Igor Maravić" a écrit :
> >
> > Could you test following patch ?
> >
>
> I've just put it to compile. I'l let you know soon as it finishes compiling.
>
> I have one proposition for your patch. To put WARN_ON before in ifdef endif,
> because we don't needed if we don't have HAVE_JUMP_LABEL, and also to check it
> before using jump_label_dec.
>
> Also I have few questions :)
>
> First - why can't we use spin_lock on jump_label?
>
> I know that You said that is because we are using mutex_lock in
> arch_jump_label_transform() or text_poke_smp(), but I don't see why couldn't
> we use mutex_lock inside spin_lock.
>
Try it, you'll see how bad it is.
> To me using spin_lock_irqsave and spin_lock_irqrestore does sound like as most logical solution.
> With that lock, we would be sure that our mutex_lock in arch_jump_label_transform() or text_poke_smp()
> isn't going to be interrupted.
> Please correct if I'm wrong.
>
> Also I saw that you put calling of net_enable_timestamp outside of spin_lock_bh
> Why?
>
Because its the same problem. We want to be allowed to sleep.
> BR
> Igor
>
> [PATCH 1/1] jump_label warning if_interrupt
>
> Move warning on the top of function net_enable_timestamp,
> so we would be also warn if we are going to jump_label_dec in interrupt
>
> Signed-off-by: Igor Maravic <igorm@etf.rs>
>
> :100644 100644 45eab03... ef23cf7... M net/core/dev.c
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 45eab03..ef23cf7 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -1453,6 +1453,7 @@ void net_enable_timestamp(void)
> {
> #ifdef HAVE_JUMP_LABEL
> int deferred = atomic_xchg(&netstamp_needed_deferred, 0);
> + WARN_ON(in_interrupt());
>
> if (deferred) {
> while (--deferred)
> @@ -1460,7 +1461,6 @@ void net_enable_timestamp(void)
> return;
> }
> #endif
> - WARN_ON(in_interrupt());
> jump_label_inc(&netstamp_needed);
> }
> EXPORT_SYMBOL(net_enable_timestamp);
Its better to have coverage of the test, even on machines with no
HAVE_JUMP_LABEL.
So move the test before the
#ifdef HAVE_JUMP_LABEL
next prev parent reply other threads:[~2011-11-29 9:31 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 ` [PATCH 1/1] netstamp_needed shouldn't be jump_label_key igorm
2011-11-28 20:33 ` 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 [this message]
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=1322559093.2970.102.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=igorm@etf.rs \
--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