From patchwork Thu Oct 15 04:19:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Guangrong X-Patchwork-Id: 7401061 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 95525BEEA4 for ; Thu, 15 Oct 2015 04:25:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AEF7A2053E for ; Thu, 15 Oct 2015 04:25:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6EE4B2052C for ; Thu, 15 Oct 2015 04:25:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753626AbbJOEZp (ORCPT ); Thu, 15 Oct 2015 00:25:45 -0400 Received: from mga03.intel.com ([134.134.136.65]:47654 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752291AbbJOEZo (ORCPT ); Thu, 15 Oct 2015 00:25:44 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP; 14 Oct 2015 21:25:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,684,1437462000"; d="scan'208";a="811386494" Received: from xiao.sh.intel.com ([10.239.159.86]) by fmsmga001.fm.intel.com with ESMTP; 14 Oct 2015 21:25:42 -0700 Subject: Re: [edk2] KVM: MTRR: fix memory type handling if MTRR is completely disabled To: Janusz , Paolo Bonzini , Wanpeng Li , Laszlo Ersek , kvm@vger.kernel.org References: <55FBDB6D.4040207@gmail.com> <55FBE248.4010809@redhat.com> <55FC4E6F.8030104@gmail.com> <55FF7095.5060106@linux.intel.com> <55FF7C41.7070400@linux.intel.com> <560D3F31.5000703@gmail.com> <560D40C2.5080205@redhat.com> <560E96D8.9080007@gmail.com> <561DD2EC.5040800@linux.intel.com> <561E0655.8080508@gmail.com> <561E1121.7030502@linux.intel.com> <561E1329.5080109@linux.intel.com> <561E9A36.3080302@gmail.com> Cc: edk2-devel@ml01.01.org From: Xiao Guangrong Message-ID: <561F2952.5060300@linux.intel.com> Date: Thu, 15 Oct 2015 12:19:30 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <561E9A36.3080302@gmail.com> 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, T_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 On 10/15/2015 02:08 AM, Janusz wrote: > W dniu 14.10.2015 o 10:32, Xiao Guangrong pisze: >> >> >> On 10/14/2015 04:24 PM, Xiao Guangrong wrote: >>> >>> >>> On 10/14/2015 03:37 PM, Janusz wrote: >>>> I was able to run my virtual machine with this, but had very high cpu >>>> usage when something happen in it like booting system. once, my virtual >>>> machine hang and I couln't even get my mouse / keyboard back from qemu. >>>> When I did vga passthrough, I didn't get any video output, and cpu >>>> usage >>>> was also high. Tried it on 4.3 >>> >>> Which tree are you using? Is it kvm tree? >>> Could you please work on queue brancn on current kvm tree based on >>> top commit 73917739334c6509: KVM: x86: fix SMI to halted VCPU. >>> >>> Hmm... interesting, this diff works on my box... >> >> Forgot to say that i built my test env following the instructions on >> kvm-wiki: >> http://www.linux-kvm.org/page/OVMF >> >> My test script is attached, and i will try to build the env like yours >> as much >> as possible... > I cloned git://git.kernel.org/pub/scm/virt/kvm/kvm.git 73917739334c6509 > commit, but this is breaking my system... > Slim is not able to start i3, xdm is not killing X when I stop xdm, qemu > is not able to start when I don't use option -nographic > log from qemu on that kernel version: > xcb_connection_has_error() returned true > No protocol specified > Could not initialize SDL(No available video device) - exiting > > On main kernel branch I don't have those problems. > > I tried to run with -nographic, and tried pc-i440fx-2.1 but the same > problem as before, high cpu usage and no graphic on my GPU. > I don't know if that will help by this is my log from option -global > isa-debugcon.iobase=0x402 -debugcon file:fedora.ovmf.log: > https://bpaste.net/show/36c54dba68c2 Well, the bug may be not in KVM. When this bug happened, i saw OVMF only checked 1 CPU out, there is the log from OVMF's debug input: Flushing GCD Flushing GCD Flushing GCD Flushing GCD Flushing GCD Flushing GCD Flushing GCD Flushing GCD Flushing GCD Flushing GCDs Detect CPU count: 1 So that the startup code has been freed however the APs are still running, i think that why we saw the vCPUs executed on unexpected address. After digging into OVMF's code, i noticed that BSP CPU waits for APs for a fixed timer period, however, KVM recent changes require zap all mappings if CR0.CD is changed, that means the APs need more time to startup. After following changes to OVMF, the bug is completely gone on my side: previous kernel to do this test. --- 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 --- a/UefiCpuPkg/CpuDxe/ApStartup.c +++ b/UefiCpuPkg/CpuDxe/ApStartup.c @@ -454,7 +454,9 @@ StartApsStackless ( // // Wait 100 milliseconds for APs to arrive at the ApEntryPoint routine // - MicroSecondDelay (100 * 1000); + MicroSecondDelay (10 * 100 * 1000); return EFI_SUCCESS; } Janusz, could you please check this instead? You can switch to your