Re: [PATCH 2/2] Repost Cell OProfile: SPU mutex lock fix, version 4

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Carl Love
Date: Friday, August 8, 2008 - 3:39 pm

Updated to address Arnd's comments.

If an error occurs on opcontrol start, the event and per cpu buffers 
are released.  If later opcontrol shutdown is called then the free
function will be called again to free buffers that no longer 
exist.  This results in a kernel oops.  The following changes
prevent the call to delete buffers that don't exist.

Signed-off-by: Carl Love <carll@us.ibm.com>

Index: Cell_kernel_6_26_2008/drivers/oprofile/cpu_buffer.c
===================================================================
--- Cell_kernel_6_26_2008.orig/drivers/oprofile/cpu_buffer.c
+++ Cell_kernel_6_26_2008/drivers/oprofile/cpu_buffer.c
@@ -38,8 +38,10 @@ void free_cpu_buffers(void)
 {
 	int i;
 
-	for_each_online_cpu(i)
+	for_each_online_cpu(i) {
 		vfree(per_cpu(cpu_buffer, i).buffer);
+		per_cpu(cpu_buffer, i).buffer = NULL;
+	}
 }
 
 unsigned long oprofile_get_cpu_buffer_size(void)
Index: Cell_kernel_6_26_2008/drivers/oprofile/event_buffer.c
===================================================================
--- Cell_kernel_6_26_2008.orig/drivers/oprofile/event_buffer.c
+++ Cell_kernel_6_26_2008/drivers/oprofile/event_buffer.c
@@ -93,6 +93,8 @@ out:
 void free_event_buffer(void)
 {
 	vfree(event_buffer);
+
+	event_buffer = NULL;
 }
 
  


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 2/2] Repost Cell OProfile: SPU mutex lock fix, ..., Carl Love, (Fri Aug 8, 3:39 pm)
please pull cell merge branch, Arnd Bergmann, (Sat Aug 9, 6:13 am)
Re: please pull cell merge branch, Paul Mackerras, (Sun Aug 10, 4:17 pm)
Re: [Cbe-oss-dev] please pull cell merge branch, Arnd Bergmann, (Mon Aug 11, 12:18 am)
powerpc/cell/oprofile: fix mutex locking for spu-oprofile, Arnd Bergmann, (Mon Aug 11, 12:25 am)
powerpc/cell/oprofile: avoid double free of profile buffer, Arnd Bergmann, (Mon Aug 11, 12:25 am)
Re: [Cbe-oss-dev] please pull cell merge branch, Carl Love, (Mon Aug 11, 8:34 am)