public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: markus@trippelsdorf.de, john stultz <johnstul@us.ibm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <bp@amd64.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"hpa@linux.intel.com" <hpa@linux.intel.com>,
	Ingo Molnar <mingo@elte.hu>,
	Andreas Herrmann <andreas.herrmann3@amd.com>,
	avi@redhat.com, mtosatti@redhat.com
Subject: Re: [bisected] Clocksource tsc unstable git
Date: Tue, 09 Nov 2010 14:33:56 +0100	[thread overview]
Message-ID: <1289309637.2191.42.camel@laptop> (raw)
In-Reply-To: <20101109125842.GA8636@osiris.boeblingen.de.ibm.com>

On Tue, 2010-11-09 at 13:58 +0100, Heiko Carstens wrote:
> Does that make any sense or did I miss something obvious?

I'd write it as a PREEMPT_ACTIVE check, but yes I think you're right.

That said, I also have the below patch queued which should fix up the
wakeup-preemption.


---
Subject: sched: Fixup cross sched_class wakeup preemption
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
Date: Sun Oct 31 12:37:04 CET 2010

Instead of dealing with sched classes inside each check_preempt_curr()
implementation, pull out this logic into the generic wakeup preemption
path.

This fixes a hang in KVM (and others) where we are waiting for the
stop machine thread to run..

Tested-by: Marcelo Tosatti <mtosatti@redhat.com>
Tested-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1288891946.2039.31.camel@laptop>
---
 kernel/sched.c          |   38 +++++++++++++++++++++++++++-----------
 kernel/sched_fair.c     |    6 ------
 kernel/sched_stoptask.c |    2 +-
 3 files changed, 28 insertions(+), 18 deletions(-)

Index: linux-2.6/kernel/sched.c
===================================================================
--- linux-2.6.orig/kernel/sched.c
+++ linux-2.6/kernel/sched.c
@@ -560,18 +560,8 @@ struct rq {
 
 static DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues);
 
-static inline
-void check_preempt_curr(struct rq *rq, struct task_struct *p, int flags)
-{
-	rq->curr->sched_class->check_preempt_curr(rq, p, flags);
 
-	/*
-	 * A queue event has occurred, and we're going to schedule.  In
-	 * this case, we can save a useless back to back clock update.
-	 */
-	if (test_tsk_need_resched(p))
-		rq->skip_clock_update = 1;
-}
+static void check_preempt_curr(struct rq *rq, struct task_struct *p, int flags);
 
 static inline int cpu_of(struct rq *rq)
 {
@@ -9402,4 +9392,30 @@ void synchronize_sched_expedited(void)
 }
 EXPORT_SYMBOL_GPL(synchronize_sched_expedited);
 
+static void check_preempt_curr(struct rq *rq, struct task_struct *p, int flags)
+{
+	const struct sched_class *class;
+
+	if (p->sched_class == rq->curr->sched_class) {
+		rq->curr->sched_class->check_preempt_curr(rq, p, flags);
+	} else {
+		for_each_class(class) {
+			if (class == rq->curr->sched_class)
+				break;
+			if (class == p->sched_class) {
+				resched_task(rq->curr);
+				break;
+			}
+		}
+	}
+
+	/*
+	 * A queue event has occurred, and we're going to schedule.  In
+	 * this case, we can save a useless back to back clock update.
+	 */
+	if (test_tsk_need_resched(rq->curr))
+		rq->skip_clock_update = 1;
+}
+
+
 #endif /* #else #ifndef CONFIG_SMP */
Index: linux-2.6/kernel/sched_fair.c
===================================================================
--- linux-2.6.orig/kernel/sched_fair.c
+++ linux-2.6/kernel/sched_fair.c
@@ -1654,12 +1654,6 @@ static void check_preempt_wakeup(struct 
 	struct cfs_rq *cfs_rq = task_cfs_rq(curr);
 	int scale = cfs_rq->nr_running >= sched_nr_latency;
 
-	if (unlikely(rt_prio(p->prio)))
-		goto preempt;
-
-	if (unlikely(p->sched_class != &fair_sched_class))
-		return;
-
 	if (unlikely(se == pse))
 		return;
 
Index: linux-2.6/kernel/sched_stoptask.c
===================================================================
--- linux-2.6.orig/kernel/sched_stoptask.c
+++ linux-2.6/kernel/sched_stoptask.c
@@ -19,7 +19,7 @@ select_task_rq_stop(struct rq *rq, struc
 static void
 check_preempt_curr_stop(struct rq *rq, struct task_struct *p, int flags)
 {
-	resched_task(rq->curr); /* we preempt everything */
+	/* we're never preempted */
 }
 
 static struct task_struct *pick_next_task_stop(struct rq *rq)


  parent reply	other threads:[~2010-11-09 13:34 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-26 11:20 Clocksource tsc unstable (delta = -8589361717 ns) in current git Markus Trippelsdorf
2010-10-26 13:18 ` Borislav Petkov
2010-10-26 13:58   ` Markus Trippelsdorf
2010-10-26 14:05     ` Markus Trippelsdorf
2010-10-26 14:38     ` Peter Zijlstra
2010-10-26 15:46       ` Thomas Gleixner
2010-10-26 16:41         ` Borislav Petkov
2010-10-26 15:48     ` Thomas Gleixner
2010-10-26 17:56       ` Markus Trippelsdorf
2010-10-26 18:19         ` Borislav Petkov
2010-10-26 19:18       ` john stultz
2010-10-27 14:26         ` Markus Trippelsdorf
2010-10-27 18:26           ` [bisected] Clocksource tsc unstable git markus
2010-10-27 19:36             ` Peter Zijlstra
2010-10-27 19:42               ` Markus Trippelsdorf
2010-10-27 19:58               ` Marcelo Tosatti
2010-11-09 12:58               ` Heiko Carstens
2010-11-09 13:07                 ` Markus Trippelsdorf
2010-11-09 13:21                 ` Markus Trippelsdorf
2010-11-09 13:28                   ` Heiko Carstens
2010-11-09 13:45                   ` Peter Zijlstra
2010-11-09 13:33                 ` Peter Zijlstra [this message]
2010-10-29  8:18             ` Borislav Petkov
2010-10-29  8:30               ` Markus Trippelsdorf
2010-10-29 10:27                 ` Borislav Petkov
2010-10-29 11:34                   ` Markus Trippelsdorf
2010-10-29 11:39                     ` Borislav Petkov
2010-10-29 11:54                       ` Markus Trippelsdorf
2010-10-29 13:13                         ` Borislav Petkov
2010-10-29 12:14                   ` Thomas Gleixner
2010-10-29 17:00                     ` Borislav Petkov
2010-10-29 17:26                       ` Markus Trippelsdorf
2010-11-01 18:05                         ` Thomas Gleixner
2010-11-01 18:45                           ` Markus Trippelsdorf
2010-11-02 15:26                             ` Thomas Gleixner
2010-11-05 16:09                               ` Borislav Petkov
2010-11-05 16:42                                 ` Markus Trippelsdorf
2010-11-05 17:45                                   ` Markus Trippelsdorf
2010-11-05 21:27                                   ` Markus Trippelsdorf
2010-11-05 21:32                                     ` Borislav Petkov
2010-11-09 14:02                                       ` Thomas Gleixner
2010-11-09 14:39                                         ` Borislav Petkov
2010-11-17 23:21                                           ` Markus Trippelsdorf
2010-11-24 11:25                                             ` Borislav Petkov
2010-10-29 17:34                       ` Thomas Gleixner
2010-10-27  3:24     ` Clocksource tsc unstable (delta = -8589361717 ns) in current git Mike Galbraith

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=1289309637.2191.42.camel@laptop \
    --to=a.p.zijlstra@chello.nl \
    --cc=andreas.herrmann3@amd.com \
    --cc=avi@redhat.com \
    --cc=bp@amd64.org \
    --cc=heiko.carstens@de.ibm.com \
    --cc=hpa@linux.intel.com \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markus@trippelsdorf.de \
    --cc=mingo@elte.hu \
    --cc=mtosatti@redhat.com \
    --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