* Re: [kvm-unit-t)ests PATCH] kvm-unit-tests: vmx: add a test for injecting events to halted L2
@ 2018-02-11 9:01 Liran Alon
2018-02-13 14:39 ` Paolo Bonzini
2018-02-14 11:47 ` Paolo Bonzini
0 siblings, 2 replies; 3+ messages in thread
From: Liran Alon @ 2018-02-11 9:01 UTC (permalink / raw)
To: chao.gao; +Cc: rkrcmar, pbonzini, kvm
----- chao.gao@intel.com wrote:
> This patch leverages existing "interrupt" tests. What the patch does
> is L1
> puts L2 in halt state and injects an event to L2. Then check a flag
> to
> identify whether event injection succeeds or not.
>
> Cc: Liran Alon <liran.alon@oracle.com>
> Signed-off-by: Chao Gao <chao.gao@intel.com>
> ---
> x86/vmx_tests.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
> index 0c3b5a7..3c46d3a 100644
> --- a/x86/vmx_tests.c
> +++ b/x86/vmx_tests.c
> @@ -1584,6 +1584,12 @@ static void interrupt_main(void)
> for (loops = 0; loops < 10000000 && !timer_fired; loops++)
> asm volatile ("nop");
> report("running a guest with interrupt acknowledgement set",
> timer_fired);
> +
> + apic_write(APIC_TMICT, 0);
> + irq_enable();
> + timer_fired = false;
> + vmcall();
> + report("Inject an event to a halted guest", timer_fired);
> }
>
> static int interrupt_exit_handler(void)
> @@ -1615,6 +1621,12 @@ static int interrupt_exit_handler(void)
> case 6:
> vmcs_write(GUEST_ACTV_STATE, ACTV_HLT);
> break;
> +
> + case 8:
> + vmcs_write(GUEST_ACTV_STATE, ACTV_HLT);
> + vmcs_write(ENT_INTR_INFO,
> + TIMER_VECTOR | INTR_INFO_VALID_MASK);
I would specify interrupt-type explicitly rather than implicitly.
Meaning passing here:
(TIMER_VECTOR |
(VMX_INTR_TYPE_EXT_INTR << INTR_INFO_INTR_TYPE_SHIFT) |
INTR_INFO_VALID_MASK)
> + break;
> }
> vmx_inc_test_stage();
> vmcs_write(GUEST_RIP, guest_rip + insn_len);
> --
> 1.9.1
Besides small comment above, looks good to me.
Reviewed-by: Liran Alon <liran.alon@oracle.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [kvm-unit-t)ests PATCH] kvm-unit-tests: vmx: add a test for injecting events to halted L2
2018-02-11 9:01 [kvm-unit-t)ests PATCH] kvm-unit-tests: vmx: add a test for injecting events to halted L2 Liran Alon
@ 2018-02-13 14:39 ` Paolo Bonzini
2018-02-14 11:47 ` Paolo Bonzini
1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2018-02-13 14:39 UTC (permalink / raw)
To: Liran Alon, chao.gao; +Cc: rkrcmar, kvm
On 11/02/2018 10:01, Liran Alon wrote:
>
> ----- chao.gao@intel.com wrote:
>
>> This patch leverages existing "interrupt" tests. What the patch does
>> is L1
>> puts L2 in halt state and injects an event to L2. Then check a flag
>> to
>> identify whether event injection succeeds or not.
>>
>> Cc: Liran Alon <liran.alon@oracle.com>
>> Signed-off-by: Chao Gao <chao.gao@intel.com>
>> ---
>> x86/vmx_tests.c | 12 ++++++++++++
>> 1 file changed, 12 insertions(+)
>>
>> diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
>> index 0c3b5a7..3c46d3a 100644
>> --- a/x86/vmx_tests.c
>> +++ b/x86/vmx_tests.c
>> @@ -1584,6 +1584,12 @@ static void interrupt_main(void)
>> for (loops = 0; loops < 10000000 && !timer_fired; loops++)
>> asm volatile ("nop");
>> report("running a guest with interrupt acknowledgement set",
>> timer_fired);
>> +
>> + apic_write(APIC_TMICT, 0);
>> + irq_enable();
>> + timer_fired = false;
>> + vmcall();
>> + report("Inject an event to a halted guest", timer_fired);
>> }
>>
>> static int interrupt_exit_handler(void)
>> @@ -1615,6 +1621,12 @@ static int interrupt_exit_handler(void)
>> case 6:
>> vmcs_write(GUEST_ACTV_STATE, ACTV_HLT);
>> break;
>> +
>> + case 8:
>> + vmcs_write(GUEST_ACTV_STATE, ACTV_HLT);
>> + vmcs_write(ENT_INTR_INFO,
>> + TIMER_VECTOR | INTR_INFO_VALID_MASK);
>
> I would specify interrupt-type explicitly rather than implicitly.
> Meaning passing here:
> (TIMER_VECTOR |
> (VMX_INTR_TYPE_EXT_INTR << INTR_INFO_INTR_TYPE_SHIFT) |
> INTR_INFO_VALID_MASK)
I'll do when applying. Thanks!
Paolo
>> + break;
>> }
>> vmx_inc_test_stage();
>> vmcs_write(GUEST_RIP, guest_rip + insn_len);
>> --
>> 1.9.1
>
> Besides small comment above, looks good to me.
> Reviewed-by: Liran Alon <liran.alon@oracle.com>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [kvm-unit-t)ests PATCH] kvm-unit-tests: vmx: add a test for injecting events to halted L2
2018-02-11 9:01 [kvm-unit-t)ests PATCH] kvm-unit-tests: vmx: add a test for injecting events to halted L2 Liran Alon
2018-02-13 14:39 ` Paolo Bonzini
@ 2018-02-14 11:47 ` Paolo Bonzini
1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2018-02-14 11:47 UTC (permalink / raw)
To: Liran Alon, chao.gao; +Cc: rkrcmar, kvm
On 11/02/2018 10:01, Liran Alon wrote:
>> @@ -1615,6 +1621,12 @@ static int interrupt_exit_handler(void)
>> case 6:
>> vmcs_write(GUEST_ACTV_STATE, ACTV_HLT);
>> break;
>> +
>> + case 8:
>> + vmcs_write(GUEST_ACTV_STATE, ACTV_HLT);
>> + vmcs_write(ENT_INTR_INFO,
>> + TIMER_VECTOR | INTR_INFO_VALID_MASK);
>
> I would specify interrupt-type explicitly rather than implicitly.
> Meaning passing here:
> (TIMER_VECTOR |
> (VMX_INTR_TYPE_EXT_INTR << INTR_INFO_INTR_TYPE_SHIFT) |
> INTR_INFO_VALID_MASK)
Agreed. Thanks for the review!
Paolo
>> + break;
>> }
>> vmx_inc_test_stage();
>> vmcs_write(GUEST_RIP, guest_rip + insn_len);
>> --
>> 1.9.1
>
> Besides small comment above, looks good to me.
> Reviewed-by: Liran Alon <liran.alon@oracle.com>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-02-14 11:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-11 9:01 [kvm-unit-t)ests PATCH] kvm-unit-tests: vmx: add a test for injecting events to halted L2 Liran Alon
2018-02-13 14:39 ` Paolo Bonzini
2018-02-14 11:47 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).