From patchwork Thu Dec 5 16:50:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 3289201 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4E5A1C0D4A for ; Thu, 5 Dec 2013 16:50:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 30BFB2050E for ; Thu, 5 Dec 2013 16:50:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8629E2050B for ; Thu, 5 Dec 2013 16:50:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756885Ab3LEQuT (ORCPT ); Thu, 5 Dec 2013 11:50:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41714 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756771Ab3LEQuS (ORCPT ); Thu, 5 Dec 2013 11:50:18 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rB5Go4U5021378 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 5 Dec 2013 11:50:05 -0500 Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-49.ams2.redhat.com [10.36.116.49]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id rB5Go38H012970; Thu, 5 Dec 2013 11:50:04 -0500 Message-ID: <52A0AEBB.4070701@redhat.com> Date: Thu, 05 Dec 2013 17:50:03 +0100 From: Laszlo Ersek User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131118 Thunderbird/17.0.11 MIME-Version: 1.0 To: KVM devel mailing list CC: edk2-devel@lists.sourceforge.net Subject: Re: [edk2] apparent KVM problem with LRET in TianoCore S3 resume trampoline References: <52A0A5E0.3090802@redhat.com> In-Reply-To: <52A0A5E0.3090802@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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): 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 --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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