From: Sean Christopherson <seanjc@google.com>
To: Joao Martins <joao.m.martins@oracle.com>
Cc: Igor Mammedov <imammedo@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Alejandro Jimenez <alejandro.j.jimenez@oracle.com>,
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Subject: Re: [PATCH v2 2/3] KVM: SVM: Modify AVIC GATag to support max number of 512 vCPUs
Date: Tue, 7 Feb 2023 16:38:13 +0000 [thread overview]
Message-ID: <Y+J+dS8ZRX07kgt7@google.com> (raw)
In-Reply-To: <0e12d654-d388-a0f9-e7f9-7e96921786b7@oracle.com>
On Tue, Feb 07, 2023, Joao Martins wrote:
> On 07/02/2023 08:33, Igor Mammedov wrote:
> > On Tue, 7 Feb 2023 00:21:55 +0000
> > Sean Christopherson <seanjc@google.com> wrote:
> >
> >> From: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> >>
> >> Define AVIC_VCPU_ID_MASK based on AVIC_PHYSICAL_MAX_INDEX, i.e. the mask
> >> that effectively controls the largest guest physical APIC ID supported by
> >> x2AVIC, instead of hardcoding the number of bits to 8 (and the number of
> >> VM bits to 24).
> >
> > Is there any particular reason not to tie it to max supported by KVM
> > KVM_MAX_VCPU_IDS?
> >
> > Another question:
> > will guest fail to start when configured with more than 512 vCPUs
> > or it will start broken?
> >
>
> I think the problem is not so much the GATag (which can really be anything at
> the resolution you want). It's more of an SVM limit AIUI. Provided you can't
> have GATAgs if you don't have guest-mode/AVIC active, then makes sense have the
> same limit on both.
Yep. The physical ID table, which is needed to achieve full AVIC benefits for a
vCPU, is a single 4KiB page that holds 512 64-bit entries. AIUI, the GATag is
used if and only if the interrupt target is in the physical ID table, so using
more GATag bits for vCPU ID is pointless.
> SVM seems to be limited to 256 vcpus in xAPIC mode or 512 vcpus in x2APIC
> mode[0]. IIUC You actually won't be able to create guests with more than
> 512vcpus as KVM bound checks those max limits very early in the vCPU init (see
> avic_init_vcpu()). I guess the alternative would an AVIC inhibit if vCPU count
> goes beyond those limits -- probably a must have once avic flips to 1 by default
> like Intel.
I don't _think_ KVM would have to explicitly inhibit AVIC. I believe the fallout
would be that vCPUs >= 512 would simply not be eligible for virtual interrupt
delivery, e.g. KVM would get a "Invalid Target in IPI" exit. I haven't dug into
the IOMMU side of things though, so it's possible something in that world would
necessitate disabling (x2)AVIC.
> [0] in APM Volume 2 15.29.4.3 Physical Address Pointer Restrictions,
>
> * All the addresses point to 4-Kbyte aligned data structures. Bits 11:0 are
> reserved (except for offset 0F8h) and should be set to zero. The lower 8 bits of
> offset 0F8h are used for the field AVIC_PHYSICAL_MAX_INDEX. VMRUN fails with
> #VMEXIT(VMEXIT_INVALID) if AVIC_PHYSICAL_MAX_INDEX is greater than 255 in xAVIC
> mode or greater than 511 in x2AVIC mode.
next prev parent reply other threads:[~2023-02-07 16:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-07 0:21 [PATCH v2 0/3] KVM: SVM: Fix GATag bug for >256 vCPUs Sean Christopherson
2023-02-07 0:21 ` [PATCH v2 1/3] KVM: SVM: Fix a benign off-by-one bug in AVIC physical table mask Sean Christopherson
2023-02-15 15:38 ` Suthikulpanit, Suravee
2023-02-07 0:21 ` [PATCH v2 2/3] KVM: SVM: Modify AVIC GATag to support max number of 512 vCPUs Sean Christopherson
2023-02-07 8:33 ` Igor Mammedov
2023-02-07 11:15 ` Joao Martins
2023-02-07 16:38 ` Sean Christopherson [this message]
2023-02-15 20:15 ` Suthikulpanit, Suravee
2023-02-15 15:50 ` Suthikulpanit, Suravee
2023-02-07 0:21 ` [PATCH v2 3/3] KVM: SVM: WARN if GATag generation drops VM or vCPU ID information Sean Christopherson
2023-02-15 20:20 ` Suthikulpanit, Suravee
2023-02-15 20:21 ` [PATCH v2 0/3] KVM: SVM: Fix GATag bug for >256 vCPUs Suthikulpanit, Suravee
2023-02-15 22:11 ` Sean Christopherson
2023-03-14 13:36 ` Paolo Bonzini
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=Y+J+dS8ZRX07kgt7@google.com \
--to=seanjc@google.com \
--cc=alejandro.j.jimenez@oracle.com \
--cc=imammedo@redhat.com \
--cc=joao.m.martins@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=suravee.suthikulpanit@amd.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;
as well as URLs for NNTP newsgroup(s).