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 05/28] x86/hvm: cleanup svm_create_vmcb()
Date: Fri, 20 Nov 2026 09:58:50 -0800 [thread overview]
Message-ID: <awCKWnL0U2UPc8YD@kraken> (raw)
In-Reply-To: <86bf2afd-45c2-46a4-b367-65c546b0af38@citrix.com>
On Fri, Nov 06, 2026 at 06:05:18PM +0000, Andrew Cooper wrote:
> On 05/11/2026 1:33 am, dmukhin@ford.com wrote:
> > From: Denis Mukhin <dmukhin@ford.com>
> >
> > svm_create_vmcb() does not need to be idempotent because in case of
> > failure caller must call svm_destroy_vmcb().
> >
> > Simplify code in svm_create_vmcb() to account for that.
>
> This is more complicated than it seems.
>
> There are two paths which need to clean up a struct vcpu:
> 1) The domain_kill hypercall (i.e. clean destruction)
> 2) A failure within vcpu_create()
>
> Nowadays, both vcpu and domain create() end up calling back into the
> relevant destroy paths. This is some work I started a long time ago and
> never managed to finish.
>
> We had a number of memory leaks because each init/create function was
> required to clean up after itself, and several did this incorrectly. It
> was also wasteful because we had duplicated cleanup code.
>
> At the moment, both vcpu_create() and hvm_vcpu_initialise() will call
> the relevant destruction path.
>
> In the future, we want to remove all the create() error handling except
> from the top-level, because that removes the duplication. However this
> is a large task and it's the common/arch boundary where it gets
> particularly hard to organise safely.
>
>
> Anyway. We can take this patch with an adjusted commit message. In
> particular, saying that the "caller must call ..." is a hope, rather
> than a clear statement that this is how the code behaves. I suggest
> something like:
>
> ---8<---
> svm_create_vmcb() does not need to do error handling itself because
> vcpu_create() handles this at the top level by calling vcpu_destroy().
> ---8<---
That sounds good to me!
Thanks!
>
> But, if someone has some copious free time, it would be nicer if we
> could do this a little bit wider and make better progress towards
> removing the create() error handling.
>
> ~Andrew
>
next prev parent reply other threads:[~2026-11-20 17:59 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 [this message]
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
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=awCKWnL0U2UPc8YD@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.