Re: [kvm-unit-tests PATCH v3 21/27] svm: cleanup the default_prepare

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Am 22/11/2022 um 17:11 schrieb Maxim Levitsky:
> default_prepare only calls vmcb_indent, which is called before
> each test anyway
> 
> Also don't call this now empty function from other
> .prepare functions
> 
> Signed-off-by: Maxim Levitsky <mlevitsk@xxxxxxxxxx>
> ---
>  x86/svm.c       |  1 -
>  x86/svm_tests.c | 18 ------------------
>  2 files changed, 19 deletions(-)
> 
> diff --git a/x86/svm.c b/x86/svm.c
> index 2ab553a5..5667402b 100644
> --- a/x86/svm.c
> +++ b/x86/svm.c
> @@ -30,7 +30,6 @@ bool default_supported(void)
>  
>  void default_prepare(struct svm_test *test)
>  {
> -	vmcb_ident(vmcb);
>  }

Makes sense removing it, but maybe remove the function alltogether since
it is not used anymore and then change test_run() to handle ->prepare ==
NULL?

>  
>  void default_prepare_gif_clear(struct svm_test *test)
> diff --git a/x86/svm_tests.c b/x86/svm_tests.c
> index 70e41300..3b68718e 100644
> --- a/x86/svm_tests.c
> +++ b/x86/svm_tests.c
> @@ -69,7 +69,6 @@ static bool check_vmrun(struct svm_test *test)
>  
>  static void prepare_rsm_intercept(struct svm_test *test)
>  {
> -	default_prepare(test);
>  	vmcb->control.intercept |= 1 << INTERCEPT_RSM;
>  	vmcb->control.intercept_exceptions |= (1ULL << UD_VECTOR);
>  }
> @@ -115,7 +114,6 @@ static bool finished_rsm_intercept(struct svm_test *test)
>  
>  static void prepare_cr3_intercept(struct svm_test *test)
>  {
> -	default_prepare(test);
>  	vmcb->control.intercept_cr_read |= 1 << 3;
>  }
>  
> @@ -149,7 +147,6 @@ static void corrupt_cr3_intercept_bypass(void *_test)
>  
>  static void prepare_cr3_intercept_bypass(struct svm_test *test)
>  {
> -	default_prepare(test);
>  	vmcb->control.intercept_cr_read |= 1 << 3;
>  	on_cpu_async(1, corrupt_cr3_intercept_bypass, test);
>  }
> @@ -169,7 +166,6 @@ static void test_cr3_intercept_bypass(struct svm_test *test)
>  
>  static void prepare_dr_intercept(struct svm_test *test)
>  {
> -	default_prepare(test);
>  	vmcb->control.intercept_dr_read = 0xff;
>  	vmcb->control.intercept_dr_write = 0xff;
>  }
> @@ -310,7 +306,6 @@ static bool check_next_rip(struct svm_test *test)
>  
>  static void prepare_msr_intercept(struct svm_test *test)
>  {
> -	default_prepare(test);
>  	vmcb->control.intercept |= (1ULL << INTERCEPT_MSR_PROT);
>  	vmcb->control.intercept_exceptions |= (1ULL << GP_VECTOR);
>  	memset(svm_get_msr_bitmap(), 0xff, MSR_BITMAP_SIZE);
> @@ -711,7 +706,6 @@ static bool tsc_adjust_supported(void)
>  
>  static void tsc_adjust_prepare(struct svm_test *test)
>  {
> -	default_prepare(test);
>  	vmcb->control.tsc_offset = TSC_OFFSET_VALUE;
>  
>  	wrmsr(MSR_IA32_TSC_ADJUST, -TSC_ADJUST_VALUE);
> @@ -811,7 +805,6 @@ static void svm_tsc_scale_test(void)
>  
>  static void latency_prepare(struct svm_test *test)
>  {
> -	default_prepare(test);
>  	runs = LATENCY_RUNS;
>  	latvmrun_min = latvmexit_min = -1ULL;
>  	latvmrun_max = latvmexit_max = 0;
> @@ -884,7 +877,6 @@ static bool latency_check(struct svm_test *test)
>  
>  static void lat_svm_insn_prepare(struct svm_test *test)
>  {
> -	default_prepare(test);
>  	runs = LATENCY_RUNS;
>  	latvmload_min = latvmsave_min = latstgi_min = latclgi_min = -1ULL;
>  	latvmload_max = latvmsave_max = latstgi_max = latclgi_max = 0;
> @@ -965,7 +957,6 @@ static void pending_event_prepare(struct svm_test *test)
>  {
>  	int ipi_vector = 0xf1;
>  
> -	default_prepare(test);
>  
>  	pending_event_ipi_fired = false;
>  
> @@ -1033,8 +1024,6 @@ static bool pending_event_check(struct svm_test *test)
>  
>  static void pending_event_cli_prepare(struct svm_test *test)
>  {
> -	default_prepare(test);
> -
>  	pending_event_ipi_fired = false;
>  
>  	handle_irq(0xf1, pending_event_ipi_isr);
> @@ -1139,7 +1128,6 @@ static void timer_isr(isr_regs_t *regs)
>  
>  static void interrupt_prepare(struct svm_test *test)
>  {
> -	default_prepare(test);
>  	handle_irq(TIMER_VECTOR, timer_isr);
>  	timer_fired = false;
>  	set_test_stage(test, 0);
> @@ -1272,7 +1260,6 @@ static void nmi_handler(struct ex_regs *regs)
>  
>  static void nmi_prepare(struct svm_test *test)
>  {
> -	default_prepare(test);
>  	nmi_fired = false;
>  	handle_exception(NMI_VECTOR, nmi_handler);
>  	set_test_stage(test, 0);
> @@ -1450,7 +1437,6 @@ static void my_isr(struct ex_regs *r)
>  
>  static void exc_inject_prepare(struct svm_test *test)
>  {
> -	default_prepare(test);
>  	handle_exception(DE_VECTOR, my_isr);
>  	handle_exception(NMI_VECTOR, my_isr);
>  }
> @@ -1519,7 +1505,6 @@ static void virq_isr(isr_regs_t *regs)
>  static void virq_inject_prepare(struct svm_test *test)
>  {
>  	handle_irq(0xf1, virq_isr);
> -	default_prepare(test);
>  	vmcb->control.int_ctl = V_INTR_MASKING_MASK | V_IRQ_MASK |
>  		(0x0f << V_INTR_PRIO_SHIFT); // Set to the highest priority
>  	vmcb->control.int_vector = 0xf1;
> @@ -1682,7 +1667,6 @@ static void reg_corruption_isr(isr_regs_t *regs)
>  
>  static void reg_corruption_prepare(struct svm_test *test)
>  {
> -	default_prepare(test);
>  	set_test_stage(test, 0);
>  
>  	vmcb->control.int_ctl = V_INTR_MASKING_MASK;
> @@ -1877,7 +1861,6 @@ static void host_rflags_db_handler(struct ex_regs *r)
>  
>  static void host_rflags_prepare(struct svm_test *test)
>  {
> -	default_prepare(test);
>  	handle_exception(DB_VECTOR, host_rflags_db_handler);
>  	set_test_stage(test, 0);
>  }
> @@ -2610,7 +2593,6 @@ static void svm_vmload_vmsave(void)
>  
>  static void prepare_vgif_enabled(struct svm_test *test)
>  {
> -	default_prepare(test);
>  }
>  
>  static void test_vgif(struct svm_test *test)
> 




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux