All of lore.kernel.org
 help / color / mirror / Atom feed
From: dmukhin@ford.com
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: dmukhin@ford.com, xen-devel@lists.xenproject.org,
	jason.andryuk@amd.com, jbeulich@suse.com, roger@xenproject.org,
	teddy.astie@vates.tech
Subject: Re: [PATCH v1 00/28] x86: initial SVM AVIC support
Date: Fri, 20 Nov 2026 09:57:27 -0800	[thread overview]
Message-ID: <awCKB7euqhzrAzd+@kraken> (raw)
In-Reply-To: <e36dfc8f-62d9-413f-bf6c-3a806bbd0e71@citrix.com>

On Fri, Nov 20, 2026 at 03:47:15PM +0000, Andrew Cooper wrote:
> On 05/11/2026 1:33 am, dmukhin@ford.com wrote:
> > Patch Series
> > ============
> >
> > Basically the entire work is divided into three big series:
> >  (A) Current series: initial SVM AVIC [5]
> >  (B) XTF interrupt latency test [6]
> >  (C) XTF infra in public CI [5]
> >
> > For this AVIC series:
> >
> >  Patches 1, 5, 6, 9, 11-16 introduce various cleanups and fixups.
> >
> >  Patch 20 changes XEN_DOMCTL_debug_op implementation to allow
> >  more debug operations added (like enabling/disabling AVIC at
> >  run-time - used by the XTF test).
> >
> >  Patches 2, 3, 4, 7, 8, 10, 17, 18-25 represent AVIC implementation
> >  including performance counters and run-time controls via debug
> >  hypercall.
> >
> >  Patches 26-28 cover various documentation updates.
> 
> Sorry this reply has taken longer to get to than I had intended.  I have
> committed a couple of trivial patches, but I think the rest of the work
> is going to take a bit more complicated rearranging.
> 
> First of all, I think there are two areas where we want to take other
> pending work as prerequisite.
> 
> 1) Moving the SVM/SEV leaves into CPU Policy.  (Series of mine needing
> dusting off and re-posting.)
> 
> In patch 4, you introduce a new command line option.  I know Intel has
> one, but it is part of a bigger anti-pattern we're trying to remove. 
> Wit the SVM leaf in policy, `cpuid=no-avic` on the command line will
> work to hide the feature from Xen, and without much effort we can make
> `cpuid=avic` work as an opt-in until it's enabled by default.

I have parameterized MSR doorbell path vs vcpu_kick() via

  svm_avic=nodoorbell 

in the current series. It was pretty useful to run experiments.

So AVIC may still need its own command line switch.
What do you think?

> 
> Also my series removes the SVM_FEATURE_* constants (they'll be
> auto-generated now), which simplifies your earlier patches.
> 
> 2) Removing the vcpu_id <-> apic_id relation.  (Series of Alejandro's,
> or at least the first part of it, needing dusting off and re-posting.)
> 
> In patch 7, you encode the guest's APIC_ID as it's vCPU ID * 2.  Yes
> this is currently true, but we're desperately trying to break this bogus
> relation.  It prohibits providing a sane topology to guests, and is one
> of the hard limits on HVM_MAX_VCPUs being 128.
> 
> Alejandro did a series making topology selection work.  The first half
> of it at least gets into a position where the toolstack chooses the
> APIC_IDs and we've got a proper variable in Xen with which to derive
> everything else from.  Getting at least this sorted will give you a
> proper base to build the logical/physical table upon.
> 
> 3) (Bonus).  We need to take a decision on whether we're going to block
> writes to APIC_ID in xAPIC mode or not.  I sent an RFC patch.  If we do
> decide to block writes to APIC_ID in xAPIC mode, then it means the
> logical/physical table is static for the lifetime of the domain.
> 
> 
> Now for some feedback in no specific order
> 
> a) Please have one single patch adding all the architectural enumeration
> in one go (CPUID, VMCB, etc).  i.e. merge parts of patch 2, 3 and 7.  (I
> have your patch 7 rebased over the VMCB cleanup which was merged after
> posting).  I find this helpful when reviewing because it separates "what
> is needed for the hardware" from "what is just internal book-keeping".
> 
> b) In patch 4 you have a single static avic_apic_access_page[].  That
> was XSA-412 (3b5beaf49033cd).
> 
> It's actually worse on AMD.  On Intel, any writes targeting a
> non-register part of the backing page are discarded.  On AMD, they're
> deposited in the backing page.  So, this page *must* be allocated per
> domain, and not global.
> 
> c) AMD has extensions to the APIC spec.  AVIC even accelerates some of
> these, and you feed the accesses into the current vlapic
> infrastructure.   For current CPUs, at a minimum that means reverting
> changes to eLVTs, but I think more generally we should probably have a
> CPU generation check during init and refuse to turn on AVIC until a
> human has checked which new hardware features leak through.
> 
> d) One very fun bug with AVIC is that a misaligned xmm store can write
> to two different registers at once (ymm can hit 3, and zmm can hit 5). 
> The whole write gets deposited (contrary to Intel, which explicitly
> discards outside of the first register hit), but only one VMExit
> occurs.  This allows the guest to write reserved bits.  We need to
> confirm that nothing in Xen is going to malfunction (e.g. check for
> BUG_ON()'s/etc. which ought to be downgraded to domain_crash()/etc.)
> because of finding non-architectural state.
> 
> e) You've got a number of fixes for interrupt-related things.  I think
> we need to get those fixed first and with robust testing in place before
> trying to add AVIC in on top.  I'll see about dusting off an XTF test I
> have on the matter, but we really need to fix CR8 handling before
> building further.
> 
> f) I'm not overly convinced with making use of debugop like that.  For
> now, maybe defer it to the end of the series.  I have had several
> occasions to need extra hypercalls to make testing happen nicely, so I
> think there is room to make something, but I suspect it will want to be
> a little different in nature.
> 
> I'm sure there's stuff I've missed, but I think this a long enough email
> for now.
> 
> There's an outstanding question on patch 5.  If you can answer it, I can
> commit.
> 
> Thanks,
> 
> ~Andrew
> 


      reply	other threads:[~2026-11-20 17:58 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05  1:33 [PATCH v1 00/28] x86: initial SVM AVIC support dmukhin
2026-11-05  1:33 ` [PATCH v1 01/28] x86/hvm: move SVM feature printout to a separate function dmukhin
2026-11-05 22:04   ` Jason Andryuk
2026-11-06 16:03   ` Andrew Cooper
2026-11-05  1:33 ` [PATCH v1 02/28] x86/hvm: report SVM AVIC support dmukhin
2026-11-05 22:05   ` Jason Andryuk
2026-11-05  1:33 ` [PATCH v1 03/28] x86/hvm: report SVM x2AVIC support dmukhin
2026-11-05 22:13   ` Jason Andryuk
2026-11-06  3:36     ` dmukhin
2026-11-06 12:25   ` Teddy Astie
2026-11-18 15:12   ` Jan Beulich
2026-11-05  1:33 ` [PATCH v1 04/28] x86/hvm: avic: add domain state initialization dmukhin
2026-11-05 23:10   ` Jason Andryuk
2026-11-06  1:35     ` Jason Andryuk
2026-11-06 13:41   ` Teddy Astie
2026-11-18 15:16     ` Jan Beulich
2026-11-13  0:29   ` Andrew Cooper
2026-11-13  7:11     ` Jan Beulich
2026-11-18 15:21   ` Jan Beulich
2026-11-05  1:33 ` [PATCH v1 05/28] x86/hvm: cleanup svm_create_vmcb() dmukhin
2026-11-06 18:05   ` Andrew Cooper
2026-11-20 17:58     ` dmukhin
2026-11-05  1:33 ` [PATCH v1 06/28] x86/hvm: introduce vlapic_reg_read() dmukhin
2026-11-18 15:23   ` Jan Beulich
2026-11-05  1:33 ` [PATCH v1 07/28] x86/hvm: avic: add VMCB state initialization dmukhin
2026-11-06 15:00   ` Ross Lagerwall
2026-11-09 14:26   ` Ross Lagerwall
2026-11-18 15:26   ` Jan Beulich
2026-11-05  1:33 ` [PATCH v1 08/28] x86/hvm: avic: add AVIC_INCOMP_IPI VMEXIT handler dmukhin
2026-11-18 15:33   ` Jan Beulich
2026-11-05  1:33 ` [PATCH v1 09/28] x86/hvm: fix hvm_emulate_one_vm_event() definition dmukhin
2026-11-05  8:30   ` Jan Beulich
2026-11-05 20:10     ` dmukhin
2026-11-06  7:06       ` Jan Beulich
2026-11-05  1:33 ` [PATCH v1 10/28] x86/hvm: avic: add AVIC_NOACCEL VMEXIT handler dmukhin
2026-11-05  1:33 ` [PATCH v1 11/28] x86/hvm: introduce vcpu_is_vlapic_tpr_emulated() dmukhin
2026-11-06 13:36   ` Andrew Cooper
2026-11-10 10:56     ` Ross Lagerwall
2026-11-05  1:33 ` [PATCH v1 12/28] x86: apic: use APIC_EIO_ACK instead of open-coded 0 dmukhin
2026-11-05  8:27   ` Jan Beulich
2026-11-05  8:28     ` Jan Beulich
2026-11-05 10:20   ` Andrew Cooper
2026-11-05 10:21     ` Jan Beulich
2026-11-05 11:06       ` Andrew Cooper
2026-11-05  1:33 ` [PATCH v1 13/28] x86/time: fix typo s/interruopt/interrupt/ dmukhin
2026-11-05  8:28   ` Jan Beulich
2026-11-05  1:33 ` [PATCH v1 14/28] x86/hvm: vlapic: update signatures of both vlapic_{clear,test}_* dmukhin
2026-11-05  8:33   ` Jan Beulich
2026-11-05 20:11     ` dmukhin
2026-11-05  1:33 ` [PATCH v1 15/28] x86/hvm: vlapic: add checks before posted interrupt delivery dmukhin
2026-11-10 11:13   ` Teddy Astie
2026-11-05  1:33 ` [PATCH v1 16/28] x86/hvm: move VINTR disable to svm_clear_intr_window() dmukhin
2026-11-05  1:33 ` [PATCH v1 17/28] x86/hvm: avic: route interrupt delivery to vCPU dmukhin
2026-11-09 18:06   ` Ross Lagerwall
2026-11-05  1:33 ` [PATCH v1 18/28] x86/hvm: add facility to print hardware-assisted vLAPIC info dmukhin
2026-11-05  1:33 ` [PATCH v1 19/28] x86/hvm: avic: enable SVM AVIC statistics reporting dmukhin
2026-11-09 15:08   ` Andrew Cooper
2026-11-05  1:33 ` [PATCH v1 20/28] x86/hvm: rework XEN_DOMCTL_debug_op dmukhin
2026-11-05  1:33 ` [PATCH v1 21/28] x86/hvm: enable debug hypercall for posted interrupts dmukhin
2026-11-05  1:33 ` [PATCH v1 22/28] x86/hvm: avic: ensure SVM AVIC supports xAPIC operation only dmukhin
2026-11-06 20:46   ` Andrew Cooper
2026-11-09 14:07   ` Ross Lagerwall
2026-11-05  1:33 ` [PATCH v1 23/28] x86/hvm: avic: enable vLAPIC mode switch hook dmukhin
2026-11-05  1:33 ` [PATCH v1 24/28] x86/hvm: avic: ensure SVM AVIC is disabled with nested guest dmukhin
2026-11-05 10:33   ` Ross Lagerwall
2026-11-05  1:33 ` [PATCH v1 25/28] x86/hvm: avic: account for AMD erratum 1235 dmukhin
2026-11-05  1:33 ` [PATCH v1 26/28] docs: add coverage for svm_avic= dmukhin
2026-11-05  8:24   ` Jan Beulich
2026-11-05 20:22     ` dmukhin
2026-11-06  7:03       ` Jan Beulich
2026-11-05  1:33 ` [PATCH v1 27/28] CHANGELOG.md: add note on initial SVM AVIC support dmukhin
2026-11-20 15:47 ` [PATCH v1 00/28] x86: " Andrew Cooper
2026-11-20 17:57   ` dmukhin [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=awCKB7euqhzrAzd+@kraken \
    --to=dmukhin@ford.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jason.andryuk@amd.com \
    --cc=jbeulich@suse.com \
    --cc=roger@xenproject.org \
    --cc=teddy.astie@vates.tech \
    --cc=xen-devel@lists.xenproject.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.