From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/3] KVM: x86: Move #PF retry tracking variables into emulation context
Date: Fri, 21 Feb 2020 10:28:13 -0800 [thread overview]
Message-ID: <20200221182813.GK12665@linux.intel.com> (raw)
In-Reply-To: <d5626891-82f6-0a0c-401c-89a901a8455d@redhat.com>
On Fri, Feb 21, 2020 at 06:14:03PM +0100, Paolo Bonzini wrote:
> On 19/02/20 16:16, Sean Christopherson wrote:
> > The easy solution to that is to move retry_instruction() into emulate.c.
> > That would also allow making x86_page_table_writing_insn() static. All
> > other functions invoked from retry_instruction() are exposed via kvm_host.h.
>
> emulate.c is supposed to invoke no (or almost no) function outside the
> ctxt->ops struct. In particular, retry_instruction() invokes
> kvm_mmu_gva_to_gpa_write and kvm_mmu_unprotect_page.
Ah, right. We could split the logic, e.g.
if (x86_retry_pf_instruction(ctxt, cr2_or_gpa, emulation_type)) {
gpa_t = gpa = cr2_or_gpa;
if (!vcpu->arch.mmu->direct_map)
gpa = kvm_mmu_gva_to_gpa_write(vcpu, cr2_or_gpa, NULL);
kvm_mmu_unprotect_page(vcpu->kvm, gpa_to_gfn(gpa));
return 1;
}
but that's probably a net negative in terms of clarity. And there's also
vcpu->arch.write_fault_to_shadow_pgtable, which is consumed only by
reexecute_instruction(), and I 100% agree that that variable should stay
in vcpu->arch. Moving one flag used to retry #PF instructions and not the
other would be weird.
That was a long winded way of saying I agree we should drop this patch :-)
prev parent reply other threads:[~2020-02-21 18:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-18 23:03 [PATCH v2 0/3] KVM: x86: Minor emulator cleanup Sean Christopherson
2020-02-18 23:03 ` [PATCH v2 1/3] KVM: x86: Add EMULTYPE_PF when emulation is triggered by a page fault Sean Christopherson
2020-02-19 9:01 ` Xiaoyao Li
2020-02-20 20:11 ` Sean Christopherson
2020-02-21 2:59 ` Xiaoyao Li
2020-02-21 17:12 ` Paolo Bonzini
2020-02-18 23:03 ` [PATCH v2 2/3] KVM: x86: Move gpa_val and gpa_available into the emulator context Sean Christopherson
2020-02-18 23:03 ` [PATCH v2 3/3] KVM: x86: Move #PF retry tracking variables into emulation context Sean Christopherson
2020-02-19 8:13 ` Paolo Bonzini
2020-02-19 15:16 ` Sean Christopherson
2020-02-21 17:14 ` Paolo Bonzini
2020-02-21 18:28 ` Sean Christopherson [this message]
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=20200221182813.GK12665@linux.intel.com \
--to=sean.j.christopherson@intel.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.