From: Nicholas Mc Guire <der.herr@hofr.at>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-rt-users@vger.kernel.org,
Sami Pietikainen <Sami.Pietikainen@wapice.com>,
Jouko Haapaluoma <jouko.haapaluoma@wapice.com>,
LKML <linux-kernel@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH RT] add missing local serialization in ip_output.c
Date: Fri, 17 Jan 2014 16:33:23 +0100 [thread overview]
Message-ID: <20140117153323.GA23566@opentech.at> (raw)
In-Reply-To: <52D94891.80109@linutronix.de>
On Fri, 17 Jan 2014, Sebastian Andrzej Siewior wrote:
> On 01/17/2014 03:59 PM, Nicholas Mc Guire wrote:
> > On Fri, 17 Jan 2014, Sebastian Andrzej Siewior wrote:
> >
> >> This is what I am going to apply. It also dropped the get_cpu_light()
> >> call which was added in a patch to remove the get_cpu_var() and is now
> >> no longer required since we have the get_locked_var() thingy now.
> >>
> >
> > I do not think you can drop that - what is preventing migration now ?
>
> Nothing but I do not see the need for it.
>
> >
> > #define get_locked_var(lvar, var) \
> > (*({ \
> > local_lock(lvar); \
> > &__get_cpu_var(var); \
> > }))
> >
q> > No migrate_disable here - so how is this protected against migration ?
>
> It does not. If you get here on CPU0, you the variable from CPU0. If
> you get migrated to CPU1 you still use the variable from CPU0. If
> another task is active on CPU0 then it will be blocked until the other
> now running on CPU1 completes and releases the lock.
>
> > Note that I did send out mail on this because I believe get_locked_var
> > should actually be doing a a migrate_disable/enable but got no feedback on that
> > yet.
>
> I don't see a reason why you should not leave the CPU on which you got
> access to the variable as long as you do not do any further assumption
> regarding the CPU number. I don't see that this happens here.
>
> > So for now I think you need to retain the get_cpu_light/put_cpu_light
>
> Are you still sure?
>
yes and no - it is needed I believe but it is actually already provided.
what I overlooked is that (actually my path-diagram was wrong - so
thanks for the catch):
#define get_locked_var(lvar, var) \
(*({ \
local_lock(lvar); \
&__get_cpu_var(var); \
}))
->#define local_lock(lvar) \
do { __local_lock(&get_local_var(lvar)); } while (0)
-> # define get_local_var(var) (*({ \
migrate_disable(); \
&__get_cpu_var(var); }))
-> #define __get_cpu_var(var) (*this_cpu_ptr(&(var)))
so its fine to drop the get_cpu_light/put_cpu_light as migration is
in fact already disabled at this point. the access to the local spinlock
object here is via this_cpu_ptr so if we would allow migration I think
you would end up unlocking the wrong lock.
thx!
hofrat
next prev parent reply other threads:[~2014-01-17 15:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-29 17:11 [PATCH RT] add missing local serialization in ip_output.c Nicholas Mc Guire
2013-12-31 7:36 ` Jouko Haapaluoma
2014-01-08 7:11 ` Sami Pietikäinen
2014-01-17 14:47 ` Sebastian Andrzej Siewior
2014-01-17 14:59 ` Nicholas Mc Guire
2014-01-17 15:13 ` Sebastian Andrzej Siewior
2014-01-17 15:33 ` Nicholas Mc Guire [this message]
2014-01-17 16:32 ` Steven Rostedt
2014-01-17 19:40 ` Nicholas Mc Guire
2014-01-17 19:41 ` [PATCH RT] use local spin_locks in local_lock Nicholas Mc Guire
2014-01-31 20:24 ` Sebastian Andrzej Siewior
2014-01-17 19:44 ` [PATCH] API cleanup - use local_lock not __local_lock for soft Nicholas Mc Guire
2014-01-31 20:28 ` Sebastian Andrzej Siewior
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=20140117153323.GA23566@opentech.at \
--to=der.herr@hofr.at \
--cc=Sami.Pietikainen@wapice.com \
--cc=bigeasy@linutronix.de \
--cc=jouko.haapaluoma@wapice.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/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).