Re: [PATCH v2 0/5] vfio, dax: prevent long term filesystem-dax pins and other fixes

2018-02-23 Thread Haozhong Zhang
+++--- > include/linux/dax.h |9 ++--- > include/linux/fs.h |6 -- > 3 files changed, 25 insertions(+), 8 deletions(-) Tested on QEMU with fs-dax and device-dax as vNVDIMM backends respectively with vfio passthrough. The fs-dax case fails QEMU as expected, and the device-dax case works normally now. Tested-by: Haozhong Zhang

Re: VMs freezing when host is running 4.14

2018-02-13 Thread Haozhong Zhang
On 02/13/18 20:04 -0600, Josh Poimboeuf wrote: > On Sun, Feb 11, 2018 at 02:39:41PM +0100, Marc Haber wrote: > > Hi, > > > > after in total nine weeks of bisecting, broken filesystems, service > > outages (thankfully on unportant systems), 4.15 seems to have fixed the > > issue. After going to 4.1

Re: [PATCH 3/3] vfio: disable filesystem-dax page pinning

2018-02-05 Thread Haozhong Zhang
> > ...at mount time, and resolving the dax-dma-vs-truncate problem is one > of the last hurdles to remove that designation. > > Cc: Alex Williamson > Cc: Michal Hocko > Cc: Christoph Hellwig > Cc: k...@vger.kernel.org > Cc: > Reported-by: Haozhong Zhang >

Re: [PATCH 3/3] vfio: disable filesystem-dax page pinning

2018-02-04 Thread Haozhong Zhang
gt; ...at mount time, and resolving the dax-dma-vs-truncate problem is one > of the last hurdles to remove that designation. > > Cc: Alex Williamson > Cc: Michal Hocko > Cc: Christoph Hellwig > Cc: k...@vger.kernel.org > Cc: > Reported-by: Haozhong Zhang > Fix

Re: [PATCH v3 2/4] KVM: X86: Fix loss of exception which has not yet injected

2018-01-09 Thread Haozhong Zhang
On 01/09/18 00:57 -0800, Liran Alon wrote: > > - haozhong.zh...@intel.com wrote: > > > On 01/07/18 00:26 -0700, Ross Zwisler wrote: > > > On Wed, Aug 23, 2017 at 10:21 PM, Wanpeng Li > > wrote: > > > > From: Wanpeng Li > > > > > > > > vmx_complete_interrupts() assumes that the exception is

Re: [PATCH v3 2/4] KVM: X86: Fix loss of exception which has not yet injected

2018-01-08 Thread Haozhong Zhang
On 01/07/18 00:26 -0700, Ross Zwisler wrote: > On Wed, Aug 23, 2017 at 10:21 PM, Wanpeng Li wrote: > > From: Wanpeng Li > > > > vmx_complete_interrupts() assumes that the exception is always injected, > > so it would be dropped by kvm_clear_exception_queue(). This patch separates > > exception.pe

[PATCH v6 0/2] KVM: MMU: fix kvm_is_mmio_pfn()

2017-12-19 Thread Haozhong Zhang
. Changes in v3: * Move cache mode check to pat.c as pat_pfn_is_uc() * Reintroduce converters between kvm_pfn_t and pfn_t. Changes in v2: * Switch to lookup_memtype() to get host memory type. * Rewrite the comment in KVM MMU patch. * Remove v1 patch 2, which is not necessary in v2. Haozhong Zhang (2

[PATCH v6 2/2] KVM: MMU: consider host cache mode in MMIO page check

2017-12-19 Thread Haozhong Zhang
pages would be harmed. Therefore, we check the host memory type in addition and only treat UC/UC-/WC pages as MMIO. Signed-off-by: Haozhong Zhang Reported-by: Cuevas Escareno, Ivan D Reported-by: Kumar, Karthik Reviewed-by: Xiao Guangrong --- arch/x86/kvm/mmu.c | 13 - 1 file changed

[PATCH v6 1/2] x86/mm: add a function to check if a pfn is UC/UC-/WCee

2017-12-19 Thread Haozhong Zhang
Check whether the PAT memory type of a pfn cannot be overridden by MTRR UC memory type, i.e. the PAT memory type is UC, UC- or WC. This function will be used by KVM to determine whether it needs to map a host pfn to guest with UC memory type. Signed-off-by: Haozhong Zhang Reviewed-by: Xiao

Re: [PATCH v5 1/2] x86/mm: add a function to check if a pfn is UC/UC-

2017-12-18 Thread Haozhong Zhang
On 12/18/17 13:55 +0100, Paolo Bonzini wrote: > On 08/11/2017 08:56, Haozhong Zhang wrote: > > +bool pat_pfn_is_uc_or_uc_minus(unsigned long pfn) > > +{ > > + enum page_cache_mode cm = lookup_memtype(PFN_PHYS(pfn)); > > + > > + retur

Re: [PATCH v5 1/2] x86/mm: add a function to check if a pfn is UC/UC-

2017-11-15 Thread Haozhong Zhang
On 11/15/17 11:44 +0100, David Hildenbrand wrote: > On 08.11.2017 08:56, Haozhong Zhang wrote: > > It will be used by KVM to check whether a pfn should be > > mapped to guest as UC. > > > > Signed-off-by: Haozhong Zhang > > --- > > arch/x86/include/a

Re: [PATCH v5 1/2] x86/mm: add a function to check if a pfn is UC/UC-

2017-11-15 Thread Haozhong Zhang
On 11/15/17 07:17 -0800, Dan Williams wrote: > On Tue, Nov 7, 2017 at 11:56 PM, Haozhong Zhang > wrote: > > It will be used by KVM to check whether a pfn should be > > mapped to guest as UC. > > > > Signed-off-by: Haozhong Zhang > > --- > > arch/x86/

[PATCH v5 2/2] KVM: MMU: consider host cache mode in MMIO page check

2017-11-07 Thread Haozhong Zhang
pages would be harmed. Therefore, we check the host memory type in addition and only treat UC/UC- pages as MMIO. Signed-off-by: Haozhong Zhang Reported-by: Cuevas Escareno, Ivan D Reported-by: Kumar, Karthik --- arch/x86/kvm/mmu.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion

[PATCH v5 1/2] x86/mm: add a function to check if a pfn is UC/UC-

2017-11-07 Thread Haozhong Zhang
It will be used by KVM to check whether a pfn should be mapped to guest as UC. Signed-off-by: Haozhong Zhang --- arch/x86/include/asm/pat.h | 2 ++ arch/x86/mm/pat.c | 16 2 files changed, 18 insertions(+) diff --git a/arch/x86/include/asm/pat.h b/arch/x86/include

[PATCH v5 0/2] KVM: MMU: fix kvm_is_mmio_pfn()

2017-11-07 Thread Haozhong Zhang
. Changes in v2: * Switch to lookup_memtype() to get host memory type. * Rewrite the comment in KVM MMU patch. * Remove v1 patch 2, which is not necessary in v2. Haozhong Zhang (2): x86/mm: add functions to check if a pfn is UC/UC- KVM: MMU: consider host cache mode in MMIO page check arch

Re: [PATCH v4 3/3] KVM: MMU: consider host cache mode in MMIO page check

2017-11-07 Thread Haozhong Zhang
On 11/03/17 16:51 +0800, Haozhong Zhang wrote: > On 11/03/17 14:54 +0800, Xiao Guangrong wrote: > > > > > > On 11/03/2017 01:53 PM, Haozhong Zhang wrote: > > > Some reserved pages, such as those from NVDIMM DAX devices, are > > > not for MMIO, and can be ma

Re: [PATCH v4 2/3] KVM: add converters between pfn_t and kvm_pfn_t

2017-11-07 Thread Haozhong Zhang
On 11/03/17 06:21 -0700, Dan Williams wrote: > On Thu, Nov 2, 2017 at 10:53 PM, Haozhong Zhang > wrote: > > Signed-off-by: Haozhong Zhang > > Can you also add some text to the changelog saying why we need these > converters? I'm going to drop these converters in the

Re: [PATCH v2 0/2] KVM: MMU: fix kvm_is_mmio_pfn()

2017-11-07 Thread Haozhong Zhang
On 11/03/17 10:15 -0400, Mikulas Patocka wrote: > > > On Tue, 31 Oct 2017, Haozhong Zhang wrote: > > > [I just copy the commit message from patch 2] > > > > Some reserved pages, such as those from NVDIMM DAX devices, are > > not for MMIO, and can be mappe

Re: [PATCH v4 3/3] KVM: MMU: consider host cache mode in MMIO page check

2017-11-03 Thread Haozhong Zhang
On 11/03/17 17:24 +0800, Xiao Guangrong wrote: > > > On 11/03/2017 05:02 PM, Haozhong Zhang wrote: > > On 11/03/17 16:51 +0800, Haozhong Zhang wrote: > > > On 11/03/17 14:54 +0800, Xiao Guangrong wrote: > > > > > > > > > > > >

Re: [PATCH v4 3/3] KVM: MMU: consider host cache mode in MMIO page check

2017-11-03 Thread Haozhong Zhang
On 11/03/17 17:10 +0800, Xiao Guangrong wrote: > > > On 11/03/2017 04:51 PM, Haozhong Zhang wrote: > > On 11/03/17 14:54 +0800, Xiao Guangrong wrote: > > > > > > > > > On 11/03/2017 01:53 PM, Haozhong Zhang wrote: > > > > Some rese

Re: [PATCH v4 3/3] KVM: MMU: consider host cache mode in MMIO page check

2017-11-03 Thread Haozhong Zhang
On 11/03/17 16:51 +0800, Haozhong Zhang wrote: > On 11/03/17 14:54 +0800, Xiao Guangrong wrote: > > > > > > On 11/03/2017 01:53 PM, Haozhong Zhang wrote: > > > Some reserved pages, such as those from NVDIMM DAX devices, are > > > not for MMIO, and can be ma

Re: [PATCH v4 3/3] KVM: MMU: consider host cache mode in MMIO page check

2017-11-03 Thread Haozhong Zhang
On 11/03/17 14:54 +0800, Xiao Guangrong wrote: > > > On 11/03/2017 01:53 PM, Haozhong Zhang wrote: > > Some reserved pages, such as those from NVDIMM DAX devices, are > > not for MMIO, and can be mapped with cached memory type for better > > performance. However, t

[PATCH v4 2/3] KVM: add converters between pfn_t and kvm_pfn_t

2017-11-02 Thread Haozhong Zhang
Signed-off-by: Haozhong Zhang --- include/linux/kvm_host.h | 4 1 file changed, 4 insertions(+) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 6882538eda32..caf6f7a6bdb2 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -27,6 +27,7 @@ #include

[PATCH v4 3/3] KVM: MMU: consider host cache mode in MMIO page check

2017-11-02 Thread Haozhong Zhang
pages would be harmed. Therefore, we check the host memory type by lookup_memtype() in addition and only treat UC/UC- pages as MMIO. Signed-off-by: Haozhong Zhang Reported-by: Cuevas Escareno, Ivan D Reported-by: Kumar, Karthik --- arch/x86/kvm/mmu.c | 19 ++- 1 file changed, 18

[PATCH v4 1/3] x86/mm: add function to check if a pfn is UC/UC-

2017-11-02 Thread Haozhong Zhang
pat_pfn_is_uc(pfn) is added and will be used by KVM to check whether the memory type of a host pfn is UC/UC-. Signed-off-by: Haozhong Zhang --- arch/x86/include/asm/pat.h | 2 ++ arch/x86/mm/pat.c | 14 ++ 2 files changed, 16 insertions(+) diff --git a/arch/x86/include

[PATCH v4 0/3] KVM: MMU: fix kvm_is_mmio_pfn()

2017-11-02 Thread Haozhong Zhang
between kvm_pfn_t and pfn_t. Changes in v2: * Switch to lookup_memtype() to get host memory type. * Rewrite the comment in KVM MMU patch. * Remove v1 patch 2, which is not necessary in v2. Haozhong Zhang (3): x86/mm: add function to check if a pfn is UC/UC- KVM: add converters between

Re: [PATCH v3 2/3] KVM: add converters between pfn_t and kvm_pfn_t

2017-11-02 Thread Haozhong Zhang
On 11/02/17 19:25 -0700, Dan Williams wrote: > On Thu, Nov 2, 2017 at 6:16 PM, Haozhong Zhang > wrote: > > Signed-off-by: Haozhong Zhang > > --- > > include/linux/kvm_host.h | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/include/l

[PATCH v3 0/3] KVM: MMU: fix kvm_is_mmio_pfn()

2017-11-02 Thread Haozhong Zhang
() to get host memory type. * Rewrite the comment in KVM MMU patch. * Remove v1 patch 2, which is not necessary in v2. Haozhong Zhang (3): x86/mm: add function to check if a pfn is UC/UC- KVM: add converters between pfn_t and kvm_pfn_t KVM: MMU: consider host cache mode in MMIO page check

[PATCH v3 2/3] KVM: add converters between pfn_t and kvm_pfn_t

2017-11-02 Thread Haozhong Zhang
Signed-off-by: Haozhong Zhang --- include/linux/kvm_host.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 6882538eda32..759fe498c89e 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -67,6 +67,9 @@ #define

[PATCH v3 1/3] x86/mm: add function to check if a pfn is UC/UC-

2017-11-02 Thread Haozhong Zhang
pat_pfn_is_uc(pfn) is added and will be used by KVM to check whether the memory type of a host pfn is UC/UC-. Signed-off-by: Haozhong Zhang --- arch/x86/include/asm/pat.h | 2 ++ arch/x86/mm/pat.c | 14 ++ 2 files changed, 16 insertions(+) diff --git a/arch/x86/include

[PATCH v3 3/3] KVM: MMU: consider host cache mode in MMIO page check

2017-11-02 Thread Haozhong Zhang
pages would be harmed. Therefore, we check the host memory type by lookup_memtype() in addition and only treat UC/UC- pages as MMIO. Signed-off-by: Haozhong Zhang Reported-by: Cuevas Escareno, Ivan D Reported-by: Kumar, Karthik --- arch/x86/kvm/mmu.c | 18 +- 1 file changed, 17

Re: [PATCH v2 0/2] KVM: MMU: fix kvm_is_mmio_pfn()

2017-11-02 Thread Haozhong Zhang
On 11/02/17 13:37 -0400, Konrad Rzeszutek Wilk wrote: > On Tue, Oct 31, 2017 at 07:48:38PM +0800, Haozhong Zhang wrote: > > [I just copy the commit message from patch 2] > > > > Some reserved pages, such as those from NVDIMM DAX devices, are > > not for MMIO, and can b

Re: [PATCH v2 2/2] KVM: MMU: consider host cache mode in MMIO page check

2017-11-02 Thread Haozhong Zhang
On 11/02/17 15:56 +0800, Xiao Guangrong wrote: > > > On 10/31/2017 07:48 PM, Haozhong Zhang wrote: > > Some reserved pages, such as those from NVDIMM DAX devices, are > > not for MMIO, and can be mapped with cached memory type for better > > performance. However, t

Re: [PATCH v2 0/2] KVM: MMU: fix kvm_is_mmio_pfn()

2017-11-01 Thread Haozhong Zhang
On 10/31/17 19:48 +0800, Haozhong Zhang wrote: > [I just copy the commit message from patch 2] > > Some reserved pages, such as those from NVDIMM DAX devices, are > not for MMIO, and can be mapped with cached memory type for better > performance. However, the above check misconcei

Re: kvm: GPF in native_write_cr4

2017-10-31 Thread Haozhong Zhang
Hi Wanpeng, On 10/31/17 19:10 +0800, Wanpeng Li wrote: > 2017-10-31 17:59 GMT+08:00 Dmitry Vyukov : > > Hello, > > > > I am seeing the following crash on upstream > > 15f859ae5c43c7f0a064ed92d33f7a5bc5de6de0 (Oct 26). > > Reproducer: > > https://gist.githubusercontent.com/dvyukov/a9690f90c39c1e3b1

[PATCH v2 1/2] x86/mm: expose lookup_memtype()

2017-10-31 Thread Haozhong Zhang
KVM MMU will use it to get the cache mode of the host page. Signed-off-by: Haozhong Zhang --- arch/x86/include/asm/pat.h | 2 ++ arch/x86/mm/pat.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/pat.h b/arch/x86/include/asm/pat.h index

[PATCH v2 2/2] KVM: MMU: consider host cache mode in MMIO page check

2017-10-31 Thread Haozhong Zhang
pages would be harmed. Therefore, we check the host memory type by lookup_memtype() in addition and only treat UC/UC- pages as MMIO. Signed-off-by: Haozhong Zhang Reported-by: Cuevas Escareno, Ivan D Reported-by: Kumar, Karthik --- arch/x86/kvm/mmu.c | 30 +++--- 1 file

[PATCH v2 0/2] KVM: MMU: fix kvm_is_mmio_pfn()

2017-10-31 Thread Haozhong Zhang
v1 patch 2, which is not necessary in v2. Haozhong Zhang (2): x86/mm: expose lookup_memtype() KVM: MMU: consider host cache mode in MMIO page check arch/x86/include/asm/pat.h | 2 ++ arch/x86/kvm/mmu.c | 30 +++--- arch/x86/mm/pat.c | 3 ++- 3 files

Re: [PATCH 3/3] KVM: MMU: consider host cache type in MMIO pfn check

2017-10-31 Thread Haozhong Zhang
On 10/27/17 10:40 +0200, Ingo Molnar wrote: > > * Haozhong Zhang wrote: > > > By default, KVM treats a reserved page as for MMIO purpose, and maps > > it to guest with UC memory type. However, some reserved pages are not > > for MMIO, such as pages of DAX device (

[PATCH 2/3] KVM: add converters between pfn_t and kvm_pfn_t

2017-10-26 Thread Haozhong Zhang
Signed-off-by: Haozhong Zhang --- include/linux/kvm_host.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 6882538eda32..759fe498c89e 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -67,6 +67,9 @@ #define

[PATCH 1/3] x86/mm: expose track_pfn_insert()

2017-10-26 Thread Haozhong Zhang
KVM MMU will use it to get the cache mode of the host pfn. Signed-off-by: Haozhong Zhang --- arch/x86/mm/pat.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index fe7d57a8fb60..cab593ea8956 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c

[PATCH 0/3] KVM: MMU: fix kvm_is_mmio_pfn()

2017-10-26 Thread Haozhong Zhang
performance. In order to exclude those cases, we check the host cache mode in addition and only treat UC/UC- pages as MMIO. Haozhong Zhang (3): x86/mm: expose track_pfn_insert() KVM: add converters between pfn_t and kvm_pfn_t KVM: MMU: consider host cache type in MMIO pfn check arch/x86/kvm

[PATCH 3/3] KVM: MMU: consider host cache type in MMIO pfn check

2017-10-26 Thread Haozhong Zhang
check the host cache mode in addition and only treat UC/UC- pages as MMIO. Signed-off-by: Haozhong Zhang Reported-by: Cuevas Escareno, Ivan D Reported-by: Kumar, Karthik --- arch/x86/kvm/mmu.c | 32 +--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a

Re: [Xen-devel] [RFC KERNEL PATCH 0/2] Add Dom0 NVDIMM support for Xen

2016-10-20 Thread Haozhong Zhang
On 10/14/16 13:18 +0100, Andrew Cooper wrote: On 14/10/16 08:08, Haozhong Zhang wrote: On 10/13/16 20:33 +0100, Andrew Cooper wrote: On 13/10/16 19:59, Dan Williams wrote: On Thu, Oct 13, 2016 at 9:01 AM, Andrew Cooper wrote: On 13/10/16 16:40, Dan Williams wrote: On Thu, Oct 13, 2016 at 2

Re: [Xen-devel] [RFC KERNEL PATCH 0/2] Add Dom0 NVDIMM support for Xen

2016-10-20 Thread Haozhong Zhang
On 10/14/16 04:16 -0600, Jan Beulich wrote: On 13.10.16 at 17:46, wrote: On 10/13/16 03:08 -0600, Jan Beulich wrote: On 13.10.16 at 10:53, wrote: On 10/13/16 02:34 -0600, Jan Beulich wrote: On 12.10.16 at 18:19, wrote: On Wed, Oct 12, 2016 at 9:01 AM, Jan Beulich wrote: On 12.10.16 at 1

Re: [Xen-devel] [RFC KERNEL PATCH 0/2] Add Dom0 NVDIMM support for Xen

2016-10-14 Thread Haozhong Zhang
On 10/13/16 20:33 +0100, Andrew Cooper wrote: On 13/10/16 19:59, Dan Williams wrote: On Thu, Oct 13, 2016 at 9:01 AM, Andrew Cooper wrote: On 13/10/16 16:40, Dan Williams wrote: On Thu, Oct 13, 2016 at 2:08 AM, Jan Beulich wrote: [..] I think we can do the similar for Xen, like to lay anoth

Re: [Xen-devel] [RFC KERNEL PATCH 0/2] Add Dom0 NVDIMM support for Xen

2016-10-13 Thread Haozhong Zhang
On 10/13/16 03:08 -0600, Jan Beulich wrote: On 13.10.16 at 10:53, wrote: On 10/13/16 02:34 -0600, Jan Beulich wrote: On 12.10.16 at 18:19, wrote: On Wed, Oct 12, 2016 at 9:01 AM, Jan Beulich wrote: On 12.10.16 at 17:42, wrote: On Wed, Oct 12, 2016 at 8:39 AM, Jan Beulich wrote: On 12.1

Re: [Xen-devel] [RFC KERNEL PATCH 0/2] Add Dom0 NVDIMM support for Xen

2016-10-13 Thread Haozhong Zhang
+Dan Williams I accidentally dropped him in my last reply. Add him back. On 10/13/16 16:53 +0800, Haozhong Zhang wrote: On 10/13/16 02:34 -0600, Jan Beulich wrote: On 12.10.16 at 18:19, wrote: On Wed, Oct 12, 2016 at 9:01 AM, Jan Beulich wrote: On 12.10.16 at 17:42, wrote: On Wed, Oct

Re: [Xen-devel] [RFC KERNEL PATCH 0/2] Add Dom0 NVDIMM support for Xen

2016-10-13 Thread Haozhong Zhang
On 10/13/16 02:34 -0600, Jan Beulich wrote: On 12.10.16 at 18:19, wrote: On Wed, Oct 12, 2016 at 9:01 AM, Jan Beulich wrote: On 12.10.16 at 17:42, wrote: On Wed, Oct 12, 2016 at 8:39 AM, Jan Beulich wrote: On 12.10.16 at 16:58, wrote: On 10/12/16 05:32 -0600, Jan Beulich wrote: On 12.1

Re: [Xen-devel] [RFC KERNEL PATCH 0/2] Add Dom0 NVDIMM support for Xen

2016-10-12 Thread Haozhong Zhang
On 10/12/16 05:32 -0600, Jan Beulich wrote: On 12.10.16 at 12:33, wrote: The layout is shown as the following diagram. +---+---+---+--+--+ | whatever used | Partition | Super | Reserved | /dev/pmem0p1 | | by kernel| Table | Block | for Xen

Re: [Xen-devel] [RFC KERNEL PATCH 0/2] Add Dom0 NVDIMM support for Xen

2016-10-12 Thread Haozhong Zhang
On 10/11/16 13:17 -0700, Dan Williams wrote: On Tue, Oct 11, 2016 at 12:48 PM, Konrad Rzeszutek Wilk wrote: On Tue, Oct 11, 2016 at 12:28:56PM -0700, Dan Williams wrote: On Tue, Oct 11, 2016 at 11:33 AM, Konrad Rzeszutek Wilk wrote: > On Tue, Oct 11, 2016 at 10:51:19AM -0700, Dan Williams wro

Re: [RFC KERNEL PATCH 0/2] Add Dom0 NVDIMM support for Xen

2016-10-11 Thread Haozhong Zhang
On 10/10/16 09:24, Dan Williams wrote: > On Sun, Oct 9, 2016 at 11:32 PM, Haozhong Zhang > wrote: > > On 10/09/16 20:45, Dan Williams wrote: > >> On Sun, Oct 9, 2016 at 5:35 PM, Haozhong Zhang > >> wrote: > >> > Overview > >> > =

Re: [Xen-devel] [RFC KERNEL PATCH 0/2] Add Dom0 NVDIMM support for Xen

2016-10-10 Thread Haozhong Zhang
On 10/10/16 17:43, Andrew Cooper wrote: > On 10/10/16 01:35, Haozhong Zhang wrote: > > Overview > > > > This RFC kernel patch series along with corresponding patch series of > > Xen, QEMU and ndctl implements Xen vNVDIMM, which can map the host > >

Re: [RFC KERNEL PATCH 0/2] Add Dom0 NVDIMM support for Xen

2016-10-09 Thread Haozhong Zhang
On 10/09/16 20:45, Dan Williams wrote: > On Sun, Oct 9, 2016 at 5:35 PM, Haozhong Zhang > wrote: > > Overview > > > > This RFC kernel patch series along with corresponding patch series of > > Xen, QEMU and ndctl implements Xen vNVDIMM, which can map the

[RFC KERNEL PATCH 1/2] nvdimm: add PFN_MODE_XEN to pfn device for Xen usage

2016-10-09 Thread Haozhong Zhang
pfn device in PFN_MODE_XEN reserves an area for Xen hypervisor to place its own pmem management data structures (i.e. frame table and M2P table). The reserved area is not used and not mapped by Linux kernel, and only the data area is mapped. Signed-off-by: Haozhong Zhang --- Cc: Dan Williams Cc

[RFC KERNEL PATCH 0/2] Add Dom0 NVDIMM support for Xen

2016-10-09 Thread Haozhong Zhang
00/16] Add vNVDIMM support to HVM domains". Haozhong Zhang (2): nvdimm: add PFN_MODE_XEN to pfn device for Xen usage xen, nvdimm: report pfn devices in PFN_MODE_XEN to Xen hypervisor drivers/nvdimm/namespace_devs.c | 2 ++ drivers/nvdimm/nd.h | 7 + drivers/nvdimm/

[RFC KERNEL PATCH 2/2] xen, nvdimm: report pfn devices in PFN_MODE_XEN to Xen hypervisor

2016-10-09 Thread Haozhong Zhang
Xen hypervisor does not include NVDIMM driver and relies on the driver in Dom0 Linux to probe pfn devices in PFN_MODE_XEN. Whenever such a pfn device is probed, Dom0 Linux reports pages of the entire device, its reserved area and data area to Xen hypervisor. Signed-off-by: Haozhong Zhang --- Cc

Re: [PATCH 2/2] KVM: x86: zero MSR_IA32_FEATURE_CONTROL on reset

2016-07-08 Thread Haozhong Zhang
On 07/08/16 14:01, Paolo Bonzini wrote: > Reported-by: Laszlo Ersek > Signed-off-by: Paolo Bonzini > --- > arch/x86/kvm/x86.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 388d9ffd7551..c01b0b3a06aa 100644 > --- a/arch/x86/kvm/x86.c > +

Re: [PATCH 1/2] KVM: x86: move MSR_IA32_FEATURE_CONTROL handling to x86.c

2016-07-08 Thread Haozhong Zhang
On 07/08/16 14:01, Paolo Bonzini wrote: > Because the MSR is listed in msrs_to_save, it is exported to userspace > for both AMD and Intel processors. However, on AMD currently getting > it will fail. > Is MSR_IA32_FEATURE_CONTROL already be excluded from msrs_to_save[] by kvm_init_msr_list() on A

Re: [PATCH v3 1/2] KVM: nVMX: Fix incorrect preemption timer vmexit in nested guest

2016-07-07 Thread Haozhong Zhang
On 07/07/16 15:07, Wanpeng Li wrote: > 2016-07-07 15:02 GMT+08:00 Haozhong Zhang : > > On 07/07/16 14:56, Wanpeng Li wrote: > >> 2016-07-07 14:48 GMT+08:00 Haozhong Zhang : > >> > On 07/07/16 11:46, Wanpeng Li wrote: > >> >> From: Wanpeng Li >

Re: [PATCH v3 1/2] KVM: nVMX: Fix incorrect preemption timer vmexit in nested guest

2016-07-07 Thread Haozhong Zhang
On 07/07/16 14:56, Wanpeng Li wrote: > 2016-07-07 14:48 GMT+08:00 Haozhong Zhang : > > On 07/07/16 11:46, Wanpeng Li wrote: > >> From: Wanpeng Li > >> > >> BUG: unable to handle kernel NULL pointer dereference at (null) > >> IP: [<

Re: [PATCH v3 1/2] KVM: nVMX: Fix incorrect preemption timer vmexit in nested guest

2016-07-06 Thread Haozhong Zhang
eference NULL pointer. > > This patch fix it by depending on check_nested_events to capture L2 preemption > timer(emulated hrtimer) expire and nested vmexit. > > Tested-by: Haozhong Zhang > Cc: Paolo Bonzini > Cc: Radim Krčmář > Cc: Yunhong Jiang > Cc: Jan Kiszka > C

Re: [PATCH v3] KVM: nVMX: Fix incorrect preemption timer vmexit in nested guest

2016-07-06 Thread Haozhong Zhang
On 07/06/16 15:32, Paolo Bonzini wrote: > > > On 06/07/2016 15:26, Haozhong Zhang wrote: > > On 07/06/16 19:42, Wanpeng Li wrote: > >> From: Wanpeng Li > >> > >> BUG: unable to handle kernel NULL pointer dereference at (null) > >> I

Re: [PATCH v3] KVM: nVMX: Fix incorrect preemption timer vmexit in nested guest

2016-07-06 Thread Haozhong Zhang
t dereference NULL pointer. > > This patch fix it by depending on check_nested_events to capture L2 > preemption > timer(emulated hrtimer) expire and nested vmexit. > > Cc: Paolo Bonzini > Cc: Radim Krčmář > Cc: Yunhong Jiang > Cc: Jan Kiszka > Cc: Haozhong Zhang >

Re: [PATCH] KVM: VMX: switch to hrtimer for TSC deadline timer when L2 guest is running

2016-07-06 Thread Haozhong Zhang
On 07/06/16 04:14, Paolo Bonzini wrote: > > On 07/06/16 16:01, Haozhong Zhang wrote: > > > On 07/06/16 09:46, Paolo Bonzini wrote: > > > > On 06/07/2016 08:05, Haozhong Zhang wrote: > > > > >> > Nested preemption timer is emulated by hrtimer, so it

Re: [PATCH] KVM: VMX: switch to hrtimer for TSC deadline timer when L2 guest is running

2016-07-06 Thread Haozhong Zhang
On 07/06/16 16:01, Haozhong Zhang wrote: > On 07/06/16 09:46, Paolo Bonzini wrote: > > > > > > On 06/07/2016 08:05, Haozhong Zhang wrote: > > >> > > > >> > Nested preemption timer is emulated by hrtimer, so it doesn't > > >>

Re: [PATCH] KVM: VMX: switch to hrtimer for TSC deadline timer when L2 guest is running

2016-07-06 Thread Haozhong Zhang
On 07/06/16 09:46, Paolo Bonzini wrote: > > > On 06/07/2016 08:05, Haozhong Zhang wrote: > >> > > >> > Nested preemption timer is emulated by hrtimer, so it doesn't > >> > influence vmcs02, why this is needed? > > Nested (L2) preemption

Re: [PATCH] KVM: VMX: switch to hrtimer for TSC deadline timer when L2 guest is running

2016-07-05 Thread Haozhong Zhang
On 07/06/16 13:37, Wanpeng Li wrote: > Cc Jan, > 2016-07-06 13:10 GMT+08:00 Haozhong Zhang : > > A different VMCS is loaded when L2 guest is running, so it's incorrect > > to use the VMX preemption timer for L1 TSC deadline timer. This patch > > switches to hrtimer f

[PATCH] KVM: VMX: switch to hrtimer for TSC deadline timer when L2 guest is running

2016-07-05 Thread Haozhong Zhang
d-off-by: Haozhong Zhang --- arch/x86/kvm/vmx.c | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 85e2f0a..cc29c2a 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -10203,6 +10203,9 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu,

[PATCH v3 2/3] KVM: VMX: validate individual bits of guest MSR_IA32_FEATURE_CONTROL

2016-06-22 Thread Haozhong Zhang
KVM currently does not check the value written to guest MSR_IA32_FEATURE_CONTROL, though bits corresponding to disabled features may be set. This patch makes KVM to validate individual bits written to guest MSR_IA32_FEATURE_CONTROL according to enabled features. Signed-off-by: Haozhong Zhang

[PATCH v3 3/3] KVM: VMX: enable guest access to LMCE related MSRs

2016-06-22 Thread Haozhong Zhang
orm Check MSR_IA32_FEATURE_CONTROL when handling guest access to MSR_IA32_MCG_EXT_CTL] Signed-off-by: Haozhong Zhang --- arch/x86/include/asm/kvm_host.h | 5 + arch/x86/kvm/vmx.c | 29 + arch/x86/kvm/x86.c | 15 +--

[PATCH v3 0/3] Add KVM support for Intel local MCE

2016-06-22 Thread Haozhong Zhang
dd QEMU support for Intel local MCE") enables Intel local MCE feature for guest. This KVM patch handles guest access to LMCE-related MSR (MSR_IA32_MCG_EXT_CTL and MSR_IA32_FEATURE_CONTROL). Ashok Raj (1): KVM: VMX: enable guest access to LMCE related MSRs Haozhong Zhang (

[PATCH v3 1/3] KVM: VMX: move msr_ia32_feature_control to vcpu_vmx

2016-06-22 Thread Haozhong Zhang
msr_ia32_feature_control will be used for LMCE and not depend only on nested anymore, so move it from struct nested_vmx to struct vcpu_vmx. Signed-off-by: Haozhong Zhang --- arch/x86/kvm/vmx.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/vmx.c b

Re: [PATCH v2 3/3] KVM: VMX: enable guest access to LMCE related MSRs

2016-06-19 Thread Haozhong Zhang
On 06/17/16 14:15, Eduardo Habkost wrote: > On Fri, Jun 17, 2016 at 09:11:16AM +0800, Haozhong Zhang wrote: > > On 06/16/16 11:55, Eduardo Habkost wrote: > > > On Thu, Jun 16, 2016 at 12:04:50PM +0200, Paolo Bonzini wrote: > > > > On 16/06/2016 08:05, Haozhong Zhan

Re: [PATCH v2 3/3] KVM: VMX: enable guest access to LMCE related MSRs

2016-06-16 Thread Haozhong Zhang
On 06/16/16 11:55, Eduardo Habkost wrote: > On Thu, Jun 16, 2016 at 12:04:50PM +0200, Paolo Bonzini wrote: > > On 16/06/2016 08:05, Haozhong Zhang wrote: > > > From: Ashok Raj > > > > > > On Intel platforms, this patch adds LMCE to KVM MCE supported > >

Re: [PATCH v2 1/3] KVM: VMX: move msr_ia32_feature_control to vcpu_vmx

2016-06-16 Thread Haozhong Zhang
On 06/16/16 13:49, Borislav Petkov wrote: > On Thu, Jun 16, 2016 at 02:05:29PM +0800, Haozhong Zhang wrote: > > msr_ia32_feature_control will be used for LMCE and not depend only on > > nested anymore, so move it from struct nested_vmx to struct vcpu_vmx. > > > > Si

Re: [PATCH v2 2/3] KVM: VMX: validate individual bits of guest MSR_IA32_FEATURE_CONTROL

2016-06-16 Thread Haozhong Zhang
On 06/16/16 13:19, Paolo Bonzini wrote: > > > On 16/06/2016 13:16, Haozhong Zhang wrote: > >> However, I think FEATURE_CONTROL_LOCKED should always be writable. If > >> you change that, it's simpler to just do |= and &= in the caller. > > > &

Re: [PATCH v2 2/3] KVM: VMX: validate individual bits of guest MSR_IA32_FEATURE_CONTROL

2016-06-16 Thread Haozhong Zhang
On 06/16/16 11:55, Paolo Bonzini wrote: > > > On 16/06/2016 08:05, Haozhong Zhang wrote: > > + /* > > +* Only bits masked by msr_ia32_feature_control_valid_bits can be set in > > +* msr_ia32_feature_control. > > +* > > +* msr_ia32_featur

Re: [PATCH v2 2/3] KVM: VMX: validate individual bits of guest MSR_IA32_FEATURE_CONTROL

2016-06-16 Thread Haozhong Zhang
On 06/16/16 12:01, Paolo Bonzini wrote: > > > On 16/06/2016 08:05, Haozhong Zhang wrote: > > +/* > > + * FEATURE_CONTROL_LOCKED is added/removed automatically by > > + * feature_control_valid_bits_add/del(), so it's not included here. > > + */ >

Re: [PATCH v2 3/3] KVM: VMX: enable guest access to LMCE related MSRs

2016-06-16 Thread Haozhong Zhang
On 06/16/16 12:04, Paolo Bonzini wrote: > > > On 16/06/2016 08:05, Haozhong Zhang wrote: > > From: Ashok Raj > > > > On Intel platforms, this patch adds LMCE to KVM MCE supported > > capabilities and handles guest access to LMCE related MSRs. > > >

[PATCH v2 3/3] KVM: VMX: enable guest access to LMCE related MSRs

2016-06-15 Thread Haozhong Zhang
orm Check MSR_IA32_FEATURE_CONTROL when handling guest access to MSR_IA32_MCG_EXT_CTL] Signed-off-by: Haozhong Zhang --- arch/x86/include/asm/kvm_host.h | 5 + arch/x86/kvm/vmx.c | 36 +++- arch/x86/kvm/x86.c |

[PATCH v2 1/3] KVM: VMX: move msr_ia32_feature_control to vcpu_vmx

2016-06-15 Thread Haozhong Zhang
msr_ia32_feature_control will be used for LMCE and not depend only on nested anymore, so move it from struct nested_vmx to struct vcpu_vmx. Signed-off-by: Haozhong Zhang --- arch/x86/kvm/vmx.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/x86/kvm/vmx.c b

[PATCH v2 2/3] KVM: VMX: validate individual bits of guest MSR_IA32_FEATURE_CONTROL

2016-06-15 Thread Haozhong Zhang
KVM currently does not check the value written to guest MSR_IA32_FEATURE_CONTROL, though bits corresponding to disabled features may be set. This patch makes KVM to validate individual bits written to guest MSR_IA32_FEATURE_CONTROL according to enabled features. Signed-off-by: Haozhong Zhang

[PATCH v2 0/3] Add KVM support for Intel local MCE

2016-06-15 Thread Haozhong Zhang
hok Raj (1): KVM: VMX: enable guest access to LMCE related MSRs Haozhong Zhang (2): KVM: VMX: move msr_ia32_feature_control to vcpu_vmx KVM: VMX: validate individual bits of guest MSR_IA32_FEATURE_CONTROL arch/x86/include/asm/kvm_host.h | 5 +++ arch/x86/kvm/vmx.c

Re: [PATCH v1] KVM: VMX: enable guest access to LMCE related MSRs

2016-06-05 Thread Haozhong Zhang
On 06/05/16 21:43, Borislav Petkov wrote: > On Sun, Jun 05, 2016 at 11:14:56PM +0800, Haozhong Zhang wrote: > > Ashok was also involved in the development of v1 patch and it's based > > on his v0 patch, so I think I should take his SOB? > > You have at least three optio

Re: [PATCH v1] KVM: VMX: enable guest access to LMCE related MSRs

2016-06-05 Thread Haozhong Zhang
On 06/04/16 13:01, Boris Petkov wrote: > Haozhong Zhang wrote: > > >On Intel platforms, this patch adds LMCE to KVM MCE supported > >capabilities and handles guest access to LMCE related MSRs. > > > >Signed-off-by: Ashok Raj > >Signed-off-by: Haozhong Zhang

Re: [PATCH v1] KVM: VMX: enable guest access to LMCE related MSRs

2016-06-05 Thread Haozhong Zhang
On 06/03/16 17:34, Radim Krčmář wrote: > 2016-06-03 14:08+0800, Haozhong Zhang: > > On Intel platforms, this patch adds LMCE to KVM MCE supported > > capabilities and handles guest access to LMCE related MSRs. > > > > Signed-off-by: Ashok Raj > > Signed-off-by:

[PATCH v1] KVM: VMX: enable guest access to LMCE related MSRs

2016-06-02 Thread Haozhong Zhang
On Intel platforms, this patch adds LMCE to KVM MCE supported capabilities and handles guest access to LMCE related MSRs. Signed-off-by: Ashok Raj Signed-off-by: Haozhong Zhang --- arch/x86/include/asm/kvm_host.h | 3 +++ arch/x86/kvm/vmx.c | 27 +-- arch

[PATCH v1] Add KVM support for Intel local MCE

2016-06-02 Thread Haozhong Zhang
eature for guest. This KVM patch handles guest access to LMCE-related MSR (MSR_IA32_MCG_EXT_CTL and MSR_IA32_FEATURE_CONTROL). Haozhong Zhang (1): KVM: VMX: enable guest access to LMCE related MSRs arch/x86/include/asm/kvm_host.h | 3 +++ arch/x86/kvm/vmx.c

[PATCH] KVM: VMX: Fix host initiated access to guest MSR_TSC_AUX

2015-12-14 Thread Haozhong Zhang
handling instead. Signed-off-by: Haozhong Zhang --- arch/x86/kvm/vmx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 1a8bfaa..50f2b78 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -2802,7 +2802,7 @@ static int

Re: [PATCH] KVM: nVMX: remove incorrect vpid check in nested invvpid emulation

2015-11-25 Thread Haozhong Zhang
On 11/25/15 10:45, Bandan Das wrote: > Haozhong Zhang writes: > > > This patch removes the vpid check when emulating nested invvpid > > instruction of type all-contexts invalidation. The existing code is > > incorrect because: > > (1) According to Intel SDM Vol 3,

[PATCH] KVM: nVMX: remove incorrect vpid check in nested invvpid emulation

2015-11-25 Thread Haozhong Zhang
erence. In practice, it can crash both KVM itself and L1 hypervisors that use invvpid (e.g. Xen). Signed-off-by: Haozhong Zhang --- arch/x86/kvm/vmx.c | 5 - 1 file changed, 5 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 87acc52..af823a3 100644 --- a/arch/x86/kvm/v

Re: [PATCH v2 00/12] KVM: x86: add support for VMX TSC scaling

2015-11-08 Thread haozhong . zhang
On 11/06/15 21:40, Paolo Bonzini wrote: > > > On 06/11/2015 13:42, Haozhong Zhang wrote: > > On 11/06/15 11:49, Paolo Bonzini wrote: > >> > >> > >> On 20/10/2015 09:39, Haozhong Zhang wrote: > >>> This patchset adds support for VMX TSC sca

Re: [PATCH v2 00/12] KVM: x86: add support for VMX TSC scaling

2015-11-06 Thread Haozhong Zhang
On 11/06/15 11:49, Paolo Bonzini wrote: > > > On 20/10/2015 09:39, Haozhong Zhang wrote: > > This patchset adds support for VMX TSC scaling feature which is > > available on Intel Skylake CPU. The specification of VMX TSC scaling > > can be found at > > http:

Re: [PATCH v2 00/12] KVM: x86: add support for VMX TSC scaling

2015-10-23 Thread Haozhong Zhang
On Fri, Oct 23, 2015 at 02:51:06PM +0200, Paolo Bonzini wrote: > > > On 23/10/2015 14:46, Joerg Roedel wrote: > >> > No, since I don't have AMD machines at hand. The modifications to SVM > >> > code are mostly lifting common code with VMX TSC scaling code, so it > >> > should still work on AMD ma

Re: [PATCH v2 00/12] KVM: x86: add support for VMX TSC scaling

2015-10-23 Thread Haozhong Zhang
Following is how I test this patchset. It should also apply to AMD machines by replacing Intel with AMD and VMX TSC scaling with SVM TSC ratio. * Hardware Requirements 1) Two machines with Intel CPUs, called M_A and M_B below. 2) TSC frequency of CPUs on M_A is different from CPUs on M_B.

Re: [PATCH v2 00/12] KVM: x86: add support for VMX TSC scaling

2015-10-23 Thread Haozhong Zhang
On Fri, Oct 23, 2015 at 02:46:19PM +0200, Joerg Roedel wrote: > On Fri, Oct 23, 2015 at 08:32:28PM +0800, Haozhong Zhang wrote: > > No, since I don't have AMD machines at hand. The modifications to SVM > > code are mostly lifting common code with VMX TSC scaling code, so it &

Re: [PATCH v2 00/12] KVM: x86: add support for VMX TSC scaling

2015-10-23 Thread Haozhong Zhang
On Fri, Oct 23, 2015 at 12:06:50PM +0200, Joerg Roedel wrote: > On Tue, Oct 20, 2015 at 03:39:00PM +0800, Haozhong Zhang wrote: > > VMX TSC scaling shares some common logics with SVM TSC ratio which > > is already supported by KVM. Patch 1 ~ 8 move those common logics from >

[PATCH v2 01/12] KVM: x86: Collect information for setting TSC scaling ratio

2015-10-20 Thread Haozhong Zhang
The number of bits of the fractional part of the 64-bit TSC scaling ratio in VMX and SVM is different. This patch makes the architecture code to collect the number of fractional bits and other related information into variables that can be accessed in the common code. Signed-off-by: Haozhong

[PATCH v2 11/12] KVM: VMX: Use a scaled host TSC for guest readings of MSR_IA32_TSC

2015-10-20 Thread Haozhong Zhang
This patch makes kvm-intel to return a scaled host TSC plus the TSC offset when handling guest readings to MSR_IA32_TSC. Signed-off-by: Haozhong Zhang --- arch/x86/kvm/vmx.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c

  1   2   >