[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 chao.p.p...@linux.intel.com --- target-i386/cpu.c | 10 -- target-i386/cpu.h | 61 ++ target-i386/kvm.c | 19 +++ target

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]; +uint16_t _w[16]; +uint32_t _l[8]; +uint64_t _q[4

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 chao.p.p...@linux.intel.com Thanks

[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 <chao.p.p...@linux.intel.com> --- target-i386/kvm.c | 18 -- 1 file changed, 16 insertions(+), 2 del

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

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] [RFC 0/9] Introduce light weight PC platform pc-lite

2016-06-20 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-20 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

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

2016-06-20 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-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

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; > >> >

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

2016-06-15 Thread Chao Peng
t.com> Signed-off-by: Chao Peng <chao.p.p...@linux.intel.com> --- Note: Of course there is other ways to fix it (e.g. check against NULL). I feel comfortable in any way. --- vl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vl.c b/vl.c index 45eff56..2088491 100644

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

2016-06-28 Thread Chao Peng
> > qboot does basically four things: 1) relocate from ROM to 0xf; 2) > initialize PCI; 2) provide the ACPI and e820 tables; 3) boot. > > If Linux can boot without initializing PCI bridges and without INTX, we > can remove that code from qboot. The PCI scan is the most expensive > part, I

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

2016-06-28 Thread Chao Peng
On Thu, Jun 23, 2016 at 01:55:06PM +0100, Daniel P. Berrange wrote: > On Mon, Jun 20, 2016 at 02:12:17PM +0800, Chao Peng wrote: > > 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: &g

[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 +--

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

2016-06-17 Thread Chao Peng
; - 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 PCIE Host

[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 <chao.p.p...@linux.intel.com> --- hw/i386/acpi-build.c

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

2016-06-17 Thread Chao Peng
assigned so guest may not recognize it, the functionality however is expected to be OK. Signed-off-by: Chao Peng <chao.p.p...@linux.intel.com> --- default-configs/i386-softmmu.mak | 1 + default-configs/x86_64-softmmu.mak | 1 + hw/pci-host/Makefile.objs | 1 + hw/pc

[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 ---

[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 <james.t.kuku...@linux.intel.com> S

[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 <chao.

[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

[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 <chao.p.p...@linux.intel.com> --- 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 --

[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 PATCH v2 00/12] Guest startup time optimization

2016-08-25 Thread Chao Peng
2ms -nopit 5ms -static-prt 8ms -nofw 62ms Thanks, Chao Chao Peng (9): pc: make smbus configurable pc: make sata configurable pc: make pic configurable pc: make pit configurable acpi: build static _PRT ich9: enable pm registers when

[Qemu-devel] [RFC PATCH v2 03/12] pc: make pic configurable

2016-08-25 Thread Chao Peng
Signed-off-by: Chao Peng <chao.p.p...@linux.intel.com> --- hw/i386/pc.c | 1 + hw/i386/pc_q35.c | 21 - include/hw/i386/pc.h | 2 ++ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 99fb9aa..ea81283 100644 --

[Qemu-devel] [RFC PATCH v2 02/12] pc: make sata configurable

2016-08-25 Thread Chao Peng
Signed-off-by: Chao Peng <chao.p.p...@linux.intel.com> --- hw/i386/pc.c | 12 +++- hw/i386/pc_q35.c | 25 +++-- include/hw/i386/pc.h | 2 ++ 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 66e1961..9

[Qemu-devel] [RFC PATCH v2 05/12] acpi: build static _PRT

2016-08-25 Thread Chao Peng
...to reduce the interpretation burden for guest ACPI component. Signed-off-by: Chao Peng <chao.p.p...@linux.intel.com> --- hw/i386/acpi-build.c | 31 ++- hw/i386/pc.c | 1 + include/hw/i386/pc.h | 2 ++ 3 files changed, 33 insertions(+), 1 deletion(-)

[Qemu-devel] [RFC PATCH v2 08/12] acpi: patch guest ACPI when there is no firmware

2016-08-25 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 ---

[Qemu-devel] [RFC PATCH v2 11/12] pc: support direct loading protected/long mode kernel

2016-08-25 Thread Chao Peng
com> Signed-off-by: Chao Peng <chao.p.p...@linux.intel.com> --- hw/i386/pc.c | 166 +-- 1 file changed, 163 insertions(+), 3 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index f479697..4a368de 100644 --- a/hw/i386/pc.c +++

[Qemu-devel] [RFC PATCH v2 12/12] pc: skip firmware

2016-08-25 Thread Chao Peng
An ELF format kernel must be specified. Only linux is supported. Signed-off-by: Chao Peng <chao.p.p...@linux.intel.com> --- hw/i386/pc.c | 92 ++-- include/hw/i386/pc.h | 2 ++ 2 files changed, 69 insertions(+), 25 deletions(-) diff

[Qemu-devel] [RFC PATCH v2 01/12] pc: make smbus configurable

2016-08-25 Thread Chao Peng
Signed-off-by: Chao Peng <chao.p.p...@linux.intel.com> --- hw/i386/pc.c | 23 +++ hw/i386/pc_q35.c | 12 +++- include/hw/i386/pc.h | 3 +++ 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 022dd1b..6

[Qemu-devel] [RFC PATCH v2 06/12] acpi: expose data structurs and functions of BIOS linker loader

2016-08-25 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 +--

[Qemu-devel] [RFC PATCH v2 07/12] acpi: expose acpi_checksum()

2016-08-25 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

[Qemu-devel] [RFC PATCH v2 04/12] pc: make pit configurable

2016-08-25 Thread Chao Peng
Signed-off-by: Chao Peng <chao.p.p...@linux.intel.com> --- hw/i386/pc.c | 6 -- hw/i386/pc_piix.c| 2 +- hw/i386/pc_q35.c | 2 +- include/hw/i386/pc.h | 5 - 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index ea81283..1

[Qemu-devel] [RFC PATCH v2 10/12] q35: initialize MMCFG base when there is no firmware

2016-08-25 Thread Chao Peng
Signed-off-by: Chao Peng <chao.p.p...@linux.intel.com> --- hw/pci-host/q35.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index e33d5a5..c5c5fe2 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -448,9 +

[Qemu-devel] [RFC PATCH v2 09/12] ich9: enable pm registers when there is no firmware

2016-08-25 Thread Chao Peng
Signed-off-by: Chao Peng <chao.p.p...@linux.intel.com> --- hw/isa/lpc_ich9.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index 10d1ee8..28e9911 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -484,6

Re: [Qemu-devel] [RFC PATCH v2 00/12] Guest startup time optimization

2016-09-06 Thread Chao Peng
> Patches 1-4 are okay, though I think it would be easier to add a -M > q35-lite too that just removes the legacy devices.  The -M q35-lite > machine doesn't have to support versioning for now. Okay, this is also good to have in my mind. > > As you might expect, I don't agree with removing the

[Qemu-devel] 9p performance

2016-09-06 Thread Chao Peng
Hi, I had some initial investigation on 9p read/write performance and it looks not good when compared to the implementation in kvmtool. With kvmtool, the write speed is ~1400MB/s. With QEMU, it's only ~ 700MB/s. I had a quick look at the code, the kvmtool code is really simple so no other

Re: [Qemu-devel] [RFC PATCH v2 00/12] Guest startup time optimization

2016-09-06 Thread Chao Peng
> > > 2) Linux optimizations: using an uncompressed image to avoid the > > > cost of copying and decompressing.  QEMU can already load the > > > image > > > at the right place and the real mode stub can do little more than > > > GDT/IDT setup. > > > > This works surely. I actually followed your

Re: [Qemu-devel] [RFC PATCH v2 00/12] Guest startup time optimization

2016-09-06 Thread Chao Peng
> > > 1) qboot optimizations: adopt the fw_cfg DMA interface instead of > > > the > > > cbfs flash hack (so that -kernel works), drop PCI bridge > > > initialization, > > > copy less than 64K of memory from ROM to 0xf; > > > > I can do the evaluation on qboot. Also adding Amnon Ilan, to see

[Qemu-devel] [PATCH 0/4] make SMBUS/SATA/PIT configurable and introduce

2016-11-05 Thread Chao Peng
/2016-09/msg00422.html for the background. Chao Peng (4): pc: make smbus configurable pc: make sata configurable pc: make pit configurable q35: introduce q35-lite hw/i386/pc.c | 68 +++- hw/i386/pc_piix.c| 2 +- hw/i386/pc_q35.c

[Qemu-devel] [PATCH 3/4] pc: make pit configurable

2016-11-05 Thread Chao Peng
Signed-off-by: Chao Peng <chao.p.p...@linux.intel.com> --- hw/i386/pc.c | 21 - hw/i386/pc_piix.c| 2 +- hw/i386/pc_q35.c | 3 ++- include/hw/i386/pc.h | 3 +++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c

[Qemu-devel] [PATCH 4/4] q35: introduce q35-lite

2016-11-05 Thread Chao Peng
This patch introduces a light weight machine type which shares the same codebase with existing q35 machine type but with some features disabled by default. Signed-off-by: Chao Peng <chao.p.p...@linux.intel.com> --- hw/i386/pc_q35.c | 18 ++ 1 file changed, 18 insertions(+)

[Qemu-devel] [PATCH 1/4] pc: make smbus configurable

2016-11-05 Thread Chao Peng
Signed-off-by: Chao Peng <chao.p.p...@linux.intel.com> --- hw/i386/pc.c | 18 ++ hw/i386/pc_q35.c | 12 +++- include/hw/i386/pc.h | 3 +++ 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index c011552..95d68d5

[Qemu-devel] [PATCH 2/4] pc: make sata configurable

2016-11-05 Thread Chao Peng
Signed-off-by: Chao Peng <chao.p.p...@linux.intel.com> --- hw/i386/pc.c | 29 - hw/i386/pc_q35.c | 24 ++-- include/hw/i386/pc.h | 2 ++ 3 files changed, 40 insertions(+), 15 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c

Re: [Qemu-devel] [PATCH 0/4] make SMBUS/SATA/PIT configurable and introduce

2016-11-13 Thread Chao Peng
On Thu, 2016-11-10 at 16:50 +0200, Michael S. Tsirkin wrote: > On Sat, Nov 05, 2016 at 03:19:47AM -0400, Chao Peng wrote: > > > > This patchset makes SMBUS/SATA/PIT configurable and introduces a > > new > > machine type q35-lite with these features disabled by defa

Re: [Qemu-devel] [PATCH 4/4] q35: introduce q35-lite

2016-11-14 Thread Chao Peng
On Mon, 2016-11-07 at 18:09 +0100, Paolo Bonzini wrote: > > On 06/11/2016 08:06, Michael S. Tsirkin wrote: > > > > On Sat, Nov 05, 2016 at 03:19:51AM -0400, Chao Peng wrote: > > > > > > > > > > > This patch introduces a light weight machine

[Qemu-devel] change x86 default machine type to Q35?

2017-07-05 Thread Chao Peng
Hi,   Q35 has been in QEMU for quite a while. Compared to the current default i440FX, Q35 is probably not that mature and not widely used, however in some case, Q35 has advantages, for example, in supporting new features. For instance, we have some features require PCI-e support which is only

Re: [Qemu-devel] Status of q35-lite?

2017-06-13 Thread Chao Peng
On Wed, 2017-05-24 at 16:07 +0100, Stefan Hajnoczi wrote: > Hi Chao, > Last year there was an effort to make "built-in" hardware optional so > that VMs can be launched with a minimal set of devices.  You made > SATA, > PIT, and SMBus optional. > > What is the current status of this work? > > Are

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 v3 kvm/queue 05/16] KVM: Maintain ofs_tree for fast memslot lookup by file offset

2021-12-30 Thread Chao Peng
On Tue, Dec 28, 2021 at 09:48:08PM +, Sean Christopherson wrote: > On Fri, Dec 24, 2021, Chao Peng wrote: > > On Thu, Dec 23, 2021 at 06:02:33PM +, Sean Christopherson wrote: > > > On Thu, Dec 23, 2021, Chao Peng wrote: > > > > > > In other words, the

Re: [PATCH v3 kvm/queue 04/16] KVM: Extend the memslot to support fd-based private memory

2021-12-30 Thread Chao Peng
On Thu, Dec 23, 2021 at 05:35:37PM +, Sean Christopherson wrote: > On Thu, Dec 23, 2021, Chao Peng wrote: > > > + struct file *file; > > Please use more descriptive names, shaving characters is not at all priority. > > > + u64 ofs; > > I believe this sh

Re: [PATCH v3 kvm/queue 03/16] mm/memfd: Introduce MEMFD_OPS

2021-12-30 Thread Chao Peng
On Fri, Dec 24, 2021 at 11:53:15AM +0800, Robert Hoo wrote: > On Thu, 2021-12-23 at 20:29 +0800, Chao Peng wrote: > > From: "Kirill A. Shutemov" > > > > +static void notify_fallocate(struct inode *inode, pgoff_t start, > > pgoff_t end) > > +{

Re: [PATCH v3 kvm/queue 11/16] KVM: Add kvm_map_gfn_range

2021-12-30 Thread Chao Peng
On Fri, Dec 24, 2021 at 12:13:51PM +0800, Chao Peng wrote: > On Thu, Dec 23, 2021 at 06:06:19PM +, Sean Christopherson wrote: > > On Thu, Dec 23, 2021, Chao Peng wrote: > > > This new function establishes the mapping in KVM page tables for a > > > given gfn range. I

Re: [PATCH v3 kvm/queue 06/16] KVM: Implement fd-based memory using MEMFD_OPS interfaces

2021-12-23 Thread Chao Peng
On Thu, Dec 23, 2021 at 06:34:22PM +, Sean Christopherson wrote: > On Thu, Dec 23, 2021, Chao Peng wrote: > > > > -kvm-y := $(KVM)/kvm_main.o $(KVM)/eventfd.o $(KVM)/binary_stats.o > > +kvm-y := $(KVM)/kvm_main.o $(KVM)/eventfd.o $(KVM)/binary_stats.o > > $(KV

Re: [PATCH v3 kvm/queue 06/16] KVM: Implement fd-based memory using MEMFD_OPS interfaces

2021-12-23 Thread Chao Peng
On Fri, Dec 24, 2021 at 12:09:47AM +0100, Paolo Bonzini wrote: > On 12/23/21 19:34, Sean Christopherson wrote: > > > select HAVE_KVM_PM_NOTIFIER if PM > > > + select MEMFD_OPS > > MEMFD_OPS is a weird Kconfig name given that it's not just memfd() that can > > implement the ops. > > > >

Re: [PATCH v3 kvm/queue 05/16] KVM: Maintain ofs_tree for fast memslot lookup by file offset

2021-12-23 Thread Chao Peng
On Thu, Dec 23, 2021 at 06:02:33PM +, Sean Christopherson wrote: > On Thu, Dec 23, 2021, Chao Peng wrote: > > Similar to hva_tree for hva range, maintain interval tree ofs_tree for > > offset range of a fd-based memslot so the lookup by offset range can be > > faster when

Re: [PATCH v3 kvm/queue 11/16] KVM: Add kvm_map_gfn_range

2021-12-23 Thread Chao Peng
On Thu, Dec 23, 2021 at 06:06:19PM +, Sean Christopherson wrote: > On Thu, Dec 23, 2021, Chao Peng wrote: > > This new function establishes the mapping in KVM page tables for a > > given gfn range. It can be used in the memory fallocate callback for > > memfd base

Re: [PATCH v3 kvm/queue 06/16] KVM: Implement fd-based memory using MEMFD_OPS interfaces

2021-12-23 Thread Chao Peng
On Thu, Dec 23, 2021 at 06:34:22PM +, Sean Christopherson wrote: > On Thu, Dec 23, 2021, Chao Peng wrote: > > diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig > > index 03b2ce34e7f4..86655cd660ca 100644 > > --- a/arch/x86/kvm/Kconfig > > +++ b/arch/x86/kvm

Re: [PATCH v3 kvm/queue 03/16] mm/memfd: Introduce MEMFD_OPS

2022-01-04 Thread Chao Peng
On Tue, Jan 04, 2022 at 05:38:38PM +, Sean Christopherson wrote: > On Fri, Dec 31, 2021, Chao Peng wrote: > > On Fri, Dec 24, 2021 at 11:53:15AM +0800, Robert Hoo wrote: > > > On Thu, 2021-12-23 at 20:29 +0800, Chao Peng wrote: > > > > From: "Kirill A. Shutem

Re: [PATCH v3 kvm/queue 05/16] KVM: Maintain ofs_tree for fast memslot lookup by file offset

2022-01-04 Thread Chao Peng
On Tue, Jan 04, 2022 at 05:43:50PM +, Sean Christopherson wrote: > On Fri, Dec 31, 2021, Chao Peng wrote: > > On Tue, Dec 28, 2021 at 09:48:08PM +, Sean Christopherson wrote: > > >KVM handles > > > reverse engineering the memslot to get the offset and wh

Re: [PATCH v3 kvm/queue 11/16] KVM: Add kvm_map_gfn_range

2022-01-04 Thread Chao Peng
On Tue, Jan 04, 2022 at 05:31:30PM +, Sean Christopherson wrote: > On Fri, Dec 31, 2021, Chao Peng wrote: > > On Fri, Dec 24, 2021 at 12:13:51PM +0800, Chao Peng wrote: > > > On Thu, Dec 23, 2021 at 06:06:19PM +, Sean Christopherson wrote: > > > > On Thu,

Re: [PATCH v3 kvm/queue 14/16] KVM: Handle page fault for private memory

2022-01-04 Thread Chao Peng
On Tue, Jan 04, 2022 at 06:06:12PM +0800, Yan Zhao wrote: > On Tue, Jan 04, 2022 at 05:10:08PM +0800, Chao Peng wrote: > > On Tue, Jan 04, 2022 at 09:46:35AM +0800, Yan Zhao wrote: > > > On Thu, Dec 23, 2021 at 08:30:09PM +0800, Chao Peng wrote: > > > > When a page

[PATCH v3 02/15] mm/memfd: Introduce MFD_INACCESSIBLE flag

2021-12-21 Thread Chao Peng
. Signed-off-by: Chao Peng --- include/uapi/linux/memfd.h | 1 + mm/memfd.c | 12 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/memfd.h b/include/uapi/linux/memfd.h index 7a8a26751c23..48750474b904 100644 --- a/include/uapi/linux

[PATCH v3 13/15] KVM: Handle page fault for private memory

2021-12-21 Thread Chao Peng
Signed-off-by: Chao Peng --- arch/x86/kvm/mmu/mmu.c | 64 +++--- arch/x86/kvm/mmu/paging_tmpl.h | 11 -- 2 files changed, 68 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index a7006e1ac2d2..7fc29f85313d 100644

[PATCH v3 15/15] KVM: Register/unregister private memory slot to memfd

2021-12-21 Thread Chao Peng
Expose KVM_MEM_PRIVATE flag and register/unregister private memory slot to memfd when userspace sets the flag. KVM_MEM_PRIVATE is disallowed by default but architecture code can turn it on by implementing kvm_arch_private_memory_supported(). Signed-off-by: Yu Zhang Signed-off-by: Chao Peng

[PATCH v3 11/15] KVM: Implement fd-based memory fallocation

2021-12-21 Thread Chao Peng
as its handler. Signed-off-by: Yu Zhang Signed-off-by: Chao Peng --- include/linux/kvm_host.h | 2 ++ virt/kvm/kvm_main.c | 22 +++--- virt/kvm/memfd.c | 2 ++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/include/linux/kvm_host.h b/include/linux

[PATCH v3 01/15] mm/shmem: Introduce F_SEAL_INACCESSIBLE

2021-12-21 Thread Chao Peng
this seal set is going to be used as the source of guest memory in confidential computing environments such as Intel TDX/AMD SEV but may not be accessible from host userspace. At this time only shmem implements this seal. Signed-off-by: Kirill A. Shutemov Signed-off-by: Chao Peng --- include/

[PATCH v3 04/15] KVM: Extend the memslot to support fd-based private memory

2021-12-21 Thread Chao Peng
KVM_MEM_PRIVATE. Signed-off-by: Yu Zhang Signed-off-by: Chao Peng --- include/linux/kvm_host.h | 9 + include/uapi/linux/kvm.h | 12 2 files changed, 21 insertions(+) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 865a677baf52..96e46b288ecd 100644

[PATCH v3 05/15] KVM: Implement fd-based memory using MEMFD_OPS interfaces

2021-12-21 Thread Chao Peng
- get/put_owner: used to ensure guest is still alive using a reference mechanism when calling above invalidate/fallocate callbacks. Signed-off-by: Yu Zhang Signed-off-by: Chao Peng --- arch/x86/kvm/Kconfig | 1 + arch/x86/kvm/Makefile| 3 +- include/linux/kvm_host.h | 8 virt/kvm/m

[PATCH v3 00/15] KVM: mm: fd-based approach for supporting KVM guest private memory

2021-12-21 Thread Chao Peng
s from the last version. Links of previous discussions - [1] https://lkml.kernel.org/kvm/51a6f74f-6c05-74b9-3fd7-b7cd900fb...@redhat.com/ [2] https://lkml.kernel.org/linux-fsdevel/2021141352.26311-1-chao.p.p...@linux.intel.com/ Chao Peng (13): mm/memfd: Int

[PATCH v3 10/15] KVM: Add kvm_map_gfn_range

2021-12-21 Thread Chao Peng
-by: Chao Peng --- arch/x86/kvm/mmu/mmu.c | 47 include/linux/kvm_host.h | 2 ++ virt/kvm/kvm_main.c | 5 + 3 files changed, 54 insertions(+) diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index 2da19356679d..a7006e1ac2d2 100644

[PATCH v3 09/15] KVM: Implement fd-based memory invalidation

2021-12-21 Thread Chao Peng
Zhang Signed-off-by: Chao Peng --- include/linux/kvm_host.h | 8 - virt/kvm/kvm_main.c | 69 +++- virt/kvm/memfd.c | 2 ++ 3 files changed, 63 insertions(+), 16 deletions(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index

[PATCH v3 03/15] mm/memfd: Introduce MEMFD_OPS

2021-12-21 Thread Chao Peng
Signed-off-by: Kirill A. Shutemov Signed-off-by: Chao Peng --- include/linux/memfd.h| 22 ++ include/linux/shmem_fs.h | 16 mm/Kconfig | 4 + mm/memfd.c | 21 ++ mm/shmem.c | 158 +++ 5 files changed, 221

[PATCH v3 14/15] KVM: Use kvm_userspace_memory_region_ext

2021-12-21 Thread Chao Peng
kvm_userspace_memory_region to kvm_userspace_memory_region_ext since the new extended structure covers all the existing fields in kvm_userspace_memory_region. Signed-off-by: Yu Zhang Signed-off-by: Chao Peng --- arch/arm64/kvm/mmu.c | 14 +++--- arch/mips/kvm/mips.c

[PATCH v3 06/15] KVM: Refactor hva based memory invalidation code

2021-12-21 Thread Chao Peng
Zhang Signed-off-by: Chao Peng --- include/linux/kvm_host.h | 8 +-- virt/kvm/kvm_main.c | 47 +--- 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index b0b63c9a160f..7279f46f35d3

[PATCH v3 08/15] KVM: Split out common memory invalidation code

2021-12-21 Thread Chao Peng
between these two types of memory invalidation. This patch moves these shared code into one place so that it can be used for CONFIG_MMU_NOTIFIER as well as CONFIG_MEMFD_NOTIFIER. Signed-off-by: Yu Zhang Signed-off-by: Chao Peng --- virt/kvm/kvm_main.c | 35 +++ 1

[PATCH v3 07/15] KVM: Special handling for fd-based memory invalidation

2021-12-21 Thread Chao Peng
the 'inode' in memslot equals to the passed-in 'inode' we should invalidate the mapping in KVM. Signed-off-by: Yu Zhang Signed-off-by: Chao Peng --- virt/kvm/kvm_main.c | 23 +++ 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm

[PATCH v3 12/15] KVM: Add KVM_EXIT_MEMORY_ERROR exit

2021-12-21 Thread Chao Peng
userspace exit for a private->shared conversion request when the page has already been allocated in the private memory backend. Signed-off-by: Yu Zhang Signed-off-by: Chao Peng --- include/uapi/linux/kvm.h | 15 +++ 1 file changed, 15 insertions(+) diff --git a/include/uapi/lin

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

2021-12-21 Thread Chao Peng
On Tue, Dec 21, 2021 at 03:44:40PM +, Sean Christopherson wrote: > On Tue, Dec 21, 2021, Chao Peng wrote: > > This is the third version of this series which try to implement the > > fd-based KVM guest private memory. > > ... > > > Test > > > >

[PATCH v3 kvm/queue 02/16] mm/memfd: Introduce MFD_INACCESSIBLE flag

2021-12-23 Thread Chao Peng
. Signed-off-by: Chao Peng --- include/uapi/linux/memfd.h | 1 + mm/memfd.c | 12 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/memfd.h b/include/uapi/linux/memfd.h index 7a8a26751c23..48750474b904 100644 --- a/include/uapi/linux

[PATCH v3 kvm/queue 09/16] KVM: Split out common memory invalidation code

2021-12-23 Thread Chao Peng
between these two types of memory invalidation. This patch moves those shared code into one place so that it can be used for both CONFIG_MMU_NOTIFIER and CONFIG_MEMFD_NOTIFIER. Signed-off-by: Yu Zhang Signed-off-by: Chao Peng --- virt/kvm/kvm_main.c | 35 +++ 1

[PATCH v3 kvm/queue 08/16] KVM: Special handling for fd-based memory invalidation

2021-12-23 Thread Chao Peng
the 'inode' in memslot equals to the passed-in 'inode' we should invalidate the mapping in KVM. Signed-off-by: Yu Zhang Signed-off-by: Chao Peng --- virt/kvm/kvm_main.c | 30 -- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt

[PATCH v3 kvm/queue 11/16] KVM: Add kvm_map_gfn_range

2021-12-23 Thread Chao Peng
-by: Chao Peng --- arch/x86/kvm/mmu/mmu.c | 47 include/linux/kvm_host.h | 2 ++ virt/kvm/kvm_main.c | 5 + 3 files changed, 54 insertions(+) diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index 1d275e9d76b5..2856eb662a21 100644

[PATCH v3 kvm/queue 16/16] KVM: Register/unregister private memory slot to memfd

2021-12-23 Thread Chao Peng
Expose KVM_MEM_PRIVATE flag and register/unregister private memory slot to memfd when userspace sets the flag. KVM_MEM_PRIVATE is disallowed by default but architecture code can turn on it by implementing kvm_arch_private_memory_supported(). Signed-off-by: Yu Zhang Signed-off-by: Chao Peng

[PATCH v3 kvm/queue 01/16] mm/shmem: Introduce F_SEAL_INACCESSIBLE

2021-12-23 Thread Chao Peng
this seal set is going to be used as the source of guest memory in confidential computing environments such as Intel TDX/AMD SEV but may not be accessible from host userspace. At this time only shmem implements this seal. Signed-off-by: Kirill A. Shutemov Signed-off-by: Chao Peng --- include/

[PATCH v3 kvm/queue 05/16] KVM: Maintain ofs_tree for fast memslot lookup by file offset

2021-12-23 Thread Chao Peng
Similar to hva_tree for hva range, maintain interval tree ofs_tree for offset range of a fd-based memslot so the lookup by offset range can be faster when memslot count is high. Signed-off-by: Chao Peng --- include/linux/kvm_host.h | 2 ++ virt/kvm/kvm_main.c | 17 + 2

[PATCH v3 kvm/queue 14/16] KVM: Handle page fault for private memory

2021-12-23 Thread Chao Peng
Signed-off-by: Chao Peng --- arch/x86/kvm/mmu/mmu.c | 73 -- arch/x86/kvm/mmu/paging_tmpl.h | 11 +++-- 2 files changed, 77 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index 2856eb662a21..fbcdf62f8281 100644

[PATCH v3 kvm/queue 00/16] KVM: mm: fd-based approach for supporting KVM guest private memory

2021-12-23 Thread Chao Peng
el.org/qemu-devel/2029134739.20218-1-chao.p.p...@linux.intel.com/ Chao Peng (14): mm/memfd: Introduce MFD_INACCESSIBLE flag KVM: Extend the memslot to support fd-based private memory KVM: Maintain ofs_tree for fast memslot lookup by file offset KVM: Implement fd-based memory using MEM

[PATCH v3 kvm/queue 10/16] KVM: Implement fd-based memory invalidation

2021-12-23 Thread Chao Peng
Zhang Signed-off-by: Chao Peng --- include/linux/kvm_host.h | 8 - virt/kvm/kvm_main.c | 69 +++- virt/kvm/memfd.c | 2 ++ 3 files changed, 63 insertions(+), 16 deletions(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h

[PATCH v3 kvm/queue 03/16] mm/memfd: Introduce MEMFD_OPS

2021-12-23 Thread Chao Peng
Signed-off-by: Kirill A. Shutemov Signed-off-by: Chao Peng --- include/linux/memfd.h| 22 ++ include/linux/shmem_fs.h | 16 mm/Kconfig | 4 + mm/memfd.c | 21 ++ mm/shmem.c | 158 +++ 5 files changed, 221

[PATCH v3 kvm/queue 06/16] KVM: Implement fd-based memory using MEMFD_OPS interfaces

2021-12-23 Thread Chao Peng
- get/put_owner: used to ensure guest is still alive using a reference mechanism when calling above invalidate/fallocate callbacks. Signed-off-by: Yu Zhang Signed-off-by: Chao Peng --- arch/x86/kvm/Kconfig | 1 + include/linux/kvm_host.h | 6 +++ virt/kvm/Makefile.kvm| 2 +- vi

[PATCH v3 kvm/queue 12/16] KVM: Implement fd-based memory fallocation

2021-12-23 Thread Chao Peng
as its handler. Signed-off-by: Yu Zhang Signed-off-by: Chao Peng --- include/linux/kvm_host.h | 2 ++ virt/kvm/kvm_main.c | 22 +++--- virt/kvm/memfd.c | 2 ++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/include/linux/kvm_host.h b/include/linux

[PATCH v3 kvm/queue 13/16] KVM: Add KVM_EXIT_MEMORY_ERROR exit

2021-12-23 Thread Chao Peng
userspace exit for a private->shared conversion request when the page has already been allocated in the private memory backend. Signed-off-by: Yu Zhang Signed-off-by: Chao Peng --- include/uapi/linux/kvm.h | 15 +++ 1 file changed, 15 insertions(+) diff --git a/include/uapi/lin

[PATCH v3 kvm/queue 15/16] KVM: Use kvm_userspace_memory_region_ext

2021-12-23 Thread Chao Peng
kvm_userspace_memory_region to kvm_userspace_memory_region_ext since the new extended structure covers all the existing fields in kvm_userspace_memory_region. Signed-off-by: Yu Zhang Signed-off-by: Chao Peng --- arch/x86/kvm/x86.c | 2 +- include/linux/kvm_host.h | 4 ++-- virt/kvm/kvm_main.c

[PATCH v3 kvm/queue 04/16] KVM: Extend the memslot to support fd-based private memory

2021-12-23 Thread Chao Peng
KVM_MEM_PRIVATE. Signed-off-by: Yu Zhang Signed-off-by: Chao Peng --- include/linux/kvm_host.h | 10 ++ include/uapi/linux/kvm.h | 12 2 files changed, 22 insertions(+) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index f8ed799e8674..2cd35560c44b 100644

[PATCH v3 kvm/queue 07/16] KVM: Refactor hva based memory invalidation code

2021-12-23 Thread Chao Peng
Zhang Signed-off-by: Chao Peng --- include/linux/kvm_host.h | 8 -- virt/kvm/kvm_main.c | 55 ++-- 2 files changed, 36 insertions(+), 27 deletions(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 21f8b1880723..07863ff855cd

Re: [PATCH v3 kvm/queue 14/16] KVM: Handle page fault for private memory

2022-01-04 Thread Chao Peng
On Tue, Jan 04, 2022 at 09:46:35AM +0800, Yan Zhao wrote: > On Thu, Dec 23, 2021 at 08:30:09PM +0800, Chao Peng wrote: > > When a page fault from the secondary page table while the guest is > > running happens in a memslot with KVM_MEM_PRIVATE, we need go > > different pat

Re: [RFC v2 PATCH 13/13] KVM: Enable memfd based page invalidation/fallocate

2021-11-22 Thread Chao Peng
On Mon, Nov 22, 2021 at 05:16:47PM +0300, Kirill A. Shutemov wrote: > On Fri, Nov 19, 2021 at 09:47:39PM +0800, Chao Peng wrote: > > Since the memory backing store does not get notified when VM is > > destroyed so need check if VM is still live in these callbacks. > > > &

  1   2   3   4   5   >