public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>, edk2-devel@lists.01.org
Cc: Jordan Justen <jordan.l.justen@intel.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: Re: [PATCH v3 3/3] OvmfPkg: save on I/O port accesses when the debug port is not in use
Date: Fri, 17 Nov 2017 18:37:01 +0100	[thread overview]
Message-ID: <068f9ac6-2fd2-d412-2eae-b84bb1a545c2@redhat.com> (raw)
In-Reply-To: <20171116203100.28085-4-pbonzini@redhat.com>

On 11/16/17 21:31, Paolo Bonzini wrote:
> When SEV is enabled, every debug message printed by OVMF to the
> QEMU debug port traps from the guest to QEMU character by character
> because "REP OUTSB" cannot be used by IoWriteFifo8.  Furthermore,
> when OVMF is built with the DEBUG_VERBOSE bit (value 0x00400000)
> enabled in "gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel", then the
> OvmfPkg/IoMmuDxe driver, and the OvmfPkg/Library/BaseMemEncryptSevLib
> library instance that is built into it, produce a huge amount of
> log messages.  Therefore, in SEV guests, the boot time impact is huge
> (about 45 seconds _additional_ time spent writing to the debug port).
> 
> While these messages are very useful for analyzing guest behavior,
> most of the time the user won't be capturing the OVMF debug log.
> In fact libvirt does not provide a method for configuring log capture;
> users that wish to do this (or are instructed to do this) have to resort
> to <qemu:arg>.
> 
> The debug console device provides a handy detection mechanism; when read,
> it returns 0xE9 (which is very much unlike the 0xFF that is returned by
> an unused port).  Use it to skip the possibly expensive OUT instructions
> when the debug I/O port isn't plugged anywhere.
> 
> For SEC, the debug port has to be read before each full message.
> However:
> 
> - if the debug port is available, then reading one byte before writing
> a full message isn't tragic, especially because SEC doesn't print many
> messages
> 
> - if the debug port is not available, then reading one byte instead of
> writing a full message is still a win.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Jordan Justen (Intel address) <jordan.l.justen@intel.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  .../PlatformDebugLibIoPort/DebugLibDetect.h        | 57 ++++++++++++++++++++++
>  OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c  | 28 +++++++++--
>  .../PlatformDebugLibIoPort/DebugLibDetect.c        | 30 ++++++++++--
>  .../PlatformDebugLibIoPort/DebugLibDetectRom.c     | 21 +++++++-
>  4 files changed, 127 insertions(+), 9 deletions(-)
>  create mode 100644 OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h

(looks like you didn't pick up my T-b from the v2 review for this patch;
I'm adding that back in)


  parent reply	other threads:[~2017-11-17 17:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-16 20:30 [PATCH v3 0/3] OvmfPkg: save on I/O port accesses when the debug port is not in use Paolo Bonzini
2017-11-16 20:30 ` [PATCH v3 1/3] OvmfPkg: make PlatformDebugLibIoPort a proper BASE library Paolo Bonzini
2017-11-17 17:21   ` Laszlo Ersek
2017-11-16 20:30 ` [PATCH v3 2/3] OvmfPkg: create a separate PlatformDebugLibIoPort instance for SEC Paolo Bonzini
2017-11-17 17:25   ` Laszlo Ersek
2017-11-16 20:31 ` [PATCH v3 3/3] OvmfPkg: save on I/O port accesses when the debug port is not in use Paolo Bonzini
2017-11-17 17:32   ` Laszlo Ersek
2017-11-17 17:37   ` Laszlo Ersek [this message]
2017-11-17 17:48 ` [PATCH v3 0/3] " Laszlo Ersek

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-list 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=068f9ac6-2fd2-d412-2eae-b84bb1a545c2@redhat.com \
    --to=devel@edk2.groups.io \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox