[Crash-utility] [RFC/PATCH] s390x: Add live dump detection
Dave Anderson
anderson at redhat.com
Fri Apr 20 14:03:23 UTC 2012
----- Original Message -----
> Hello Dave,
>
> On Thu, 19 Apr 2012 14:44:43 -0400 (EDT)
> Dave Anderson <anderson at redhat.com> wrote:
>
> [snip]
>
> > I would have no problem with adding a new LIVE_DUMP flag to
> > pc->flags2, and just checking it in display_sys_stats() and
> > non_matching_kernel() as you've done below. In dealing with
> > dumpfiles generated from snap.so, the "bt" command is pretty
> > much the only command that probably should be restricted.
> > However, I don't restrict "bt" with snap.so vmcores because
> > currently there's no magic/signature/whatever that indicates
> > what kind of dump it is. But if you implement a new LIVE_DUMP
> > flag, I might do it there as well so we've got some consistency.
> >
> > What do you think about that?
>
> Sounds good. So what about introducing a new macro LIVE() that
> indicates that the dump or live system is inconsistent.
Good idea -- queued for crash-6.0.6.
I'll also put some kind of indicator in the snap.so ELF header.
Thanks,
Dave
> Something like the following:
> ---
> defs.h | 2 ++
> kernel.c | 9 +++++++--
> main.c | 2 ++
> s390x.c | 12 ++++++++++++
> 4 files changed, 23 insertions(+), 2 deletions(-)
>
> --- a/defs.h
> +++ b/defs.h
> @@ -203,6 +203,7 @@ struct number_option {
>
> #define ACTIVE() (pc->flags & LIVE_SYSTEM)
> #define DUMPFILE() (!(pc->flags & LIVE_SYSTEM))
> +#define LIVE() (pc->flags2 & LIVE_DUMP || pc->flags &
> LIVE_SYSTEM)
> #define MEMORY_SOURCES
> (NETDUMP|KDUMP|MCLXCD|LKCD|DEVMEM|S390D|MEMMOD|DISKDUMP|XENDUMP|CRASHBUILTIN|KVMDUMP|PROC_KCORE|SADUMP)
> #define DUMPFILE_TYPES
> (DISKDUMP|NETDUMP|KDUMP|MCLXCD|LKCD|S390D|XENDUMP|KVMDUMP|SADUMP)
> #define REMOTE() (pc->flags2 & REMOTE_DAEMON)
> @@ -446,6 +447,7 @@ struct program_context {
> #define REMOTE_DAEMON (0x08ULL)
> #define ERASEINFO_DATA (0x10ULL)
> #define GDB_CMD_MODE (0x20ULL)
> +#define LIVE_DUMP (0x40ULL)
> #define FLAT_FORMAT() (pc->flags2 & FLAT)
> #define ELF_NOTES_VALID() (pc->flags2 & ELF_NOTES)
> char *cleanup;
> --- a/kernel.c
> +++ b/kernel.c
> @@ -992,6 +992,8 @@ non_matching_kernel(void)
> else
> fprintf(fp, "%s", pc->dumpfile);
> }
> + if (LIVE())
> + fprintf(fp, " [LIVE DUMP]");
> }
>
> fprintf(fp, "\n\n");
> @@ -2072,9 +2074,9 @@ else
> }
>
> if (active) {
> - if (ACTIVE())
> + if (LIVE())
> error(FATAL,
> - "-a option not supported on a live system\n");
> + "-a option not supported on a live system or live dump\n");
>
> if (bt->flags & BT_THREAD_GROUP)
> error(FATAL,
> @@ -4098,6 +4100,9 @@ display_sys_stats(void)
> fprintf(fp, "%s", pc->dumpfile);
> }
>
> + if (LIVE())
> + fprintf(fp, " [LIVE DUMP]");
> +
> if (NETDUMP_DUMPFILE() && is_partial_netdump())
> fprintf(fp, " [PARTIAL DUMP]");
>
> --- a/main.c
> +++ b/main.c
> @@ -1110,6 +1110,8 @@ dump_program_context(void)
> if (pc->flags & LIVE_SYSTEM)
> sprintf(&buf[strlen(buf)], "%sLIVE_SYSTEM",
> others++ ? "|" : "");
> + if (pc->flags2 & LIVE_DUMP)
> + sprintf(&buf[strlen(buf)], "%sLIVE_DUMP", others++ ? "|" : "");
> if (pc->flags & TTY)
> sprintf(&buf[strlen(buf)], "%sTTY", others++ ? "|" : "");
> if (pc->flags & IN_FOREACH)
> --- a/s390x.c
> +++ b/s390x.c
> @@ -328,6 +328,17 @@ static void s390x_process_elf_notes(void
> }
> }
>
> +static void s390x_check_live(void)
> +{
> + unsigned long long live_magic;
> +
> + readmem(0, KVADDR, &live_magic, sizeof(live_magic), "live_magic",
> + RETURN_ON_ERROR | QUIET);
> +
> + if (live_magic == 0x4c49564544554d50ULL)
> + pc->flags2 |= LIVE_DUMP;
> +}
> +
> /*
> * Do all necessary machine-specific setup here. This is called
> several
> * times during initialization.
> @@ -402,6 +413,7 @@ s390x_init(int when)
> break;
>
> case POST_INIT:
> + s390x_check_live();
> break;
> }
> }
>
More information about the Crash-utility
mailing list