[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YeFi9FTPSyLbQytu@FVFF77S0Q05N>
Date: Fri, 14 Jan 2022 11:48:04 +0000
From: Mark Rutland <mark.rutland@....com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: linux-kernel@...r.kernel.org, aleksandar.qemu.devel@...il.com,
alexandru.elisei@....com, anup.patel@....com,
aou@...s.berkeley.edu, atish.patra@....com,
benh@...nel.crashing.org, borntraeger@...ux.ibm.com, bp@...en8.de,
catalin.marinas@....com, chenhuacai@...nel.org,
dave.hansen@...ux.intel.com, david@...hat.com,
frankja@...ux.ibm.com, frederic@...nel.org, gor@...ux.ibm.com,
hca@...ux.ibm.com, imbrenda@...ux.ibm.com, james.morse@....com,
jmattson@...gle.com, joro@...tes.org, kvm@...r.kernel.org,
maz@...nel.org, mingo@...hat.com, mpe@...erman.id.au,
nsaenzju@...hat.com, palmer@...belt.com, paulmck@...nel.org,
paulus@...ba.org, paul.walmsley@...ive.com, pbonzini@...hat.com,
suzuki.poulose@....com, tglx@...utronix.de,
tsbogend@...ha.franken.de, vkuznets@...hat.com,
wanpengli@...cent.com, will@...nel.org
Subject: Re: [PATCH 1/5] kvm: add exit_to_guest_mode() and
enter_from_guest_mode()
On Thu, Jan 13, 2022 at 08:32:20PM +0000, Sean Christopherson wrote:
> On Tue, Jan 11, 2022, Mark Rutland wrote:
> > Atop this, new exit_to_guest_mode() and enter_from_guest_mode() helpers
> > are added to handle the ordering of lockdep, tracing, and RCU manageent.
> > These are named to align with exit_to_user_mode() and
> > enter_from_user_mode().
> >
> > Subsequent patches will migrate architectures over to the new helpers,
> > following a sequence:
> >
> > guest_timing_enter_irqoff();
> >
> > exit_to_guest_mode();
>
> I'm not a fan of this nomenclature. First and foremost, virtualization refers to
> transfers to guest mode as VM-Enter, and transfers from guest mode as VM-Exit.
> It's really, really confusing to read this code from a virtualization perspective.
> The functions themselves are contradictory as the "enter" helper calls functions
> with "exit" in their name, and vice versa.
Sure; FWIW I wasn't happy with the naming either, but I couldn't find anything
that was entirely clear, because it depends on whether you consider this an
entry..exit of guest context or an exit..entry of regular kernel context. I
went with exit_to_guest_mode() and enter_from_guest_mode() because that clearly
corresponded to exit_to_user_mode() and enter_from_user_mode(), and the
convention in the common entry code is to talk in terms of the regular kernel
context.
While I was working on this, I had guest_context_enter_irqoff() for
kernel->guest and guest_context_exit_irqoff() for guest->kernel, which also
matched the style of guest_timing_{enter,exit}_irqoff().
I'm happy to change to that, if that works for you?
> We settled on xfer_to_guest_mode_work() for a similar conundrum in the past, though
> I don't love using xfer_to/from_guest_mode() as that makes it sound like those
> helpers handle the actual transition into guest mode, i.e. runs the vCPU.
>
> To avoid too much bikeshedding, what about reusing the names we all compromised
> on when we did this for x86 and call them kvm_guest_enter/exit_irqoff()? If x86
> is converted in the first patch then we could even avoid temporary #ifdefs.
I'd like to keep this somewhat orthogonal to the x86 changes (e.g. as other
architectures will need backports to stable at least for the RCU bug fix), so
I'd rather use a name that isn't immediately coupled with x86 changes.
Does the guest_context_{enter,exit}_irqoff() naming above work for you?
Thanks,
Mark.
Powered by blists - more mailing lists