From: Bui Quang Minh <minhquangbui99@gmail.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: qemu-devel@nongnu.org, "David Woodhouse" <dwmw2@infradead.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Igor Mammedov" <imammedo@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Joao Martins" <joao.m.martins@oracle.com>,
"Peter Xu" <peterx@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [PATCH v8 0/5] Support x2APIC mode with TCG accelerator
Date: Wed, 4 Oct 2023 23:40:43 +0700 [thread overview]
Message-ID: <d7e14546-96e0-4ee2-928e-bd4035f09b89@gmail.com> (raw)
In-Reply-To: <20231004025051-mutt-send-email-mst@kernel.org>
On 10/4/23 13:51, Michael S. Tsirkin wrote:
> On Tue, Sep 26, 2023 at 11:23:53PM +0700, Bui Quang Minh wrote:
>> On 9/26/23 23:06, Bui Quang Minh wrote:
>>
>>> Version 8 changes,
>>> - Patch 2, 4:
>>> + Rebase to master and resolve conflicts in these 2 patches
>>
>> The conflicts when rebasing is due to the commit 9926cf34de5fa15da
>> ("target/i386: Allow elision of kvm_enable_x2apic()"). AFAIK, this commit
>> adds kvm_enabled() before kvm_enable_x2apic() in the and (&&) expression so
>> that when kvm_enabled() is known to be false at the compile time
>> (CONFIG_KVM_IS_POSSIBLE is undefined), the compiler can omit the
>> kvm_enable_x2apic() in the and expression.
>>
>> In patch 2, I simply combine the change logic in patch 2 with logic in the
>> commit 9926cf34de5fa15da.
>>
>> In patch 4, the end result of version 8 is the same as version 7. I don't
>> think we need to add the kvm_enabled() to make the expression become
>>
>> if (kvm_enabled() && kvm_irqchip_is_split() && !kvm_enable_x2apic())
>>
>> Because when CONFIG_KVM_IS_POSSIBLE is undefined, kvm_irqchip_is_split() is
>> known to be false at the compile time too so just keep the expression as
>>
>> if (kvm_irqchip_is_split() && !kvm_enable_x2apic())
>>
>> is enough.
>>
>>> git range-diff feat/tcg-x2apic-v7~5..feat/tcg-x2apic-v7
>> feat/tcg-x2apic-v8~5..feat/tcg-x2apic-v8
>>
>> 1: c1d197a230 = 1: f6e3918e0f i386/tcg: implement x2APIC registers MSR
>> access
>> 2: dd96cb0238 ! 2: 54d44a15b6 apic: add support for x2APIC mode
>> @@ Commit message
>>
>> ## hw/i386/x86.c ##
>> @@ hw/i386/x86.c: void x86_cpus_init(X86MachineState *x86ms, int
>> default_cpu_version)
>> - * Can we support APIC ID 255 or higher?
>> - *
>> - * Under Xen: yes.
>> -- * With userspace emulated lapic: no
>> -+ * With userspace emulated lapic: checked later in
>> apic_common_set_id.
>> - * With KVM's in-kernel lapic: only if X2APIC API is enabled.
>> + * both in-kernel lapic and X2APIC userspace API.
>> */
>> - if (x86ms->apic_id_limit > 255 && !xen_enabled() &&
>> + if (x86ms->apic_id_limit > 255 && kvm_enabled() &&
>> - (!kvm_irqchip_in_kernel() || !kvm_enable_x2apic())) {
>> + kvm_irqchip_in_kernel() && !kvm_enable_x2apic()) {
>> error_report("current -smp configuration requires kernel "
>> 3: 31a5c555a6 = 3: eb080d1e2c apic, i386/tcg: add x2apic transitions
>> 4: d78b5c43b4 ! 4: 59f028f119 intel_iommu: allow Extended Interrupt Mode
>> when using userspace APIC
>> @@ hw/i386/intel_iommu.c: static bool vtd_decide_config(IntelIOMMUState
>> *s, Error *
>> - error_setg(errp, "eim=on requires
>> accel=kvm,kernel-irqchip=split");
>> - return false;
>> - }
>> -- if (!kvm_enable_x2apic()) {
>> +- if (kvm_enabled() && !kvm_enable_x2apic()) {
>> + if (kvm_irqchip_is_split() && !kvm_enable_x2apic()) {
>> error_setg(errp, "eim=on requires support on the KVM side"
>> "(X2APIC_API, first shipped in v4.7)");
>> 5: 51f558035d = 5: bc95c3cb60 amd_iommu: report x2APIC support to the
>> operating system
>>
>> As the change is minor and does not change the main logic, I keep the
>> Reviewed-by and Acked-by tags.
>>
>> Thank you,
>> Quang Minh.
>
>
>
> Causes some build failures:
>
> https://gitlab.com/mstredhat/qemu/-/jobs/5216377483
> /builds/mstredhat/qemu/build/../hw/intc/apic.c:1023: undefined reference to `raise_exception_ra'
raise_exception_ra is tcg specific so the builds are failed as tcg is
disabled. I will remove the use of raise_exception_ra, the invalid
register read just returns 0, invalid register write has no effect
without raising the exception anymore. The APIC state invalid transition
does not raise exception either, just don't change the APIC state. As a
side effect, we fail some more KVM unit test of invalid APIC state
transition, as they expect to catch exception in these cases. I think
it's not a big problem. What's your opinion?
Thank you,
Quang Minh.
next prev parent reply other threads:[~2023-10-04 16:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-26 16:06 [PATCH v8 0/5] Support x2APIC mode with TCG accelerator Bui Quang Minh
2023-09-26 16:06 ` [PATCH v8 1/5] i386/tcg: implement x2APIC registers MSR access Bui Quang Minh
2023-10-22 13:59 ` Phil Dennis-Jordan
2023-10-24 15:27 ` Bui Quang Minh
2023-09-26 16:06 ` [PATCH v8 2/5] apic: add support for x2APIC mode Bui Quang Minh
2023-09-26 16:06 ` [PATCH v8 3/5] apic, i386/tcg: add x2apic transitions Bui Quang Minh
2023-09-26 16:06 ` [PATCH v8 4/5] intel_iommu: allow Extended Interrupt Mode when using userspace APIC Bui Quang Minh
2023-09-26 16:06 ` [PATCH v8 5/5] amd_iommu: report x2APIC support to the operating system Bui Quang Minh
2023-09-26 16:23 ` [PATCH v8 0/5] Support x2APIC mode with TCG accelerator Bui Quang Minh
2023-10-04 6:51 ` Michael S. Tsirkin
2023-10-04 16:40 ` Bui Quang Minh [this message]
2023-10-04 17:05 ` Michael S. Tsirkin
2023-10-05 15:50 ` Bui Quang Minh
2023-10-05 15:52 ` [RFC PATCH] tcg, apic: create a separate root memory region for each CPU Bui Quang Minh
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=d7e14546-96e0-4ee2-928e-bd4035f09b89@gmail.com \
--to=minhquangbui99@gmail.com \
--cc=alex.bennee@linaro.org \
--cc=dwmw2@infradead.org \
--cc=eduardo@habkost.net \
--cc=imammedo@redhat.com \
--cc=jasowang@redhat.com \
--cc=joao.m.martins@oracle.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).