From: Paolo Bonzini <pbonzini@redhat.com>
To: Emanuele Giuseppe Esposito <eesposit@redhat.com>, kvm@vger.kernel.org
Cc: Maxim Levitsky <mlevitsk@redhat.com>,
Sean Christopherson <seanjc@google.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 1/2] nSVM: introduce struct vmcb_ctrl_area_cached
Date: Tue, 28 Sep 2021 18:14:49 +0200 [thread overview]
Message-ID: <05425bd8-46dc-f136-fbe0-52f42351aea1@redhat.com> (raw)
In-Reply-To: <20210917124956.2042052-2-eesposit@redhat.com>
On 17/09/21 14:49, Emanuele Giuseppe Esposito wrote:
> +static inline bool vmcb_is_intercept_cached(struct vmcb_ctrl_area_cached *control, u32 bit)
> +{
> + return vmcb_is_intercept((struct vmcb_control_area *) control,
> + bit);
> +}
> +
This is quite dangerous, because it expects that the offset is the same
between vmcb_control_area and vmcb_ctrl_area_cached. You can just
duplicate the implementation (which is essentially just a test_bit), and
call the function
static inline bool vmcb12_is_intercept(struct kvm_vcpu *vcpu, u32 bit)
Likewise, nested_vmcb_check_controls can just take the vcpu since you
moved nested_load_control_from_vmcb12 earlier.
Finally, copy_vmcb_control_area can be inlined, and its caller
nested_load_control_from_vmcb12 can stop copying the ASID. There is
only one call to it since commit 4995a3685f1b ("KVM: SVM: Use a separate
vmcb for the nested L2 guest", 2021-03-15).
Thanks,
Paolo
next prev parent reply other threads:[~2021-09-28 16:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-17 12:49 [RFC PATCH 0/2] KVM: nSVM: use vmcb_ctrl_area_cached instead Emanuele Giuseppe Esposito
2021-09-17 12:49 ` [RFC PATCH 1/2] nSVM: introduce struct vmcb_ctrl_area_cached Emanuele Giuseppe Esposito
2021-09-28 16:14 ` Paolo Bonzini [this message]
2021-09-17 12:49 ` [RFC PATCH 2/2] nSVM: use vmcb_ctrl_area_cached instead of vmcb_control_area in svm_nested_state Emanuele Giuseppe Esposito
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=05425bd8-46dc-f136-fbe0-52f42351aea1@redhat.com \
--to=pbonzini@redhat.com \
--cc=bp@alien8.de \
--cc=eesposit@redhat.com \
--cc=hpa@zytor.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=mlevitsk@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--cc=x86@kernel.org \
/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.