All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf_event: fix perf_swevent_hrtimer()
@ 2009-12-10  4:14 Xiao Guangrong
  2009-12-10  5:15 ` Peter Zijlstra
  0 siblings, 1 reply; 7+ messages in thread
From: Xiao Guangrong @ 2009-12-10  4:14 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Frederic Weisbecker, Peter Zijlstra, Paul Mackerras, LKML

fix:
 [<c0477471>] ? printk+0x1d/0x24
 [<c01c98f9>] ? perf_prepare_sample+0x269/0x280
 [<c0149231>] warn_slowpath_common+0x71/0xd0
 [<c01c98f9>] ? perf_prepare_sample+0x269/0x280
 [<c01492aa>] warn_slowpath_null+0x1a/0x20
 [<c01c98f9>] perf_prepare_sample+0x269/0x280
 [<c016e9f3>] ? cpu_clock+0x53/0x90
 [<c01cc368>] __perf_event_overflow+0x2a8/0x300
 [<c01ccc3b>] perf_event_overflow+0x1b/0x30
 [<c01ccccf>] perf_swevent_hrtimer+0x7f/0x120

This is because 'data' variable not initialize.

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
---
 kernel/perf_event.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 0bd0f67..41c2dde 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -4009,7 +4009,7 @@ static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer)
 	event	= container_of(hrtimer, struct perf_event, hw.hrtimer);
 	event->pmu->read(event);
 
-	data.addr = 0;
+	memset(&data, 0, sizeof(data));
 	data.period = event->hw.last_period;
 	regs = get_irq_regs();
 	/*
-- 
1.6.1.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] perf_event: fix perf_swevent_hrtimer()
  2009-12-10  4:14 [PATCH] perf_event: fix perf_swevent_hrtimer() Xiao Guangrong
@ 2009-12-10  5:15 ` Peter Zijlstra
  2009-12-10  5:24   ` Xiao Guangrong
                     ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Peter Zijlstra @ 2009-12-10  5:15 UTC (permalink / raw)
  To: Xiao Guangrong; +Cc: Ingo Molnar, Frederic Weisbecker, Paul Mackerras, LKML

On Thu, 2009-12-10 at 12:14 +0800, Xiao Guangrong wrote:
> fix:
>  [<c0477471>] ? printk+0x1d/0x24
>  [<c01c98f9>] ? perf_prepare_sample+0x269/0x280
>  [<c0149231>] warn_slowpath_common+0x71/0xd0
>  [<c01c98f9>] ? perf_prepare_sample+0x269/0x280
>  [<c01492aa>] warn_slowpath_null+0x1a/0x20
>  [<c01c98f9>] perf_prepare_sample+0x269/0x280
>  [<c016e9f3>] ? cpu_clock+0x53/0x90
>  [<c01cc368>] __perf_event_overflow+0x2a8/0x300
>  [<c01ccc3b>] perf_event_overflow+0x1b/0x30
>  [<c01ccccf>] perf_swevent_hrtimer+0x7f/0x120
> 
> This is because 'data' variable not initialize.

Nope, please just initialize the missing variable. Which from a quick
glance is data.raw.

> Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
> ---
>  kernel/perf_event.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/perf_event.c b/kernel/perf_event.c
> index 0bd0f67..41c2dde 100644
> --- a/kernel/perf_event.c
> +++ b/kernel/perf_event.c
> @@ -4009,7 +4009,7 @@ static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer)
>  	event	= container_of(hrtimer, struct perf_event, hw.hrtimer);
>  	event->pmu->read(event);
>  
> -	data.addr = 0;
> +	memset(&data, 0, sizeof(data));
>  	data.period = event->hw.last_period;
>  	regs = get_irq_regs();
>  	/*


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] perf_event: fix perf_swevent_hrtimer()
  2009-12-10  5:15 ` Peter Zijlstra
@ 2009-12-10  5:24   ` Xiao Guangrong
  2009-12-10  6:00   ` [PATCH v2] " Xiao Guangrong
  2009-12-10  9:08   ` [PATCH] perf_event: fix variable initialization in other path Xiao Guangrong
  2 siblings, 0 replies; 7+ messages in thread
From: Xiao Guangrong @ 2009-12-10  5:24 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Ingo Molnar, Frederic Weisbecker, Paul Mackerras, LKML



Peter Zijlstra wrote:
> On Thu, 2009-12-10 at 12:14 +0800, Xiao Guangrong wrote:
>> fix:
>>  [<c0477471>] ? printk+0x1d/0x24
>>  [<c01c98f9>] ? perf_prepare_sample+0x269/0x280
>>  [<c0149231>] warn_slowpath_common+0x71/0xd0
>>  [<c01c98f9>] ? perf_prepare_sample+0x269/0x280
>>  [<c01492aa>] warn_slowpath_null+0x1a/0x20
>>  [<c01c98f9>] perf_prepare_sample+0x269/0x280
>>  [<c016e9f3>] ? cpu_clock+0x53/0x90
>>  [<c01cc368>] __perf_event_overflow+0x2a8/0x300
>>  [<c01ccc3b>] perf_event_overflow+0x1b/0x30
>>  [<c01ccccf>] perf_swevent_hrtimer+0x7f/0x120
>>
>> This is because 'data' variable not initialize.
> 
> Nope, please just initialize the missing variable. 

Ah, my mistake, I'll resend it.

Thanks,
Xiao


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] perf_event: fix perf_swevent_hrtimer()
  2009-12-10  5:15 ` Peter Zijlstra
  2009-12-10  5:24   ` Xiao Guangrong
@ 2009-12-10  6:00   ` Xiao Guangrong
  2009-12-10  6:18     ` [tip:perf/urgent] perf_event: Fix perf_swevent_hrtimer() variable initialization tip-bot for Xiao Guangrong
  2009-12-10  9:08   ` [PATCH] perf_event: fix variable initialization in other path Xiao Guangrong
  2 siblings, 1 reply; 7+ messages in thread
From: Xiao Guangrong @ 2009-12-10  6:00 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Ingo Molnar, Frederic Weisbecker, Paul Mackerras, LKML

fix:
 [<c0477471>] ? printk+0x1d/0x24
 [<c01c98f9>] ? perf_prepare_sample+0x269/0x280
 [<c0149231>] warn_slowpath_common+0x71/0xd0
 [<c01c98f9>] ? perf_prepare_sample+0x269/0x280
 [<c01492aa>] warn_slowpath_null+0x1a/0x20
 [<c01c98f9>] perf_prepare_sample+0x269/0x280
 [<c016e9f3>] ? cpu_clock+0x53/0x90
 [<c01cc368>] __perf_event_overflow+0x2a8/0x300
 [<c01ccc3b>] perf_event_overflow+0x1b/0x30
 [<c01ccccf>] perf_swevent_hrtimer+0x7f/0x120

This is because 'data.raw' variable not initialize.

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
---
 kernel/perf_event.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 0bd0f67..e63ba9a 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -4010,6 +4010,7 @@ static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer)
 	event->pmu->read(event);
 
 	data.addr = 0;
+	data.raw = NULL;
 	data.period = event->hw.last_period;
 	regs = get_irq_regs();
 	/*
-- 
1.6.1.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [tip:perf/urgent] perf_event: Fix perf_swevent_hrtimer() variable initialization
  2009-12-10  6:00   ` [PATCH v2] " Xiao Guangrong
@ 2009-12-10  6:18     ` tip-bot for Xiao Guangrong
  0 siblings, 0 replies; 7+ messages in thread
From: tip-bot for Xiao Guangrong @ 2009-12-10  6:18 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, peterz, xiaoguangrong, fweisbec,
	tglx, mingo

Commit-ID:  21140f4d3387aa2213f1deea0128df1dbf924379
Gitweb:     http://git.kernel.org/tip/21140f4d3387aa2213f1deea0128df1dbf924379
Author:     Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
AuthorDate: Thu, 10 Dec 2009 14:00:51 +0800
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 10 Dec 2009 07:11:05 +0100

perf_event: Fix perf_swevent_hrtimer() variable initialization

fix:

 [<c0477471>] ? printk+0x1d/0x24
 [<c01c98f9>] ? perf_prepare_sample+0x269/0x280
 [<c0149231>] warn_slowpath_common+0x71/0xd0
 [<c01c98f9>] ? perf_prepare_sample+0x269/0x280
 [<c01492aa>] warn_slowpath_null+0x1a/0x20
 [<c01c98f9>] perf_prepare_sample+0x269/0x280
 [<c016e9f3>] ? cpu_clock+0x53/0x90
 [<c01cc368>] __perf_event_overflow+0x2a8/0x300
 [<c01ccc3b>] perf_event_overflow+0x1b/0x30
 [<c01ccccf>] perf_swevent_hrtimer+0x7f/0x120

This is because 'data.raw' variable not initialize.

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <4B208E93.1010801@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/perf_event.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 94e1b28..3a5d6c4 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -4010,6 +4010,7 @@ static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer)
 	event->pmu->read(event);
 
 	data.addr = 0;
+	data.raw = NULL;
 	data.period = event->hw.last_period;
 	regs = get_irq_regs();
 	/*

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH] perf_event: fix variable initialization in other path
  2009-12-10  5:15 ` Peter Zijlstra
  2009-12-10  5:24   ` Xiao Guangrong
  2009-12-10  6:00   ` [PATCH v2] " Xiao Guangrong
@ 2009-12-10  9:08   ` Xiao Guangrong
  2009-12-10 16:24     ` [tip:perf/urgent] perf_event: Fix variable initialization in other codepaths tip-bot for Xiao Guangrong
  2 siblings, 1 reply; 7+ messages in thread
From: Xiao Guangrong @ 2009-12-10  9:08 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Peter Zijlstra, Frederic Weisbecker, Paul Mackerras, LKML

fix variable initialization in other path
[Commit-ID:  21140f4d3387aa2213f1deea0128df1dbf924379 is not clean]

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
---
 arch/x86/kernel/cpu/perf_event.c |    4 ++++
 kernel/perf_event.c              |    1 +
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index d35f260..1342f23 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -1632,6 +1632,7 @@ static void intel_pmu_drain_bts_buffer(struct cpu_hw_events *cpuc)
 
 	data.period	= event->hw.last_period;
 	data.addr	= 0;
+	data.raw	= NULL;
 	regs.ip		= 0;
 
 	/*
@@ -1749,6 +1750,7 @@ static int p6_pmu_handle_irq(struct pt_regs *regs)
 	u64 val;
 
 	data.addr = 0;
+	data.raw = NULL;
 
 	cpuc = &__get_cpu_var(cpu_hw_events);
 
@@ -1794,6 +1796,7 @@ static int intel_pmu_handle_irq(struct pt_regs *regs)
 	u64 ack, status;
 
 	data.addr = 0;
+	data.raw = NULL;
 
 	cpuc = &__get_cpu_var(cpu_hw_events);
 
@@ -1857,6 +1860,7 @@ static int amd_pmu_handle_irq(struct pt_regs *regs)
 	u64 val;
 
 	data.addr = 0;
+	data.raw = NULL;
 
 	cpuc = &__get_cpu_var(cpu_hw_events);
 
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 41c2dde..6e2888d 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -4299,6 +4299,7 @@ void perf_bp_event(struct perf_event *bp, void *data)
 	struct perf_sample_data sample;
 	struct pt_regs *regs = data;
 
+	sample.raw = NULL;
 	sample.addr = bp->attr.bp_addr;
 
 	if (!perf_exclude_event(bp, regs))
-- 
1.6.1.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [tip:perf/urgent] perf_event: Fix variable initialization in other codepaths
  2009-12-10  9:08   ` [PATCH] perf_event: fix variable initialization in other path Xiao Guangrong
@ 2009-12-10 16:24     ` tip-bot for Xiao Guangrong
  0 siblings, 0 replies; 7+ messages in thread
From: tip-bot for Xiao Guangrong @ 2009-12-10 16:24 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, peterz, xiaoguangrong, fweisbec,
	tglx, mingo

Commit-ID:  5e855db5d8fec44e6604eb245aa9077bbd3f0d05
Gitweb:     http://git.kernel.org/tip/5e855db5d8fec44e6604eb245aa9077bbd3f0d05
Author:     Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
AuthorDate: Thu, 10 Dec 2009 17:08:54 +0800
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 10 Dec 2009 17:23:02 +0100

perf_event: Fix variable initialization in other codepaths

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <4B20BAA6.7010609@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event.c |    4 ++++
 kernel/perf_event.c              |    1 +
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index d35f260..1342f23 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -1632,6 +1632,7 @@ static void intel_pmu_drain_bts_buffer(struct cpu_hw_events *cpuc)
 
 	data.period	= event->hw.last_period;
 	data.addr	= 0;
+	data.raw	= NULL;
 	regs.ip		= 0;
 
 	/*
@@ -1749,6 +1750,7 @@ static int p6_pmu_handle_irq(struct pt_regs *regs)
 	u64 val;
 
 	data.addr = 0;
+	data.raw = NULL;
 
 	cpuc = &__get_cpu_var(cpu_hw_events);
 
@@ -1794,6 +1796,7 @@ static int intel_pmu_handle_irq(struct pt_regs *regs)
 	u64 ack, status;
 
 	data.addr = 0;
+	data.raw = NULL;
 
 	cpuc = &__get_cpu_var(cpu_hw_events);
 
@@ -1857,6 +1860,7 @@ static int amd_pmu_handle_irq(struct pt_regs *regs)
 	u64 val;
 
 	data.addr = 0;
+	data.raw = NULL;
 
 	cpuc = &__get_cpu_var(cpu_hw_events);
 
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 3a5d6c4..d891ec4 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -4300,6 +4300,7 @@ void perf_bp_event(struct perf_event *bp, void *data)
 	struct perf_sample_data sample;
 	struct pt_regs *regs = data;
 
+	sample.raw = NULL;
 	sample.addr = bp->attr.bp_addr;
 
 	if (!perf_exclude_event(bp, regs))

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-12-10 16:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-10  4:14 [PATCH] perf_event: fix perf_swevent_hrtimer() Xiao Guangrong
2009-12-10  5:15 ` Peter Zijlstra
2009-12-10  5:24   ` Xiao Guangrong
2009-12-10  6:00   ` [PATCH v2] " Xiao Guangrong
2009-12-10  6:18     ` [tip:perf/urgent] perf_event: Fix perf_swevent_hrtimer() variable initialization tip-bot for Xiao Guangrong
2009-12-10  9:08   ` [PATCH] perf_event: fix variable initialization in other path Xiao Guangrong
2009-12-10 16:24     ` [tip:perf/urgent] perf_event: Fix variable initialization in other codepaths tip-bot for Xiao Guangrong

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.