Skip to contentSkip to conversation

add core dump file name pattern option for cpu id

PATCH Joshua Aas 1 participant 2 messages Jul 15, 2004 – Jul 22, 2004

Subsystems (2)
lore
Share & tools
lore

Joshua Aas

author
#0 lore raw

Normally core dumps can be blamed on a program itself. However, core dumps can also be the result of faulty hardware. Tracking down what CPU a failure occurred on usually requires that hardware be powered off piece by piece until no core dumps occur (on big machines this can take a long time). Another option is to run the test pinned to each CPU until the core dump occurs, but this can also take a long time on big machines. It would be very beneficial if the kernel was capable of making the CPU ID of the CPU the core dump occurred on available somehow. The following patch adds an option (%c) to the core dump file naming pattern convention for putting the CPU ID into core dump file names.

-----------------------------------------------------------------

fs/exec.c +8 -0
@@ -1276,6 +1276,14 @@ void format_corename(char *corename, con
 					goto out;
 				out_ptr += rc;
 				break;
+			/* cpu id */
+			case 'c':
+				rc = snprintf(out_ptr, out_end - out_ptr,
+					      "%d", smp_processor_id());
+				if (rc > out_end - out_ptr)
+					goto out;
+				out_ptr += rc;
+				break;
 			default:
 				break;
 			}

-----------------------------------------------------------------

Signature · 4 lines
Josh Aas
Silicon Graphics, Inc. (SGI)
Linux System Software
651-683-3068
author
#1 lore raw
Quoted 12 lines · Joshua Aas

Normally core dumps can be blamed on a program itself. However, core dumps can also be the result of faulty hardware. Tracking down what CPU a failure occurred on usually requires that hardware be powered off piece by piece until no core dumps occur (on big machines this can take a long time). Another option is to run the test pinned to each CPU until the core dump occurs, but this can also take a long time on big machines. It would be very beneficial if the kernel was capable of making the CPU ID of the CPU the core dump occurred on available somehow. The following patch adds an option (%c) to the core dump file naming pattern convention for putting the CPU ID into core dump file names.

Quoted 2 lines

-----------------------------------------------------------------

fs/exec.c +8 -0
@@ -1276,6 +1276,14 @@ void format_corename(char *corename, con
 					goto out;
 				out_ptr += rc;
 				break;
+			/* cpu id */
+			case 'c':
+				rc = snprintf(out_ptr, out_end - out_ptr,
+					      "%d", smp_processor_id());
+				if (rc > out_end - out_ptr)
+					goto out;
+				out_ptr += rc;
+				break;
 			default:
 				break;
 			}

-----------------------------------------------------------------

Is there any reason this couldn't be taken into the kernel? I didn't get any response at all and it seems to be a safe and useful patch. Any feedback would be appreciated.

--
Josh Aas
Silicon Graphics, Inc. (SGI)
Linux System Software
651-683-3068