[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALMp9eRzMC=6hFUeDP9V_CnJ29EbrC6KzWNXzbAsq7Uqqr=f6g@mail.gmail.com>
Date: Wed, 10 Jun 2020 10:11:38 -0700
From: Jim Mattson <jmattson@...gle.com>
To: Vitaly Kuznetsov <vkuznets@...hat.com>
Cc: kvm list <kvm@...r.kernel.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <sean.j.christopherson@...el.com>,
Wanpeng Li <wanpengli@...cent.com>,
Marcelo Bandeira Condotta <mcondotta@...hat.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] KVM: selftests: fix sync_with_host() in smm_test
On Wed, Jun 10, 2020 at 9:41 AM Vitaly Kuznetsov <vkuznets@...hat.com> wrote:
>
> It was reported that older GCCs compile smm_test in a way that breaks
> it completely:
>
> kvm_exit: reason EXIT_CPUID rip 0x4014db info 0 0
> func 7ffffffd idx 830 rax 0 rbx 0 rcx 0 rdx 0, cpuid entry not found
> ...
> kvm_exit: reason EXIT_MSR rip 0x40abd9 info 0 0
> kvm_msr: msr_read 487 = 0x0 (#GP)
> ...
>
> Note, '7ffffffd' was supposed to be '80000001' as we're checking for
> SVM. Dropping '-O2' from compiler flags help. Turns out, asm block in
> sync_with_host() is wrong. We us 'in 0xe, %%al' instruction to sync
> with the host and in 'AL' register we actually pass the parameter
> (stage) but after sync 'AL' gets written to but GCC thinks the value
> is still there and uses it to compute 'EAX' for 'cpuid'.
That smells like VMware's hypercall madness!
> smm_test can't fully use standard ucall() framework as we need to
> write a very simple SMI handler there. Fix the immediate issue by
> making RAX input/output operand. While on it, make sync_with_host()
> static inline.
>
> Reported-by: Marcelo Bandeira Condotta <mcondotta@...hat.com>
> Signed-off-by: Vitaly Kuznetsov <vkuznets@...hat.com>
Reviewed-by: Jim Mattson <jmattson@...gle.com>
Powered by blists - more mailing lists