[Qemu-devel] [PATCH] target-i386: add Intel AVX-512 support

2014-10-22 Thread Chao Peng
Add AVX512 feature bits, register definition and corresponding xsave/vmstate support. Signed-off-by: Chao Peng --- target-i386/cpu.c | 10 -- target-i386/cpu.h | 61 ++ target-i386/kvm.c | 19 +++ target-i386/machine.c | 87

Re: [Qemu-devel] [PATCH] target-i386: add Intel AVX-512 support

2014-10-23 Thread Chao Peng
On Thu, Oct 23, 2014 at 05:49:23PM -0200, Eduardo Habkost wrote: > On Thu, Oct 23, 2014 at 11:02:43AM +0800, Chao Peng wrote: > [...] > > @@ -707,6 +714,24 @@ typedef union { > > } XMMReg; > > > > typedef union { > > +uint8_t _b[32]; > > +

Re: [Qemu-devel] [PATCH] target-i386: add Intel AVX-512 support

2014-10-26 Thread Chao Peng
On Fri, Oct 24, 2014 at 02:01:44PM -0200, Eduardo Habkost wrote: > On Thu, Oct 23, 2014 at 11:02:43AM +0800, Chao Peng wrote: > > Add AVX512 feature bits, register definition and corresponding > > xsave/vmstate support. > > > > Signed-off-by: Chao Peng > > --

Re: [Qemu-devel] [PATCH] target-i386: add Intel AVX-512 support

2014-11-02 Thread Chao Peng
On Sun, Nov 02, 2014 at 12:19:09PM +0200, Michael S. Tsirkin wrote: > On Thu, Oct 23, 2014 at 11:02:43AM +0800, Chao Peng wrote: > > Add AVX512 feature bits, register definition and corresponding > > xsave/vmstate support. > > > > Signed-off-by: Chao Peng > &g

[Qemu-devel] [PATCH] target-i386: kvm: cache KVM_GET_SUPPORTED_CPUID data

2016-06-12 Thread Chao Peng
for most invocations and looks all the places in current code hold true. A non-cached version can be introduced if refresh is required in the future. Signed-off-by: Chao Peng --- target-i386/kvm.c | 18 -- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/target-i386

Re: [Qemu-devel] [PATCH] target-i386: kvm: cache KVM_GET_SUPPORTED_CPUID data

2016-06-13 Thread Chao Peng
On Mon, Jun 13, 2016 at 12:02:41PM +0200, Paolo Bonzini wrote: > > > On 13/06/2016 04:21, Chao Peng wrote: > > KVM_GET_SUPPORTED_CPUID ioctl is called frequently when initializing > > CPU. Depends on CPU features and CPU count, the number of calls can be > > extremely

Re: [Qemu-devel] [PATCH] target-i386: kvm: cache KVM_GET_SUPPORTED_CPUID data

2016-06-14 Thread Chao Peng
On Tue, Jun 14, 2016 at 10:21:41AM +0200, Paolo Bonzini wrote: > > > On 14/06/2016 07:01, Chao Peng wrote: > >> > > >> > Which are the CPUID leaves for which KVM_GET_SUPPORTED_CPUID is not > >> > stateless? I cannot find any. > > I have though

[Qemu-devel] [PATCH] vnc: wrap vnc initialization code with CONFIG_VNC

2016-06-15 Thread Chao Peng
commit f8c75b2486 (vnc: Initialization stubs) removed CONFIG_VNC in vl.c code. However qemu_find_opts("vnc") is NULL when vnc is configured out. Crash will happen in qemu_opts_foreach() before stub vnc_init_func() is called. This patch add it back. Cc: Eduardo Habkost Signed-off-by:

[Qemu-devel] [RFC 4/9] acpi: expose data structurs and functions of BIOS linker loader

2016-06-17 Thread Chao Peng
From: Haozhong Zhang Expose some data structures and functions of BIOS linker loader which will be used by later commits. Signed-off-by: Haozhong Zhang --- hw/acpi/bios-linker-loader.c | 83 +-- include/hw/acpi/bios-linker-loader.h | 85 +

[Qemu-devel] [RFC 0/9] Introduce light weight PC platform pc-lite

2016-06-17 Thread Chao Peng
est kernel; - You are forced to use virtio-serial-pci, old 8250/16550 is not there; Want to have a try? === Please follow https://github.com/chao-p/qemu-lite-tools. Thanks, Chao Chao Peng (6): acpi: introduce light weight ACPI PM emulation pm-lite pci: introduce light weight

[Qemu-devel] [RFC 1/9] acpi: introduce light weight ACPI PM emulation pm-lite

2016-06-17 Thread Chao Peng
The code is loosely based on piix4_pm. The goal is to make it light weight and dedicated to the emulation of PM registers defined in ACPI spec. Unlike piix4_pm, the register address (PM_IO_BASE) is fixed so configuration in BIOS is impossible and unnecessary. Signed-off-by: Chao Peng --- docs

[Qemu-devel] [RFC 3/9] acpi: add support for pc-lite platform

2016-06-17 Thread Chao Peng
Basically, the to be added pc-lite platform uses pm-lite to support CPU/memory/PCI hotplug and pci-lite as the host bridge. The code here reuses some existing facilities for piix/q35 platform. Signed-off-by: Chao Peng --- hw/i386/acpi-build.c | 108

[Qemu-devel] [RFC 2/9] pci: introduce light weight PCIE Host emulation pci-lite

2016-06-17 Thread Chao Peng
ce ID assigned so guest may not recognize it, the functionality however is expected to be OK. Signed-off-by: Chao Peng --- default-configs/i386-softmmu.mak | 1 + default-configs/x86_64-softmmu.mak | 1 + hw/pci-host/Makefile.objs | 1 + hw/pci-host/pci_lite.c

[Qemu-devel] [RFC 5/9] acpi: expose acpi_checksum()

2016-06-17 Thread Chao Peng
From: Haozhong Zhang It will be used in later commits. Signed-off-by: Haozhong Zhang --- hw/acpi/core.c | 2 +- include/hw/acpi/acpi.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/acpi/core.c b/hw/acpi/core.c index d24b9a9..70ad6ff 100644 --- a/hw/acpi/core.

[Qemu-devel] [RFC 7/9] pc: skip setting CMOS data when RTC device is unavailable

2016-06-17 Thread Chao Peng
... to make sure hotplug for new platform that without RTC support can still work. Signed-off-by: Chao Peng --- hw/i386/pc.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 7198ed5..46ca0e3 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c

[Qemu-devel] [RFC 9/9] pc: introduce light weight PC board pc-lite

2016-06-17 Thread Chao Peng
The new board gets rid of most legacy devices and mainly support modern PCI devices. BIOS is skipped and an ELF format kernel must be specified. QEMU will boot this kernel directly. Add "-machine pc-lite -kernel $ELF_KERNEL -append $KERNEL_CMD" to use it. Signed-off-by: Chao Peng --

[Qemu-devel] [RFC 6/9] acpi: patch guest ACPI for pc-lite

2016-06-17 Thread Chao Peng
From: Haozhong Zhang Traditionally, guest firmware is responsible to patch ACPI tables generated by QEMU. However, no firmware is used with pc-lite and patching ACPI should be done in QEMU for pc-lite. Signed-off-by: Haozhong Zhang --- hw/acpi/nvdimm.c | 6 +- hw/i386/Makefile.

[Qemu-devel] [RFC 8/9] pc: support direct loading protected/long mode kernel

2016-06-17 Thread Chao Peng
ping several steps and speed up the whole booting. We do this by filling the zero page per Linux booting protocol and then jumping to the kernel protected/long mode entry. Registers and paging should also be put in the correct state. Signed-off-by: Jim Kukunas Signed-off-by: Chao Peng --- hw/i38

Re: [Qemu-devel] [RFC 0/9] Introduce light weight PC platform pc-lite

2016-06-19 Thread Chao Peng
On Fri, Jun 17, 2016 at 03:24:59PM +0200, Paolo Bonzini wrote: > > > On 17/06/2016 10:14, Chao Peng wrote: > > Basically: > > - it removes old ISA devices and support only PCI devices; > > I think you need to keep at least the RTC, otherwise where does Linux >

Re: [Qemu-devel] [RFC 0/9] Introduce light weight PC platform pc-lite

2016-06-19 Thread Chao Peng
On Sun, Jun 19, 2016 at 06:51:04AM +0300, Michael S. Tsirkin wrote: > On Fri, Jun 17, 2016 at 04:14:08AM -0400, Chao Peng wrote: > > - it is FAST; > > Any numbers to demonstrate just how fast it is and fast at what? On a 2.30GHz Haswell server, guest kernel booting time is 59.9

Re: [Qemu-devel] [RFC 0/9] Introduce light weight PC platform pc-lite

2016-06-19 Thread Chao Peng
> > The combination of devices removed/supported seems a bit arbitrary to me. > The use in this text of "legacy" and non-"legacy" is also arbitrary if not > given a definition. The criterial here is to remove the devices that have poor performance. You can think legacy devices here as ISA device

Re: [Qemu-devel] [RFC 0/9] Introduce light weight PC platform pc-lite

2016-06-20 Thread Chao Peng
> It would be nice to at least see the patches. :) > > I think a lightweight q35 platform that can run the usual firmware could > be acceptable in QEMU. OK, I will send out v2. > > >> 2) this: > >> > >>> - it loads guest kernel directly, no BIOS, no bootloader, no realmode > >>> code; > >> >

Re: [Qemu-devel] [RFC 0/9] Introduce light weight PC platform pc-lite

2016-06-23 Thread Chao Peng
> > I think a lightweight q35 platform that can run the usual firmware could > be acceptable in QEMU. After re-thought the target usage model, I'm not sure if this is a good idea. The original usage model is to replace kvm-tool with QEMU for Clear Containers (https://clearlinux.org/features/clea

Re: [PATCH v9 2/8] KVM: Extend the memslot to support fd-based private memory

2022-11-15 Thread Chao Peng
On Mon, Nov 14, 2022 at 04:04:59PM +, Alex Bennée wrote: > > Chao Peng writes: > > > In memory encryption usage, guest memory may be encrypted with special > > key and can be accessed only by the guest itself. We call such memory > > private memory. It's v

Re: [PATCH v9 1/8] mm: Introduce memfd_restricted system call to create restricted user memory

2022-11-15 Thread Chao Peng
v 01, 2022 at 07:37:29PM +0800, Chao Peng wrote: > > > >> > > > > >> > 1) restoring kernel directmap: > > > >> > > > > >> > Currently SNP (and I believe TDX) need to either split or > > > >&

Re: [PATCH v9 3/8] KVM: Add KVM_EXIT_MEMORY_FAULT exit

2022-11-15 Thread Chao Peng
On Tue, Nov 15, 2022 at 04:56:12PM +, Alex Bennée wrote: > > Chao Peng writes: > > > This new KVM exit allows userspace to handle memory-related errors. It > > indicates an error happens in KVM at guest memory range [gpa, gpa+size). > > The flags includes

Re: [PATCH v9 0/8] KVM: mm: fd-based approach for supporting KVM

2022-11-15 Thread Chao Peng
On Mon, Nov 14, 2022 at 11:43:37AM +, Alex Bennée wrote: > > Chao Peng writes: > > > > Introduction > > > > KVM userspace being able to crash the host is horrible. Under current > > KVM architecture, all guest memory is inherently acce

Re: [PATCH v9 5/8] KVM: Register/unregister the guest private memory regions

2022-11-17 Thread Chao Peng
On Wed, Nov 16, 2022 at 10:24:11PM +, Sean Christopherson wrote: > On Tue, Oct 25, 2022, Chao Peng wrote: > > +static int kvm_vm_ioctl_set_mem_attr(struct kvm *kvm, gpa_t gpa, gpa_t > > size, > > +bool is_private) > >

Re: [PATCH v9 7/8] KVM: Handle page fault for private memory

2022-11-17 Thread Chao Peng
On Wed, Nov 16, 2022 at 10:13:07PM +, Sean Christopherson wrote: > On Wed, Nov 16, 2022, Ackerley Tng wrote: > > >@@ -4173,6 +4203,22 @@ static int kvm_faultin_pfn(struct kvm_vcpu *vcpu, > > >struct kvm_page_fault *fault) > > > return RET_PF_EMULATE; > > > } > > > > > >+ i

Re: [PATCH v9 3/8] KVM: Add KVM_EXIT_MEMORY_FAULT exit

2022-11-17 Thread Chao Peng
On Wed, Nov 16, 2022 at 06:48:43PM +, Sean Christopherson wrote: > On Wed, Nov 16, 2022, Andy Lutomirski wrote: > > > > > > On Tue, Oct 25, 2022, at 8:13 AM, Chao Peng wrote: > > > diff --git a/Documentation/virt/kvm/api.rst > > > b/Documentation/vi

Re: [PATCH v9 3/8] KVM: Add KVM_EXIT_MEMORY_FAULT exit

2022-11-17 Thread Chao Peng
On Wed, Nov 16, 2022 at 07:03:49PM +, Alex Bennée wrote: > > Chao Peng writes: > > > On Tue, Nov 15, 2022 at 04:56:12PM +, Alex Bennée wrote: > >> > >> Chao Peng writes: > >> > >> > This new KVM exit allows userspace to hand

Re: [PATCH v9 0/8] KVM: mm: fd-based approach for supporting KVM

2022-11-17 Thread Chao Peng
On Wed, Nov 16, 2022 at 09:40:23AM +, Alex Bennée wrote: > > Chao Peng writes: > > > On Mon, Nov 14, 2022 at 11:43:37AM +, Alex Bennée wrote: > >> > >> Chao Peng writes: > >> > >> > >> > Introduction > >> >

Re: [PATCH v9 3/8] KVM: Add KVM_EXIT_MEMORY_FAULT exit

2022-11-17 Thread Chao Peng
On Thu, Nov 17, 2022 at 03:08:17PM +, Alex Bennée wrote: > > Chao Peng writes: > > > On Wed, Nov 16, 2022 at 07:03:49PM +, Alex Bennée wrote: > >> > >> Chao Peng writes: > >> > >> > On Tue, Nov 15, 2022 at 04:56:12PM +,

Re: [PATCH v9 3/8] KVM: Add KVM_EXIT_MEMORY_FAULT exit

2022-11-22 Thread Chao Peng
On Fri, Nov 18, 2022 at 03:59:12PM +, Sean Christopherson wrote: > On Fri, Nov 18, 2022, Alex Benn?e wrote: > > > > Chao Peng writes: > > > > > On Thu, Nov 17, 2022 at 03:08:17PM +, Alex Benn?e wrote: > > >> >> I think this should b

Re: [PATCH v9 1/8] mm: Introduce memfd_restricted system call to create restricted user memory

2022-11-29 Thread Chao Peng
On Tue, Nov 29, 2022 at 02:21:39PM +0300, Kirill A. Shutemov wrote: > On Mon, Nov 28, 2022 at 06:06:32PM -0600, Michael Roth wrote: > > On Tue, Oct 25, 2022 at 11:13:37PM +0800, Chao Peng wrote: > > > From: "Kirill A. Shutemov" > > > >

Re: [PATCH v9 1/8] mm: Introduce memfd_restricted system call to create restricted user memory

2022-11-29 Thread Chao Peng
On Tue, Nov 29, 2022 at 12:39:06PM +0100, David Hildenbrand wrote: > On 29.11.22 12:21, Kirill A. Shutemov wrote: > > On Mon, Nov 28, 2022 at 06:06:32PM -0600, Michael Roth wrote: > > > On Tue, Oct 25, 2022 at 11:13:37PM +0800, Chao Peng wrote: > > >

Re: [PATCH v9 1/8] mm: Introduce memfd_restricted system call to create restricted user memory

2022-11-29 Thread Chao Peng
On Mon, Nov 28, 2022 at 06:37:25PM -0600, Michael Roth wrote: > On Tue, Oct 25, 2022 at 11:13:37PM +0800, Chao Peng wrote: ... > > +static long restrictedmem_fallocate(struct file *file, int mode, > > + loff_t offset, loff_t len) > &

Re: [PATCH v9 1/8] mm: Introduce memfd_restricted system call to create restricted user memory

2022-11-30 Thread Chao Peng
On Tue, Nov 29, 2022 at 01:18:15PM -0600, Michael Roth wrote: > On Tue, Nov 29, 2022 at 01:06:58PM -0600, Michael Roth wrote: > > On Tue, Nov 29, 2022 at 10:06:15PM +0800, Chao Peng wrote: > > > On Mon, Nov 28, 2022 at 06:37:25PM -0600, Michael Roth wrote: > > > >

[PATCH v10 1/9] mm: Introduce memfd_restricted system call to create restricted user memory

2022-12-01 Thread Chao Peng
default memfd_restricted() prevents userspace read, write and mmap. By defining new bit in the 'flags', it can be extended to support other restricted semantics in the future. The system call is currently wired up for x86 arch. Signed-off-by: Kirill A. Shutemov Signed-off-by: Chao

[PATCH v10 0/9] KVM: mm: fd-based approach for supporting KVM

2022-12-01 Thread Chao Peng
...@linux.intel.com/T/ [3] Original design proposal: https://lore.kernel.org/all/20210824005248.200037-1-sea...@google.com/ [4] Selftest: https://lore.kernel.org/all/2022014244.1714148-1-vannapu...@google.com/ Chao Peng (8): KVM: Introduce per-page memory attributes KVM: Extend the mems

[PATCH v10 4/9] KVM: Add KVM_EXIT_MEMORY_FAULT exit

2022-12-01 Thread Chao Peng
re KVM exits to userspace for an implicit conversion when the page is in a different state than requested (private or shared). Suggested-by: Sean Christopherson Co-developed-by: Yu Zhang Signed-off-by: Yu Zhang Signed-off-by: Chao Peng Reviewed-by: Fuad Tabba ---

[PATCH v10 5/9] KVM: Use gfn instead of hva for mmu_notifier_retry

2022-12-01 Thread Chao Peng
: Sean Christopherson Signed-off-by: Chao Peng --- arch/x86/kvm/mmu/mmu.c | 8 +--- include/linux/kvm_host.h | 33 + virt/kvm/kvm_main.c | 32 +++- 3 files changed, 49 insertions(+), 24 deletions(-) diff --git a/arch/x86/kvm

[PATCH v10 8/9] KVM: Handle page fault for private memory

2022-12-01 Thread Chao Peng
y: Yu Zhang Signed-off-by: Yu Zhang Signed-off-by: Chao Peng --- arch/x86/kvm/mmu/mmu.c | 63 +++-- arch/x86/kvm/mmu/mmu_internal.h | 14 +++- arch/x86/kvm/mmu/mmutrace.h | 1 + arch/x86/kvm/mmu/tdp_mmu.c | 2 +- include/linux/kvm_host.h

[PATCH v10 6/9] KVM: Unmap existing mappings when change the memory attributes

2022-12-01 Thread Chao Peng
page state, invoke kvm_mmu_invalidate_* helpers to let the page fault handler retry during this time frame. Signed-off-by: Chao Peng --- include/linux/kvm_host.h | 7 +- virt/kvm/kvm_main.c | 168 ++- 2 files changed, 116 insertions(+), 59 deletions

[PATCH v10 3/9] KVM: Extend the memslot to support fd-based private memory

2022-12-01 Thread Chao Peng
user_mem_region to handle both the normal and the '_ext' variants. Co-developed-by: Yu Zhang Signed-off-by: Yu Zhang Signed-off-by: Chao Peng Reviewed-by: Fuad Tabba Tested-by: Fuad Tabba --- Documentation/virt/kvm/api.rst | 40 ++- arch/x86/kvm/Kconf

[PATCH v10 9/9] KVM: Enable and expose KVM_MEM_PRIVATE

2022-12-01 Thread Chao Peng
Signed-off-by: Yu Zhang Signed-off-by: Chao Peng Reviewed-by: Fuad Tabba --- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/x86.c | 13 +++ include/linux/kvm_host.h| 3 + virt/kvm/kvm_main.c | 179 +++- 4 files changed, 191

[PATCH v10 7/9] KVM: Update lpage info when private/shared memory are mixed

2022-12-01 Thread Chao Peng
large page has mixed private/share subpages and update this 'mixed' bit whenever the memory attribute is changed between private and shared. Signed-off-by: Chao Peng --- arch/x86/include/asm/kvm_host.h | 8 ++ arch/x86/kvm/mmu/mmu.c | 134 ++

[PATCH v10 2/9] KVM: Introduce per-page memory attributes

2022-12-01 Thread Chao Peng
. - KVM_GET_SUPPORTED_MEMORY_ATTRIBUTES to return the KVM supported memory attributes. KVM internally uses xarray to store the per-page memory attributes. Suggested-by: Sean Christopherson Signed-off-by: Chao Peng Link: https://lore.kernel.org/all/y2wb48kd0j4vg...@google.com/ --- Documentation/virt/kvm/api.rst | 63

Re: [PATCH v9 1/8] mm: Introduce memfd_restricted system call to create restricted user memory

2022-12-01 Thread Chao Peng
On Thu, Dec 01, 2022 at 06:16:46PM -0800, Vishal Annapurve wrote: > On Tue, Oct 25, 2022 at 8:18 AM Chao Peng wrote: > > ... > > +} > > + > > +SYSCALL_DEFINE1(memfd_restricted, unsigned int, flags) > > +{ > > Looking at the underlying shmem implementatio

Re: [PATCH v10 3/9] KVM: Extend the memslot to support fd-based private memory

2022-12-06 Thread Chao Peng
On Mon, Dec 05, 2022 at 09:03:11AM +, Fuad Tabba wrote: > Hi Chao, > > On Fri, Dec 2, 2022 at 6:18 AM Chao Peng wrote: > > > > In memory encryption usage, guest memory may be encrypted with special > > key and can be accessed only by the guest itself. We call suc

Re: [PATCH v10 5/9] KVM: Use gfn instead of hva for mmu_notifier_retry

2022-12-06 Thread Chao Peng
On Mon, Dec 05, 2022 at 09:23:49AM +, Fuad Tabba wrote: > Hi Chao, > > On Fri, Dec 2, 2022 at 6:19 AM Chao Peng wrote: > > > > Currently in mmu_notifier invalidate path, hva range is recorded and > > then checked against by mmu_notifier_retry_hva() in the p

Re: [PATCH v10 7/9] KVM: Update lpage info when private/shared memory are mixed

2022-12-06 Thread Chao Peng
On Mon, Dec 05, 2022 at 02:49:59PM -0800, Isaku Yamahata wrote: > On Fri, Dec 02, 2022 at 02:13:45PM +0800, > Chao Peng wrote: > > > A large page with mixed private/shared subpages can't be mapped as large > > page since its sub private/shared pages are from different m

Re: [PATCH v7 11/14] KVM: Register/unregister the guest private memory regions

2022-07-25 Thread Chao Peng
On Thu, Jul 21, 2022 at 05:58:50PM +, Sean Christopherson wrote: > On Thu, Jul 21, 2022, Chao Peng wrote: > > On Thu, Jul 21, 2022 at 03:34:59PM +0800, Wei Wang wrote: > > > > > > > > > On 7/21/22 00:21, Sean Christopherson wrote: > > >

Re: [PATCH v7 01/14] mm: Add F_SEAL_AUTO_ALLOCATE seal to memfd

2022-07-25 Thread Chao Peng
On Thu, Jul 21, 2022 at 11:44:11AM +0200, David Hildenbrand wrote: > On 06.07.22 10:20, Chao Peng wrote: > > Normally, a write to unallocated space of a file or the hole of a sparse > > file automatically causes space allocation, for memfd, this equals to > > memory allo

Re: [PATCH v7 01/14] mm: Add F_SEAL_AUTO_ALLOCATE seal to memfd

2022-07-25 Thread Chao Peng
On Thu, Jul 21, 2022 at 03:05:09PM +, Sean Christopherson wrote: > On Thu, Jul 21, 2022, David Hildenbrand wrote: > > On 21.07.22 11:44, David Hildenbrand wrote: > > > On 06.07.22 10:20, Chao Peng wrote: > > >> Normally, a write to unallocated space of

Re: [PATCH v7 01/14] mm: Add F_SEAL_AUTO_ALLOCATE seal to memfd

2022-07-25 Thread Chao Peng
confidential computing usage where we use two memfds to > > > back guest memory and at a single point only one memfd is alive and we > > > want to prevent memory allocation for the other memfd which may have > > > been mmap-ed previously. More discussion can be fou

Re: [PATCH v7 12/14] KVM: Handle page fault for private memory

2022-08-03 Thread Chao Peng
On Fri, Jul 29, 2022 at 08:58:41PM +, Sean Christopherson wrote: > On Wed, Jul 06, 2022, Chao Peng wrote: > > A page fault can carry the private/shared information for > > KVM_MEM_PRIVATE memslot, this can be filled by architecture code(like > > TDX code). To handle page

Re: [PATCH v7 11/14] KVM: Register/unregister the guest private memory regions

2022-08-03 Thread Chao Peng
On Tue, Aug 02, 2022 at 04:38:55PM +, Sean Christopherson wrote: > On Tue, Aug 02, 2022, Sean Christopherson wrote: > > I think we should avoid UNMAPPABLE even on the KVM side of things for the > > core > > memslots functionality and instead be very literal, e.g. > > > > KVM_HAS_FD_BASED_

Re: [PATCH v7 14/14] memfd_create.2: Describe MFD_INACCESSIBLE flag

2022-08-03 Thread Chao Peng
On Mon, Aug 01, 2022 at 07:40:32AM -0700, Dave Hansen wrote: > This patch does not belong in this series. It's not a patch to the > kernel. This is a kernel series. You are right. > > It would be much more appropriate to put a link to a separately posted > manpage patch in the cover letter. T

Re: [PATCH v7 08/14] KVM: Rename mmu_notifier_*

2022-08-03 Thread Chao Peng
On Fri, Jul 29, 2022 at 07:02:12PM +, Sean Christopherson wrote: > On Wed, Jul 06, 2022, Chao Peng wrote: > > The sync mechanism between mmu_notifier and page fault handler employs > > fields mmu_notifier_seq/count and mmu_notifier_range_start/end. For the > > to be added

Re: [PATCH v7 09/14] KVM: Extend the memslot to support fd-based private memory

2022-08-03 Thread Chao Peng
On Fri, Jul 29, 2022 at 07:51:29PM +, Sean Christopherson wrote: > On Wed, Jul 06, 2022, Chao Peng wrote: > > @@ -1332,9 +1332,18 @@ yet and must be cleared on entry. > > __u64 userspace_addr; /* start of the userspace allocated memory */ > >}

Re: [PATCH v7 11/14] KVM: Register/unregister the guest private memory regions

2022-08-04 Thread Chao Peng
On Wed, Aug 03, 2022 at 03:51:24PM +, Sean Christopherson wrote: > On Wed, Aug 03, 2022, Chao Peng wrote: > > On Tue, Aug 02, 2022 at 04:38:55PM +, Sean Christopherson wrote: > > > On Tue, Aug 02, 2022, Sean Christopherson wrote: > > > > I think we should av

Re: [PATCH v7 08/14] KVM: Rename mmu_notifier_*

2022-08-10 Thread Chao Peng
are all trackng, > > e.g. > > > >mmu_invalidate_seq > >mmu_invalidate_in_progress > >mmu_invalidate_range_start > >mmu_invalidate_range_end > > > > Agreed, and this can of course be committed separately if Chao Peng sends it > outs

Re: [PATCH v7 07/14] KVM: Use gfn instead of hva for mmu_notifier_retry

2022-08-10 Thread Chao Peng
On Thu, Aug 04, 2022 at 12:10:44AM -0700, Isaku Yamahata wrote: > On Wed, Jul 06, 2022 at 04:20:09PM +0800, > Chao Peng wrote: > > > diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h > > index 0bdb6044e316..e9153b54e2a4 100644 > > --- a/include/linux/k

Re: [PATCH v7 03/14] mm: Introduce memfile_notifier

2022-08-10 Thread Chao Peng
On Fri, Aug 05, 2022 at 03:22:58PM +0200, David Hildenbrand wrote: > On 06.07.22 10:20, Chao Peng wrote: > > This patch introduces memfile_notifier facility so existing memory file > > subsystems (e.g. tmpfs/hugetlbfs) can provide memory pages to allow a > > third kernel com

Re: [PATCH v7 04/14] mm/shmem: Support memfile_notifier

2022-08-10 Thread Chao Peng
On Fri, Aug 05, 2022 at 03:26:02PM +0200, David Hildenbrand wrote: > On 06.07.22 10:20, Chao Peng wrote: > > From: "Kirill A. Shutemov" > > > > Implement shmem as a memfile_notifier backing store. Essentially it > > interacts with the memfile_notifier featur

Re: [PATCH v7 05/14] mm/memfd: Introduce MFD_INACCESSIBLE flag

2022-08-10 Thread Chao Peng
On Fri, Aug 05, 2022 at 03:28:50PM +0200, David Hildenbrand wrote: > On 06.07.22 10:20, Chao Peng wrote: > > Introduce a new memfd_create() flag indicating the content of the > > created memfd is inaccessible from userspace through ordinary MMU > > access (e.g., read/write/mma

Re: [PATCH v7 01/14] mm: Add F_SEAL_AUTO_ALLOCATE seal to memfd

2022-08-10 Thread Chao Peng
On Fri, Aug 05, 2022 at 07:55:38PM +0200, Paolo Bonzini wrote: > On 7/21/22 11:44, David Hildenbrand wrote: > > > > Also, I*think* you can place pages via userfaultfd into shmem. Not > > sure if that would count "auto alloc", but it would certainly bypass > > fallocate(). > > Yeah, userfaultfd_r

Re: [PATCH v7 01/14] mm: Add F_SEAL_AUTO_ALLOCATE seal to memfd

2022-08-10 Thread Chao Peng
On Fri, Aug 05, 2022 at 08:06:03PM +0200, David Hildenbrand wrote: > On 05.08.22 19:55, Paolo Bonzini wrote: > > On 7/21/22 11:44, David Hildenbrand wrote: > >> > >> Also, I*think* you can place pages via userfaultfd into shmem. Not > >> sure if that would count "auto alloc", but it would certainl

Re: [PATCH v7 05/14] mm/memfd: Introduce MFD_INACCESSIBLE flag

2022-08-11 Thread Chao Peng
On Wed, Aug 10, 2022 at 11:55:19AM +0200, David Hildenbrand wrote: > On 10.08.22 11:37, Chao Peng wrote: > > On Fri, Aug 05, 2022 at 03:28:50PM +0200, David Hildenbrand wrote: > >> On 06.07.22 10:20, Chao Peng wrote: > >>> Introduce a new memfd_create() flag

Re: [PATCH v7 00/14] KVM: mm: fd-based approach for supporting KVM guest private memory

2022-08-11 Thread Chao Peng
On Thu, Aug 11, 2022 at 01:30:06PM +0200, Gupta, Pankaj wrote: > > > > This is the v7 of this series which tries to implement the fd-based KVM > > > guest private memory. The patches are based on latest kvm/queue branch > > > commit: > > > > > >b9b71f43683a (kvm/queue) KVM: x86/mmu: Buffer ne

Re: [PATCH v7 03/14] mm: Introduce memfile_notifier

2022-08-11 Thread Chao Peng
On Thu, Aug 11, 2022 at 12:27:56PM +, Quentin Perret wrote: > +CC Fuad > > On Wednesday 10 Aug 2022 at 14:38:43 (+), Sean Christopherson wrote: > > > I understand Sean's suggestion about abstracting, but if the new name > > > makes it harder to grasp and there isn't really an alternative t

Re: [PATCH v2 0/5] virtio mmio specification enhancement

2020-02-11 Thread Chao Peng
On Mon, Feb 10, 2020 at 06:44:50AM -0500, Michael S. Tsirkin wrote: > On Mon, Feb 10, 2020 at 05:05:16PM +0800, Zha Bin wrote: > > We have compared the number of files and the lines of code between > > virtio-mmio and virio-pci. > > > > Virtio-PCI Virtio-MMIO

Re: [PATCH v10 1/9] mm: Introduce memfd_restricted system call to create restricted user memory

2023-01-17 Thread Chao Peng
On Fri, Jan 13, 2023 at 09:54:41PM +, Sean Christopherson wrote: > On Fri, Dec 02, 2022, Chao Peng wrote: > > The system call is currently wired up for x86 arch. > > Building on other architectures (except for arm64 for some reason) yields: > > CALL/.../scr

Re: [PATCH v10 3/9] KVM: Extend the memslot to support fd-based private memory

2023-01-17 Thread Chao Peng
On Fri, Jan 13, 2023 at 10:37:39PM +, Sean Christopherson wrote: > On Tue, Jan 10, 2023, Chao Peng wrote: > > On Mon, Jan 09, 2023 at 07:32:05PM +, Sean Christopherson wrote: > > > On Fri, Jan 06, 2023, Chao Peng wrote: > > > > On Thu, Jan 05, 2023 at 11:

Re: [PATCH v10 9/9] KVM: Enable and expose KVM_MEM_PRIVATE

2023-01-17 Thread Chao Peng
On Sat, Jan 14, 2023 at 12:01:01AM +, Sean Christopherson wrote: > On Fri, Dec 02, 2022, Chao Peng wrote: > > @@ -10357,6 +10364,12 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) > > > > if (kvm_check_request(KVM_REQ_UPDATE_CP

Re: [PATCH v10 0/9] KVM: mm: fd-based approach for supporting KVM

2023-01-17 Thread Chao Peng
On Sat, Jan 14, 2023 at 12:37:59AM +, Sean Christopherson wrote: > On Fri, Dec 02, 2022, Chao Peng wrote: > > This patch series implements KVM guest private memory for confidential > > computing scenarios like Intel TDX[1]. If a TDX host accesses > > TDX-protected guest

Re: [PATCH v10 2/9] KVM: Introduce per-page memory attributes

2023-01-17 Thread Chao Peng
On Tue, Jan 17, 2023 at 11:21:10AM +0800, Binbin Wu wrote: > > On 12/2/2022 2:13 PM, Chao Peng wrote: > > In confidential computing usages, whether a page is private or shared is > > necessary information for KVM to perform operations like page fault > > handling, pag

Re: [PATCH v10 1/9] mm: Introduce memfd_restricted system call to create restricted user memory

2023-01-18 Thread Chao Peng
On Tue, Jan 17, 2023 at 04:34:15PM +, Sean Christopherson wrote: > On Tue, Jan 17, 2023, Chao Peng wrote: > > On Fri, Jan 13, 2023 at 09:54:41PM +, Sean Christopherson wrote: > > > > + list_for_each_entry(notifier, &data->notifiers, list) { > >

Re: [PATCH v10 9/9] KVM: Enable and expose KVM_MEM_PRIVATE

2023-01-18 Thread Chao Peng
On Tue, Jan 17, 2023 at 07:35:58PM +, Sean Christopherson wrote: > On Tue, Jan 17, 2023, Chao Peng wrote: > > On Sat, Jan 14, 2023 at 12:01:01AM +, Sean Christopherson wrote: > > > On Fri, Dec 02, 2022, Chao Peng wrote: > > > > @@ -10357,6 +10364,12 @@ stat

Re: [PATCH v10 9/9] KVM: Enable and expose KVM_MEM_PRIVATE

2023-03-23 Thread Chao Peng
On Wed, Mar 22, 2023 at 05:41:31PM -0700, Isaku Yamahata wrote: > On Wed, Mar 08, 2023 at 03:40:26PM +0800, > Chao Peng wrote: > > > On Wed, Mar 08, 2023 at 12:13:24AM +, Ackerley Tng wrote: > > > Chao Peng writes: > > > > > > > On Sat, Jan 14,

Re: [PATCH v10 0/9] KVM: mm: fd-based approach for supporting KVM

2023-03-24 Thread Chao Peng
On Wed, Mar 22, 2023 at 08:27:37PM -0500, Michael Roth wrote: > On Tue, Feb 21, 2023 at 08:11:35PM +0800, Chao Peng wrote: > > > Hi Sean, > > > > > > We've rebased the SEV+SNP support onto your updated UPM base support > > > tree and things seem to b

Re: [PATCH v10 9/9] KVM: Enable and expose KVM_MEM_PRIVATE

2023-03-28 Thread Chao Peng
On Fri, Mar 24, 2023 at 10:29:25AM +0800, Xiaoyao Li wrote: > On 3/24/2023 10:10 AM, Chao Peng wrote: > > On Wed, Mar 22, 2023 at 05:41:31PM -0700, Isaku Yamahata wrote: > > > On Wed, Mar 08, 2023 at 03:40:26PM +0800, > > > Chao Peng wrote: > > > > > &g

Re: [PATCH v10 7/9] KVM: Update lpage info when private/shared memory are mixed

2023-01-28 Thread Chao Peng
On Fri, Jan 13, 2023 at 11:16:27PM +, Sean Christopherson wrote: > On Fri, Dec 02, 2022, Chao Peng wrote: > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > > index 9a07380f8d3c..5aefcff614d2 100644 > > --- a/arch/x86/kvm/x86.c > > +++ b/arch/x86/kvm/x86

Re: [PATCH v10 9/9] KVM: Enable and expose KVM_MEM_PRIVATE

2023-01-28 Thread Chao Peng
On Sat, Jan 14, 2023 at 12:01:01AM +, Sean Christopherson wrote: > On Fri, Dec 02, 2022, Chao Peng wrote: ... > Strongly prefer to use similar logic to existing code that detects wraps: > > mem->restricted_offset + mem->memory_size < > mem->restrict

[RFC PATCH 0/6] KVM: mm: fd-based approach for supporting KVM guest private memory

2021-11-11 Thread Chao Peng
vm/51a6f74f-6c05-74b9-3fd7-b7cd900fb...@redhat.com/t/ Thanks, Chao --- Chao Peng (6): mm: Add F_SEAL_GUEST to shmem/memfd kvm: x86: Introduce guest private memory address space to memslot kvm: x86: add private_ops to memslot kvm: x86: implement private_ops for memfd backing store

[RFC PATCH 2/6] kvm: x86: Introduce guest private memory address space to memslot

2021-11-11 Thread Chao Peng
Existing memslots functions are extended to pass a bool ‘private’ parameter to indicate whether the operation is on guest private memory address space or not. Signed-off-by: Sean Christopherson Signed-off-by: Yu Zhang Signed-off-by: Chao Peng --- arch/x86/include/asm/kvm_host.h | 5

[RFC PATCH 07/13] linux-headers: Update

2021-11-11 Thread Chao Peng
Signed-off-by: Chao Peng --- linux-headers/asm-x86/kvm.h | 5 + linux-headers/linux/kvm.h | 29 + 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/linux-headers/asm-x86/kvm.h b/linux-headers/asm-x86/kvm.h index a6c327f8ad..f9aadf0ebb 100644 --- a

[RFC PATCH 1/6] mm: Add F_SEAL_GUEST to shmem/memfd

2021-11-11 Thread Chao Peng
The new seal is only allowed if there's no pre-existing pages in the fd and there's no existing mapping of the file. After the seal is set, no read/write/mmap from userspace is allowed. Signed-off-by: Kirill A. Shutemov Signed-off-by: Yu Zhang Signed-off-by: Chao Peng --- inc

[RFC PATCH 09/13] qmp: Include "guest-private" property for memory backends

2021-11-11 Thread Chao Peng
Signed-off-by: Chao Peng --- hw/core/machine-hmp-cmds.c | 3 +++ hw/core/machine-qmp-cmds.c | 1 + qapi/machine.json | 3 +++ qapi/qom.json | 3 +++ 4 files changed, 10 insertions(+) diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c index 76b22b00d6

[RFC PATCH 4/6] kvm: x86: implement private_ops for memfd backing store

2021-11-11 Thread Chao Peng
Call memfd_register_guest() module API to setup private_ops for a given private memslot. Signed-off-by: Sean Christopherson Signed-off-by: Yu Zhang Signed-off-by: Chao Peng --- arch/x86/kvm/Makefile| 2 +- arch/x86/kvm/memfd.c | 63 include

[RFC PATCH 3/6] kvm: x86: add private_ops to memslot

2021-11-11 Thread Chao Peng
f-by: Sean Christopherson Signed-off-by: Yu Zhang Signed-off-by: Chao Peng --- Documentation/virt/kvm/api.rst | 1 + arch/x86/kvm/mmu/mmu.c | 47 ++ arch/x86/kvm/mmu/paging_tmpl.h | 3 ++- include/linux/kvm_host.h | 8 ++ include/uapi/linux/kvm.h

[RFC PATCH 5/6] kvm: x86: add KVM_EXIT_MEMORY_ERROR exit

2021-11-11 Thread Chao Peng
Currently support to exit to userspace for private/shared memory conversion. Signed-off-by: Sean Christopherson Signed-off-by: Yu Zhang Signed-off-by: Chao Peng --- arch/x86/kvm/mmu/mmu.c | 20 include/uapi/linux/kvm.h | 15 +++ 2 files changed, 35

[RFC PATCH 6/6] KVM: add KVM_SPLIT_MEMORY_REGION

2021-11-11 Thread Chao Peng
This new ioctl let user to split an exising memory region into two parts. The first part reuses the existing memory region but have a shrinked size. The second part is a newly created one. Signed-off-by: Yu Zhang Signed-off-by: Chao Peng --- arch/x86/kvm/x86.c | 3 +- include/linux

[RFC PATCH 08/13] hostmem: Add guest private memory to memory backend

2021-11-11 Thread Chao Peng
Currently only memfd is supported. Signed-off-by: Chao Peng --- backends/hostmem-memfd.c | 12 +--- backends/hostmem.c | 24 include/exec/memory.h| 3 +++ include/exec/ram_addr.h | 3 ++- include/qemu/memfd.h | 5 + include/sysemu/hostmem.h

[RFC PATCH 11/13] kvm: register private memory slots

2021-11-11 Thread Chao Peng
Signed-off-by: Chao Peng --- accel/kvm/kvm-all.c | 9 + include/sysemu/kvm_int.h | 1 + 2 files changed, 10 insertions(+) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 0125c17edb..d336458e9e 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -138,6 +138,7

[RFC PATCH 10/13] softmmu/physmem: Add private memory address space

2021-11-11 Thread Chao Peng
Signed-off-by: Chao Peng --- include/exec/address-spaces.h | 2 ++ softmmu/physmem.c | 13 + 2 files changed, 15 insertions(+) diff --git a/include/exec/address-spaces.h b/include/exec/address-spaces.h index db8bfa9a92..b3f45001c0 100644 --- a/include/exec/address

[RFC PATCH 13/13] machine: Add 'private-memory-backend' property

2021-11-11 Thread Chao Peng
Signed-off-by: Chao Peng --- hw/core/machine.c | 38 ++ hw/i386/pc.c| 22 -- include/hw/boards.h | 2 ++ softmmu/vl.c| 16 ++-- 4 files changed, 66 insertions(+), 12 deletions(-) diff --git a/hw/core

[RFC PATCH 12/13] kvm: handle private to shared memory conversion

2021-11-11 Thread Chao Peng
Signed-off-by: Chao Peng --- accel/kvm/kvm-all.c| 49 ++ include/sysemu/kvm.h | 1 + target/arm/kvm.c | 5 + target/i386/kvm/kvm.c | 27 +++ target/mips/kvm.c | 5 + target/ppc/kvm.c | 5 + target

Re: [RFC PATCH 5/6] kvm: x86: add KVM_EXIT_MEMORY_ERROR exit

2021-11-11 Thread Chao Peng
On Thu, Nov 11, 2021 at 05:08:47PM +0200, Mika Penttilä wrote: > > > On 11.11.2021 16.13, Chao Peng wrote: > > Currently support to exit to userspace for private/shared memory > > conversion. > > > > Signed-off-by: Sean Christopherson > > Signed-off-by:

  1   2   3   4   5   >