All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Alexandru Elisei <alexandru.elisei@arm.com>
Cc: Will Deacon <will@kernel.org>,
	kvmarm@lists.cs.columbia.edu,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [RFC PATCH v5 02/38] KVM: arm64: Add lock/unlock memslot user API
Date: Tue, 15 Feb 2022 12:02:26 +0000	[thread overview]
Message-ID: <87ee4449t9.wl-maz@kernel.org> (raw)
In-Reply-To: <YguInzLt1D9PZkwh@monolith.localdoman>

On Tue, 15 Feb 2022 11:03:59 +0000,
Alexandru Elisei <alexandru.elisei@arm.com> wrote:
> 
> > If a memslot with read/write permission is locked with read only,
> > and then unlocked, can userspace expect stage 2 mapping for the
> > memslot to be updated with read/write ?
> 
> Locking a memslot with the read flag would map the memory described by the
> memslot with read permissions at stage 2. When the memslot is unlocked, KVM
> won't touch the stage 2 entries.
> 
> When the memslot is unlocked, the pages (as in, struct page) backing the VM
> memory as described by the memslot are unpinned. Then the host's MM subsystem
> can treat the memory like any other pages (make them old, new, unmap them, do
> nothing, etc), and the MMU notifier will take care of updating the stage 2
> entries as necessary.
> 
> I guess I should have been more precise in the description. I'll
> change "causes the memory pinned when locking the memslot specified
> in args[0] to be unpinned" to something that clearly states that the
> memory in the host that backs the memslot is unpinned.
> 
> > Can userspace delete the memslot that is locked (without unlocking) ?
> 
> No, it cannot.
> 
> > If so, userspace can expect the corresponding range to be implicitly
> > unlocked, correct ?
> 
> Userspace must explicitely unlock the memslot before deleting it. I want
> userspace to be explicit in its intent.

Does it get in the way of making this robust wrt userspace being
killed (or terminating without unlock first)?

	M.

-- 
Without deviation from the norm, progress is not possible.
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <maz@kernel.org>
To: Alexandru Elisei <alexandru.elisei@arm.com>
Cc: Reiji Watanabe <reijiw@google.com>,
	James Morse <james.morse@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	kvmarm@lists.cs.columbia.edu, Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>
Subject: Re: [RFC PATCH v5 02/38] KVM: arm64: Add lock/unlock memslot user API
Date: Tue, 15 Feb 2022 12:02:26 +0000	[thread overview]
Message-ID: <87ee4449t9.wl-maz@kernel.org> (raw)
In-Reply-To: <YguInzLt1D9PZkwh@monolith.localdoman>

On Tue, 15 Feb 2022 11:03:59 +0000,
Alexandru Elisei <alexandru.elisei@arm.com> wrote:
> 
> > If a memslot with read/write permission is locked with read only,
> > and then unlocked, can userspace expect stage 2 mapping for the
> > memslot to be updated with read/write ?
> 
> Locking a memslot with the read flag would map the memory described by the
> memslot with read permissions at stage 2. When the memslot is unlocked, KVM
> won't touch the stage 2 entries.
> 
> When the memslot is unlocked, the pages (as in, struct page) backing the VM
> memory as described by the memslot are unpinned. Then the host's MM subsystem
> can treat the memory like any other pages (make them old, new, unmap them, do
> nothing, etc), and the MMU notifier will take care of updating the stage 2
> entries as necessary.
> 
> I guess I should have been more precise in the description. I'll
> change "causes the memory pinned when locking the memslot specified
> in args[0] to be unpinned" to something that clearly states that the
> memory in the host that backs the memslot is unpinned.
> 
> > Can userspace delete the memslot that is locked (without unlocking) ?
> 
> No, it cannot.
> 
> > If so, userspace can expect the corresponding range to be implicitly
> > unlocked, correct ?
> 
> Userspace must explicitely unlock the memslot before deleting it. I want
> userspace to be explicit in its intent.

Does it get in the way of making this robust wrt userspace being
killed (or terminating without unlock first)?

	M.

-- 
Without deviation from the norm, progress is not possible.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-02-15 12:02 UTC|newest]

Thread overview: 118+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-17 15:38 [RFC PATCH v5 00/38] KVM: arm64: Add Statistical Profiling Extension (SPE) support Alexandru Elisei
2021-11-17 15:38 ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 01/38] KVM: arm64: Make lock_all_vcpus() available to the rest of KVM Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2022-02-15  5:34   ` Reiji Watanabe
2022-02-15  5:34     ` Reiji Watanabe
2022-02-15 10:34     ` Alexandru Elisei
2022-02-15 10:34       ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 02/38] KVM: arm64: Add lock/unlock memslot user API Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2022-02-15  5:59   ` Reiji Watanabe
2022-02-15  5:59     ` Reiji Watanabe
2022-02-15 11:03     ` Alexandru Elisei
2022-02-15 11:03       ` Alexandru Elisei
2022-02-15 12:02       ` Marc Zyngier [this message]
2022-02-15 12:02         ` Marc Zyngier
2022-02-15 12:13         ` Alexandru Elisei
2022-02-15 12:13           ` Alexandru Elisei
2022-02-17  7:35       ` Reiji Watanabe
2022-02-17  7:35         ` Reiji Watanabe
2022-02-17 10:31         ` Alexandru Elisei
2022-02-17 10:31           ` Alexandru Elisei
2022-02-18  4:41           ` Reiji Watanabe
2022-02-18  4:41             ` Reiji Watanabe
2021-11-17 15:38 ` [RFC PATCH v5 03/38] KVM: arm64: Implement the memslot lock/unlock functionality Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2022-02-15  7:46   ` Reiji Watanabe
2022-02-15  7:46     ` Reiji Watanabe
2022-02-15 11:26     ` Alexandru Elisei
2022-02-15 11:26       ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 04/38] KVM: arm64: Defer CMOs for locked memslots until a VCPU is run Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2022-02-24  5:56   ` Reiji Watanabe
2022-02-24  5:56     ` Reiji Watanabe
2022-03-21 17:10     ` Alexandru Elisei
2022-03-21 17:10       ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 05/38] KVM: arm64: Perform CMOs on locked memslots when userspace resets VCPUs Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 06/38] KVM: arm64: Delay tag scrubbing for locked memslots until a VCPU runs Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2022-03-18  5:03   ` Reiji Watanabe
2022-03-18  5:03     ` Reiji Watanabe
2022-03-21 17:17     ` Alexandru Elisei
2022-03-21 17:17       ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 07/38] KVM: arm64: Unmap unlocked memslot from stage 2 if kvm_mmu_has_pending_ops() Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 08/38] KVM: arm64: Unlock memslots after stage 2 tables are freed Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2022-03-18  5:19   ` Reiji Watanabe
2022-03-18  5:19     ` Reiji Watanabe
2022-03-21 17:29     ` Alexandru Elisei
2022-03-21 17:29       ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 09/38] KVM: arm64: Deny changes to locked memslots Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 10/38] KVM: Add kvm_warn{,_ratelimited} macros Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 11/38] KVM: arm64: Print a warning for unexpected faults on locked memslots Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 12/38] KVM: arm64: Allow userspace to lock and unlock memslots Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 13/38] KVM: arm64: Add CONFIG_KVM_ARM_SPE Kconfig option Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 14/38] KVM: arm64: Add SPE capability and VCPU feature Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 15/38] perf: arm_spe_pmu: Move struct arm_spe_pmu to a separate header file Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2022-07-05 16:57   ` Calvin Owens
2022-07-05 16:57     ` Calvin Owens
2022-07-06 10:51     ` Alexandru Elisei
2022-07-06 10:51       ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 16/38] KVM: arm64: Allow SPE emulation when the SPE hardware is present Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 17/38] KVM: arm64: Allow userspace to set the SPE feature only if SPE " Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 18/38] KVM: arm64: Expose SPE version to guests Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 19/38] KVM: arm64: Do not run a VCPU on a CPU without SPE Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2022-01-10 11:40   ` Alexandru Elisei
2022-01-10 11:40     ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 20/38] KVM: arm64: Add a new VCPU device control group for SPE Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 21/38] KVM: arm64: Add SPE VCPU device attribute to set the interrupt number Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 22/38] KVM: arm64: Add SPE VCPU device attribute to initialize SPE Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 23/38] KVM: arm64: debug: Configure MDCR_EL2 when a VCPU has SPE Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 24/38] KVM: arm64: Move accesses to MDCR_EL2 out of __{activate, deactivate}_traps_common Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 25/38] KVM: arm64: VHE: Change MDCR_EL2 at world switch if VCPU has SPE Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 26/38] KVM: arm64: Add SPE system registers to VCPU context Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 27/38] KVM: arm64: nVHE: Save PMSCR_EL1 to the host context Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 28/38] KVM: arm64: Rename DEBUG_STATE_SAVE_SPE -> DEBUG_SAVE_SPE_BUFFER flags Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 29/38] KVM: arm64: nVHE: Context switch SPE state if VCPU has SPE Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 30/38] KVM: arm64: VHE: " Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 31/38] KVM: arm64: Save/restore PMSNEVFR_EL1 on VCPU put/load Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 32/38] KVM: arm64: Allow guest to use physical timestamps if perfmon_capable() Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 33/38] KVM: arm64: Emulate SPE buffer management interrupt Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 34/38] KVM: arm64: Add an userspace API to stop a VCPU profiling Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 35/38] KVM: arm64: Implement " Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 36/38] KVM: arm64: Add PMSIDR_EL1 to the SPE register context Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 37/38] KVM: arm64: Make CONFIG_KVM_ARM_SPE depend on !CONFIG_NUMA_BALANCING Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei
2021-11-17 15:38 ` [RFC PATCH v5 38/38] KVM: arm64: Allow userspace to enable SPE for guests Alexandru Elisei
2021-11-17 15:38   ` Alexandru Elisei

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=87ee4449t9.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=alexandru.elisei@arm.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=will@kernel.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.