On Wed, Apr 10, 2024 at 11:30 PM Andrew Morton
wrote:
> On Fri, 5 Apr 2024 07:58:11 -0400 Paolo Bonzini wrote:
> > Please review! Also feel free to take the KVM patches through the mm
> > tree, as I don't expect any conflicts.
>
> It's mainly a KVM thing and the MM changes
On Mon, Apr 8, 2024 at 3:56 PM Peter Xu wrote:
> Paolo,
>
> I may miss a bunch of details here (as I still remember some change_pte
> patches previously on the list..), however not sure whether we considered
> enable it? Asked because I remember Andrea used to have a custom tree
> maintaining
With the demise of the .change_pte() MMU notifier callback, there is no
notification happening in set_pte_at_notify(). It is a synonym of
set_pte_at() and can be replaced with it.
Signed-off-by: Paolo Bonzini
---
include/linux/mmu_notifier.h | 2 --
kernel/events/uprobes.c | 5 ++---
mm
The only user was kvm_mmu_notifier_change_pte(), which is now gone.
Signed-off-by: Paolo Bonzini
---
virt/kvm/kvm_main.c | 7 +--
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 2fcd9979752a..970111ad 100644
--- a/virt/kvm
set_pte_at_notify() even though it is just a synonym for set_pte_at().
Signed-off-by: Paolo Bonzini
---
include/linux/mmu_notifier.h | 46 ++--
mm/mmu_notifier.c| 17 -
2 files changed, 2 insertions(+), 61 deletions(-)
diff --git a/include/linux
t, because KVM unmaps the sPTEs during .invalidate_range_start()
and therefore .change_pte() has no hope of finding a sPTE to change.
Drop the generic KVM code that dispatches to kvm_set_spte_gfn(), as
well as all the architecture specific implementations.
Signed-off-by: Paolo Bonzini
---
arch
ks,
Paolo
Paolo Bonzini (4):
KVM: delete .change_pte MMU notifier callback
KVM: remove unused argument of kvm_handle_hva_range()
mmu_notifier: remove the .change_pte() callback
mm: replace set_pte_at_notify() with just set_pte_at()
arch/arm64/kvm/mmu.c | 34 -
ail VM creation.
>
> Change to a void return to discourage architectures from making debugfs
> failures fatal for the VM. Seems like everyone already had the right
> idea, as all implementations already return 0 unconditionally.
>
> Signed-off-by: Oliver Upton
Acked-by: Paolo Bonzini
; keeping that additional argument.
>
> Signed-off-by: Christian Brauner
> ---
> arch/x86/kvm/hyperv.c | 2 +-
> arch/x86/kvm/xen.c| 2 +-
> virt/kvm/eventfd.c| 4 ++--
> 30 files changed, 60 insertions(
6_64__, while the usages introduced here aren't.
> >
> > Should
> >
> > On Sun, Nov 5, 2023 at 8:35 AM Paolo Bonzini wrote:
> > >
> > > + test_invalid_memory_region_flags();
> >
> > be #ifdef'd, perhaps? I'm not quite sure what the intent
On 11/5/23 17:30, Paolo Bonzini wrote:
The "development cycle" for this version is going to be very short;
ideally, next week I will merge it as is in kvm/next, taking this through
the KVM tree for 6.8 immediately after the end of the merge window.
The series is still based on 6.6
On 11/9/23 00:37, Anish Moorthy wrote:
On Wed, Nov 8, 2023 at 9:00 AM Anish Moorthy wrote:
This commit breaks the arm64 selftests build btw: looks like a simple oversight?
Yup, fix is a one-liner. Posted below.
diff --git a/tools/testing/selftests/kvm/aarch64/page_fault_test.c
On 11/5/23 17:30, Paolo Bonzini wrote:
From: Chao Peng
Expand set_memory_region_test to exercise various positive and negative
testcases for private memory.
- Non-guest_memfd() file descriptor for private memory
- guest_memfd() from different VM
- Overlapping bindings
- Unaligned
On 11/6/23 12:00, Fuad Tabba wrote:
Hi,
On Fri, Oct 27, 2023 at 7:23 PM Sean Christopherson wrote:
Add a new x86 VM type, KVM_X86_SW_PROTECTED_VM, to serve as a development
and testing vehicle for Confidential (CoCo) VMs, and potentially to even
become a "real" product in the distant
com>
[Allow even with CONFIG_TRANSPARENT_HUGEPAGE; dropped momentarily due to
uneasiness about the API. - Paolo]
Signed-off-by: Paolo Bonzini
---
Documentation/virt/kvm/api.rst| 7 ++
include/uapi/linux/kvm.h | 2 +
.../testing/selftests/kvm/guest_memfd_
17.3615211-13-sea...@google.com>
Signed-off-by: Paolo Bonzini
---
include/linux/kvm_host.h | 2 ++
virt/kvm/kvm_main.c | 17 +
2 files changed, 19 insertions(+)
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 3ebc6912c54a..4d5d139b0bde 100644
---
sea...@google.com>
Signed-off-by: Paolo Bonzini
---
.../selftests/kvm/set_memory_region_test.c| 49 +++
1 file changed, 49 insertions(+)
diff --git a/tools/testing/selftests/kvm/set_memory_region_test.c
b/tools/testing/selftests/kvm/set_memory_region_test.c
index 189177
OTECTED_VM without its prerequisites.
Signed-off-by: Ackerley Tng
[sean: call out the similarities with set_memory_region_test]
Signed-off-by: Sean Christopherson
Message-Id: <20231027182217.3615211-36-sea...@google.com>
Signed-off-by: Paolo Bonzini
---
tools/testing/selftests/kvm/Makefil
Signed-off-by: Ackerley Tng
Co-developed-by: Paolo Bonzini
Signed-off-by: Paolo Bonzini
Co-developed-by: Sean Christopherson
Signed-off-by: Sean Christopherson
Message-Id: <20231027182217.3615211-35-sea...@google.com>
Signed-off-by: Paolo Bonzini
---
tools/testing/selftests/kvm/Ma
-by: Ackerley Tng
Signed-off-by: Ackerley Tng
[sean: trim the testcases to remove duplicate coverage]
Signed-off-by: Sean Christopherson
Message-Id: <20231027182217.3615211-34-sea...@google.com>
Signed-off-by: Paolo Bonzini
---
.../selftests/kvm/include/kvm_util_base.h
ss version to reduce
the amount of boilerplate code need for basic usage.
Signed-off-by: Chao Peng
Signed-off-by: Ackerley Tng
Signed-off-by: Sean Christopherson
Message-Id: <20231027182217.3615211-33-sea...@google.com>
Signed-off-by: Paolo Bonzini
---
.../selftests/kvm/includ
opherson
Signed-off-by: Sean Christopherson
Message-Id: <20231027182217.3615211-32-sea...@google.com>
Signed-off-by: Paolo Bonzini
---
tools/testing/selftests/kvm/Makefile | 1 +
.../kvm/x86_64/private_mem_conversions_test.c | 482 ++
2 files changed, 483 inserti
From: Sean Christopherson
Add GUEST_SYNC[1-6]() so that tests can pass the maximum amount of
information supported via ucall(), without needing to resort to shared
memory.
Signed-off-by: Sean Christopherson
Message-Id: <20231027182217.3615211-31-sea...@google.com>
Signed-off-by: Paolo B
t's expected that x86 will double down and require unique
VM types for TDX and SNP guests.
Signed-off-by: Sean Christopherson
Message-Id: <20231027182217.3615211-30-sea...@google.com>
Signed-off-by: Paolo Bonzini
---
tools/testing/selftests/kvm/dirty_log_test.c |
: drop shared/private helpers (let tests specify flags)]
Signed-off-by: Sean Christopherson
Message-Id: <20231027182217.3615211-29-sea...@google.com>
Signed-off-by: Paolo Bonzini
---
.../selftests/kvm/include/x86_64/processor.h | 15 +++
1 file changed, 15 insertions(+)
: <20231027182217.3615211-28-sea...@google.com>
Signed-off-by: Paolo Bonzini
---
.../selftests/kvm/include/kvm_util_base.h | 48 +++
tools/testing/selftests/kvm/lib/kvm_util.c| 28 +++
2 files changed, 76 insertions(+)
diff --git a/tools/testing/selftests/kvm/i
he fd without having to first
destroy memslots.
Co-developed-by: Ackerley Tng
Signed-off-by: Ackerley Tng
Signed-off-by: Sean Christopherson
Message-Id: <20231027182217.3615211-27-sea...@google.com>
Signed-off-by: Paolo Bonzini
---
.../selftests/kvm/include/kvm_util_base.h | 23 ++
this point forward.
Signed-off-by: Sean Christopherson
Message-Id: <20231027182217.3615211-26-sea...@google.com>
Signed-off-by: Paolo Bonzini
---
.../selftests/kvm/include/kvm_util_base.h | 2 +-
tools/testing/selftests/kvm/lib/kvm_util.c| 19 ++-
2 files chang
information.
Signed-off-by: Sean Christopherson
Message-Id: <20231027182217.3615211-25-sea...@google.com>
Signed-off-by: Paolo Bonzini
---
.../selftests/kvm/include/kvm_util_base.h | 4 ---
tools/testing/selftests/kvm/lib/kvm_util.c| 29 ---
2 files changed, 33 deletions(-)
tic option.
At the very least, KVM_X86_SW_PROTECTED_VM will enable a variety of
selftests for guest_memfd and private memory support without requiring
unique hardware.
Signed-off-by: Sean Christopherson
Reviewed-by: Paolo Bonzini
Message-Id: <20231027182217.3615211-24-sea...@google.com>
Sign
Reviewed-by: Paolo Bonzini
Reviewed-by: Fuad Tabba
Tested-by: Fuad Tabba
Message-Id: <20231027182217.3615211-23-sea...@google.com>
Signed-off-by: Paolo Bonzini
---
arch/powerpc/kvm/book3s_hv.c| 2 +-
arch/x86/include/asm/kvm_host.h | 8 +++-
arch/x86/kvm/debugfs.c | 2 +-
From: Sean Christopherson
Drop __KVM_VCPU_MULTIPLE_ADDRESS_SPACE and instead check the value of
KVM_ADDRESS_SPACE_NUM.
No functional change intended.
Reviewed-by: Paolo Bonzini
Signed-off-by: Sean Christopherson
Reviewed-by: Fuad Tabba
Tested-by: Fuad Tabba
Message-Id
ys come from a guest_memfd instance.
Co-developed-by: Yu Zhang
Signed-off-by: Yu Zhang
Signed-off-by: Chao Peng
Co-developed-by: Sean Christopherson
Signed-off-by: Sean Christopherson
Reviewed-by: Fuad Tabba
Tested-by: Fuad Tabba
Message-Id: <20231027182217.3615211-21-sea.
-by: Sean Christopherson
Message-Id: <20231027182217.3615211-20-sea...@google.com>
Signed-off-by: Paolo Bonzini
---
arch/x86/include/asm/kvm_host.h | 3 +
arch/x86/kvm/mmu/mmu.c | 154 +++-
arch/x86/kvm/x86.c | 4 +
3 files change
_RUN when run->immediate_exit is true.
Link: https://lore.kernel.org/all/20230908222905.1321305-1-amoor...@google.com
Link: https://lore.kernel.org/all/zffbwoxz5ui%2fg...@google.com
Signed-off-by: Sean Christopherson
Reviewed-by: Paolo Bonzini
Reviewed-by: Fuad Tabba
Tested-by: Fuad Tabba
Message-Id: &l
Signed-off-by: Kirill A. Shutemov
Co-developed-by: Yu Zhang
Signed-off-by: Yu Zhang
Co-developed-by: Chao Peng
Signed-off-by: Chao Peng
Co-developed-by: Ackerley Tng
Signed-off-by: Ackerley Tng
Co-developed-by: Isaku Yamahata
Signed-off-by: Isaku Yamahata
Co-developed-by: Paolo Bonzini
Signed-off
is no in-tree module that uses it, and the old name is gone anyway.
If anybody actually needs the symbol, they can ask or they can just use
anon_inode_create_getfile(), which will be exported very soon for use
in KVM.
Suggested-by: Christian Brauner
Signed-off-by: Paolo Bonzini
---
fs/anon_inod
NEVICTABLE.
Cc: Matthew Wilcox
Co-developed-by: Vlastimil Babka
Signed-off-by: Vlastimil Babka
Signed-off-by: Sean Christopherson
Message-Id: <20231027182217.3615211-15-sea...@google.com>
Signed-off-by: Paolo Bonzini
---
include/linux/pagemap.h | 19 +-
mm/compactio
231027182217.3615211-14-sea...@google.com>
Signed-off-by: Paolo Bonzini
---
Documentation/virt/kvm/api.rst | 36 ++
include/linux/kvm_host.h | 19 +++
include/uapi/linux/kvm.h | 13 ++
virt/kvm/Kconfig | 4 +
virt/kvm/kvm_main.c| 216 ++
of this nature.
Reported-by: Isaku Yamahata
Link: https://lore.kernel.org/all/20230802203119.gb2021...@ls.amr.corp.intel.com
Signed-off-by: Sean Christopherson
Reviewed-by: Paolo Bonzini
Reviewed-by: Fuad Tabba
Tested-by: Fuad Tabba
Message-Id: <20231027182217.3615211-12-sea...@google.com>
Sign
from a function call (not to mention the size of the struct will
be two bytes in practice).
Signed-off-by: Sean Christopherson
Reviewed-by: Paolo Bonzini
Reviewed-by: Fuad Tabba
Tested-by: Fuad Tabba
Message-Id: <20231027182217.3615211-11-sea...@google.com>
Signed-off-by: Paolo B
ristopherson
Signed-off-by: Sean Christopherson
Reviewed-by: Paolo Bonzini
Message-Id: <20231027182217.3615211-10-sea...@google.com>
Signed-off-by: Paolo Bonzini
---
Documentation/virt/kvm/api.rst | 41 ++
arch/x86/kvm/x86.c | 1 +
include/linux/kvm_ho
tection of bad flags a bit more robust, e.g. if the new fd field
is guarded only by a flag and not a new ioctl(), then a userspace bug
(setting a "bad" flag) would generate out-of-bounds access instead of an
-EINVAL error.
Cc: Jarkko Sakkinen
Reviewed-by: Paolo Bonzini
Reviewed-by: X
reason not to define it in common KVM.
Acked-by: Anup Patel
Signed-off-by: Sean Christopherson
Reviewed-by: Paolo Bonzini
Reviewed-by: Fuad Tabba
Tested-by: Fuad Tabba
Message-Id: <20231027182217.3615211-8-sea...@google.com>
Signed-off-by: Paolo Bonzini
---
arch/arm64/include/asm/kvm_
.
Suggested-by: Paolo Bonzini
Signed-off-by: Sean Christopherson
Message-Id: <20231027182217.3615211-7-sea...@google.com>
Signed-off-by: Paolo Bonzini
---
arch/powerpc/kvm/powerpc.c | 4
1 file changed, 4 deletions(-)
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
defined(KVM_ARCH_WANT_MMU_NOTIFIER)
checks into a single
#ifdef CONFIG_KVM_GENERIC_MMU_NOTIFIER
without having to worry about PPC's "bare" usage of
KVM_ARCH_WANT_MMU_NOTIFIER.
Signed-off-by: Sean Christopherson
Reviewed-by: Paolo Bonzini
Reviewed-by: Fuad Tabba
Message-Id: <2023102
-by: Sean Christopherson
Reviewed-by: Paolo Bonzini
Reviewed-by: Fuad Tabba
Tested-by: Fuad Tabba
Message-Id: <20231027182217.3615211-5-sea...@google.com>
Signed-off-by: Paolo Bonzini
---
virt/kvm/kvm_main.c | 9 -
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/vi
is expected small.
Suggested-by: Sean Christopherson
Cc: Xu Yilun
Signed-off-by: Chao Peng
Reviewed-by: Fuad Tabba
Tested-by: Fuad Tabba
[sean: convert vmx_set_apic_access_page_addr() to gfn-based API]
Signed-off-by: Sean Christopherson
Reviewed-by: Paolo Bonzini
Reviewed-by: Xu Yilun
Message-Id
().
Signed-off-by: Sean Christopherson
Reviewed-by: Paolo Bonzini
Reviewed-by: Fuad Tabba
Tested-by: Fuad Tabba
Message-Id: <20231027182217.3615211-3-sea...@google.com>
Signed-off-by: Paolo Bonzini
---
virt/kvm/kvm_main.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git
t should always have been gfn_handler_t).
Practically speaking, this is a nop for 64-bit kernels as the only
meaningful change is to store start+end as u64s instead of unsigned longs.
Reviewed-by: Paolo Bonzini
Reviewed-by: Xiaoyao Li
Signed-off-by: Sean Christopherson
Reviewed-by: Fuad Ta
VM_SET_USER_MEMORY_REGION2 helper
KVM: selftests: Expand set_memory_region_test to validate
guest_memfd()
KVM: selftests: Add basic selftest for guest_memfd()
Paolo Bonzini (1):
fs: Rename anon_inode_getfile_secure() and anon_inode_getfd_secure()
Sean Christopherson (23):
KVM: Tweak kvm_hv
On Sun, Nov 5, 2023 at 2:04 PM Xu Yilun wrote:
>
> > +static void kvm_mmu_prepare_memory_fault_exit(struct kvm_vcpu *vcpu,
> > + struct kvm_page_fault *fault)
> > +{
> > + kvm_prepare_memory_fault_exit(vcpu, fault->gfn << PAGE_SHIFT,
> > +
On 11/2/23 17:24, Christian Brauner wrote:
On Fri, Oct 27, 2023 at 11:21:57AM -0700, Sean Christopherson wrote:
Export anon_inode_getfile_secure() so that it can be used by KVM to create
and manage file-based guest memory without need a fullblow filesystem.
The "standard" anon_inode_getfd()
On Thu, Nov 2, 2023 at 4:38 PM Sean Christopherson wrote:
> Actually, looking that this again, there's not actually a hard dependency on
> THP.
> A THP-enabled kernel _probably_ gives a higher probability of using
> hugepages,
> but mostly because THP selects COMPACTION, and I suppose because
On 10/31/23 23:39, David Matlack wrote:
Maybe can you sketch out how you see this proposal being extensible to
using guest_memfd for shared mappings?
For in-place conversions, e.g. pKVM, no additional guest_memfd is needed.
What's
missing there is the ability to (safely) mmap() guest_memfd,
On 11/2/23 06:59, Binbin Wu wrote:
Add flags to "struct kvm_gfn_range" to let notifier events target
only shared and only private mappings, and write up the existing
mmu_notifier events to be shared-only (private memory is never
associated with a userspace virtual address, i.e. can't be
On 11/2/23 10:35, Huang, Kai wrote:
IIUC KVM can already handle the case of poisoned
page by sending signal to user app:
static int kvm_handle_error_pfn(struct kvm_vcpu *vcpu,
struct kvm_page_fault *fault)
{
...
if
On 11/1/23 18:36, Sean Christopherson wrote:
A good example is KVM_RUN with -EINTR; if KVM were to return something other
than
-EINTR on a pending signal or vcpu->run->immediate_exit, userspace would fall
over.
And dually if KVM were to return KVM_EXIT_INTR together with something
other
On 11/2/23 04:01, Huang, Kai wrote:
On Fri, 2023-10-27 at 11:21 -0700, Sean Christopherson wrote:
From: Chao Peng
In confidential computing usages, whether a page is private or shared is
necessary information for KVM to perform operations like page fault
handling, page zapping etc. There are
On Wed, Nov 1, 2023 at 11:35 PM Sean Christopherson wrote:
>
> On Wed, Nov 01, 2023, Paolo Bonzini wrote:
> > On 11/1/23 17:36, Sean Christopherson wrote:
> > > > > "Allow" isn't perfect, e.g. I would much prefer a straight
&g
On 11/1/23 17:36, Sean Christopherson wrote:
"Allow" isn't perfect, e.g. I would much prefer a straight
KVM_GUEST_MEMFD_USE_HUGEPAGES
or KVM_GUEST_MEMFD_HUGEPAGES flag, but I wanted the name to convey that KVM
doesn't
(yet) guarantee hugepages. I.e. KVM_GUEST_MEMFD_ALLOW_HUGEPAGE is stronger
On Wed, Nov 1, 2023 at 2:41 PM Sean Christopherson wrote:
>
> On Wed, Nov 01, 2023, Xiaoyao Li wrote:
> > On 10/31/2023 10:16 PM, Sean Christopherson wrote:
> > > On Tue, Oct 31, 2023, Xiaoyao Li wrote:
> > > > On 10/28/2023 2:21 AM, Sean Christopherson wrote:
> > > > > Extended guest_memfd to
On Tue, Oct 31, 2023 at 11:13 PM Sean Christopherson wrote:
> On Tue, Oct 31, 2023, Fuad Tabba wrote:
> > On Fri, Oct 27, 2023 at 7:23 PM Sean Christopherson
> > wrote:
> Since we now know that at least pKVM will use guest_memfd for shared memory,
> and
> odds are quite good that "regular" VMs
On 10/30/23 21:25, Sean Christopherson wrote:
On Mon, Oct 30, 2023, Paolo Bonzini wrote:
On 10/27/23 20:21, Sean Christopherson wrote:
+ if (ioctl == KVM_SET_USER_MEMORY_REGION)
+ size = sizeof(struct kvm_userspace_memory_region);
This also needs a memset
On 10/27/23 20:21, Sean Christopherson wrote:
Non-KVM people, please take a gander at two small-ish patches buried in the
middle of this series:
fs: Export anon_inode_getfile_secure() for use by KVM
mm: Add AS_UNMOVABLE to mark mapping as completely unmovable
Our plan/hope is to take
mory isn't a realistic option.
At the very least, KVM_X86_SW_PROTECTED_VM will enable a variety of
selftests for guest_memfd and private memory support without requiring
unique hardware.
Signed-off-by: Sean Christopherson
Reviewed-by: Paolo Bonzini
with one nit:
+-
+
+:
and write guest memory and register state.
Disallowing SMM will simplify support for guest private memory, as KVM
will not need to worry about tracking memory attributes for multiple
address spaces (SMM is the only "non-default" address space across all
architectures).
Reviewed-by: Paolo Bonzini
--git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index ee3cd8c3c0ef..f41dbb1465a0 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -10963,6 +10963,7 @@ static int vcpu_run(struct kvm_vcpu *vcpu)
{
int r;
+ vcpu->run->exit_reason = KVM_EXIT_UNKNOWN;
vcpu->ar
On 10/27/23 20:21, Sean Christopherson wrote:
Export anon_inode_getfile_secure() so that it can be used by KVM to
create and manage file-based guest memory without need a fullblow
without introducing a full-blown
Otherwise,
Reviewed-by: Paolo Bonzini
Paolo
filesystem. The "sta
On 10/27/23 20:21, Sean Christopherson wrote:
Add an "unmovable" flag for mappings that cannot be migrated under any
circumstance. KVM will use the flag for its upcoming GUEST_MEMFD support,
which will not support compaction/migration, at least not in the
foreseeable future.
Test AS_UNMOVABLE
d-off-by: Chao Peng
Co-developed-by: Sean Christopherson
Signed-off-by: Sean Christopherson
Reviewed-by: Paolo Bonzini
---
Documentation/virt/kvm/api.rst | 41 ++
arch/x86/kvm/x86.c | 1 +
include/linux/kvm_host.h | 11 +
in
On 10/27/23 20:21, Sean Christopherson wrote:
@@ -635,6 +635,13 @@ static __always_inline kvm_mn_ret_t
__kvm_handle_hva_range(struct kvm *kvm,
* the second or later invocation of the handler).
*/
gfn_range.arg =
future bugs of this nature.
This is what David suggested to do in patch 3, FWIW.
Reviewed-by: Paolo Bonzini
Paolo
Reported-by: Isaku Yamahata
Link: https://lore.kernel.org/all/20230802203119.gb2021...@ls.amr.corp.intel.com
Signed-off-by: Sean Christopherson
---
actually be
returned from a function call (not to mention the size of the struct will
be two bytes in practice).
Could have been split in two patches, but it's fine anyway.
Reviewed-by: Paolo Bonzini
Paolo
On Mon, Oct 30, 2023 at 5:53 PM David Matlack wrote:
>
> On 2023-10-27 11:21 AM, Sean Christopherson wrote:
> > From: Chao Peng
> >
> > Currently in mmu_notifier invalidate path, hva range is recorded and
> > then checked against by mmu_notifier_retry_hva() in the page fault
> > handling path.
On 10/27/23 20:21, Sean Christopherson wrote:
+ if (ioctl == KVM_SET_USER_MEMORY_REGION)
+ size = sizeof(struct kvm_userspace_memory_region);
This also needs a memset(, 0, sizeof(mem)), otherwise the
out-of-bounds access of the commit message becomes a
and I'll post it for 6.8.
Reviewed-by: Paolo Bonzini
Paolo
r = 1;
#else
- r = 0;
+ r = 1;
#endif
break;
#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
Reviewed-by: Paolo Bonzini
...@linux.intel.com
Signed-off-by: Sean Christopherson
Reviewed-by: Paolo Bonzini
Paolo
. Such aliasing should be uncommon, so the impact is expected
small.
Reviewed-by: Paolo Bonzini
Paolo
() without a start().
Reviewed-by: Paolo Bonzini
Signed-off-by: Sean Christopherson
---
virt/kvm/kvm_main.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 0524933856d4..5a97e6c7d9c2 100644
--- a/virt/kvm/kvm_main.c
+++ b
On Fri, Jul 21, 2023 at 7:13 PM Sean Christopherson wrote:
> On Fri, Jul 21, 2023, Paolo Bonzini wrote:
> > On 7/19/23 01:44, Sean Christopherson wrote:
> > > @@ -413,6 +454,9 @@ int kvm_gmem_create(struct kvm *kvm, struct
> > > kvm_create_guest_memfd *args)
> &
On 7/29/23 02:03, Sean Christopherson wrote:
KVM would need to do multiple uaccess reads, but that's not a big
deal. Am I missing something, or did past us just get too clever and
miss the obvious solution?
You would have to introduce struct kvm_userspace_memory_region2 anyway,
though not a
On 7/28/23 18:02, Vlastimil Babka wrote:
There's even a comment to that effect later on in the function:
Hmm, well spotted. But it wouldn't be so great if we now had to lock every
inspected page (and not just dirty pages), just to check the AS_ bit.
But I wonder if this is leftover from
On 7/19/23 01:44, Sean Christopherson wrote:
+ inode = alloc_anon_inode(mnt->mnt_sb);
+ if (IS_ERR(inode))
+ return PTR_ERR(inode);
+
+ err = security_inode_init_security_anon(inode, , NULL);
+ if (err)
+ goto err_inode;
+
I don't understand
On 7/19/23 01:45, Sean Christopherson wrote:
Drop kvm_userspace_memory_region_find(), it's unused and a terrible API
(probably why it's unused). If anything outside of kvm_util.c needs to
get at the memslot, userspace_mem_region_find() can be exposed to give
others full access to all memory
On 7/19/23 01:44, Sean Christopherson wrote:
@@ -4725,9 +4725,9 @@ static int kvm_vm_ioctl_check_extension_generic(struct
kvm *kvm, long arg)
case KVM_CAP_IRQ_ROUTING:
return KVM_MAX_IRQ_ROUTES;
#endif
-#if KVM_ADDRESS_SPACE_NUM > 1
+#if KVM_MAX_NR_ADDRESS_SPACES > 1
ch/x86/kvm/mmu/mmutrace.h b/arch/x86/kvm/mmu/mmutrace.h
index ae86820cef69..2d7555381955 100644
--- a/arch/x86/kvm/mmu/mmutrace.h
+++ b/arch/x86/kvm/mmu/mmutrace.h
@@ -58,6 +58,7 @@ TRACE_DEFINE_ENUM(RET_PF_CONTINUE);
TRACE_DEFINE_ENUM(RET_PF_RETRY);
TRACE_DEFINE_ENUM(RET_PF_EMULATE);
TRACE_DEFINE_ENUM(RET_PF_INVALID);
+TRACE_DEFINE_ENUM(RET_PF_USER);
TRACE_DEFINE_ENUM(RET_PF_FIXED);
TRACE_DEFINE_ENUM(RET_PF_SPURIOUS);
Reviewed-by: Paolo Bonzini
TIPLE_ADDRESS_SPACE
+#if KVM_ADDRESS_SPACE_NUM == 1
static inline int kvm_arch_vcpu_memslots_id(struct kvm_vcpu *vcpu)
{
return 0;
Reviewed-by: Paolo Bonzini
On 7/19/23 01:44, Sean Christopherson wrote:
@@ -413,6 +454,9 @@ int kvm_gmem_create(struct kvm *kvm, struct kvm_create_guest_memfd *args)
u64 flags = args->flags;
u64 valid_flags = 0;
+ if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE))
+ valid_flags |=
On 7/19/23 01:44, Sean Christopherson wrote:
+static bool range_has_attrs(struct kvm *kvm, gfn_t start, gfn_t end,
+ unsigned long attrs)
+{
+ XA_STATE(xas, >mem_attr_array, start);
+ unsigned long index;
+ bool has_attrs;
+ void *entry;
+
+
Reviewed-by: Paolo Bonzini
KVM_GET_DIRTY_LOG: {
Reviewed-by: Paolo Bonzini
On 7/19/23 01:44, Sean Christopherson wrote:
Signed-off-by: Sean Christopherson
---
arch/powerpc/kvm/powerpc.c | 7 ---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 7197c8256668..5cf9e5e3112a 100644
---
On 7/19/23 01:44, Sean Christopherson wrote:
Signed-off-by: Sean Christopherson
---
virt/kvm/kvm_main.c | 34 +++---
1 file changed, 19 insertions(+), 15 deletions(-)
Reviewed-by: Paolo Bonzini
should be uncommon, so the
impact is expected small.
Reviewed-by: Paolo Bonzini
Suggested-by: Sean Christopherson
Signed-off-by: Chao Peng
Reviewed-by: Fuad Tabba
Tested-by: Fuad Tabba
[sean: convert vmx_set_apic_access_page_addr() to gfn-based API]
Signed-off-by: Sean Christopherson
---
arch
bility is to remove 'raw' and just assign
the whole union.
Apart from this,
Reviewed-by: Paolo Bonzini
Paolo
+ BUILD_BUG_ON(sizeof(gfn_range.arg) != sizeof(range->arg));
On 5/27/23 01:44, Yu Zhao wrote:
TLDR
This patchset adds a fast path to clear the accessed bit without
taking kvm->mmu_lock. It can significantly improve the performance of
guests when the host is under heavy memory pressure.
ChromeOS has been using a similar approach [1] since mid 2021
On 5/27/23 01:44, Yu Zhao wrote:
+#define kvm_arch_has_test_clear_young kvm_arch_has_test_clear_young
+static inline bool kvm_arch_has_test_clear_young(void)
+{
+ return IS_ENABLED(CONFIG_X86_64) &&
+ (!IS_REACHABLE(CONFIG_KVM) || (tdp_mmu_enabled &&
shadow_accessed_mask));
On 5/31/23 21:17, Jason Gunthorpe wrote:
+ int (*test_clear_young)(struct mmu_notifier *mn, struct mm_struct *mm,
+ unsigned long start, unsigned long end,
+ bool clear, unsigned long *bitmap);
+
Why leave clear_young behind?
1 - 100 of 278 matches
Mail list logo