[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201009005823.GA11151@linux.intel.com>
Date: Thu, 8 Oct 2020 17:58:23 -0700
From: Sean Christopherson <sean.j.christopherson@...el.com>
To: yulei.kernel@...il.com
Cc: akpm@...ux-foundation.org, naoya.horiguchi@....com,
viro@...iv.linux.org.uk, pbonzini@...hat.com,
linux-fsdevel@...r.kernel.org, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, xiaoguangrong.eric@...il.com,
kernellwp@...il.com, lihaiwei.kernel@...il.com,
Yulei Zhang <yuleixzhang@...cent.com>,
Chen Zhuo <sagazchen@...cent.com>
Subject: Re: [PATCH 22/35] kvm, x86: Distinguish dmemfs page from mmio page
On Thu, Oct 08, 2020 at 03:54:12PM +0800, yulei.kernel@...il.com wrote:
> From: Yulei Zhang <yuleixzhang@...cent.com>
>
> Dmem page is pfn invalid but not mmio. Support cacheable
> dmem page for kvm.
>
> Signed-off-by: Chen Zhuo <sagazchen@...cent.com>
> Signed-off-by: Yulei Zhang <yuleixzhang@...cent.com>
> ---
> arch/x86/kvm/mmu/mmu.c | 5 +++--
> include/linux/dmem.h | 7 +++++++
> mm/dmem.c | 7 +++++++
> 3 files changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index 71aa3da2a0b7..0115c1767063 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -41,6 +41,7 @@
> #include <linux/hash.h>
> #include <linux/kern_levels.h>
> #include <linux/kthread.h>
> +#include <linux/dmem.h>
>
> #include <asm/page.h>
> #include <asm/memtype.h>
> @@ -2962,9 +2963,9 @@ static bool kvm_is_mmio_pfn(kvm_pfn_t pfn)
> */
> (!pat_enabled() || pat_pfn_immune_to_uc_mtrr(pfn));
>
> - return !e820__mapped_raw_any(pfn_to_hpa(pfn),
> + return (!e820__mapped_raw_any(pfn_to_hpa(pfn),
> pfn_to_hpa(pfn + 1) - 1,
> - E820_TYPE_RAM);
> + E820_TYPE_RAM)) || (!is_dmem_pfn(pfn));
This is wrong. As is, the logic reads "A PFN is MMIO if it is INVALID &&
(!RAM || !DMEM)". The obvious fix would be to change it to "INVALID &&
!RAM && !DMEM", but that begs the question of whether or DMEM is reported
as RAM. I don't see any e820 related changes in the series, i.e. no evidence
that dmem yanks its memory out of the e820 tables, which makes me think this
change is unnecessary.
> }
>
> /* Bits which may be returned by set_spte() */
Powered by blists - more mailing lists