All of lore.kernel.org
 help / color / mirror / Atom feed
From: David VomLehn <dvomlehn@gmail.com>
To: "linux-rt-users@vger.kernel.org" <linux-rt-users@vger.kernel.org>
Subject: Scheduling while atomic in find_task_lock_mm
Date: Wed, 22 Jul 2015 11:39:55 -0700	[thread overview]
Message-ID: <20150722183955.GA3188@Gracie> (raw)

I'm trying to port the RT patch to Android (based on Linux 3.10) and things have been
going pretty smoothly. However, I've hit a snag--I have to have hot plugging enabled
and when the system tries to take down a CPU, it gets "scheduling while atomic". At
a high level, the code to take the CPU down is trying to clear the CPU's bit in the
mm_struct associated with every task_struct.

In more detail, cpu_stopper_thread() disables preemption, then there is a sequence
of calls, passing through the ARM-specific __cpu_disable(), finally atrriving at
find_lock_task_mm(). That function calls task_lock(), which uses spin_lock() to
lock a task_struct. When it encounters a task_struct that is already locked, schedule()
gets called and Bad Things happen.

So:
o	I don't think I can enable preemption here because it's pretty like another
	task will swoop in and mess things up.

o	Using a raw_spin_lock() just for ARM doesn't seem like a good choice.

o	I *think* I do need the spin_lock() before changing the CPU's bit in the
	cpu_vm_mask_var element of the mm_struct.

                 reply	other threads:[~2015-07-22 18:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20150722183955.GA3188@Gracie \
    --to=dvomlehn@gmail.com \
    --cc=linux-rt-users@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.