linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] oprofile fixes and updates
@ 2012-08-24 18:53 Robert Richter
  2012-08-24 18:53 ` [PATCH 1/2] oprofile, s390: Fix uninitialized memory access when writing to oprofilefs Robert Richter
  2012-08-24 18:53 ` [PATCH 2/2] oprofile: Remove 'WQ on CPUx, prefer CPUy' warning Robert Richter
  0 siblings, 2 replies; 4+ messages in thread
From: Robert Richter @ 2012-08-24 18:53 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: LKML, oprofile-list, Robert Richter

2 small patches sent out for review.

-Robert

Robert Richter (2):
  oprofile, s390: Fix uninitialized memory access when writing to
    oprofilefs
  oprofile: Remove 'WQ on CPUx, prefer CPUy' warning

 arch/s390/oprofile/init.c     |   10 +++++-----
 drivers/oprofile/cpu_buffer.c |   11 +++--------
 2 files changed, 8 insertions(+), 13 deletions(-)

-- 
1.7.8.6



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

* [PATCH 1/2] oprofile, s390: Fix uninitialized memory access when writing to oprofilefs
  2012-08-24 18:53 [PATCH 0/2] oprofile fixes and updates Robert Richter
@ 2012-08-24 18:53 ` Robert Richter
  2012-08-24 18:53 ` [PATCH 2/2] oprofile: Remove 'WQ on CPUx, prefer CPUy' warning Robert Richter
  1 sibling, 0 replies; 4+ messages in thread
From: Robert Richter @ 2012-08-24 18:53 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: LKML, oprofile-list, Robert Richter, stable, #, 3.3+

If oprofilefs_ulong_from_user() is called with count equals zero, *val
remains unchanged. Depending on the implementation it might be
uninitialized. Fixing users of oprofilefs_ulong_ from_user().

We missed these s390 changes with:

 913050b oprofile: Fix uninitialized memory access when writing to writing to oprofilefs

Cc: stable@vger.kernel.org  # 3.3+
Signed-off-by: Robert Richter <robert.richter@amd.com>
---
 arch/s390/oprofile/init.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/s390/oprofile/init.c b/arch/s390/oprofile/init.c
index a1e9d69..584b936 100644
--- a/arch/s390/oprofile/init.c
+++ b/arch/s390/oprofile/init.c
@@ -169,7 +169,7 @@ static ssize_t hw_interval_write(struct file *file, char const __user *buf,
 	if (*offset)
 		return -EINVAL;
 	retval = oprofilefs_ulong_from_user(&val, buf, count);
-	if (retval)
+	if (retval <= 0)
 		return retval;
 	if (val < oprofile_min_interval)
 		oprofile_hw_interval = oprofile_min_interval;
@@ -212,7 +212,7 @@ static ssize_t hwsampler_zero_write(struct file *file, char const __user *buf,
 		return -EINVAL;
 
 	retval = oprofilefs_ulong_from_user(&val, buf, count);
-	if (retval)
+	if (retval <= 0)
 		return retval;
 	if (val != 0)
 		return -EINVAL;
@@ -243,7 +243,7 @@ static ssize_t hwsampler_kernel_write(struct file *file, char const __user *buf,
 		return -EINVAL;
 
 	retval = oprofilefs_ulong_from_user(&val, buf, count);
-	if (retval)
+	if (retval <= 0)
 		return retval;
 
 	if (val != 0 && val != 1)
@@ -278,7 +278,7 @@ static ssize_t hwsampler_user_write(struct file *file, char const __user *buf,
 		return -EINVAL;
 
 	retval = oprofilefs_ulong_from_user(&val, buf, count);
-	if (retval)
+	if (retval <= 0)
 		return retval;
 
 	if (val != 0 && val != 1)
@@ -317,7 +317,7 @@ static ssize_t timer_enabled_write(struct file *file, char const __user *buf,
 		return -EINVAL;
 
 	retval = oprofilefs_ulong_from_user(&val, buf, count);
-	if (retval)
+	if (retval <= 0)
 		return retval;
 
 	if (val != 0 && val != 1)
-- 
1.7.8.6



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

* [PATCH 2/2] oprofile: Remove 'WQ on CPUx, prefer CPUy' warning
  2012-08-24 18:53 [PATCH 0/2] oprofile fixes and updates Robert Richter
  2012-08-24 18:53 ` [PATCH 1/2] oprofile, s390: Fix uninitialized memory access when writing to oprofilefs Robert Richter
@ 2012-08-24 18:53 ` Robert Richter
  2012-08-27 16:08   ` Andi Kleen
  1 sibling, 1 reply; 4+ messages in thread
From: Robert Richter @ 2012-08-24 18:53 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: LKML, oprofile-list, Robert Richter, Andi Kleen

Under certain workloads we see the following warnings:

 WQ on CPU0, prefer CPU1
 WQ on CPU0, prefer CPU2
 WQ on CPU0, prefer CPU3

It warns the user that the wq to access a per-cpu buffers runs not on
the same cpu. This happens if the wq is rescheduled on a different cpu
than where the buffer is located. This was probably implemented to
detect performance issues. Not sure if there actually is one as the
buffers are copied to a single buffer anyway which should be the
actual bottleneck.

We wont change WQ implementation. Since a user can do nothing the
warning is pointless. Removing it.

Cc: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Robert Richter <robert.richter@amd.com>
---
 drivers/oprofile/cpu_buffer.c |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/oprofile/cpu_buffer.c b/drivers/oprofile/cpu_buffer.c
index b8ef8dd..8aa73fa 100644
--- a/drivers/oprofile/cpu_buffer.c
+++ b/drivers/oprofile/cpu_buffer.c
@@ -451,14 +451,9 @@ static void wq_sync_buffer(struct work_struct *work)
 {
 	struct oprofile_cpu_buffer *b =
 		container_of(work, struct oprofile_cpu_buffer, work.work);
-	if (b->cpu != smp_processor_id()) {
-		printk(KERN_DEBUG "WQ on CPU%d, prefer CPU%d\n",
-		       smp_processor_id(), b->cpu);
-
-		if (!cpu_online(b->cpu)) {
-			cancel_delayed_work(&b->work);
-			return;
-		}
+	if (b->cpu != smp_processor_id() && !cpu_online(b->cpu)) {
+		cancel_delayed_work(&b->work);
+		return;
 	}
 	sync_buffer(b->cpu);
 
-- 
1.7.8.6



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

* Re: [PATCH 2/2] oprofile: Remove 'WQ on CPUx, prefer CPUy' warning
  2012-08-24 18:53 ` [PATCH 2/2] oprofile: Remove 'WQ on CPUx, prefer CPUy' warning Robert Richter
@ 2012-08-27 16:08   ` Andi Kleen
  0 siblings, 0 replies; 4+ messages in thread
From: Andi Kleen @ 2012-08-27 16:08 UTC (permalink / raw)
  To: Robert Richter; +Cc: Ingo Molnar, LKML, oprofile-list, Andi Kleen

On Fri, Aug 24, 2012 at 08:53:31PM +0200, Robert Richter wrote:
> Under certain workloads we see the following warnings:
> 
>  WQ on CPU0, prefer CPU1
>  WQ on CPU0, prefer CPU2
>  WQ on CPU0, prefer CPU3
> 
> It warns the user that the wq to access a per-cpu buffers runs not on
> the same cpu. This happens if the wq is rescheduled on a different cpu
> than where the buffer is located. This was probably implemented to
> detect performance issues. Not sure if there actually is one as the
> buffers are copied to a single buffer anyway which should be the
> actual bottleneck.
> 
> We wont change WQ implementation. Since a user can do nothing the
> warning is pointless. Removing it.

Looks good to me.

Acked-by: Andi Kleen <ak@linux.intel.com>

-Andi

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

end of thread, other threads:[~2012-08-27 16:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-24 18:53 [PATCH 0/2] oprofile fixes and updates Robert Richter
2012-08-24 18:53 ` [PATCH 1/2] oprofile, s390: Fix uninitialized memory access when writing to oprofilefs Robert Richter
2012-08-24 18:53 ` [PATCH 2/2] oprofile: Remove 'WQ on CPUx, prefer CPUy' warning Robert Richter
2012-08-27 16:08   ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).