[edk2] KVM: MTRR: fix memory type handling if MTRR is completely disabled
diff mbox

Message ID 561DD2EC.5040800@linux.intel.com
State New
Headers show

Commit Message

Xiao Guangrong Oct. 14, 2015, 3:58 a.m. UTC
Janusz,

Could you please try this:

$ git diff

To see if the issue still there?


On 10/02/2015 10:38 PM, Janusz wrote:
> W dniu 01.10.2015 o 16:18, Paolo Bonzini pisze:
>>
>> On 01/10/2015 16:12, Janusz wrote:
>>> Now, I can also add, that the problem is only when I allow VM to use
>>> more than one core, so with option  for example:
>>> -smp 8,cores=4,threads=2,sockets=1 and other combinations like -smp
>>> 4,threads=1 its not working, and without it I am always running VM
>>> without problems
>>>
>>> Any ideas what can it be? or any idea what would help to find out what
>>> is causing this?
>> I am going to send a revert of the patch tomorrow.
>>
>> Paolo
> Thanks, but revert patch doesn't help, so something else is wrong here
>
--
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

Comments

Janusz Oct. 14, 2015, 7:37 a.m. UTC | #1
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

W dniu 14.10.2015 o 05:58, Xiao Guangrong pisze:
>
> Janusz,
>
> Could you please try this:
>
> $ git diff
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 185fc16..bdd564f 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -4957,12 +4957,14 @@ static int handle_emulation_failure(struct
> kvm_vcpu *vcpu)
>
>         ++vcpu->stat.insn_emulation_fail;
>         trace_kvm_emulate_insn_failed(vcpu);
> +#if 0
>         if (!is_guest_mode(vcpu) && kvm_x86_ops->get_cpl(vcpu) == 0) {
>                 vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
>                 vcpu->run->internal.suberror =
> KVM_INTERNAL_ERROR_EMULATION;
>                 vcpu->run->internal.ndata = 0;
>                 r = EMULATE_FAIL;
>         }
> +#endif
>         kvm_queue_exception(vcpu, UD_VECTOR);
>
>         return r;
>
> To see if the issue still there?
>
>
> On 10/02/2015 10:38 PM, Janusz wrote:
>> W dniu 01.10.2015 o 16:18, Paolo Bonzini pisze:
>>>
>>> On 01/10/2015 16:12, Janusz wrote:
>>>> Now, I can also add, that the problem is only when I allow VM to use
>>>> more than one core, so with option  for example:
>>>> -smp 8,cores=4,threads=2,sockets=1 and other combinations like -smp
>>>> 4,threads=1 its not working, and without it I am always running VM
>>>> without problems
>>>>
>>>> Any ideas what can it be? or any idea what would help to find out what
>>>> is causing this?
>>> I am going to send a revert of the patch tomorrow.
>>>
>>> Paolo
>> Thanks, but revert patch doesn't help, so something else is wrong here
>>

--
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
Xiao Guangrong Oct. 14, 2015, 8:24 a.m. UTC | #2
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...

>
> W dniu 14.10.2015 o 05:58, Xiao Guangrong pisze:
>>
>> Janusz,
>>
>> Could you please try this:
>>
>> $ git diff
>> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
>> index 185fc16..bdd564f 100644
>> --- a/arch/x86/kvm/x86.c
>> +++ b/arch/x86/kvm/x86.c
>> @@ -4957,12 +4957,14 @@ static int handle_emulation_failure(struct
>> kvm_vcpu *vcpu)
>>
>>          ++vcpu->stat.insn_emulation_fail;
>>          trace_kvm_emulate_insn_failed(vcpu);
>> +#if 0
>>          if (!is_guest_mode(vcpu) && kvm_x86_ops->get_cpl(vcpu) == 0) {
>>                  vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
>>                  vcpu->run->internal.suberror =
>> KVM_INTERNAL_ERROR_EMULATION;
>>                  vcpu->run->internal.ndata = 0;
>>                  r = EMULATE_FAIL;
>>          }
>> +#endif
>>          kvm_queue_exception(vcpu, UD_VECTOR);
>>
>>          return r;
>>
>> To see if the issue still there?
>>
>>
>> On 10/02/2015 10:38 PM, Janusz wrote:
>>> W dniu 01.10.2015 o 16:18, Paolo Bonzini pisze:
>>>>
>>>> On 01/10/2015 16:12, Janusz wrote:
>>>>> Now, I can also add, that the problem is only when I allow VM to use
>>>>> more than one core, so with option  for example:
>>>>> -smp 8,cores=4,threads=2,sockets=1 and other combinations like -smp
>>>>> 4,threads=1 its not working, and without it I am always running VM
>>>>> without problems
>>>>>
>>>>> Any ideas what can it be? or any idea what would help to find out what
>>>>> is causing this?
>>>> I am going to send a revert of the patch tomorrow.
>>>>
>>>> Paolo
>>> Thanks, but revert patch doesn't help, so something else is wrong here
>>>
>
>
--
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
Xiao Guangrong Oct. 14, 2015, 8:32 a.m. UTC | #3
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...
Janusz Oct. 14, 2015, 9:13 a.m. UTC | #4
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 attach my script. I see that you are using pc-i440fx-2.1 - I use
default, I think its pc-i440fx-2.4, tried 2.3 some time ago and I get
the same problem. I will try with 2.1 after work
I am using  master from main kernel  tree, will also try this tree you
mentioned after work
Janusz Oct. 14, 2015, 9:16 a.m. UTC | #5
W dniu 14.10.2015 o 11:13, Janusz pisze:
> 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 attach my script. I see that you are using pc-i440fx-2.1 - I use
> default, I think its pc-i440fx-2.4, tried 2.3 some time ago and I get
> the same problem. I will try with 2.1 after work
> I am using  master from main kernel  tree, will also try this tree you
> mentioned after work
I am sending this one more time, as my message was rejected by intel
servers because of attached script... Script:
https://bpaste.net/show/8467c3af8b18
--
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
Laszlo Ersek Oct. 14, 2015, 9:47 a.m. UTC | #6
On 10/14/15 10:32, Xiao Guangrong wrote:
> 
> 
> 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

Wow! Someone actually cares about the whitepaper. Thank you. :)

Laszlo

> 
> My test script is attached, and i will try to build the env like yours
> as much
> as possible...

--
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
Janusz Oct. 14, 2015, 6:08 p.m. UTC | #7
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

--
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
Xiao Guangrong Oct. 15, 2015, 3:59 a.m. UTC | #8
On 10/14/2015 05:47 PM, Laszlo Ersek wrote:
> On 10/14/15 10:32, Xiao Guangrong wrote:
>>
>>
>> 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
>
> Wow! Someone actually cares about the whitepaper. Thank you. :)

:)

The document is really useful to me, thanks for your contribution.

--
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

Patch
diff mbox

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 185fc16..bdd564f 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4957,12 +4957,14 @@  static int handle_emulation_failure(struct kvm_vcpu *vcpu)

         ++vcpu->stat.insn_emulation_fail;
         trace_kvm_emulate_insn_failed(vcpu);
+#if 0
         if (!is_guest_mode(vcpu) && kvm_x86_ops->get_cpl(vcpu) == 0) {
                 vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
                 vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION;
                 vcpu->run->internal.ndata = 0;
                 r = EMULATE_FAIL;
         }
+#endif
         kvm_queue_exception(vcpu, UD_VECTOR);

         return r;