lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1290075796-2975-1-git-send-email-sonnyrao@linux.vnet.ibm.com>
Date:	Thu, 18 Nov 2010 04:23:14 -0600
From:	Sonny Rao <sonnyrao@...ux.vnet.ibm.com>
To:	linux-kernel@...r.kernel.org
Cc:	Sonny Rao <sonnyrao@...ux.vnet.ibm.com>,
	Milton Miller <miltonm@....com>, Ingo Molnar <mingo@...e.hu>,
	Peter Zijlstra <peterz@...radead.org>
Subject: [PATCH] print_cfq_rq: per_cpu(xx, 0) may not exist

Per cpu variables only exist for possible cpus.  On some architectures
and platforms, cpu 0 may not be possible, and this debug code generates
an oops.

As a variable for the boot cpu seems to be architecture dependent, replace
this aparently arbitrary choice of reference for spread of min vruntime
across run queues from that of cpu 0 to that of the first online cpu.

Signed-off-by: Milton Miller <miltonm@....com>
Signed-off-by: Sonny Rao <sonnyrao@...ux.vnet.ibm.com>
---
 kernel/sched_debug.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index 2e1b0d1..be586db 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -163,7 +163,7 @@ static void task_group_path(struct task_group *tg, char *buf, int buflen)
 void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
 {
 	s64 MIN_vruntime = -1, min_vruntime, max_vruntime = -1,
-		spread, rq0_min_vruntime, spread0;
+		spread, spread0;
 	struct rq *rq = cpu_rq(cpu);
 	struct sched_entity *last;
 	unsigned long flags;
@@ -188,7 +188,6 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
 	if (last)
 		max_vruntime = last->vruntime;
 	min_vruntime = cfs_rq->min_vruntime;
-	rq0_min_vruntime = cpu_rq(0)->cfs.min_vruntime;
 	raw_spin_unlock_irqrestore(&rq->lock, flags);
 	SEQ_printf(m, "  .%-30s: %Ld.%06ld\n", "MIN_vruntime",
 			SPLIT_NS(MIN_vruntime));
@@ -199,7 +198,8 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
 	spread = max_vruntime - MIN_vruntime;
 	SEQ_printf(m, "  .%-30s: %Ld.%06ld\n", "spread",
 			SPLIT_NS(spread));
-	spread0 = min_vruntime - rq0_min_vruntime;
+	spread0 = min_vruntime - per_cpu(runqueues,
+			cpumask_first(cpu_online_mask)).cfs.min_vruntime;
 	SEQ_printf(m, "  .%-30s: %Ld.%06ld\n", "spread0",
 			SPLIT_NS(spread0));
 	SEQ_printf(m, "  .%-30s: %ld\n", "nr_running", cfs_rq->nr_running);
-- 
1.5.6.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ