rpms/kernel/F-12 perf-events-dont-generate-events-for-the-idle-task.patch, NONE, 1.1 perf-events-fix-swevent-hrtimer-sampling.patch, NONE, 1.1 Makefile, 1.111, 1.112 config-x86_64-generic, 1.92, 1.93 kernel.spec, 1.1881, 1.1882

Kyle McMartin kyle at fedoraproject.org
Fri Oct 23 22:58:26 UTC 2009


Author: kyle

Update of /cvs/pkgs/rpms/kernel/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv25225

Modified Files:
	Makefile config-x86_64-generic kernel.spec 
Added Files:
	perf-events-dont-generate-events-for-the-idle-task.patch 
	perf-events-fix-swevent-hrtimer-sampling.patch 
Log Message:
* Fri Oct 23 2009 Kyle McMartin <kyle at redhat.com> 2.6.31.5-96
- Bump NR_CPUS to 256 on x86_64.
- Add two backports (ugh, just had to go renaming perf counters to events...)
  for fixing sysprof with perf.


perf-events-dont-generate-events-for-the-idle-task.patch:
 perf_counter.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- NEW FILE perf-events-dont-generate-events-for-the-idle-task.patch ---
From: Soeren Sandmann <sandmann at daimi.au.dk>
Date: Thu, 22 Oct 2009 16:34:08 +0000 (+0200)
Subject: perf events: Don't generate events for the idle task when exclude_idle is set
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftip%2Flinux-2.6-tip.git;a=commitdiff_plain;h=54f4407608c59712a8f5ec1e10dfac40bef5a2e7

perf events: Don't generate events for the idle task when exclude_idle is set

Getting samples for the idle task is often not interesting, so
don't generate them when exclude_idle is set for the event in
question.

Signed-off-by: Søren Sandmann Pedersen <sandmann at redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra at chello.nl>
Cc: Mike Galbraith <efault at gmx.de>
Cc: Paul Mackerras <paulus at samba.org>
Cc: Arnaldo Carvalho de Melo <acme at redhat.com>
Cc: Frederic Weisbecker <fweisbec at gmail.com>
Cc: Steven Rostedt <rostedt at goodmis.org>
LKML-Reference: <ye8pr8fmlq7.fsf at camel16.daimi.au.dk>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 6017671..f8ad53a 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -3788,8 +3788,9 @@ static enum hrtimer_restart perf_swcounter_hrtimer(struct hrtimer *hrtimer)
 		data.regs = task_pt_regs(current);
 
 	if (data.regs) {
-		if (perf_counter_overflow(counter, 0, &data))
-			ret = HRTIMER_NORESTART;
+		if (!(counter->attr.exclude_idle && current->pid == 0))
+			if (perf_counter_overflow(counter, 0, &data))
+				ret = HRTIMER_NORESTART;
 	}
 
 	period = max_t(u64, 10000, counter->hw.sample_period);

perf-events-fix-swevent-hrtimer-sampling.patch:
 include/linux/perf_counter.h |    4 +-
 kernel/perf_counter.c        |   61 ++++++++++++++++++++++++++++---------------
 2 files changed, 43 insertions(+), 22 deletions(-)

--- NEW FILE perf-events-fix-swevent-hrtimer-sampling.patch ---
From: Soeren Sandmann <sandmann at daimi.au.dk>
Date: Tue, 15 Sep 2009 12:33:08 +0000 (+0200)
Subject: perf events: Fix swevent hrtimer sampling by keeping track of remaining time when... 
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftip%2Flinux-2.6-tip.git;a=commitdiff_plain;h=721a669b7225edeeb0ca8e2bf71b83882326a71b

perf events: Fix swevent hrtimer sampling by keeping track of remaining time when enabling/disabling swevent hrtimers

Make the hrtimer based events work for sysprof.

Whenever a swevent is scheduled out, the hrtimer is canceled.
When it is scheduled back in, the timer is restarted. This
happens every scheduler tick, which means the timer never
expired because it was getting repeatedly restarted over and
over with the same period.

To fix that, save the remaining time when disabling; when
reenabling, use that saved time as the period instead of the
user-specified sampling period.

Also, move the starting and stopping of the hrtimers to helper
functions instead of duplicating the code.

Signed-off-by: Søren Sandmann Pedersen <sandmann at redhat.com>
LKML-Reference: <ye8vdi7mluz.fsf at camel16.daimi.au.dk>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index b53f700..c32e411 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -460,8 +460,8 @@ struct hw_perf_counter {
 			unsigned long	counter_base;
 			int		idx;
 		};
-		union { /* software */
-			atomic64_t	count;
+		struct { /* software */
+			s64		remaining;
 			struct hrtimer	hrtimer;
 		};
 	};
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index b1dc468..6017671 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -3798,6 +3798,42 @@ static enum hrtimer_restart perf_swcounter_hrtimer(struct hrtimer *hrtimer)
 	return ret;
 }
 
+static void perf_swcounter_start_hrtimer(struct perf_counter *counter)
+{
+	struct hw_perf_counter *hwc = &counter->hw;
+
+	hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+	hwc->hrtimer.function = perf_swcounter_hrtimer;
+	if (hwc->sample_period) {
+		u64 period;
+
+		if (hwc->remaining) {
+			if (hwc->remaining < 0)
+				period = 10000;
+			else
+				period = hwc->remaining;
+			hwc->remaining = 0;
+		} else {
+			period = max_t(u64, 10000, hwc->sample_period);
+		}
+		__hrtimer_start_range_ns(&hwc->hrtimer, ns_to_ktime(period),
+				0, HRTIMER_MODE_REL, 0);
+	}
+}
+
+static void perf_swcounter_cancel_hrtimer(struct perf_counter *counter)
+{
+	struct hw_perf_counter *hwc = &counter->hw;
+
+	if (hwc->sample_period) {
+		ktime_t remaining = hrtimer_get_remaining(&hwc->hrtimer);
+		hwc->remaining = ktime_to_ns(remaining);
+
+		hrtimer_cancel(&hwc->hrtimer);
+	}
+}
+
+
 /*
  * Software counter: cpu wall time clock
  */
@@ -3820,22 +3856,14 @@ static int cpu_clock_perf_counter_enable(struct perf_counter *counter)
 	int cpu = raw_smp_processor_id();
 
 	atomic64_set(&hwc->prev_count, cpu_clock(cpu));
-	hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	hwc->hrtimer.function = perf_swcounter_hrtimer;
-	if (hwc->sample_period) {
-		u64 period = max_t(u64, 10000, hwc->sample_period);
-		__hrtimer_start_range_ns(&hwc->hrtimer,
-				ns_to_ktime(period), 0,
-				HRTIMER_MODE_REL, 0);
-	}
+	perf_swcounter_start_hrtimer(counter);
 
 	return 0;
 }
 
 static void cpu_clock_perf_counter_disable(struct perf_counter *counter)
 {
-	if (counter->hw.sample_period)
-		hrtimer_cancel(&counter->hw.hrtimer);
+	perf_swcounter_cancel_hrtimer(counter);
 	cpu_clock_perf_counter_update(counter);
 }
 
@@ -3872,22 +3900,15 @@ static int task_clock_perf_counter_enable(struct perf_counter *counter)
 	now = counter->ctx->time;
 
 	atomic64_set(&hwc->prev_count, now);
-	hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	hwc->hrtimer.function = perf_swcounter_hrtimer;
-	if (hwc->sample_period) {
-		u64 period = max_t(u64, 10000, hwc->sample_period);
-		__hrtimer_start_range_ns(&hwc->hrtimer,
-				ns_to_ktime(period), 0,
-				HRTIMER_MODE_REL, 0);
-	}
+
+	perf_swcounter_start_hrtimer(counter);
 
 	return 0;
 }
 
 static void task_clock_perf_counter_disable(struct perf_counter *counter)
 {
-	if (counter->hw.sample_period)
-		hrtimer_cancel(&counter->hw.hrtimer);
+	perf_swcounter_cancel_hrtimer(counter);
 	task_clock_perf_counter_update(counter, counter->ctx->time);
 
 }


Index: Makefile
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-12/Makefile,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -p -r1.111 -r1.112
--- Makefile	23 Oct 2009 21:29:18 -0000	1.111
+++ Makefile	23 Oct 2009 22:58:21 -0000	1.112
@@ -82,7 +82,7 @@ debug:
 	@perl -pi -e 's/CONFIG_DEBUG_PAGEALLOC=y/# CONFIG_DEBUG_PAGEALLOC is not set/' config-nodebug
 
 	@perl -pi -e 's/^%define debugbuildsenabled 1/%define debugbuildsenabled 0/' kernel.spec
-	@perl -pi -e 's/CONFIG_NR_CPUS=64/CONFIG_NR_CPUS=512/' config-x86_64-generic
+	@perl -pi -e 's/CONFIG_NR_CPUS=256/CONFIG_NR_CPUS=512/' config-x86_64-generic
 
 release:
 	@perl -pi -e 's/CONFIG_SLUB_DEBUG_ON=y/# CONFIG_SLUB_DEBUG_ON is not set/' config-nodebug
@@ -124,14 +124,14 @@ release:
 	@perl -pi -e 's/CONFIG_MMIOTRACE=y/# CONFIG_MMIOTRACE is not set/' config-nodebug
 	@perl -pi -e 's/# CONFIG_STRIP_ASM_SYMS is not set/CONFIG_STRIP_ASM_SYMS=y/' config-nodebug
 
-	@perl -pi -e 's/CONFIG_NR_CPUS=512/CONFIG_NR_CPUS=64/' config-x86_64-generic
+	@perl -pi -e 's/CONFIG_NR_CPUS=512/CONFIG_NR_CPUS=256/' config-x86_64-generic
 
 	@perl -pi -e 's/^%define debugbuildsenabled 0/%define debugbuildsenabled 1/' kernel.spec
 	@perl -pi -e 's/^%define rawhide_skip_docs 1/%define rawhide_skip_docs 0/' kernel.spec
 
 rhel:
 	@perl -pi -e 's/# CONFIG_PPC_64K_PAGES is not set/CONFIG_PPC_64K_PAGES=y/' config-powerpc64
-	@perl -pi -e 's/CONFIG_NR_CPUS=64/CONFIG_NR_CPUS=512/' config-x86_64-generic
+	@perl -pi -e 's/CONFIG_NR_CPUS=256/CONFIG_NR_CPUS=512/' config-x86_64-generic
 
 reconfig:
 	@rm -f kernel-*-config


Index: config-x86_64-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-12/config-x86_64-generic,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -p -r1.92 -r1.93
--- config-x86_64-generic	23 Oct 2009 21:08:00 -0000	1.92
+++ config-x86_64-generic	23 Oct 2009 22:58:21 -0000	1.93
@@ -16,7 +16,7 @@ CONFIG_NUMA=y
 CONFIG_K8_NUMA=y
 CONFIG_X86_64_ACPI_NUMA=y
 # CONFIG_NUMA_EMU is not set
-CONFIG_NR_CPUS=64
+CONFIG_NR_CPUS=256
 CONFIG_X86_POWERNOW_K8=m
 CONFIG_X86_POWERNOW_K8_ACPI=y
 CONFIG_X86_P4_CLOCKMOD=m 


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-12/kernel.spec,v
retrieving revision 1.1881
retrieving revision 1.1882
diff -u -p -r1.1881 -r1.1882
--- kernel.spec	23 Oct 2009 21:29:18 -0000	1.1881
+++ kernel.spec	23 Oct 2009 22:58:21 -0000	1.1882
@@ -767,6 +767,10 @@ Patch14410: keys-get_instantiation_keyri
 # Fix kernel memory leak to userspace. (CVE-2009-3612)
 Patch14411: netlink-fix-typo-in-initialization.patch
 
+# fix perf for sysprof
+Patch14420: perf-events-fix-swevent-hrtimer-sampling.patch
+Patch14421: perf-events-dont-generate-events-for-the-idle-task.patch
+
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -1434,6 +1438,10 @@ ApplyPatch keys-get_instantiation_keyrin
 # Fix kernel memory leak to userspace. (CVE-2009-3612)
 ApplyPatch netlink-fix-typo-in-initialization.patch
 
+# fix perf for sysprof
+ApplyPatch perf-events-fix-swevent-hrtimer-sampling.patch
+ApplyPatch perf-events-dont-generate-events-for-the-idle-task.patch
+
 # END OF PATCH APPLICATIONS
 
 %endif
@@ -2084,7 +2092,12 @@ fi
 # and build.
 
 %changelog
-* Fri Oct 23 2009 Dave Airlie <airlied at redhat.com. 2.6.31.5-95
+* Fri Oct 23 2009 Kyle McMartin <kyle at redhat.com> 2.6.31.5-96
+- Bump NR_CPUS to 256 on x86_64.
+- Add two backports (ugh, just had to go renaming perf counters to events...)
+  for fixing sysprof with perf.
+
+* Fri Oct 23 2009 Dave Airlie <airlied at redhat.com> 2.6.31.5-95
 - re enable MSI
 
 * Fri Oct 23 2009 Dave Airlie <airlied at redhat.com> 2.6.31.5-94




More information about the fedora-extras-commits mailing list