From: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Borislav Petkov <bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org>
Cc: linux-efi <linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Laszlo Ersek <lersek-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Ard Biesheuvel
<ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Matt Fleming
<matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Ricardo Neri
<ricardo.neri-calderon-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
lkml <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: Shorten efi regions output
Date: Wed, 10 Dec 2014 10:17:41 +0800 [thread overview]
Message-ID: <20141210021741.GA3280@darkstar.nay.redhat.com> (raw)
In-Reply-To: <20141209095843.GA3990-fF5Pk5pvG8Y@public.gmane.org>
On 12/09/14 at 10:58am, Borislav Petkov wrote:
> Hi guys,
>
> so this decoded EFI regions output is nice but can we shorten it? It
> sticks too far out in the terminal more than anything else in dmesg and
> staring at it needs me to resize window and such. It probably is an even
> bigger problem if one's monitor hasn't switched to higher res early
> during boot.
I have same feeling with you, it is too long for most of people.
Since the printk code are for EFI_DEBUG, they are around the #ifdef
so I would like to see a kernel param like efi_debug=on, so only efi_debug
is specified then these verbose messages are printed. Without the param
kernel can print some basic infomation about the memory ranges.
In arm64 code there's already a uefi_debug param it can be moved to general
code so that there will be a goable switch.
>
> So here's what I'm seeing with the latest EDKII:
>
> [ 0.000000] efi: EFI v2.40 by EDK II
> [ 0.000000] efi: ACPI=0x7ff2d000 ACPI 2.0=0x7ff2d014
> [ 0.000000] efi: mem00: [Conventional Memory| | | | | |WB|WT|WC|UC] range=[0x0000000000000000-0x0000000000001000) (0MB)
> [ 0.000000] efi: mem01: [Loader Data | | | | | |WB|WT|WC|UC] range=[0x0000000000001000-0x0000000000002000) (0MB)
> [ 0.000000] efi: mem02: [Conventional Memory| | | | | |WB|WT|WC|UC] range=[0x0000000000002000-0x000000000009f000) (0MB)
> [ 0.000000] efi: mem03: [Loader Data | | | | | |WB|WT|WC|UC] range=[0x000000000009f000-0x00000000000a0000) (0MB)
> [ 0.000000] efi: mem04: [Conventional Memory| | | | | |WB|WT|WC|UC] range=[0x0000000000100000-0x0000000000820000) (7MB)
> [ 0.000000] efi: mem05: [Boot Data | | | | | |WB|WT|WC|UC] range=[0x0000000000820000-0x0000000001000000) (7MB)
> [ 0.000000] efi: mem06: [Loader Data | | | | | |WB|WT|WC|UC] range=[0x0000000001000000-0x0000000003cbc000) (44MB)
> [ 0.000000] efi: mem07: [Conventional Memory| | | | | |WB|WT|WC|UC] range=[0x0000000003cbc000-0x0000000004000000) (3MB)
> [ 0.000000] efi: mem08: [Loader Data | | | | | |WB|WT|WC|UC] range=[0x0000000004000000-0x0000000005cbc000) (28MB)
> [ 0.000000] efi: mem09: [Conventional Memory| | | | | |WB|WT|WC|UC] range=[0x0000000005cbc000-0x000000003fffc000) (931MB)
> [ 0.000000] efi: mem10: [Loader Data | | | | | |WB|WT|WC|UC] range=[0x000000003fffc000-0x0000000040000000) (0MB)
> [ 0.000000] efi: mem11: [Conventional Memory| | | | | |WB|WT|WC|UC] range=[0x0000000040000000-0x000000007c000000) (960MB)
> [ 0.000000] efi: mem12: [Boot Data | | | | | |WB|WT|WC|UC] range=[0x000000007c000000-0x000000007c020000) (0MB)
> [ 0.000000] efi: mem13: [Conventional Memory| | | | | |WB|WT|WC|UC] range=[0x000000007c020000-0x000000007ebc5000) (43MB)
> [ 0.000000] efi: mem14: [Loader Data | | | | | |WB|WT|WC|UC] range=[0x000000007ebc5000-0x000000007ebfe000) (0MB)
> [ 0.000000] efi: mem15: [Boot Data | | | | | |WB|WT|WC|UC] range=[0x000000007ebfe000-0x000000007ebff000) (0MB)
> [ 0.000000] efi: mem16: [Conventional Memory| | | | | |WB|WT|WC|UC] range=[0x000000007ebff000-0x000000007ec03000) (0MB)
> [ 0.000000] efi: mem17: [Boot Data | | | | | |WB|WT|WC|UC] range=[0x000000007ec03000-0x000000007ec05000) (0MB)
> [ 0.000000] efi: mem18: [Loader Data | | | | | |WB|WT|WC|UC] range=[0x000000007ec05000-0x000000007ec06000) (0MB)
> [ 0.000000] efi: mem19: [Boot Data | | | | | |WB|WT|WC|UC] range=[0x000000007ec06000-0x000000007ec07000) (0MB)
> [ 0.000000] efi: mem20: [Loader Data | | | | | |WB|WT|WC|UC] range=[0x000000007ec07000-0x000000007ec08000) (0MB)
> [ 0.000000] efi: mem21: [Boot Data | | | | | |WB|WT|WC|UC] range=[0x000000007ec08000-0x000000007ece7000) (0MB)
> [ 0.000000] efi: mem22: [Boot Code | | | | | |WB|WT|WC|UC] range=[0x000000007ece7000-0x000000007ee3b000) (1MB)
> [ 0.000000] efi: mem23: [Runtime Data |RUN| | | | |WB|WT|WC|UC] range=[0x000000007ee3b000-0x000000007ee4e000) (0MB)
> [ 0.000000] efi: mem24: [Boot Data | | | | | |WB|WT|WC|UC] range=[0x000000007ee4e000-0x000000007fd4e000) (15MB)
> [ 0.000000] efi: mem25: [Boot Code | | | | | |WB|WT|WC|UC] range=[0x000000007fd4e000-0x000000007fece000) (1MB)
> [ 0.000000] efi: mem26: [Runtime Code |RUN| | | | |WB|WT|WC|UC] range=[0x000000007fece000-0x000000007fefe000) (0MB)
> [ 0.000000] efi: mem27: [Runtime Data |RUN| | | | |WB|WT|WC|UC] range=[0x000000007fefe000-0x000000007ff22000) (0MB)
> [ 0.000000] efi: mem28: [Reserved | | | | | |WB|WT|WC|UC] range=[0x000000007ff22000-0x000000007ff26000) (0MB)
> [ 0.000000] efi: mem29: [ACPI Reclaim Memory| | | | | |WB|WT|WC|UC] range=[0x000000007ff26000-0x000000007ff2e000) (0MB)
> [ 0.000000] efi: mem30: [ACPI Memory NVS | | | | | |WB|WT|WC|UC] range=[0x000000007ff2e000-0x000000007ff32000) (0MB)
> [ 0.000000] efi: mem31: [Boot Data | | | | | |WB|WT|WC|UC] range=[0x000000007ff32000-0x000000007ffd0000) (0MB)
> [ 0.000000] efi: mem32: [Runtime Data |RUN| | | | |WB|WT|WC|UC] range=[0x000000007ffd0000-0x0000000080000000) (0MB)
> [ 0.000000] efi: mem33: [Runtime Data |RUN| | | | | | | |UC] range=[0x00000000fff00000-0x0000000100000000) (1MB)
>
> and here's with the proposed changes:
>
> * regions get printed first so that vertical alignment gets preserved
>
> * memory types come then, with shorter names but still readable (I hope :))
>
> * efi mem attributes which are not set do not print the empty string.
> The vertical bar after "UC" is missing on purpose although this is not
> that totally correct if the region we're printing doesn't have the UC
> bit set. Then it would issue "|]" at the end but who cares - I'd like to
> not complicate this function unnecessarily.
>
> This way the output fits much better in dmesg and we shorten it by 30ish
> columns while preserving it. Diff below.
>
> [ 0.000000] efi: EFI v2.40 by EDK II
> [ 0.000000] efi: ACPI=0x7ff2d000 ACPI 2.0=0x7ff2d014
> [ 0.000000] efi: mem00: [0x0000000000000000-0x0000000000001000) [Mem |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem01: [0x0000000000001000-0x0000000000002000) [LdrData |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem02: [0x0000000000002000-0x000000000009f000) [Mem |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem03: [0x000000000009f000-0x00000000000a0000) [LdrData |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem04: [0x0000000000100000-0x0000000000820000) [Mem |WB|WT|WC|UC] (7MB)
> [ 0.000000] efi: mem05: [0x0000000000820000-0x0000000001000000) [BootData |WB|WT|WC|UC] (7MB)
> [ 0.000000] efi: mem06: [0x0000000001000000-0x0000000003cbc000) [LdrData |WB|WT|WC|UC] (44MB)
> [ 0.000000] efi: mem07: [0x0000000003cbc000-0x0000000004000000) [Mem |WB|WT|WC|UC] (3MB)
> [ 0.000000] efi: mem08: [0x0000000004000000-0x0000000005cbc000) [LdrData |WB|WT|WC|UC] (28MB)
> [ 0.000000] efi: mem09: [0x0000000005cbc000-0x000000003fffc000) [Mem |WB|WT|WC|UC] (931MB)
> [ 0.000000] efi: mem10: [0x000000003fffc000-0x0000000040000000) [LdrData |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem11: [0x0000000040000000-0x000000007c000000) [Mem |WB|WT|WC|UC] (960MB)
> [ 0.000000] efi: mem12: [0x000000007c000000-0x000000007c020000) [BootData |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem13: [0x000000007c020000-0x000000007ebc5000) [Mem |WB|WT|WC|UC] (43MB)
> [ 0.000000] efi: mem14: [0x000000007ebc5000-0x000000007ebfe000) [LdrData |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem15: [0x000000007ebfe000-0x000000007ebff000) [BootData |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem16: [0x000000007ebff000-0x000000007ec03000) [Mem |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem17: [0x000000007ec03000-0x000000007ec05000) [BootData |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem18: [0x000000007ec05000-0x000000007ec06000) [LdrData |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem19: [0x000000007ec06000-0x000000007ec07000) [BootData |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem20: [0x000000007ec07000-0x000000007ec08000) [LdrData |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem21: [0x000000007ec08000-0x000000007ece7000) [BootData |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem22: [0x000000007ece7000-0x000000007ee3b000) [BootCode |WB|WT|WC|UC] (1MB)
> [ 0.000000] efi: mem23: [0x000000007ee3b000-0x000000007ee4e000) [RtData |RT|WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem24: [0x000000007ee4e000-0x000000007fd4e000) [BootData |WB|WT|WC|UC] (15MB)
> [ 0.000000] efi: mem25: [0x000000007fd4e000-0x000000007fece000) [BootCode |WB|WT|WC|UC] (1MB)
> [ 0.000000] efi: mem26: [0x000000007fece000-0x000000007fefe000) [RtCode |RT|WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem27: [0x000000007fefe000-0x000000007ff22000) [RtData |RT|WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem28: [0x000000007ff22000-0x000000007ff26000) [Reserved |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem29: [0x000000007ff26000-0x000000007ff2e000) [ACPIRclMem |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem30: [0x000000007ff2e000-0x000000007ff32000) [ACPIMemNVS |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem31: [0x000000007ff32000-0x000000007ffd0000) [BootData |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem32: [0x000000007ffd0000-0x0000000080000000) [RtData |RT|WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem33: [0x00000000fff00000-0x0000000100000000) [RtData |RT|UC] (1MB)
>
> ---
> arch/x86/platform/efi/efi.c | 5 +++--
> drivers/firmware/efi/efi.c | 52 ++++++++++++++++++++++-----------------------
> 2 files changed, 29 insertions(+), 28 deletions(-)
>
> diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
> index 6a1ffd777db0..4b76256dcb31 100644
> --- a/arch/x86/platform/efi/efi.c
> +++ b/arch/x86/platform/efi/efi.c
> @@ -203,10 +203,11 @@ static void __init print_efi_memmap(void)
> char buf[64];
>
> md = p;
> - pr_info("mem%02u: %s range=[0x%016llx-0x%016llx) (%lluMB)\n",
> - i, efi_md_typeattr_format(buf, sizeof(buf), md),
> + pr_info("mem%02u: [0x%016llx-0x%016llx) %s (%lluMB)\n",
> + i,
> md->phys_addr,
> md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT),
> + efi_md_typeattr_format(buf, sizeof(buf), md),
> (md->num_pages >> (20 - EFI_PAGE_SHIFT)));
> }
> #endif /* EFI_DEBUG */
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index 8590099ac148..6734072980ee 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -446,21 +446,23 @@ int __init efi_get_fdt_params(struct efi_fdt_params *params, int verbose)
> }
> #endif /* CONFIG_EFI_PARAMS_FROM_FDT */
>
> +/* Update this if you're adding a longer string */
> +#define MEM_TYPE_MAXLEN 11
> static __initdata char memory_type_name[][20] = {
> "Reserved",
> - "Loader Code",
> - "Loader Data",
> - "Boot Code",
> - "Boot Data",
> - "Runtime Code",
> - "Runtime Data",
> - "Conventional Memory",
> - "Unusable Memory",
> - "ACPI Reclaim Memory",
> - "ACPI Memory NVS",
> - "Memory Mapped I/O",
> - "MMIO Port Space",
> - "PAL Code"
> + "LdrCode",
> + "LdrData",
> + "BootCode",
> + "BootData",
> + "RtCode",
> + "RtData",
> + "Mem",
> + "UnusableMem",
> + "ACPIRclMem",
> + "ACPIMemNVS",
> + "MMappedI/O",
> + "MMIOPortSpc",
> + "PALCode"
> };
>
> char * __init efi_md_typeattr_format(char *buf, size_t size,
> @@ -474,9 +476,7 @@ char * __init efi_md_typeattr_format(char *buf, size_t size,
> if (md->type >= ARRAY_SIZE(memory_type_name))
> type_len = snprintf(pos, size, "[type=%u", md->type);
> else
> - type_len = snprintf(pos, size, "[%-*s",
> - (int)(sizeof(memory_type_name[0]) - 1),
> - memory_type_name[md->type]);
> + type_len = snprintf(pos, size, "[%-*s", MEM_TYPE_MAXLEN, memory_type_name[md->type]);
> if (type_len >= size)
> return buf;
>
> @@ -490,15 +490,15 @@ char * __init efi_md_typeattr_format(char *buf, size_t size,
> snprintf(pos, size, "|attr=0x%016llx]",
> (unsigned long long)attr);
> else
> - snprintf(pos, size, "|%3s|%2s|%2s|%2s|%3s|%2s|%2s|%2s|%2s]",
> - attr & EFI_MEMORY_RUNTIME ? "RUN" : "",
> - attr & EFI_MEMORY_XP ? "XP" : "",
> - attr & EFI_MEMORY_RP ? "RP" : "",
> - attr & EFI_MEMORY_WP ? "WP" : "",
> - attr & EFI_MEMORY_UCE ? "UCE" : "",
> - attr & EFI_MEMORY_WB ? "WB" : "",
> - attr & EFI_MEMORY_WT ? "WT" : "",
> - attr & EFI_MEMORY_WC ? "WC" : "",
> - attr & EFI_MEMORY_UC ? "UC" : "");
> + snprintf(pos, size, "|%s%s%s%s%s%s%s%s%s]",
> + attr & EFI_MEMORY_RUNTIME ? "RT|" : "",
> + attr & EFI_MEMORY_XP ? "XP|" : "",
> + attr & EFI_MEMORY_RP ? "RP|" : "",
> + attr & EFI_MEMORY_WP ? "WP|" : "",
> + attr & EFI_MEMORY_UCE ? "UCE|" : "",
> + attr & EFI_MEMORY_WB ? "WB|" : "",
> + attr & EFI_MEMORY_WT ? "WT|" : "",
> + attr & EFI_MEMORY_WC ? "WC|" : "",
> + attr & EFI_MEMORY_UC ? "UC" : "");
> return buf;
> }
> --
> 2.0.0
>
>
> --
> Regards/Gruss,
> Boris.
>
> Sent from a fat crate under my desk. Formatting is fine.
> --
> --
> To unsubscribe from this list: send the line "unsubscribe linux-efi" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Dave Young <dyoung@redhat.com>
To: Borislav Petkov <bp@alien8.de>
Cc: linux-efi <linux-efi@vger.kernel.org>,
Laszlo Ersek <lersek@redhat.com>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Matt Fleming <matt.fleming@intel.com>,
Ricardo Neri <ricardo.neri-calderon@linux.intel.com>,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: Shorten efi regions output
Date: Wed, 10 Dec 2014 10:17:41 +0800 [thread overview]
Message-ID: <20141210021741.GA3280@darkstar.nay.redhat.com> (raw)
In-Reply-To: <20141209095843.GA3990@pd.tnic>
On 12/09/14 at 10:58am, Borislav Petkov wrote:
> Hi guys,
>
> so this decoded EFI regions output is nice but can we shorten it? It
> sticks too far out in the terminal more than anything else in dmesg and
> staring at it needs me to resize window and such. It probably is an even
> bigger problem if one's monitor hasn't switched to higher res early
> during boot.
I have same feeling with you, it is too long for most of people.
Since the printk code are for EFI_DEBUG, they are around the #ifdef
so I would like to see a kernel param like efi_debug=on, so only efi_debug
is specified then these verbose messages are printed. Without the param
kernel can print some basic infomation about the memory ranges.
In arm64 code there's already a uefi_debug param it can be moved to general
code so that there will be a goable switch.
>
> So here's what I'm seeing with the latest EDKII:
>
> [ 0.000000] efi: EFI v2.40 by EDK II
> [ 0.000000] efi: ACPI=0x7ff2d000 ACPI 2.0=0x7ff2d014
> [ 0.000000] efi: mem00: [Conventional Memory| | | | | |WB|WT|WC|UC] range=[0x0000000000000000-0x0000000000001000) (0MB)
> [ 0.000000] efi: mem01: [Loader Data | | | | | |WB|WT|WC|UC] range=[0x0000000000001000-0x0000000000002000) (0MB)
> [ 0.000000] efi: mem02: [Conventional Memory| | | | | |WB|WT|WC|UC] range=[0x0000000000002000-0x000000000009f000) (0MB)
> [ 0.000000] efi: mem03: [Loader Data | | | | | |WB|WT|WC|UC] range=[0x000000000009f000-0x00000000000a0000) (0MB)
> [ 0.000000] efi: mem04: [Conventional Memory| | | | | |WB|WT|WC|UC] range=[0x0000000000100000-0x0000000000820000) (7MB)
> [ 0.000000] efi: mem05: [Boot Data | | | | | |WB|WT|WC|UC] range=[0x0000000000820000-0x0000000001000000) (7MB)
> [ 0.000000] efi: mem06: [Loader Data | | | | | |WB|WT|WC|UC] range=[0x0000000001000000-0x0000000003cbc000) (44MB)
> [ 0.000000] efi: mem07: [Conventional Memory| | | | | |WB|WT|WC|UC] range=[0x0000000003cbc000-0x0000000004000000) (3MB)
> [ 0.000000] efi: mem08: [Loader Data | | | | | |WB|WT|WC|UC] range=[0x0000000004000000-0x0000000005cbc000) (28MB)
> [ 0.000000] efi: mem09: [Conventional Memory| | | | | |WB|WT|WC|UC] range=[0x0000000005cbc000-0x000000003fffc000) (931MB)
> [ 0.000000] efi: mem10: [Loader Data | | | | | |WB|WT|WC|UC] range=[0x000000003fffc000-0x0000000040000000) (0MB)
> [ 0.000000] efi: mem11: [Conventional Memory| | | | | |WB|WT|WC|UC] range=[0x0000000040000000-0x000000007c000000) (960MB)
> [ 0.000000] efi: mem12: [Boot Data | | | | | |WB|WT|WC|UC] range=[0x000000007c000000-0x000000007c020000) (0MB)
> [ 0.000000] efi: mem13: [Conventional Memory| | | | | |WB|WT|WC|UC] range=[0x000000007c020000-0x000000007ebc5000) (43MB)
> [ 0.000000] efi: mem14: [Loader Data | | | | | |WB|WT|WC|UC] range=[0x000000007ebc5000-0x000000007ebfe000) (0MB)
> [ 0.000000] efi: mem15: [Boot Data | | | | | |WB|WT|WC|UC] range=[0x000000007ebfe000-0x000000007ebff000) (0MB)
> [ 0.000000] efi: mem16: [Conventional Memory| | | | | |WB|WT|WC|UC] range=[0x000000007ebff000-0x000000007ec03000) (0MB)
> [ 0.000000] efi: mem17: [Boot Data | | | | | |WB|WT|WC|UC] range=[0x000000007ec03000-0x000000007ec05000) (0MB)
> [ 0.000000] efi: mem18: [Loader Data | | | | | |WB|WT|WC|UC] range=[0x000000007ec05000-0x000000007ec06000) (0MB)
> [ 0.000000] efi: mem19: [Boot Data | | | | | |WB|WT|WC|UC] range=[0x000000007ec06000-0x000000007ec07000) (0MB)
> [ 0.000000] efi: mem20: [Loader Data | | | | | |WB|WT|WC|UC] range=[0x000000007ec07000-0x000000007ec08000) (0MB)
> [ 0.000000] efi: mem21: [Boot Data | | | | | |WB|WT|WC|UC] range=[0x000000007ec08000-0x000000007ece7000) (0MB)
> [ 0.000000] efi: mem22: [Boot Code | | | | | |WB|WT|WC|UC] range=[0x000000007ece7000-0x000000007ee3b000) (1MB)
> [ 0.000000] efi: mem23: [Runtime Data |RUN| | | | |WB|WT|WC|UC] range=[0x000000007ee3b000-0x000000007ee4e000) (0MB)
> [ 0.000000] efi: mem24: [Boot Data | | | | | |WB|WT|WC|UC] range=[0x000000007ee4e000-0x000000007fd4e000) (15MB)
> [ 0.000000] efi: mem25: [Boot Code | | | | | |WB|WT|WC|UC] range=[0x000000007fd4e000-0x000000007fece000) (1MB)
> [ 0.000000] efi: mem26: [Runtime Code |RUN| | | | |WB|WT|WC|UC] range=[0x000000007fece000-0x000000007fefe000) (0MB)
> [ 0.000000] efi: mem27: [Runtime Data |RUN| | | | |WB|WT|WC|UC] range=[0x000000007fefe000-0x000000007ff22000) (0MB)
> [ 0.000000] efi: mem28: [Reserved | | | | | |WB|WT|WC|UC] range=[0x000000007ff22000-0x000000007ff26000) (0MB)
> [ 0.000000] efi: mem29: [ACPI Reclaim Memory| | | | | |WB|WT|WC|UC] range=[0x000000007ff26000-0x000000007ff2e000) (0MB)
> [ 0.000000] efi: mem30: [ACPI Memory NVS | | | | | |WB|WT|WC|UC] range=[0x000000007ff2e000-0x000000007ff32000) (0MB)
> [ 0.000000] efi: mem31: [Boot Data | | | | | |WB|WT|WC|UC] range=[0x000000007ff32000-0x000000007ffd0000) (0MB)
> [ 0.000000] efi: mem32: [Runtime Data |RUN| | | | |WB|WT|WC|UC] range=[0x000000007ffd0000-0x0000000080000000) (0MB)
> [ 0.000000] efi: mem33: [Runtime Data |RUN| | | | | | | |UC] range=[0x00000000fff00000-0x0000000100000000) (1MB)
>
> and here's with the proposed changes:
>
> * regions get printed first so that vertical alignment gets preserved
>
> * memory types come then, with shorter names but still readable (I hope :))
>
> * efi mem attributes which are not set do not print the empty string.
> The vertical bar after "UC" is missing on purpose although this is not
> that totally correct if the region we're printing doesn't have the UC
> bit set. Then it would issue "|]" at the end but who cares - I'd like to
> not complicate this function unnecessarily.
>
> This way the output fits much better in dmesg and we shorten it by 30ish
> columns while preserving it. Diff below.
>
> [ 0.000000] efi: EFI v2.40 by EDK II
> [ 0.000000] efi: ACPI=0x7ff2d000 ACPI 2.0=0x7ff2d014
> [ 0.000000] efi: mem00: [0x0000000000000000-0x0000000000001000) [Mem |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem01: [0x0000000000001000-0x0000000000002000) [LdrData |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem02: [0x0000000000002000-0x000000000009f000) [Mem |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem03: [0x000000000009f000-0x00000000000a0000) [LdrData |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem04: [0x0000000000100000-0x0000000000820000) [Mem |WB|WT|WC|UC] (7MB)
> [ 0.000000] efi: mem05: [0x0000000000820000-0x0000000001000000) [BootData |WB|WT|WC|UC] (7MB)
> [ 0.000000] efi: mem06: [0x0000000001000000-0x0000000003cbc000) [LdrData |WB|WT|WC|UC] (44MB)
> [ 0.000000] efi: mem07: [0x0000000003cbc000-0x0000000004000000) [Mem |WB|WT|WC|UC] (3MB)
> [ 0.000000] efi: mem08: [0x0000000004000000-0x0000000005cbc000) [LdrData |WB|WT|WC|UC] (28MB)
> [ 0.000000] efi: mem09: [0x0000000005cbc000-0x000000003fffc000) [Mem |WB|WT|WC|UC] (931MB)
> [ 0.000000] efi: mem10: [0x000000003fffc000-0x0000000040000000) [LdrData |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem11: [0x0000000040000000-0x000000007c000000) [Mem |WB|WT|WC|UC] (960MB)
> [ 0.000000] efi: mem12: [0x000000007c000000-0x000000007c020000) [BootData |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem13: [0x000000007c020000-0x000000007ebc5000) [Mem |WB|WT|WC|UC] (43MB)
> [ 0.000000] efi: mem14: [0x000000007ebc5000-0x000000007ebfe000) [LdrData |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem15: [0x000000007ebfe000-0x000000007ebff000) [BootData |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem16: [0x000000007ebff000-0x000000007ec03000) [Mem |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem17: [0x000000007ec03000-0x000000007ec05000) [BootData |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem18: [0x000000007ec05000-0x000000007ec06000) [LdrData |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem19: [0x000000007ec06000-0x000000007ec07000) [BootData |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem20: [0x000000007ec07000-0x000000007ec08000) [LdrData |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem21: [0x000000007ec08000-0x000000007ece7000) [BootData |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem22: [0x000000007ece7000-0x000000007ee3b000) [BootCode |WB|WT|WC|UC] (1MB)
> [ 0.000000] efi: mem23: [0x000000007ee3b000-0x000000007ee4e000) [RtData |RT|WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem24: [0x000000007ee4e000-0x000000007fd4e000) [BootData |WB|WT|WC|UC] (15MB)
> [ 0.000000] efi: mem25: [0x000000007fd4e000-0x000000007fece000) [BootCode |WB|WT|WC|UC] (1MB)
> [ 0.000000] efi: mem26: [0x000000007fece000-0x000000007fefe000) [RtCode |RT|WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem27: [0x000000007fefe000-0x000000007ff22000) [RtData |RT|WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem28: [0x000000007ff22000-0x000000007ff26000) [Reserved |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem29: [0x000000007ff26000-0x000000007ff2e000) [ACPIRclMem |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem30: [0x000000007ff2e000-0x000000007ff32000) [ACPIMemNVS |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem31: [0x000000007ff32000-0x000000007ffd0000) [BootData |WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem32: [0x000000007ffd0000-0x0000000080000000) [RtData |RT|WB|WT|WC|UC] (0MB)
> [ 0.000000] efi: mem33: [0x00000000fff00000-0x0000000100000000) [RtData |RT|UC] (1MB)
>
> ---
> arch/x86/platform/efi/efi.c | 5 +++--
> drivers/firmware/efi/efi.c | 52 ++++++++++++++++++++++-----------------------
> 2 files changed, 29 insertions(+), 28 deletions(-)
>
> diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
> index 6a1ffd777db0..4b76256dcb31 100644
> --- a/arch/x86/platform/efi/efi.c
> +++ b/arch/x86/platform/efi/efi.c
> @@ -203,10 +203,11 @@ static void __init print_efi_memmap(void)
> char buf[64];
>
> md = p;
> - pr_info("mem%02u: %s range=[0x%016llx-0x%016llx) (%lluMB)\n",
> - i, efi_md_typeattr_format(buf, sizeof(buf), md),
> + pr_info("mem%02u: [0x%016llx-0x%016llx) %s (%lluMB)\n",
> + i,
> md->phys_addr,
> md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT),
> + efi_md_typeattr_format(buf, sizeof(buf), md),
> (md->num_pages >> (20 - EFI_PAGE_SHIFT)));
> }
> #endif /* EFI_DEBUG */
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index 8590099ac148..6734072980ee 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -446,21 +446,23 @@ int __init efi_get_fdt_params(struct efi_fdt_params *params, int verbose)
> }
> #endif /* CONFIG_EFI_PARAMS_FROM_FDT */
>
> +/* Update this if you're adding a longer string */
> +#define MEM_TYPE_MAXLEN 11
> static __initdata char memory_type_name[][20] = {
> "Reserved",
> - "Loader Code",
> - "Loader Data",
> - "Boot Code",
> - "Boot Data",
> - "Runtime Code",
> - "Runtime Data",
> - "Conventional Memory",
> - "Unusable Memory",
> - "ACPI Reclaim Memory",
> - "ACPI Memory NVS",
> - "Memory Mapped I/O",
> - "MMIO Port Space",
> - "PAL Code"
> + "LdrCode",
> + "LdrData",
> + "BootCode",
> + "BootData",
> + "RtCode",
> + "RtData",
> + "Mem",
> + "UnusableMem",
> + "ACPIRclMem",
> + "ACPIMemNVS",
> + "MMappedI/O",
> + "MMIOPortSpc",
> + "PALCode"
> };
>
> char * __init efi_md_typeattr_format(char *buf, size_t size,
> @@ -474,9 +476,7 @@ char * __init efi_md_typeattr_format(char *buf, size_t size,
> if (md->type >= ARRAY_SIZE(memory_type_name))
> type_len = snprintf(pos, size, "[type=%u", md->type);
> else
> - type_len = snprintf(pos, size, "[%-*s",
> - (int)(sizeof(memory_type_name[0]) - 1),
> - memory_type_name[md->type]);
> + type_len = snprintf(pos, size, "[%-*s", MEM_TYPE_MAXLEN, memory_type_name[md->type]);
> if (type_len >= size)
> return buf;
>
> @@ -490,15 +490,15 @@ char * __init efi_md_typeattr_format(char *buf, size_t size,
> snprintf(pos, size, "|attr=0x%016llx]",
> (unsigned long long)attr);
> else
> - snprintf(pos, size, "|%3s|%2s|%2s|%2s|%3s|%2s|%2s|%2s|%2s]",
> - attr & EFI_MEMORY_RUNTIME ? "RUN" : "",
> - attr & EFI_MEMORY_XP ? "XP" : "",
> - attr & EFI_MEMORY_RP ? "RP" : "",
> - attr & EFI_MEMORY_WP ? "WP" : "",
> - attr & EFI_MEMORY_UCE ? "UCE" : "",
> - attr & EFI_MEMORY_WB ? "WB" : "",
> - attr & EFI_MEMORY_WT ? "WT" : "",
> - attr & EFI_MEMORY_WC ? "WC" : "",
> - attr & EFI_MEMORY_UC ? "UC" : "");
> + snprintf(pos, size, "|%s%s%s%s%s%s%s%s%s]",
> + attr & EFI_MEMORY_RUNTIME ? "RT|" : "",
> + attr & EFI_MEMORY_XP ? "XP|" : "",
> + attr & EFI_MEMORY_RP ? "RP|" : "",
> + attr & EFI_MEMORY_WP ? "WP|" : "",
> + attr & EFI_MEMORY_UCE ? "UCE|" : "",
> + attr & EFI_MEMORY_WB ? "WB|" : "",
> + attr & EFI_MEMORY_WT ? "WT|" : "",
> + attr & EFI_MEMORY_WC ? "WC|" : "",
> + attr & EFI_MEMORY_UC ? "UC" : "");
> return buf;
> }
> --
> 2.0.0
>
>
> --
> Regards/Gruss,
> Boris.
>
> Sent from a fat crate under my desk. Formatting is fine.
> --
> --
> To unsubscribe from this list: send the line "unsubscribe linux-efi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-12-10 2:17 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-09 9:58 Shorten efi regions output Borislav Petkov
2014-12-09 9:58 ` Borislav Petkov
[not found] ` <20141209095843.GA3990-fF5Pk5pvG8Y@public.gmane.org>
2014-12-09 12:42 ` Ard Biesheuvel
2014-12-09 12:42 ` Ard Biesheuvel
[not found] ` <CAKv+Gu_F+o6NKb5JJ8ZQ7AJbjvASeQF1YcuUXv8seOMa5oaxgg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-12-09 12:48 ` Borislav Petkov
2014-12-09 12:48 ` Borislav Petkov
2014-12-09 15:35 ` Laszlo Ersek
2014-12-09 15:35 ` Laszlo Ersek
[not found] ` <548716C5.6000506-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-12-09 16:45 ` Borislav Petkov
2014-12-09 16:45 ` Borislav Petkov
2014-12-10 2:17 ` Dave Young [this message]
2014-12-10 2:17 ` Dave Young
[not found] ` <20141210021741.GA3280-4/PLUo9XfK+sDdueE5tM26fLeoKvNuZc@public.gmane.org>
2014-12-10 10:46 ` Borislav Petkov
2014-12-10 10:46 ` Borislav Petkov
[not found] ` <20141210104627.GA17053-fF5Pk5pvG8Y@public.gmane.org>
2015-01-05 14:03 ` Matt Fleming
2015-01-05 14:03 ` Matt Fleming
2015-01-05 15:00 ` Laszlo Ersek
2015-01-21 5:48 ` Jon Masters
[not found] ` <54BF3DCA.4070708-Zp4isUonpHBD60Wz+7aTrA@public.gmane.org>
2015-01-21 10:06 ` Borislav Petkov
2015-01-21 10:06 ` Borislav Petkov
2015-01-26 10:49 ` Matt Fleming
[not found] ` <20150126104936.GB3320-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2015-01-30 16:43 ` [PATCH] efi, x86: Add a "debug" option to the efi= cmdline Borislav Petkov
2015-01-30 16:43 ` Borislav Petkov
[not found] ` <20150130164309.GG1451-fF5Pk5pvG8Y@public.gmane.org>
2015-01-30 16:58 ` Laszlo Ersek
2015-01-30 16:58 ` Laszlo Ersek
2015-01-30 18:06 ` Randy Dunlap
2015-01-30 18:06 ` Randy Dunlap
[not found] ` <54CBC815.5060502-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-01-30 21:17 ` Borislav Petkov
2015-01-30 21:17 ` Borislav Petkov
2015-02-04 12:18 ` Parmeshwr Prasad
2015-02-04 12:18 ` Parmeshwr Prasad
2015-02-05 3:18 ` Dave Young
2015-02-05 3:18 ` Dave Young
[not found] ` <20150205031846.GA1903-4/PLUo9XfK/1wF9wiOj0lkEOCMrvLtNR@public.gmane.org>
2015-02-05 8:11 ` Borislav Petkov
2015-02-05 8:11 ` Borislav Petkov
[not found] ` <20150205081143.GA23980-fF5Pk5pvG8Y@public.gmane.org>
2015-02-05 8:41 ` Dave Young
2015-02-05 8:41 ` Dave Young
[not found] ` <20150205084139.GA23146-je1gSBvt1Tc/CGXRbJeUwh/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
2015-02-05 10:44 ` [PATCH v2] " Borislav Petkov
2015-02-05 10:44 ` Borislav Petkov
[not found] ` <20150205104441.GC23980-fF5Pk5pvG8Y@public.gmane.org>
2015-02-05 12:45 ` Parmeshwr Prasad
2015-02-05 12:45 ` Parmeshwr Prasad
2015-02-05 14:28 ` Borislav Petkov
[not found] ` <20150205142858.GH23980-fF5Pk5pvG8Y@public.gmane.org>
2015-02-06 6:00 ` Parmeshwr Prasad
2015-02-06 6:00 ` Parmeshwr Prasad
[not found] ` <20150206060007.GA26758-uSknhY0EtF8ok8EplQz5xE1Vg53cnbg30E9HWUfgJXw@public.gmane.org>
2015-02-06 10:49 ` Borislav Petkov
2015-02-06 10:49 ` Borislav Petkov
2015-02-24 22:33 ` Matt Fleming
2015-02-24 22:33 ` Matt Fleming
2015-04-02 12:27 ` [tip:core/efi] x86/efi: " tip-bot for Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141210021741.GA3280@darkstar.nay.redhat.com \
--to=dyoung-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org \
--cc=lersek-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=ricardo.neri-calderon-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.