[Crash-utility] Why does crash check the program context flags in FILL_PML4() macro

Dave Anderson anderson at redhat.com
Thu Jan 4 15:50:30 UTC 2018



----- Original Message -----
> Hi Dave,
> 
> One question:
> 
> #define FILL_PML4() { \
> 	if (!(pc->flags & RUNTIME) || ACTIVE()) { \
>          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> I am confused that crash checks the flags in the FILL_PML4() macro, but
> not check that in other macros, such as FILL_PGD().

Good question -- I don't have a really good answer...

I think it's a legacy of an earlier time, but as I recall, the !RUNTIME check
was simply to ensure that it had been initialized at least once during session
initialization.  I don't recall the reasoning behind the ACTIVE() check, other
than the fact that while it could never change in a dumpfile, conceivably it may
change during an active session in future kernels?  However, I believe that once 
FILL_PML4() is called in x86_64_init_kernel_pgd(), it really never needs to be
called again.  So it pretty much makes the checks redundantly for the sake of
absolute surety.

Dave


> 
> Could you tell me why we need to do this check?
> 
> 		if (!IS_LAST_PML4_READ(vt->kernel_pgd[0])) \
>                      readmem(vt->kernel_pgd[0], KVADDR,
> machdep->machspec->pml4, \
>                          PAGESIZE(), "init_level4_pgt", FAULT_ON_ERROR); \
>                  machdep->machspec->last_pml4_read =
> (ulong)(vt->kernel_pgd[0]); \
> 	} \
> }
> 
> Thanks,
> 	dou
> 
> 
> 




More information about the Crash-utility mailing list