[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e09869bc-ab5b-dd53-1d72-e103675418d1@redhat.com>
Date: Wed, 18 Oct 2017 11:26:01 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Brijesh Singh <brijesh.singh@....com>, x86@...nel.org,
kvm@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>,
Radim Krčmář <rkrcmar@...hat.com>,
Joerg Roedel <joro@...tes.org>, Borislav Petkov <bp@...e.de>,
Tom Lendacky <thomas.lendacky@....com>
Subject: Re: [Part2 PATCH v5 31/31] KVM: X86: Restart the guest when insn_len
is zero and SEV is enabled
On 04/10/2017 15:17, Brijesh Singh wrote:
> + /*
> + * On AMD platforms, under certain conditions insn_len may be zero on #NPF.
> + * This can happen if a guest gets a page-fault on data access but the HW
> + * table walker is not able to read the instruction page (e.g instruction
> + * page is not present in memory).
> + *
> + * Typically, when insn_len is zero, x86_emulate_instruction() walks the
> + * guest page table and fetches the instruction bytes from guest memory.
> + * When SEV is enabled, the guest memory is encrypted with guest-specific
> + * key hence hypervisor will not able to fetch the instruction bytes.
> + * In those cases we simply restart the guest.
> + */
> + if (unlikely(!insn_len) &&
> + kvm_x86_ops->mem_enc_enabled &&
> + kvm_x86_ops->mem_enc_enabled(vcpu))
> + return 1;
> +
Is it needed to test mem_enc_enabled? Could it instead test for the
availability of decode assists?
Thanks,
Paolo
Powered by blists - more mailing lists