mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] add core dump file name pattern option for cpu id
@ 2004-07-27 19:14 Josh Aas
  2004-07-27 19:31 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Josh Aas @ 2004-07-27 19:14 UTC (permalink / raw)
  To: akpm, linux-kernel

On Thu, 2004-07-15 at 15:14, Joshua Aas wrote:
> 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.
> 
> Signed-off-by: Josh Aas <josha@sgi.com>

---------------------------------------------------------
--- a/fs/exec.c	2004-07-13 14:32:24.000000000 -0500
+++ b/fs/exec.c	2004-07-15 13:16:17.000000000 -0500
@@ -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.

Signed-off-by: Josh Aas <josha@sgi.com>

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



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

* Re: [PATCH] add core dump file name pattern option for cpu id
  2004-07-27 19:14 [PATCH] add core dump file name pattern option for cpu id Josh Aas
@ 2004-07-27 19:31 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2004-07-27 19:31 UTC (permalink / raw)
  To: Josh Aas; +Cc: linux-kernel

Josh Aas <josha@sgi.com> wrote:
>
>  ---------------------------------------------------------
>  --- a/fs/exec.c	2004-07-13 14:32:24.000000000 -0500
>  +++ b/fs/exec.c	2004-07-15 13:16:17.000000000 -0500
>  @@ -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.

There's no guarantee at all that we're still running on the same CPU by the
time we get here.

Possibly do_coredump() could fish the relevant info out of the pt_regs in
some arch-dependent way, or it needs to be propagated down in some manner. 
Either way, the patch will become more complex.

Any future revision of this patch should include an update to
Documentation/sysctl/kernel.txt:core_pattern please.

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

end of thread, other threads:[~2004-07-27 19:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-27 19:14 [PATCH] add core dump file name pattern option for cpu id Josh Aas
2004-07-27 19:31 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®