public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander Duyck <alexander.h.duyck-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: "Jérôme Glisse" <jglisse-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	"Barret Rhoden" <brho-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	"Zhang,
	Yu C" <yu.c.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	"KVM list" <kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-nvdimm
	<linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org>,
	"Jan Kara" <jack-AlSwsSmVLrQ@public.gmane.org>,
	"David Hildenbrand"
	<david-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	"Linux Kernel Mailing List"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"Linux MM" <linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org>,
	rkrcmar-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	"Paolo Bonzini"
	<pbonzini-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	"Christoph Hellwig" <hch-jcswGhMUV9g@public.gmane.org>
Subject: Re: [PATCH RFC 2/3] mm: Add support for exposing if dev_pagemap supports refcount pinning
Date: Mon, 03 Dec 2018 12:21:42 -0800	[thread overview]
Message-ID: <97943d2ed62e6887f4ba51b985ef4fb5478bc586.camel@linux.intel.com> (raw)
In-Reply-To: <CAPcyv4gZkx9zRsKkVhrmPG7SyjPEycp0neFnECmSADZNLuDOpQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Mon, 2018-12-03 at 11:47 -0800, Dan Williams wrote:
> On Mon, Dec 3, 2018 at 11:25 AM Alexander Duyck
> <alexander.h.duyck-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> wrote:
> > 
> > Add a means of exposing if a pagemap supports refcount pinning. I am doing
> > this to expose if a given pagemap has backing struct pages that will allow
> > for the reference count of the page to be incremented to lock the page
> > into place.
> > 
> > The KVM code already has several spots where it was trying to use a
> > pfn_valid check combined with a PageReserved check to determien if it could
> > take a reference on the page. I am adding this check so in the case of the
> > page having the reserved flag checked we can check the pagemap for the page
> > to determine if we might fall into the special DAX case.
> > 
> > Signed-off-by: Alexander Duyck <alexander.h.duyck-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> > ---
> >  drivers/nvdimm/pfn_devs.c |    2 ++
> >  include/linux/memremap.h  |    5 ++++-
> >  include/linux/mm.h        |   11 +++++++++++
> >  3 files changed, 17 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c
> > index 6f22272e8d80..7a4a85bcf7f4 100644
> > --- a/drivers/nvdimm/pfn_devs.c
> > +++ b/drivers/nvdimm/pfn_devs.c
> > @@ -640,6 +640,8 @@ static int __nvdimm_setup_pfn(struct nd_pfn *nd_pfn, struct dev_pagemap *pgmap)
> >         } else
> >                 return -ENXIO;
> > 
> > +       pgmap->support_refcount_pinning = true;
> > +
> 
> There should be no dev_pagemap instance instance where this isn't
> true, so I'm missing why this is needed?

I thought in the case of HMM there were instances where you couldn't
pin the page, isn't there? Specifically I am thinking of the definition
of MEMORY_DEVICE_PUBLIC:
  Device memory that is cache coherent from device and CPU point of 
  view. This is use on platform that have an advance system bus (like 
  CAPI or CCIX). A driver can hotplug the device memory using 
  ZONE_DEVICE and with that memory type. Any page of a process can be 
  migrated to such memory. However no one should be allow to pin such 
  memory so that it can always be evicted.

It sounds like MEMORY_DEVICE_PUBLIC and MMIO would want to fall into
the same category here in order to allow a hot-plug event to remove the
device and take the memory with it, or is my understanding on this not
correct?

Thanks.

- Alex

  parent reply	other threads:[~2018-12-03 20:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-03 19:25 [PATCH RFC 0/3] Fix KVM misinterpreting Reserved page as an MMIO page Alexander Duyck
     [not found] ` <154386493754.27193.1300965403157243427.stgit-+uVpp3jiz/SWyQ3uPIV3rPooFf0ArEBIu+b9c/7xato@public.gmane.org>
2018-12-03 19:25   ` [PATCH RFC 1/3] kvm: Split use cases for kvm_is_reserved_pfn to kvm_is_refcounted_pfn Alexander Duyck
2018-12-03 19:25   ` [PATCH RFC 3/3] kvm: Add additional check to determine if a page is refcounted Alexander Duyck
2018-12-03 19:25 ` [PATCH RFC 2/3] mm: Add support for exposing if dev_pagemap supports refcount pinning Alexander Duyck
2018-12-03 19:47   ` Dan Williams
     [not found]     ` <CAPcyv4gZkx9zRsKkVhrmPG7SyjPEycp0neFnECmSADZNLuDOpQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-12-03 20:21       ` Alexander Duyck [this message]
     [not found]         ` <97943d2ed62e6887f4ba51b985ef4fb5478bc586.camel-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-12-03 20:31           ` Dan Williams
     [not found]             ` <CAPcyv4i=FL4f34H2_1mgWMk=UyyaXFaKPh5zJSnFNyN3cBoJhA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-12-03 20:53               ` Alexander Duyck
2018-12-03 21:05                 ` Dan Williams
2018-12-03 21:50                   ` Alexander Duyck
     [not found]                     ` <30ab5fa569a6ede936d48c18e666bc6f718d50db.camel-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-12-04 19:08                       ` Dan Williams
     [not found]                         ` <CAPcyv4izGr4dLs_Xpa1wbqJRrHZVEKFWQNb2Qo2Ej_xbEXhbTg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-12-04 22:51                           ` Alexander Duyck
     [not found]                             ` <dd7296db5996f15cc3e666d008f209f5f24fa98e.camel-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-12-04 23:24                               ` Barret Rhoden
2018-12-05  0:01                                 ` Alexander Duyck
2018-12-05  0:26                                   ` Dan Williams
2018-12-05  8:13                                     ` David Hildenbrand
2018-12-04  6:59 ` [PATCH RFC 0/3] Fix KVM misinterpreting Reserved page as an MMIO page Yi Zhang
2018-12-04 18:45   ` Alexander Duyck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=97943d2ed62e6887f4ba51b985ef4fb5478bc586.camel@linux.intel.com \
    --to=alexander.h.duyck-vuqaysv1563yd54fqh9/ca@public.gmane.org \
    --cc=brho-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=david-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=hch-jcswGhMUV9g@public.gmane.org \
    --cc=jack-AlSwsSmVLrQ@public.gmane.org \
    --cc=jglisse-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
    --cc=linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org \
    --cc=pbonzini-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=rkrcmar-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=yu.c.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox