From: Paolo Bonzini <pbonzini@redhat.com>
To: Wincy Van <fanwenyi0529@gmail.com>,
"gleb@kernel.org" <gleb@kernel.org>,
"Zhang, Yang Z" <yang.z.zhang@intel.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Wanpeng Li <wanpeng.li@linux.intel.com>,
Jan Kiszka <jan.kiszka@web.de>
Subject: Re: [PATCH v3 2/6] KVM: nVMX: Enable nested virtualize x2apic mode.
Date: Tue, 27 Jan 2015 22:37:01 +0100 [thread overview]
Message-ID: <54C804FD.6060108@redhat.com> (raw)
In-Reply-To: <CACzj_yXLgAKaRzXx4Y=ZQN=QXK8EnX4fvcSTJmKSXSywN2Kb8Q@mail.gmail.com>
On 24/01/2015 11:21, Wincy Van wrote:
> + memset(vmx_msr_bitmap_nested, 0xff, PAGE_SIZE);
Most bytes are always 0xff. It's better to initialize it to 0xff once,
and set the bit here if !nested_cpu_has_virt_x2apic_mode(vmcs12).
> + if (nested_cpu_has_virt_x2apic_mode(vmcs12))
Please add braces here, because of the /* */ command below.
> + /* TPR is allowed */
> + nested_vmx_disable_intercept_for_msr(msr_bitmap,
> + vmx_msr_bitmap_nested,
> + APIC_BASE_MSR + (APIC_TASKPRI >> 4),
> + MSR_TYPE_R | MSR_TYPE_W);
>
> +static inline int nested_vmx_check_virt_x2apic(struct kvm_vcpu *vcpu,
> + struct vmcs12 *vmcs12)
> +{
> + if (nested_cpu_has2(vmcs12, SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES))
> + return -EINVAL;
No need for this function and nested_cpu_has_virt_x2apic_mode. Just
inline them in their caller(s). Same for other cases throughout the series.
Paolo
> + return 0;
> +}
> +
> +static int nested_vmx_check_apicv_controls(struct kvm_vcpu *vcpu,
> + struct vmcs12 *vmcs12)
> +{
> + int r;
> +
> + if (!nested_cpu_has_virt_x2apic_mode(vmcs12))
> + return 0;
> +
> + r = nested_vmx_check_virt_x2apic(vcpu, vmcs12);
> + if (r)
> + goto fail;
> +
next prev parent reply other threads:[~2015-01-27 21:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-24 10:21 Wincy Van
2015-01-27 21:37 ` Paolo Bonzini [this message]
2015-01-28 6:19 ` Wincy Van
2015-01-28 7:31 ` Paolo Bonzini
2015-01-28 10:19 ` Wincy Van
2015-01-28 10:20 ` Paolo Bonzini
2015-01-27 21:39 ` Paolo Bonzini
2015-01-28 6:20 ` Wincy Van
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=54C804FD.6060108@redhat.com \
--to=pbonzini@redhat.com \
--cc=fanwenyi0529@gmail.com \
--cc=gleb@kernel.org \
--cc=jan.kiszka@web.de \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wanpeng.li@linux.intel.com \
--cc=yang.z.zhang@intel.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
Powered by JetHome