mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: David Miller <davem@davemloft.net>
Cc: sparclinux <sparclinux@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@elte.hu>
Subject: [RFC][PATCH] sparc64: remove __ARCH_WANT_UNLOCKED_CTXSW usage
Date: Mon, 12 Dec 2011 16:14:12 +0100	[thread overview]
Message-ID: <1323702852.13285.25.camel@twins> (raw)

Hi David,

As mentioned a while ago, I was looking into why SPARC64 uses
__ARCH_WANT_UNLOCKED_CTXSW. You thought to remember some AB-BA deadlock
with the rq->lock so I went through the various sparc64 arch hooks but
came up empty.

switch_to()
  flush_tlb_pending()
    flush_tsb_user
      mm->context.lock

switch_mm()
  mm->context.lock
  get_new_mmu_context()
    ctx_alloc_lock()

I went through all sites where either mm->context.lock or ctx_alloc_lock
was used but could not find anything calling back into the scheduler --
this would have to be a wakeup because everything is ran with IRQs
disabled.

There's also activate_mm() that takes both these locks and is ran under
task_lock(), but there too I cannot see any problems with rq->lock.

This investigation has one assumption; that pure assembly functions are
'clean', ie. they don't take locks and don't go calling try_to_wake_up()
etc. This because my sparc64 asm is very much gone from memory (some 10+
years ago I could have maybe followed it).

The only thing resting me is asking you to simply test the below patch
and report what happens. Hopefully things will simply work.. if not I've
messed up and need to go look harder :/


---
 arch/sparc/include/asm/system_64.h |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/arch/sparc/include/asm/system_64.h b/arch/sparc/include/asm/system_64.h
index 10bcabc..715fefa 100644
--- a/arch/sparc/include/asm/system_64.h
+++ b/arch/sparc/include/asm/system_64.h
@@ -123,8 +123,6 @@ extern void __flushw_user(void);
 #define flush_user_windows flushw_user
 #define flush_register_windows flushw_all
 
-/* Don't hold the runqueue lock over context switch */
-#define __ARCH_WANT_UNLOCKED_CTXSW
 #define prepare_arch_switch(next)		\
 do {						\
 	flushw_all();				\


             reply	other threads:[~2011-12-12 15:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-12 15:14 Peter Zijlstra [this message]
2011-12-21 21:44 ` David Miller
2011-12-21 23:05   ` David Miller
2011-12-22 19:16     ` Peter Zijlstra
2011-12-22 19:22       ` David Miller

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=1323702852.13285.25.camel@twins \
    --to=peterz@infradead.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=sparclinux@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

all inboxes | Powered by JetHome®