All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: KVM devel mailing list <kvm@vger.kernel.org>
Cc: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] apparent KVM problem with LRET in TianoCore S3 resume trampoline
Date: Thu, 05 Dec 2013 17:50:03 +0100	[thread overview]
Message-ID: <52A0AEBB.4070701@redhat.com> (raw)
In-Reply-To: <52A0A5E0.3090802@redhat.com>

Small addition -- apologies for the self-followup:

On 12/05/13 17:12, Laszlo Ersek wrote:
> I tried to trace the problem with ftrace, but I didn't get any mentions of
> em_ret_far(). (Maybe I was looking in the wrong place.)

I applied the following small patch (to the original code):

diff --git a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/S3Asm.S b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/S3Asm.S
index e59fd04..daa4f7e 100644
--- a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/S3Asm.S
+++ b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/S3Asm.S
@@ -18,8 +18,8 @@ ASM_GLOBAL ASM_PFX(AsmTransferControl)
 ASM_PFX(AsmTransferControl):
     # rcx S3WakingVector    :DWORD
     # rdx AcpiLowMemoryBase :DWORD
-    lea   _AsmTransferControl_al_0000(%rip), %eax
-    movq  $0x2800000000, %r8
+    lea   AsmTransferControl(%rip), %eax
+    movq  $0x3800000000, %r8
     orq   %r8, %rax
     pushq %rax
     shrd  $20, %ecx, %ebx

This turns the code right under AsmTransferControl into a working, 64-bit mode
loop. (Recall that 0x38 selects a descriptor that has the L ("64-bitC") bit
set:

>   0x0038: 0x00AF9B000000FFFF: Base=0x00000000 Limit=0xFFFFF Type=0xB (C ER A     ) S=0x1 (code/data) DPL=0x0 Present=1 Avail=0 64-bitC=1 D/B=0 LimitGran=0x1 (4KB)
)

While this was spinning (I checked the RIP several times with the qemu monitor
and it was alternating between a few close values -- ie. not stuck), I ran
trace-cmd. The report seems to confirm that the lret is not emulated, because
the only lines I'm seeing are:

 qemu-system-x86-3901  [001] 38939.599663: kvm_exit:             reason EXTERNAL_INTERRUPT rip 0x9c75be0a info 0 800000ef
 qemu-system-x86-3901  [001] 38939.599684: kvm_entry:            vcpu 0

repeated infinitely. The rip varies between a few close values,

    458 rip 0x9c75be04
    313 rip 0x9c75be0a
      5 rip 0x9c75be17
      4 rip 0x9c75be18
      3 rip 0x9c75be22
      8 rip 0x9c75be28

Thanks again and sorry for the noise.
Laszlo

------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk

  reply	other threads:[~2013-12-05 16:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-05 16:12 [edk2] apparent KVM problem with LRET in TianoCore S3 resume trampoline Laszlo Ersek
2013-12-05 16:50 ` Laszlo Ersek [this message]
2013-12-05 17:42 ` Paolo Bonzini
2013-12-05 18:29   ` Laszlo Ersek
2013-12-06 12:03     ` Paolo Bonzini
2013-12-06 13:31       ` Paolo Bonzini
2013-12-06 13:46         ` Yao, Jiewen
2013-12-06 14:29           ` Paolo Bonzini
2013-12-06 14:47             ` Yao, Jiewen
2013-12-06 14:51               ` Paolo Bonzini
2013-12-06 13:31       ` Yao, Jiewen
2013-12-08 17:43       ` Laszlo Ersek
2013-12-08 22:15         ` Laszlo Ersek
2013-12-05 22:38   ` Laszlo Ersek
2013-12-05 22:53     ` Andrew Fish
2013-12-07 16:25     ` David Woodhouse

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=52A0AEBB.4070701@redhat.com \
    --to=lersek@redhat.com \
    --cc=edk2-devel@lists.sourceforge.net \
    --cc=kvm@vger.kernel.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.