Re: [PATCH v4 0/6] virtio core DMA API conversion

2015-11-09 Thread Paolo Bonzini
On 09/11/2015 13:15, Michael S. Tsirkin wrote: > Well that's not exactly true. I think we would like to make > it possible to put virtio devices behind an IOMMU on x86, > but if this means existing guests break, then many people won't be able > to use this option: having to find out which kernel

Re: [PATCH 1/3] context_tracking: remove duplicate enabled check

2015-11-09 Thread Rik van Riel
On 10/27/2015 09:39 PM, Paolo Bonzini wrote: > All calls to context_tracking_enter and context_tracking_exit > are already checking context_tracking_is_enabled, except the > context_tracking_user_enter and context_tracking_user_exit > functions left in for the benefit of assembly calls. > > Pull

Re: [PATCH 7/9] KVM, pkeys: Add pkeys support for gva_to_gpa funcions

2015-11-09 Thread Paolo Bonzini
On 09/11/2015 12:54, Huaitong Han wrote: > index 7a84b83..6e9156d 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -3960,6 +3960,8 @@ gpa_t kvm_mmu_gva_to_gpa_read(struct kvm_vcpu *vcpu, > gva_t gva, > struct x86_exception *exception) > { >

Re: [PATCH 2/3] context_tracking: avoid irq_save/irq_restore on guest entry and exit

2015-11-09 Thread Rik van Riel
On 10/27/2015 09:39 PM, Paolo Bonzini wrote: > guest_enter and guest_exit must be called with interrupts disabled, > since they take the vtime_seqlock with write_seq{lock,unlock}. > Therefore, it is not necessary to check for exceptions, nor to > save/restore the IRQ state, when context tracking

Re: [PATCH v4 0/6] virtio core DMA API conversion

2015-11-09 Thread Michael S. Tsirkin
On Thu, Oct 29, 2015 at 06:09:45PM -0700, Andy Lutomirski wrote: > This switches virtio to use the DMA API unconditionally. I'm sure > it breaks things, but it seems to work on x86 using virtio-pci, with > and without Xen, and using both the modern 1.0 variant and the > legacy variant. > > This

Re: [PATCH 3/9] KVM, pkeys: expose CPUID:OSPKE to guest

2015-11-09 Thread Paolo Bonzini
On 09/11/2015 12:54, Huaitong Han wrote: > This patch exposes X86_FEATURE_OSPKE to guest, X86_FEATURE_OSPKE is > software support for pkeys, enumerated with CPUID.7.0.ECX[4]:OSPKE, > and it reflects the setting of CR4.PKE. > > Signed-off-by: Huaitong Han > > diff --git

Re: [PATCH 6/9] KVM, pkeys: add pkeys support for permission_fault logic

2015-11-09 Thread Paolo Bonzini
On 09/11/2015 12:54, Huaitong Han wrote: > Protection keys define a new 4-bit protection key field (PKEY) in bits > 62:59 of leaf entries of the page tables, the PKEY is an index to PKRU > register(16 domains), every domain has 2 bits(write disable bit, access > disable bit). > > Static logic

[Bug 107561] New: 4.2 breaks PCI passthrough in QEMU/KVM

2015-11-09 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=107561 Bug ID: 107561 Summary: 4.2 breaks PCI passthrough in QEMU/KVM Product: Virtualization Version: unspecified Kernel Version: 4.2 Hardware: All OS: Linux Tree:

[patch v2] vfio/pci: make an array larger

2015-11-09 Thread Dan Carpenter
Smatch complains about a possible out of bounds error: drivers/vfio/pci/vfio_pci_config.c:1241 vfio_cap_init() error: buffer overflow 'pci_cap_length' 20 <= 20 The problem is that pci_cap_length[] was defined as large enough to hold "PCI_CAP_ID_AF + 1" elements. The code in

Re: [PATCH 1/3] qemu, pkeys: add pkeys support for qemu cpuid handling

2015-11-09 Thread Paolo Bonzini
On 09/11/2015 12:55, Huaitong Han wrote: > @@ -351,6 +362,7 @@ static const char *cpuid_6_feature_name[] = { >CPUID_7_0_EBX_FSGSBASE, CPUID_7_0_EBX_HLE, CPUID_7_0_EBX_AVX2, >CPUID_7_0_EBX_ERMS, CPUID_7_0_EBX_INVPCID, CPUID_7_0_EBX_RTM, >CPUID_7_0_EBX_RDSEED */

Re: [PATCH v6 05/33] acpi: add aml_object_type

2015-11-09 Thread Igor Mammedov
On Mon, 9 Nov 2015 13:35:51 +0200 "Michael S. Tsirkin" wrote: > On Fri, Oct 30, 2015 at 01:55:59PM +0800, Xiao Guangrong wrote: > > Implement ObjectType which is used by NVDIMM _DSM method in > > later patch > > > > Signed-off-by: Xiao Guangrong

Re: [PATCH 6/9] KVM, pkeys: add pkeys support for permission_fault logic

2015-11-09 Thread Paolo Bonzini
On 09/11/2015 13:43, Paolo Bonzini wrote: > > > On 09/11/2015 12:54, Huaitong Han wrote: >> Protection keys define a new 4-bit protection key field (PKEY) in bits >> 62:59 of leaf entries of the page tables, the PKEY is an index to PKRU >> register(16 domains), every domain has 2 bits(write

Re: [PATCH 5/9] KVM, pkeys: update memeory permission bitmask for pkeys

2015-11-09 Thread Paolo Bonzini
On 09/11/2015 12:54, Huaitong Han wrote: >* Byte index: page fault error code [4:1] >* Bit index: pte permissions in ACC_* format > + * > + * Add PFEC.PK (bit 5) for protection-key violations Instead, change "[4:1]" to "[5:1]" in the "Byte index" line. Paolo >

Re: [PATCH v4 0/6] virtio core DMA API conversion

2015-11-09 Thread Benjamin Herrenschmidt
On Mon, 2015-11-09 at 18:18 -0800, Andy Lutomirski wrote: > > /* Qumranet donated their vendor ID for devices 0x1000 thru 0x10FF. > */ > static const struct pci_device_id virtio_pci_id_table[] = { >     { PCI_DEVICE(0x1af4, PCI_ANY_ID) }, >     { 0 } > }; > > Can we match on that range?

Re: [PATCH v4 0/6] virtio core DMA API conversion

2015-11-09 Thread Andy Lutomirski
On Mon, Nov 9, 2015 at 9:28 PM, Benjamin Herrenschmidt wrote: > On Mon, 2015-11-09 at 18:18 -0800, Andy Lutomirski wrote: >> >> /* Qumranet donated their vendor ID for devices 0x1000 thru 0x10FF. >> */ >> static const struct pci_device_id virtio_pci_id_table[] = { >>

Re: [PATCH v4 0/6] virtio core DMA API conversion

2015-11-09 Thread Andy Lutomirski
On Mon, Nov 9, 2015 at 9:26 PM, Benjamin Herrenschmidt wrote: > On Mon, 2015-11-09 at 18:18 -0800, Andy Lutomirski wrote: >> >> Which leaves the special case of Xen, where even preexisting devices >> don't bypass the IOMMU. Can we keep this specific to powerpc and >>

Re: [PATCH v4 0/6] virtio core DMA API conversion

2015-11-09 Thread Andy Lutomirski
On Mon, Nov 9, 2015 at 6:04 PM, Benjamin Herrenschmidt wrote: > On Mon, 2015-11-09 at 16:46 -0800, Andy Lutomirski wrote: >> The problem here is that in some of the problematic cases the virtio >> driver may not even be loaded. If someone runs an L1 guest with an >>

Re: [PATCH v7 07/35] util: introduce qemu_file_get_page_size()

2015-11-09 Thread Eduardo Habkost
On Mon, Nov 09, 2015 at 12:36:36PM +0800, Xiao Guangrong wrote: > On 11/06/2015 11:36 PM, Eduardo Habkost wrote: > >On Mon, Nov 02, 2015 at 05:13:09PM +0800, Xiao Guangrong wrote: > >>There are three places use the some logic to get the page size on > >>the file path or file fd > >> > >>Windows

Re: [PATCH v7 12/35] util: let qemu_fd_getlength support block device

2015-11-09 Thread Eduardo Habkost
On Mon, Nov 09, 2015 at 01:58:27PM +0800, Xiao Guangrong wrote: > > > On 11/06/2015 11:54 PM, Eduardo Habkost wrote: > >On Mon, Nov 02, 2015 at 05:13:14PM +0800, Xiao Guangrong wrote: > >>lseek can not work for all block devices as the man page says: > >>| Some devices are incapable of seeking

Re: [PATCH 2/3] qemu, pkeys: add pkeys support for qemu xsave state handling

2015-11-09 Thread Eduardo Habkost
On Mon, Nov 09, 2015 at 07:55:33PM +0800, Huaitong Han wrote: > This patch adds pkeys support for qemu xsave state handling. > > Signed-off-by: Huaitong Han [...] > @@ -1145,6 +1146,7 @@ static int kvm_put_xsave(X86CPU *cpu) > #ifdef TARGET_X86_64 >

Re: [PATCH v3 2/3] target-i386: calculate vcpu's TSC rate to be migrated

2015-11-09 Thread Eduardo Habkost
On Mon, Nov 09, 2015 at 08:33:55AM +0800, haozhong.zh...@intel.com wrote: > On 11/06/15 13:12, Eduardo Habkost wrote: > > On Fri, Nov 06, 2015 at 10:32:24AM +0800, haozhong.zh...@intel.com wrote: > > > On 11/05/15 14:05, Eduardo Habkost wrote: > > > > On Thu, Nov 05, 2015 at 09:30:51AM +0800,

Re: [PATCH 1/3] qemu, pkeys: add pkeys support for qemu cpuid handling

2015-11-09 Thread Andreas Färber
Am 09.11.2015 um 13:24 schrieb Paolo Bonzini: > On 09/11/2015 12:55, Huaitong Han wrote: >> @@ -351,6 +362,7 @@ static const char *cpuid_6_feature_name[] = { >>CPUID_7_0_EBX_FSGSBASE, CPUID_7_0_EBX_HLE, CPUID_7_0_EBX_AVX2, >>CPUID_7_0_EBX_ERMS, CPUID_7_0_EBX_INVPCID,

Re: [PATCH v3 2/3] target-i386: calculate vcpu's TSC rate to be migrated

2015-11-09 Thread Dr. David Alan Gilbert
* Eduardo Habkost (ehabk...@redhat.com) wrote: > On Mon, Nov 09, 2015 at 08:33:55AM +0800, haozhong.zh...@intel.com wrote: > > On 11/06/15 13:12, Eduardo Habkost wrote: > > > On Fri, Nov 06, 2015 at 10:32:24AM +0800, haozhong.zh...@intel.com wrote: > > > > On 11/05/15 14:05, Eduardo Habkost wrote:

Re: [PATCH v7 11/35] util: introduce qemu_file_getlength()

2015-11-09 Thread Eduardo Habkost
On Mon, Nov 09, 2015 at 12:44:55PM +0800, Xiao Guangrong wrote: > On 11/06/2015 11:50 PM, Eduardo Habkost wrote: > >As this patch affects raw_getlength(), CCing the raw block driver > >maintainer and the qemu-block mailing list. > > Eduardo, thanks for your reminder. I will keep CCing Kevin and

Re: [kvm-unit-tests PATCH v2 02/19] trivial: lib: fail hard on failed mallocs

2015-11-09 Thread Thomas Huth
On 09/11/15 21:53, Andrew Jones wrote: > It's pretty safe to not even bother checking for NULL when > using malloc and friends, but if we do check, then fail > hard. > > Signed-off-by: Andrew Jones > --- > v2: no code in asserts [Thomas Huth] > > lib/virtio-mmio.c | 6

[kvm-unit-tests PATCH 19/18] don't embed code inside asserts

2015-11-09 Thread Andrew Jones
assert() is classically a macro which could also be disabled, so if somebody introduces a switch to "#define assert(...) /*nothing*/" in the future, we'd lose code. Suggested-by: Thomas Huth Signed-off-by: Andrew Jones --- lib/arm/setup.c | 19

Re: [PATCH v6 07/33] util: introduce qemu_file_get_page_size()

2015-11-09 Thread Michael S. Tsirkin
On Sat, Oct 31, 2015 at 04:09:56PM +0800, Xiao Guangrong wrote: > > > On 10/30/2015 11:54 PM, Eduardo Habkost wrote: > >On Fri, Oct 30, 2015 at 01:56:01PM +0800, Xiao Guangrong wrote: > >>There are three places use the some logic to get the page size on > >>the file path or file fd > >> > >>This

Re: [PATCH v6 14/33] pc-dimm: drop the prefix of pc-dimm

2015-11-09 Thread Michael S. Tsirkin
On Fri, Oct 30, 2015 at 01:56:08PM +0800, Xiao Guangrong wrote: > This patch is generated by this script: > > find ./ -name "*.[ch]" -o -name "*.json" -o -name "trace-events" -type f \ > | xargs sed -i "s/PC_DIMM/DIMM/g" > > find ./ -name "*.[ch]" -o -name "*.json" -o -name "trace-events" -type

Re: [PATCH V6 0/6] Fast mmio eventfd fixes

2015-11-09 Thread Michael S. Tsirkin
On Mon, Nov 09, 2015 at 12:35:45PM +0800, Jason Wang wrote: > > > On 11/09/2015 01:11 AM, Michael S. Tsirkin wrote: > > On Tue, Sep 15, 2015 at 02:41:53PM +0800, Jason Wang wrote: > >> Hi: > >> > >> This series fixes two issues of fast mmio eventfd: > >> > >> 1) A single iodev instance were

[kvm-unit-tests PATCH v2 02/19] trivial: lib: fail hard on failed mallocs

2015-11-09 Thread Andrew Jones
It's pretty safe to not even bother checking for NULL when using malloc and friends, but if we do check, then fail hard. Signed-off-by: Andrew Jones --- v2: no code in asserts [Thomas Huth] lib/virtio-mmio.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff

Re: [PATCH V6 0/6] Fast mmio eventfd fixes

2015-11-09 Thread Jason Wang
On 11/10/2015 04:19 AM, Michael S. Tsirkin wrote: > On Mon, Nov 09, 2015 at 12:35:45PM +0800, Jason Wang wrote: >> > >> > >> > On 11/09/2015 01:11 AM, Michael S. Tsirkin wrote: >>> > > On Tue, Sep 15, 2015 at 02:41:53PM +0800, Jason Wang wrote: > >> Hi: > >> > >> This series

Re: [PATCH v4 0/6] virtio core DMA API conversion

2015-11-09 Thread Benjamin Herrenschmidt
On Mon, 2015-11-09 at 18:18 -0800, Andy Lutomirski wrote: > > Which leaves the special case of Xen, where even preexisting devices > don't bypass the IOMMU.  Can we keep this specific to powerpc and > sparc?  On x86, this problem is basically nonexistent, since the IOMMU > is properly

Re: [PATCH v4 0/6] virtio core DMA API conversion

2015-11-09 Thread Benjamin Herrenschmidt
On Mon, 2015-11-09 at 16:46 -0800, Andy Lutomirski wrote: > The problem here is that in some of the problematic cases the virtio > driver may not even be loaded.  If someone runs an L1 guest with an > IOMMU-bypassing virtio device and assigns it to L2 using vfio, then > *boom* L1 crashes.  (Same

Re: [PATCH v6 11/33] hostmem-file: use whole file size if possible

2015-11-09 Thread Xiao Guangrong
On 11/09/2015 06:17 PM, Michael S. Tsirkin wrote: On Fri, Oct 30, 2015 at 01:56:05PM +0800, Xiao Guangrong wrote: Use the whole file size if @size is not specified which is useful if we want to directly pass a file to guest Signed-off-by: Xiao Guangrong

Re: [PATCH v6 09/33] exec: allow file_ram_alloc to work on file

2015-11-09 Thread Xiao Guangrong
On 11/09/2015 06:13 PM, Michael S. Tsirkin wrote: On Fri, Oct 30, 2015 at 01:56:03PM +0800, Xiao Guangrong wrote: Currently, file_ram_alloc() only works on directory - it creates a file under @path and do mmap on it This patch tries to allow it to work on file directly, if @path is a

Re: [PATCH v6 07/33] util: introduce qemu_file_get_page_size()

2015-11-09 Thread Xiao Guangrong
On 11/09/2015 06:33 PM, Michael S. Tsirkin wrote: On Fri, Oct 30, 2015 at 01:56:01PM +0800, Xiao Guangrong wrote: There are three places use the some logic to get the page size on the file path or file fd This patch introduces qemu_file_get_page_size() to unify the code Signed-off-by: Xiao

Re: [PATCH v6 19/33] dimm: keep the state of the whole backend memory

2015-11-09 Thread Michael S. Tsirkin
On Fri, Oct 30, 2015 at 01:56:13PM +0800, Xiao Guangrong wrote: > QEMU keeps the state of memory of dimm device during live migration, > however, it is not enough for nvdimm device as its memory does not > contain its label data, so that we should protect the whole backend > memory instead > >

Re: [PATCH v6 08/33] exec: allow memory to be allocated from any kind of path

2015-11-09 Thread Xiao Guangrong
On 11/09/2015 06:39 PM, Michael S. Tsirkin wrote: On Fri, Oct 30, 2015 at 01:56:02PM +0800, Xiao Guangrong wrote: Currently file_ram_alloc() is designed for hugetlbfs, however, the memory of nvdimm can come from either raw pmem device eg, /dev/pmem, or the file locates at DAX enabled

Re: [Qemu-devel] [PATCH v7 25/35] nvdimm acpi: init the resource used by NVDIMM ACPI

2015-11-09 Thread Igor Mammedov
On Fri, 6 Nov 2015 16:31:43 +0800 Xiao Guangrong wrote: > > > On 11/05/2015 10:49 PM, Igor Mammedov wrote: > > On Thu, 5 Nov 2015 21:33:39 +0800 > > Xiao Guangrong wrote: > > > >> > >> > >> On 11/05/2015 09:03 PM, Igor Mammedov

Re: [PATCH v6 06/33] acpi: add aml_method_serialized

2015-11-09 Thread Michael S. Tsirkin
On Fri, Oct 30, 2015 at 01:56:00PM +0800, Xiao Guangrong wrote: > It avoid explicit Mutex and will be used by NVDIMM ACPI > > Signed-off-by: Xiao Guangrong I'd rather you squashed these utility patches in with where the code is used. This is just making it harder

Re: [PATCH v6 19/33] dimm: keep the state of the whole backend memory

2015-11-09 Thread Xiao Guangrong
On 11/09/2015 07:04 PM, Michael S. Tsirkin wrote: On Fri, Oct 30, 2015 at 01:56:13PM +0800, Xiao Guangrong wrote: QEMU keeps the state of memory of dimm device during live migration, however, it is not enough for nvdimm device as its memory does not contain its label data, so that we should

Re: [PATCH v6 12/33] pc-dimm: remove DEFAULT_PC_DIMMSIZE

2015-11-09 Thread Xiao Guangrong
On 11/09/2015 06:40 PM, Michael S. Tsirkin wrote: On Fri, Oct 30, 2015 at 01:56:06PM +0800, Xiao Guangrong wrote: It's not used any more Signed-off-by: Xiao Guangrong You should leave the renames and cleanups off for later. This patchset is large enough as

Re: [PATCH v6 06/33] acpi: add aml_method_serialized

2015-11-09 Thread Xiao Guangrong
On 11/09/2015 07:14 PM, Michael S. Tsirkin wrote: On Fri, Oct 30, 2015 at 01:56:00PM +0800, Xiao Guangrong wrote: It avoid explicit Mutex and will be used by NVDIMM ACPI Signed-off-by: Xiao Guangrong I'd rather you squashed these utility patches in with

Re: [PATCH 3/3] KVM/arm64: enable enhanced armv8 fp/simd lazy switch

2015-11-09 Thread Mario Smarduch
On 11/5/2015 7:02 AM, Christoffer Dall wrote: > On Fri, Oct 30, 2015 at 02:56:33PM -0700, Mario Smarduch wrote: >> This patch enables arm64 lazy fp/simd switch, similar to arm described in >> second patch. Change from previous version - restore function is moved to >> host. >> >> Signed-off-by:

Re: [PATCH v4 0/6] virtio core DMA API conversion

2015-11-09 Thread Benjamin Herrenschmidt
So ... I've finally tried to sort that out for powerpc and I can't find a way to make that work that isn't a complete pile of stinking shit. I'm very tempted to go back to my original idea: virtio itself should indicate it's "bypassing ability" via the virtio config space or some other bit (like

Re: [PATCH v6 07/33] util: introduce qemu_file_get_page_size()

2015-11-09 Thread Michael S. Tsirkin
On Fri, Oct 30, 2015 at 01:56:01PM +0800, Xiao Guangrong wrote: > There are three places use the some logic to get the page size on > the file path or file fd > > This patch introduces qemu_file_get_page_size() to unify the code > > Signed-off-by: Xiao Guangrong

Re: [PATCH v6 08/33] exec: allow memory to be allocated from any kind of path

2015-11-09 Thread Michael S. Tsirkin
On Fri, Oct 30, 2015 at 01:56:02PM +0800, Xiao Guangrong wrote: > Currently file_ram_alloc() is designed for hugetlbfs, however, the memory > of nvdimm can come from either raw pmem device eg, /dev/pmem, or the file > locates at DAX enabled filesystem > > So this patch let it work on any kind of

Re: [PATCH v6 12/33] pc-dimm: remove DEFAULT_PC_DIMMSIZE

2015-11-09 Thread Michael S. Tsirkin
On Fri, Oct 30, 2015 at 01:56:06PM +0800, Xiao Guangrong wrote: > It's not used any more > > Signed-off-by: Xiao Guangrong You should leave the renames and cleanups off for later. This patchset is large enough as it is. > --- > include/hw/mem/pc-dimm.h | 2 -- >

Re: [PATCH v4 0/6] virtio core DMA API conversion

2015-11-09 Thread Andy Lutomirski
On Mon, Nov 9, 2015 at 2:58 PM, Benjamin Herrenschmidt wrote: > So ... > > I've finally tried to sort that out for powerpc and I can't find a way > to make that work that isn't a complete pile of stinking shit. > > I'm very tempted to go back to my original idea: virtio

[PATCH] kvm-all: PAGE_SIZE should be real host page size

2015-11-09 Thread Andrew Jones
Just noticed this while grepping TARGET_PAGE_SIZE for an unrelated reason. I didn't use qemu_real_host_page_size as kvm_set_phys_mem() does, because we'd need to make sure page_size_init() has run first. Signed-off-by: Andrew Jones --- kvm-all.c | 6 -- 1 file changed, 4

Re: [PATCH v6 09/33] exec: allow file_ram_alloc to work on file

2015-11-09 Thread Michael S. Tsirkin
On Fri, Oct 30, 2015 at 01:56:03PM +0800, Xiao Guangrong wrote: > Currently, file_ram_alloc() only works on directory - it creates a file > under @path and do mmap on it > > This patch tries to allow it to work on file directly, if @path is a > directory it works as before, otherwise it treats

Re: [PATCH 5/5] KVM: x86: MMU: Consolidate WARN_ON/BUG_ON checks for reverse-mapped sptes

2015-11-09 Thread Paolo Bonzini
On 06/11/2015 08:25, Takuya Yoshikawa wrote: > At some call sites of rmap_get_first() and rmap_get_next(), BUG_ON is > placed right after the call to detect unrelated sptes which should not > be found in the reverse-mapping list. > > Move this check in rmap_get_first/next() so that all call

Re: [PATCH 0/5] KVM: x86: MMU: Clean up x86's mmu code for future work

2015-11-09 Thread Paolo Bonzini
On 06/11/2015 08:20, Takuya Yoshikawa wrote: > Patch 1/2/3 are easy ones. > > Following two, patch 4/5, may not be ideal solutions, but at least > explain, or try to explain, the problems. They are okay! I replied to patch 5 with a suggestion for further cleanup. I'll apply them for 4.5.

Re: [PATCH v6 11/33] hostmem-file: use whole file size if possible

2015-11-09 Thread Michael S. Tsirkin
On Fri, Oct 30, 2015 at 01:56:05PM +0800, Xiao Guangrong wrote: > Use the whole file size if @size is not specified which is useful > if we want to directly pass a file to guest > > Signed-off-by: Xiao Guangrong Better split these simplifications off from the

Re: [PATCH v2 0/4] KVM: VMX: enable LBR virtualization

2015-11-09 Thread Paolo Bonzini
On 09/11/2015 02:33, Jian Zhou wrote: > Hi Paolo, > > May I ask that any suggestion about the version 2 of VMX LBRV? > This version is updated following your advices in version 1. > BTW the kvm-unit-test for this feature has sent too, and I > have tested the CPUs emulated by QEMU. Hi, since

Re: [PATCH v2 0/4] KVM: VMX: enable LBR virtualization

2015-11-09 Thread Jian Zhou
On 2015/11/9 17:06, Paolo Bonzini wrote: On 09/11/2015 02:33, Jian Zhou wrote: Hi Paolo, May I ask that any suggestion about the version 2 of VMX LBRV? This version is updated following your advices in version 1. BTW the kvm-unit-test for this feature has sent too, and I have tested the CPUs

Re: [PATCH v6 05/33] acpi: add aml_object_type

2015-11-09 Thread Michael S. Tsirkin
On Fri, Oct 30, 2015 at 01:55:59PM +0800, Xiao Guangrong wrote: > Implement ObjectType which is used by NVDIMM _DSM method in > later patch > > Signed-off-by: Xiao Guangrong I had to go dig in the _DSM patch to see how it's used. And sure enough, callers have to

[PATCH 1/3] qemu, pkeys: add pkeys support for qemu cpuid handling

2015-11-09 Thread Huaitong Han
This patch adds pkeys support for qemu cpuid handling. Signed-off-by: Huaitong Han --- target-i386/cpu.c | 21 - target-i386/cpu.h | 4 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index

[PATCH 0/9] KVM, pkeys: add memory protection-key support

2015-11-09 Thread Huaitong Han
The protection-key feature provides an additional mechanism by which IA-32e paging controls access to usermode addresses. Hardware support for protection keys for user pages is enumerated with CPUID feature flag CPUID.7.0.ECX[3]:PKU. Software support is CPUID.7.0.ECX[4]:OSPKE with the setting of

[PATCH 4/9] KVM, pkeys: disable pkeys for guests in non-paging mode

2015-11-09 Thread Huaitong Han
Pkeys is disabled if CPU is in non-paging mode in hardware. However KVM always uses paging mode to emulate guest non-paging, mode with TDP. To emulate this behavior, pkeys needs to be manually disabled when guest switches to non-paging mode. Signed-off-by: Huaitong Han

[PATCH 3/9] KVM, pkeys: expose CPUID:OSPKE to guest

2015-11-09 Thread Huaitong Han
This patch exposes X86_FEATURE_OSPKE to guest, X86_FEATURE_OSPKE is software support for pkeys, enumerated with CPUID.7.0.ECX[4]:OSPKE, and it reflects the setting of CR4.PKE. Signed-off-by: Huaitong Han diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index

[PATCH 2/9] KVM, pkeys: add pkeys support when setting CR4

2015-11-09 Thread Huaitong Han
This patch adds pkeys support when setting CR4.PKE (bit 22). Signed-off-by: Huaitong Han diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index c12e845..3bbc1cb 100644 --- a/arch/x86/include/asm/kvm_host.h +++

[PATCH 1/9] KVM, pkeys: expose CPUID:PKU to guest

2015-11-09 Thread Huaitong Han
This patch expose X86_FEATURE_PKU to guest, X86_FEATURE_PKU is referred to as "PKU" in the hardware documentation: CPUID.7.0.ECX[3]:PKU. Signed-off-by: Huaitong Han diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index 156441b..29e6502 100644 ---

[PATCH 0/3] qemu, pkeys: add memory protection-key support

2015-11-09 Thread Huaitong Han
The protection-key feature provides an additional mechanism by which IA-32e paging controls access to usermode addresses. Hardware support for protection keys for user pages is enumerated with CPUID feature flag CPUID.7.0.ECX[3]:PKU. Software support is CPUID.7.0.ECX[4]:OSPKE with the setting of

[PATCH 9/9] KVM, pkeys: disable PKU feature without ept

2015-11-09 Thread Huaitong Han
This patch disables CPUID:PKU without ept. Signed-off-by: Huaitong Han diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index ece687b..e1113ae 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -447,6 +447,8 @@ static inline int __do_cpuid_ent(struct

[PATCH 7/9] KVM, pkeys: Add pkeys support for gva_to_gpa funcions

2015-11-09 Thread Huaitong Han
This patch adds pkeys support for gva_to_gpa funcions. Signed-off-by: Huaitong Han diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 7a84b83..6e9156d 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -3960,6 +3960,8 @@ gpa_t

[PATCH 2/3] qemu, pkeys: add pkeys support for qemu xsave state handling

2015-11-09 Thread Huaitong Han
This patch adds pkeys support for qemu xsave state handling. Signed-off-by: Huaitong Han --- target-i386/cpu.c | 2 ++ target-i386/cpu.h | 3 +++ target-i386/kvm.c | 3 +++ 3 files changed, 8 insertions(+) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index

[PATCH 5/9] KVM, pkeys: update memeory permission bitmask for pkeys

2015-11-09 Thread Huaitong Han
Pkeys define a new status bit in the PFEC. PFEC.PK (bit 5), if some conditions is true, the fault is considered as a PKU violation. This patch updates memeory permission bitmask for pkeys. Signed-off-by: Huaitong Han diff --git a/arch/x86/include/asm/kvm_host.h

[PATCH 6/9] KVM, pkeys: add pkeys support for permission_fault logic

2015-11-09 Thread Huaitong Han
Protection keys define a new 4-bit protection key field (PKEY) in bits 62:59 of leaf entries of the page tables, the PKEY is an index to PKRU register(16 domains), every domain has 2 bits(write disable bit, access disable bit). Static logic has been produced in update_permission_bitmask, dynamic

[PATCH 3/3] qemu, pkeys: add pkeys support for qemu migration

2015-11-09 Thread Huaitong Han
This patch adds pkeys support for qemu migration. Signed-off-by: Huaitong Han --- target-i386/machine.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/target-i386/machine.c b/target-i386/machine.c index a0df64b..1b190c7 100644 ---

[PATCH 8/9] KVM, pkeys: add pkeys support for xsave state

2015-11-09 Thread Huaitong Han
This patch adds pkeys support for xsave state. Signed-off-by: Huaitong Han diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h index f2afa5f..0f71d5d 100644 --- a/arch/x86/kvm/x86.h +++ b/arch/x86/kvm/x86.h @@ -182,7 +182,8 @@ bool

Re: [PATCH v3 2/3] target-i386: calculate vcpu's TSC rate to be migrated

2015-11-09 Thread Haozhong Zhang
On 11/09/15 14:01, Eduardo Habkost wrote: > On Mon, Nov 09, 2015 at 08:33:55AM +0800, haozhong.zh...@intel.com wrote: > > On 11/06/15 13:12, Eduardo Habkost wrote: > > > On Fri, Nov 06, 2015 at 10:32:24AM +0800, haozhong.zh...@intel.com wrote: > > > > On 11/05/15 14:05, Eduardo Habkost wrote: > >