From: Maxim Levitsky <mlevitsk@redhat.com>
To: Emanuele Giuseppe Esposito <eesposit@redhat.com>, kvm@vger.kernel.org
Cc: "Andrew Jones" <drjones@redhat.com>,
"Alexandru Elisei" <alexandru.elisei@arm.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Claudio Imbrenda" <imbrenda@linux.ibm.com>,
"Thomas Huth" <thuth@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Nico Boehr" <nrb@linux.ibm.com>,
"Cathy Avery" <cavery@redhat.com>,
"Janosch Frank" <frankja@linux.ibm.com>
Subject: Re: [kvm-unit-tests PATCH v3 21/27] svm: cleanup the default_prepare
Date: Tue, 06 Dec 2022 15:56:25 +0200 [thread overview]
Message-ID: <7d7f580b16f41688f7b483993e1d1ae026f41825.camel@redhat.com> (raw)
In-Reply-To: <297e66f8-3e6d-bcd4-2ce4-aeb25f6cb699@redhat.com>
On Fri, 2022-12-02 at 10:45 +0100, Emanuele Giuseppe Esposito wrote:
>
> 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@redhat.com>
> > ---
> > 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?
I had a version of the refactoring which removed all of these, but that made
the table of unit tests look ugly with all the NULL's there, which suggests
that this table should be rewrittern to use named initializers.
I decided to drop off this for now, so I'll do that later.
Best regards,
Maxim Levitsky
>
> >
> > 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)
> >
next prev parent reply other threads:[~2022-12-06 13:57 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-22 16:11 [kvm-unit-tests PATCH v3 00/27] kvm-unit-tests: set of fixes and new tests Maxim Levitsky
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 01/27] x86: replace irq_{enable|disable}() with sti()/cli() Maxim Levitsky
2022-12-01 13:46 ` Emanuele Giuseppe Esposito
2022-12-06 13:55 ` Maxim Levitsky
2022-12-06 14:15 ` Emanuele Giuseppe Esposito
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 02/27] x86: introduce sti_nop() and sti_nop_cli() Maxim Levitsky
2022-12-01 13:46 ` Emanuele Giuseppe Esposito
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 03/27] x86: add few helper functions for apic local timer Maxim Levitsky
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 04/27] svm: remove nop after stgi/clgi Maxim Levitsky
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 05/27] svm: make svm_intr_intercept_mix_if/gif test a bit more robust Maxim Levitsky
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 06/27] svm: use apic_start_timer/apic_stop_timer instead of open coding it Maxim Levitsky
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 07/27] x86: Add test for #SMI during interrupt window Maxim Levitsky
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 08/27] x86: Add a simple test for SYSENTER instruction Maxim Levitsky
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 09/27] svm: add simple nested shutdown test Maxim Levitsky
2022-12-01 13:46 ` Emanuele Giuseppe Esposito
2022-12-06 13:56 ` Maxim Levitsky
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 10/27] SVM: add two tests for exitintinto on exception Maxim Levitsky
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 11/27] lib: Add random number generator Maxim Levitsky
2022-11-23 9:28 ` Claudio Imbrenda
2022-11-23 12:54 ` Andrew Jones
2022-12-06 13:57 ` Maxim Levitsky
2022-12-06 14:07 ` Maxim Levitsky
2022-12-14 10:33 ` Claudio Imbrenda
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 12/27] x86: add IPI stress test Maxim Levitsky
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 13/27] svm: remove get_npt_pte extern Maxim Levitsky
2022-12-01 13:46 ` Emanuele Giuseppe Esposito
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 14/27] svm: move svm spec definitions to lib/x86/svm.h Maxim Levitsky
2022-12-01 13:54 ` Emanuele Giuseppe Esposito
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 15/27] svm: move some svm support functions into lib/x86/svm_lib.h Maxim Levitsky
2022-12-01 13:59 ` Emanuele Giuseppe Esposito
2022-12-06 14:10 ` Maxim Levitsky
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 16/27] svm: move setup_svm() to svm_lib.c Maxim Levitsky
2022-12-01 16:14 ` Emanuele Giuseppe Esposito
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 17/27] svm: correctly skip if NPT not supported Maxim Levitsky
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 18/27] svm: move vmcb_ident to svm_lib.c Maxim Levitsky
2022-12-01 16:18 ` Emanuele Giuseppe Esposito
2022-12-06 14:11 ` Maxim Levitsky
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 19/27] svm: rewerite vm entry macros Maxim Levitsky
2022-12-02 10:14 ` Emanuele Giuseppe Esposito
2022-12-06 13:56 ` Maxim Levitsky
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 20/27] svm: move v2 tests run into test_run Maxim Levitsky
2022-12-02 9:53 ` Emanuele Giuseppe Esposito
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 21/27] svm: cleanup the default_prepare Maxim Levitsky
2022-12-02 9:45 ` Emanuele Giuseppe Esposito
2022-12-06 13:56 ` Maxim Levitsky [this message]
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 22/27] svm: introduce svm_vcpu Maxim Levitsky
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 23/27] svm: introduce struct svm_test_context Maxim Levitsky
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 24/27] svm: use svm_test_context in v2 tests Maxim Levitsky
2022-12-02 10:27 ` Emanuele Giuseppe Esposito
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 25/27] svm: move nested vcpu to test context Maxim Levitsky
2022-12-02 10:22 ` Emanuele Giuseppe Esposito
2022-12-06 14:29 ` Maxim Levitsky
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 26/27] svm: move test_guest_func " Maxim Levitsky
2022-12-02 10:28 ` Emanuele Giuseppe Esposito
2022-11-22 16:11 ` [kvm-unit-tests PATCH v3 27/27] x86: ipi_stress: add optional SVM support Maxim Levitsky
2023-06-07 23:25 ` [kvm-unit-tests PATCH v3 00/27] kvm-unit-tests: set of fixes and new tests Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7d7f580b16f41688f7b483993e1d1ae026f41825.camel@redhat.com \
--to=mlevitsk@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=alexandru.elisei@arm.com \
--cc=cavery@redhat.com \
--cc=drjones@redhat.com \
--cc=eesposit@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=nrb@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox