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 <haozhong.zh...@intel.com>

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

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

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

2018-02-05 Thread Haozhong Zhang
esolving the dax-dma-vs-truncate problem is one > of the last hurdles to remove that designation. > > Cc: Alex Williamson <alex.william...@redhat.com> > Cc: Michal Hocko <mho...@suse.com> > Cc: Christoph Hellwig <h...@lst.de> > Cc: k...@vger.kernel.or

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

2018-02-05 Thread Haozhong Zhang
esolving 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 > Fixes: d475c6346a38 ("dax,ex

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

2018-02-04 Thread Haozhong Zhang
the dax-dma-vs-truncate problem is one > of the last hurdles to remove that designation. > > Cc: Alex Williamson <alex.william...@redhat.com> > Cc: Michal Hocko <mho...@suse.com> > Cc: Christoph Hellwig <h...@lst.de> > Cc: k...@vger.kernel.org > Cc: <sta..

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

2018-02-04 Thread Haozhong Zhang
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 > Fixes: d475c6346a38 ("dax,ext2: r

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

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

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

[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 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 <haozhong.zh...@intel.com> Reported-by: Cuevas Escareno, Ivan D <ivan.d.cuevas.escar...@intel.com> Reported-by: Kumar, Karthik <karthik.

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

[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-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 <haozhong.zh...@intel.com> > > -

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 > <haozhong.zh...@intel.com> wrote: > > It will be used by KVM to check whether a pfn should be > > mapped to guest as UC. > > > > Signed-off-by: Haoz

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 <haozhong.zh...@intel.com> Reported-by: Cuevas Escareno, Ivan D <ivan.d.cuevas.escar...@intel.com> Reported-by: Kumar, Karthik <karthik.

[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 <haozhong.zh...@intel.com> --- arch/x86/include/asm/pat.h | 2 ++ arch/x86/mm/pat.c | 16 2 files changed, 18 insertions(+) diff --git a/arch/x86/inclu

[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

[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 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 > <haozhong.zh...@intel.com> wrote: > > Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> > > Can you also add some text to the changelog saying why we need t

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 next

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

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

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

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 <haozhong.zh...@intel.com> --- 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_

[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 <haozhong.zh...@intel.com> Reported-by: Cuevas Escareno, Ivan D <ivan.d.cuevas.escar...@intel.com> Reported-by: Kumar, Karthik

[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 <haozhong.zh...@intel.com> --- arch/x86/include/asm/pat.h | 2 ++ arch/x86/mm/pat.c | 14 ++ 2 files changed, 16 insertions(+)

[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

[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 <haozhong.zh...@intel.com> > wrote: > > Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> > > --- > > include/linux/kvm_host.h | 3 +++ > > 1 file c

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 <haozhong.zh...@intel.com> --- 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_

[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 <haozhong.zh...@intel.com> --- arch/x86/include/asm/pat.h | 2 ++ arch/x86/mm/pat.c | 14 ++ 2 files changed, 16 insertions(+)

[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 <haozhong.zh...@intel.com> Reported-by: Cuevas Escareno, Ivan D <ivan.d.cuevas.escar...@intel.com> Reported-by: Kumar, Karthik

[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 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 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-02 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: [PATCH v2 0/2] KVM: MMU: fix kvm_is_mmio_pfn()

2017-11-02 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: > >

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

[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 <haozhong.zh...@intel.com> --- 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/ar

[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 <haozhong.zh...@intel.com> Reported-by: Cuevas Escareno, Ivan D <ivan.d.cuevas.escar...@intel.com> Reported-by: Kumar, Karthik

[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

[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 <haozhong.zh...@intel.com> 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,

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 <haozhong.zh...@intel.com> --- 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_

[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 <haozhong.zh...@intel.com> --- 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

[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
the 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 0/3] KVM: MMU: fix kvm_is_mmio_pfn()

2017-10-26 Thread Haozhong Zhang
the 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 <haozhong.zh...@intel.com> Reported-by: Cuevas Escareno, Ivan D <ivan.d.cuevas.escar...@intel.com> Reported-by: Kumar, Karthik <karthik.ku...@intel.com> --- arch/

[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

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 <andrew.coop...@citrix.com> wrote: On 13/10/16 16:40, Dan Williams

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,

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

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

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

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

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

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, <dan.j.willi...@intel.com> wrote: On Wed, Oct 12, 2016 at 9:01 AM, Jan Beulich <jbeul...@suse.c

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

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

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|

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

  1   2   3   >