public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 00/12] Introduce Bootlog DEBUG() output
@ 2022-05-27  2:43 Alexander Graf
  2022-05-27  2:43 ` [PATCH 01/12] MdePkg: Add DebugBootlog header Alexander Graf
                   ` (12 more replies)
  0 siblings, 13 replies; 16+ messages in thread
From: Alexander Graf @ 2022-05-27  2:43 UTC (permalink / raw)
  To: devel; +Cc: Ard Biesheuvel, Leif Lindholm, Dandan Bi, Zhichao Gao, Liming Gao

I recently looked at improving the bootup performance of virtual machines
and was amazed by the fact that there is no logging / tracing framework
available that would give me a full picture of the Pre-OS phase including
time stamps and boot loaders (such as grub) without writing data to the
serial port - which taints all measurements.

The only place that I did find was PerformanceLib, which creates an FPDT.
I had 2 problems with that though:

  1) Discoverability - The best debugging tools give you all information
     you need as quickly as possible. The sub table FBPT which contains
     performance data is very condensed: It contains a modules GUID and up
     to 24 bytes of text per entry. Entries are limited to 255 bytes. It
     also only logs load events by default, nothing as fancy as FS reads.

  2) Ease of use - The best kernel engineers I know still use printk()
     and trace_printk() to identify issues: Because it's easy. You can
     quickly extract data into text and analyze later.

  3) Extensability to other payloads - The FPDT infrastructure considers
     everything as owned by PerformanceLib. I would like to create a one
     stop place for arbitrary UEFI applications to also put performance
     measurement data.

So I wrote a small configuration table (very similar to FPDT) that
contains references to boot logs, each with an array of strings as well
as time stamp. This patch set contains everything needed to set this up
and hook it into the 2 main DebugLib implementations in virtual machines:
Serial and DebugIO. That way, I can see every debug message after boot
with time stamp included, with very little impact on boot time.

I tried to see if I can call PERF_EVENT() instead of my Bootlog
infrastructure, but was unsuccessful. Let's use this patch set to open
the conversation on how to best move forward.

Eventually, I want to be able to log into Linux, fetch a sysfs file and
get a human readable, synchronized, time stamped log file with enough
information that allow me to create at least a bug report against the
actual firmware owner.


Github: https://github.com/agraf/edk2/tree/bootlog-v1

Alex


Alexander Graf (12):
  MdePkg: Add DebugBootlog header
  MdePkg: Add Null BaseDebugBootlog
  MdePkg: Add Fallback timer support for BaseDebugBootlog
  MdePkg: Add X86 timer support for BaseDebugBootlog
  MdePkg: Add ARM timer support for BaseDebugBootlog
  MdePkg: Add Pei phase BaseDebugBootlog
  MdePkg: Add Dxe phase BaseDebugBootlog
  MdePkg: Add BaseDebugLibBootlog
  Scripts: Add bootlog decyphering script
  BaseDebugLibSerialPort: Include BaseDebugBootlog in all dscs
  BaseDebugLibSerialPort: Emit messages to boot log
  OvmfPkg/PlatformDebugLibIoPort: Add Bootlog support

 ArmVirtPkg/ArmVirt.dsc.inc                    |   5 +
 BaseTools/Scripts/ShowDebugLog.py             |  88 +++++
 EmulatorPkg/EmulatorPkg.dsc                   |   3 +
 IntelFsp2Pkg/Tools/Tests/QemuFspPkg.dsc       |   1 +
 MdePkg/Include/Library/DebugBootlog.h         | 141 +++++++
 .../BaseDebugBootlog/BaseDebugBootlog.h       |  43 +++
 .../BaseDebugBootlog/BaseDebugBootlogLib.inf  |  61 +++
 .../BaseDebugBootlogLibPei.inf                |  60 +++
 .../BaseDebugBootlogNullLib.inf               |  26 ++
 .../Library/BaseDebugBootlog/DebugBootlog.c   |  22 ++
 .../BaseDebugBootlog/DebugBootlogArm.c        |  32 ++
 .../BaseDebugBootlog/DebugBootlogDxe.c        | 349 ++++++++++++++++++
 .../BaseDebugBootlog/DebugBootlogNotime.c     |  31 ++
 .../BaseDebugBootlog/DebugBootlogNull.c       |  32 ++
 .../BaseDebugBootlog/DebugBootlogPei.c        |  36 ++
 .../BaseDebugBootlog/DebugBootlogX86.c        |  50 +++
 .../BaseDebugLibBootlog.inf                   |  44 +++
 .../BaseDebugLibBootlog.uni                   |  17 +
 MdePkg/Library/BaseDebugLibBootlog/DebugLib.c | 338 +++++++++++++++++
 .../BaseDebugLibSerialPort.inf                |   1 +
 .../Library/BaseDebugLibSerialPort/DebugLib.c |  22 +-
 MdePkg/MdePkg.dec                             |  29 ++
 OvmfPkg/AmdSev/AmdSevX64.dsc                  |  10 +
 OvmfPkg/Bhyve/BhyveX64.dsc                    |  10 +
 OvmfPkg/CloudHv/CloudHvX64.dsc                |  10 +
 OvmfPkg/IntelTdx/IntelTdxX64.dsc              |   8 +
 .../Library/PlatformDebugLibIoPort/DebugLib.c |  23 +-
 .../PlatformDebugLibIoPort.inf                |   1 +
 .../PlatformRomDebugLibIoPort.inf             |   1 +
 .../PlatformRomDebugLibIoPortNocheck.inf      |   1 +
 OvmfPkg/Microvm/MicrovmX64.dsc                |  10 +
 OvmfPkg/OvmfPkgIa32.dsc                       |  10 +
 OvmfPkg/OvmfPkgIa32X64.dsc                    |  10 +
 OvmfPkg/OvmfPkgX64.dsc                        |   7 +
 OvmfPkg/OvmfXen.dsc                           |   1 +
 SourceLevelDebugPkg/SourceLevelDebugPkg.dsc   |   1 +
 UefiPayloadPkg/UefiPayloadPkg.dsc             |   1 +
 37 files changed, 1526 insertions(+), 9 deletions(-)
 create mode 100755 BaseTools/Scripts/ShowDebugLog.py
 create mode 100644 MdePkg/Include/Library/DebugBootlog.h
 create mode 100644 MdePkg/Library/BaseDebugBootlog/BaseDebugBootlog.h
 create mode 100644 MdePkg/Library/BaseDebugBootlog/BaseDebugBootlogLib.inf
 create mode 100644 MdePkg/Library/BaseDebugBootlog/BaseDebugBootlogLibPei.inf
 create mode 100644 MdePkg/Library/BaseDebugBootlog/BaseDebugBootlogNullLib.inf
 create mode 100644 MdePkg/Library/BaseDebugBootlog/DebugBootlog.c
 create mode 100644 MdePkg/Library/BaseDebugBootlog/DebugBootlogArm.c
 create mode 100644 MdePkg/Library/BaseDebugBootlog/DebugBootlogDxe.c
 create mode 100644 MdePkg/Library/BaseDebugBootlog/DebugBootlogNotime.c
 create mode 100644 MdePkg/Library/BaseDebugBootlog/DebugBootlogNull.c
 create mode 100644 MdePkg/Library/BaseDebugBootlog/DebugBootlogPei.c
 create mode 100644 MdePkg/Library/BaseDebugBootlog/DebugBootlogX86.c
 create mode 100644 MdePkg/Library/BaseDebugLibBootlog/BaseDebugLibBootlog.inf
 create mode 100644 MdePkg/Library/BaseDebugLibBootlog/BaseDebugLibBootlog.uni
 create mode 100644 MdePkg/Library/BaseDebugLibBootlog/DebugLib.c

-- 
2.28.0.394.ge197136389




Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879




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

end of thread, other threads:[~2022-06-02  8:35 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-27  2:43 [PATCH 00/12] Introduce Bootlog DEBUG() output Alexander Graf
2022-05-27  2:43 ` [PATCH 01/12] MdePkg: Add DebugBootlog header Alexander Graf
2022-05-27  2:43 ` [PATCH 02/12] MdePkg: Add Null BaseDebugBootlog Alexander Graf
2022-05-27  2:43 ` [PATCH 03/12] MdePkg: Add Fallback timer support for BaseDebugBootlog Alexander Graf
2022-05-27  2:43 ` [PATCH 04/12] MdePkg: Add X86 " Alexander Graf
2022-05-27  2:43 ` [PATCH 05/12] MdePkg: Add ARM " Alexander Graf
2022-05-27  2:43 ` [PATCH 06/12] MdePkg: Add Pei phase BaseDebugBootlog Alexander Graf
2022-05-27  2:43 ` [PATCH 07/12] MdePkg: Add Dxe " Alexander Graf
2022-05-27  2:43 ` [PATCH 08/12] MdePkg: Add BaseDebugLibBootlog Alexander Graf
2022-05-27  2:43 ` [PATCH 09/12] Scripts: Add bootlog decyphering script Alexander Graf
2022-05-27  2:43 ` [PATCH 10/12] BaseDebugLibSerialPort: Include BaseDebugBootlog in all dscs Alexander Graf
2022-05-27  2:43 ` [PATCH 11/12] BaseDebugLibSerialPort: Emit messages to boot log Alexander Graf
2022-05-27  2:43 ` [PATCH 12/12] OvmfPkg/PlatformDebugLibIoPort: Add Bootlog support Alexander Graf
2022-06-01  9:33 ` [edk2-devel] [PATCH 00/12] Introduce Bootlog DEBUG() output Gerd Hoffmann
2022-06-01 16:58   ` Benjamin Doron
2022-06-02  8:35     ` Gerd Hoffmann

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