From: Frederic Weisbecker <fweisbec@gmail.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Dave Jones <davej@redhat.com>,
Paul McKenney <paulmck@linux.vnet.ibm.com>,
Linux Kernel <linux-kernel@vger.kernel.org>,
Richard Guy Briggs <rgb@redhat.com>,
Eric Paris <eparis@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Oleg Nesterov <oleg@redhat.com>
Subject: Re: audit: rcu_read_lock() used illegally while idle
Date: Wed, 3 Dec 2014 23:08:37 +0100 [thread overview]
Message-ID: <20141203220836.GC31369@lerouge> (raw)
In-Reply-To: <CALCETrVtKcwWsN4q7kp-K7kEfQyebKfSbBQy4iAhfP0WPVZNpQ@mail.gmail.com>
On Wed, Dec 03, 2014 at 12:38:36PM -0800, Andy Lutomirski wrote:
> On Wed, Dec 3, 2014 at 12:19 PM, Dave Jones <davej@redhat.com> wrote:
> > On Wed, Dec 03, 2014 at 12:06:56PM -0800, Andy Lutomirski wrote:
> >
> > > >> Did something in RCU change recently ?
> > > >
> > > > Not since -rc1, as far as I know, anyway.
> > >
> > > I have patches to delete this whole fscking sysret fast but not really
> > > fast path. I'll resend them for 3.19. In the mean time, can you test
> > > this patch by itself:
> > >
> > > https://git.kernel.org/cgit/linux/kernel/git/luto/linux.git/commit/?h=x86/entry&id=1072a16a8d4ad1b11b8062f76e3236b9771b0fb6
> >
> > With that applied, I no longer see the trace.
> >
>
> Thanks.
>
> The bug is that SCHEDULE_USER in sysret_schedule is wrong. I'd
> suggest adding a warning to schedule_user that fires if context
> tracking thinks we're already in the kernel.
>
> FWIW, I think that the rest of the SCHEDULE_USER calls may be wrong,
> too. In particular, the one in int_careful looks wrong as well, so I
> don't see why my patch made a difference if I'm right.
>
> Frédéric, any ideas here? As a stopgap measure, making SCHEDULE_USER
> restore the previous state might make sense for 3.18.
I don't know. It's possible that something went wrong with the recent entry_64.S
and ptrace.c rework.
Previously we expected to set context tracking to user state from syscall_trace_exit()
and to kernel state from syscall_trace_enter(). And if anything using RCU
was called between syscall_trace_exit() and the actual return to userspace, the code
had to be wrapped between user_exit() *code* user_enter().
So it looked like this:
syscall {
//enter kernel
syscall_trace_enter() {
user_exit();
}
syscall()
syscall_trace_enter() {
user_enter();
}
while (test_thread_flag(TIF_EXIT_WORK)) {
if (need_resched()) {
schedule_user() {
user_exit();
schedule()
user_enter();
}
}
if ( need signal ) {
do_notify_resume() {
user_exit()
handle signal and stuff
user_enter()
}
}
}
}
This is suboptimal but it doesn't impact the syscall fastpath
and it's correct from cputime accounting and RCU point of views.
Now maybe the recent logic rework broke the above assumptions?
next prev parent reply other threads:[~2014-12-03 22:08 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-03 18:19 audit: rcu_read_lock() used illegally while idle Dave Jones
2014-12-03 19:29 ` Paul E. McKenney
2014-12-03 20:06 ` Andy Lutomirski
2014-12-03 20:19 ` Dave Jones
2014-12-03 20:38 ` Andy Lutomirski
2014-12-03 22:08 ` Frederic Weisbecker [this message]
2014-12-03 22:12 ` Andy Lutomirski
2014-12-03 23:49 ` Frederic Weisbecker
2014-12-03 23:18 ` [PATCH] context_tracking: Restore previous state in schedule_user Andy Lutomirski
2014-12-03 23:26 ` Andy Lutomirski
2014-12-03 23:31 ` Dave Jones
2014-12-03 23:58 ` Frederic Weisbecker
2014-12-04 0:04 ` Andy Lutomirski
2014-12-04 0:30 ` Dave Jones
2014-12-04 0:38 ` Andy Lutomirski
2014-12-04 1:13 ` Frederic Weisbecker
2014-12-03 23:37 ` [PATCH v2] " Andy Lutomirski
2014-12-03 23:50 ` Paul E. McKenney
2014-12-04 0:01 ` Frederic Weisbecker
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=20141203220836.GC31369@lerouge \
--to=fweisbec@gmail.com \
--cc=davej@redhat.com \
--cc=eparis@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=oleg@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=rgb@redhat.com \
--cc=torvalds@linux-foundation.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