All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jerome Glisse <jglisse@redhat.com>
To: Balbir Singh <bsingharora@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	John Hubbard <jhubbard@nvidia.com>,
	David Nellans <dnellans@nvidia.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Balbir Singh <balbirs@au1.ibm.com>,
	Aneesh Kumar <aneesh.kumar@linux.vnet.ibm.com>,
	"Paul E . McKenney" <paulmck@linux.vnet.ibm.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Ross Zwisler <ross.zwisler@linux.intel.com>
Subject: Re: [PATCH 2/5] mm/device-public-memory: device memory cache coherent with CPU v2
Date: Tue, 11 Jul 2017 10:57:44 -0400	[thread overview]
Message-ID: <20170711145744.GA5347@redhat.com> (raw)
In-Reply-To: <20170711141215.4fd1a972@firefly.ozlabs.ibm.com>

On Tue, Jul 11, 2017 at 02:12:15PM +1000, Balbir Singh wrote:
> On Mon,  3 Jul 2017 17:14:12 -0400
> Jerome Glisse <jglisse@redhat.com> wrote:
> 
> > Platform with advance system bus (like CAPI or CCIX) allow device
> > memory to be accessible from CPU in a cache coherent fashion. Add
> > a new type of ZONE_DEVICE to represent such memory. The use case
> > are the same as for the un-addressable device memory but without
> > all the corners cases.
> >
> 
> Looks good overall, some comments inline.
>  

[...]

> >  /*
> > @@ -92,6 +100,8 @@ enum memory_type {
> >   * The page_free() callback is called once the page refcount reaches 1
> >   * (ZONE_DEVICE pages never reach 0 refcount unless there is a refcount bug.
> >   * This allows the device driver to implement its own memory management.)
> > + *
> > + * For MEMORY_DEVICE_CACHE_COHERENT only the page_free() callback matter.
> 
> Correct, but I wonder if we should in the long term allow for minor faults
> (due to coherency) via this interface?

This is something we can explore latter on.

[...]

> > diff --git a/kernel/memremap.c b/kernel/memremap.c
> > index e82456c39a6a..da74775f2247 100644
> > --- a/kernel/memremap.c
> > +++ b/kernel/memremap.c
> > @@ -466,7 +466,7 @@ struct vmem_altmap *to_vmem_altmap(unsigned long memmap_start)
> >  
> >  
> >  #ifdef CONFIG_DEVICE_PRIVATE
> 
> Does the #ifdef above need to go as well?

Good catch i should make that conditional on DEVICE_PUBLIC or whatever
the name endup to be. I will make sure i test without DEVICE_PRIVATE
config before posting again.

[...]

> > @@ -2541,11 +2551,21 @@ static void migrate_vma_insert_page(struct migrate_vma *migrate,
> >  	 */
> >  	__SetPageUptodate(page);
> >  
> > -	if (is_zone_device_page(page) && is_device_private_page(page)) {
> > -		swp_entry_t swp_entry;
> > +	if (is_zone_device_page(page)) {
> > +		if (is_device_private_page(page)) {
> > +			swp_entry_t swp_entry;
> >  
> > -		swp_entry = make_device_private_entry(page, vma->vm_flags & VM_WRITE);
> > -		entry = swp_entry_to_pte(swp_entry);
> > +			swp_entry = make_device_private_entry(page, vma->vm_flags & VM_WRITE);
> > +			entry = swp_entry_to_pte(swp_entry);
> > +		}
> > +#if IS_ENABLED(CONFIG_DEVICE_PUBLIC)
> 
> Do we need this #if check? is_device_public_page(page)
> will return false if the config is disabled

pte_mkdevmap() is not define if ZONE_DEVICE is not enabled hence
i had to protect this with #if/#endif to avoid build error.

> 
> > +		else if (is_device_public_page(page)) {
> > +			entry = pte_mkold(mk_pte(page, READ_ONCE(vma->vm_page_prot)));
> > +			if (vma->vm_flags & VM_WRITE)
> > +				entry = pte_mkwrite(pte_mkdirty(entry));
> > +			entry = pte_mkdevmap(entry);
> > +		}
> > +#endif /* IS_ENABLED(CONFIG_DEVICE_PUBLIC) */

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Jerome Glisse <jglisse@redhat.com>
To: Balbir Singh <bsingharora@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	John Hubbard <jhubbard@nvidia.com>,
	David Nellans <dnellans@nvidia.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Balbir Singh <balbirs@au1.ibm.com>,
	Aneesh Kumar <aneesh.kumar@linux.vnet.ibm.com>,
	"Paul E . McKenney" <paulmck@linux.vnet.ibm.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Ross Zwisler <ross.zwisler@linux.intel.com>
Subject: Re: [PATCH 2/5] mm/device-public-memory: device memory cache coherent with CPU v2
Date: Tue, 11 Jul 2017 10:57:44 -0400	[thread overview]
Message-ID: <20170711145744.GA5347@redhat.com> (raw)
In-Reply-To: <20170711141215.4fd1a972@firefly.ozlabs.ibm.com>

On Tue, Jul 11, 2017 at 02:12:15PM +1000, Balbir Singh wrote:
> On Mon,  3 Jul 2017 17:14:12 -0400
> Jérôme Glisse <jglisse@redhat.com> wrote:
> 
> > Platform with advance system bus (like CAPI or CCIX) allow device
> > memory to be accessible from CPU in a cache coherent fashion. Add
> > a new type of ZONE_DEVICE to represent such memory. The use case
> > are the same as for the un-addressable device memory but without
> > all the corners cases.
> >
> 
> Looks good overall, some comments inline.
>  

[...]

> >  /*
> > @@ -92,6 +100,8 @@ enum memory_type {
> >   * The page_free() callback is called once the page refcount reaches 1
> >   * (ZONE_DEVICE pages never reach 0 refcount unless there is a refcount bug.
> >   * This allows the device driver to implement its own memory management.)
> > + *
> > + * For MEMORY_DEVICE_CACHE_COHERENT only the page_free() callback matter.
> 
> Correct, but I wonder if we should in the long term allow for minor faults
> (due to coherency) via this interface?

This is something we can explore latter on.

[...]

> > diff --git a/kernel/memremap.c b/kernel/memremap.c
> > index e82456c39a6a..da74775f2247 100644
> > --- a/kernel/memremap.c
> > +++ b/kernel/memremap.c
> > @@ -466,7 +466,7 @@ struct vmem_altmap *to_vmem_altmap(unsigned long memmap_start)
> >  
> >  
> >  #ifdef CONFIG_DEVICE_PRIVATE
> 
> Does the #ifdef above need to go as well?

Good catch i should make that conditional on DEVICE_PUBLIC or whatever
the name endup to be. I will make sure i test without DEVICE_PRIVATE
config before posting again.

[...]

> > @@ -2541,11 +2551,21 @@ static void migrate_vma_insert_page(struct migrate_vma *migrate,
> >  	 */
> >  	__SetPageUptodate(page);
> >  
> > -	if (is_zone_device_page(page) && is_device_private_page(page)) {
> > -		swp_entry_t swp_entry;
> > +	if (is_zone_device_page(page)) {
> > +		if (is_device_private_page(page)) {
> > +			swp_entry_t swp_entry;
> >  
> > -		swp_entry = make_device_private_entry(page, vma->vm_flags & VM_WRITE);
> > -		entry = swp_entry_to_pte(swp_entry);
> > +			swp_entry = make_device_private_entry(page, vma->vm_flags & VM_WRITE);
> > +			entry = swp_entry_to_pte(swp_entry);
> > +		}
> > +#if IS_ENABLED(CONFIG_DEVICE_PUBLIC)
> 
> Do we need this #if check? is_device_public_page(page)
> will return false if the config is disabled

pte_mkdevmap() is not define if ZONE_DEVICE is not enabled hence
i had to protect this with #if/#endif to avoid build error.

> 
> > +		else if (is_device_public_page(page)) {
> > +			entry = pte_mkold(mk_pte(page, READ_ONCE(vma->vm_page_prot)));
> > +			if (vma->vm_flags & VM_WRITE)
> > +				entry = pte_mkwrite(pte_mkdirty(entry));
> > +			entry = pte_mkdevmap(entry);
> > +		}
> > +#endif /* IS_ENABLED(CONFIG_DEVICE_PUBLIC) */

  reply	other threads:[~2017-07-11 14:57 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-03 21:14 [PATCH 0/5] Cache coherent device memory (CDM) with HMM v3 Jérôme Glisse
2017-07-03 21:14 ` Jérôme Glisse
2017-07-03 21:14 ` [PATCH 1/5] mm/persistent-memory: match IORES_DESC name and enum memory_type one Jérôme Glisse
2017-07-03 21:14   ` Jérôme Glisse
2017-07-03 23:49   ` Dan Williams
2017-07-03 23:49     ` Dan Williams
2017-07-05 14:25     ` Jerome Glisse
2017-07-05 14:25       ` Jerome Glisse
2017-07-05 16:15       ` Dan Williams
2017-07-05 16:15         ` Dan Williams
2017-07-05 18:49         ` Jerome Glisse
2017-07-05 18:49           ` Jerome Glisse
2017-07-11  3:48           ` Balbir Singh
2017-07-11  3:48             ` Balbir Singh
2017-07-11  7:31           ` Dan Williams
2017-07-11  7:31             ` Dan Williams
2017-07-11 15:05             ` Jerome Glisse
2017-07-11 15:05               ` Jerome Glisse
2017-07-11 16:49               ` Dan Williams
2017-07-11 16:49                 ` Dan Williams
2017-07-03 21:14 ` [PATCH 2/5] mm/device-public-memory: device memory cache coherent with CPU v2 Jérôme Glisse
2017-07-03 21:14   ` Jérôme Glisse
2017-07-11  4:12   ` Balbir Singh
2017-07-11  4:12     ` Balbir Singh
2017-07-11 14:57     ` Jerome Glisse [this message]
2017-07-11 14:57       ` Jerome Glisse
2017-07-12  5:50       ` Balbir Singh
2017-07-12  5:50         ` Balbir Singh
2017-07-03 21:14 ` [PATCH 3/5] mm/hmm: add new helper to hotplug CDM memory region Jérôme Glisse
2017-07-03 21:14   ` Jérôme Glisse
2017-07-03 21:14 ` [PATCH 4/5] mm/memcontrol: allow to uncharge page without using page->lru field Jérôme Glisse
2017-07-03 21:14   ` Jérôme Glisse
2017-07-03 21:14   ` Jérôme Glisse
2017-07-04 12:51   ` Michal Hocko
2017-07-04 12:51     ` Michal Hocko
2017-07-04 12:51     ` Michal Hocko
     [not found]     ` <20170704125113.GC14727-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2017-07-05  3:18       ` Balbir Singh
2017-07-05  3:18         ` Balbir Singh
2017-07-05  3:18         ` Balbir Singh
2017-07-05  6:38         ` Michal Hocko
2017-07-05  6:38           ` Michal Hocko
2017-07-05  6:38           ` Michal Hocko
     [not found]           ` <20170705063813.GB10354-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2017-07-05 10:22             ` Balbir Singh
2017-07-05 10:22               ` Balbir Singh
2017-07-05 10:22               ` Balbir Singh
2017-07-05 14:35     ` Jerome Glisse
2017-07-05 14:35       ` Jerome Glisse
2017-07-10  8:28       ` Michal Hocko
2017-07-10  8:28         ` Michal Hocko
2017-07-10  8:28         ` Michal Hocko
     [not found]         ` <20170710082805.GD19185-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2017-07-10 15:32           ` Jerome Glisse
2017-07-10 15:32             ` Jerome Glisse
2017-07-10 15:32             ` Jerome Glisse
2017-07-10 16:04             ` Michal Hocko
2017-07-10 16:04               ` Michal Hocko
2017-07-10 16:04               ` Michal Hocko
     [not found]               ` <20170710160444.GB7071-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2017-07-10 16:25                 ` Jerome Glisse
2017-07-10 16:25                   ` Jerome Glisse
2017-07-10 16:25                   ` Jerome Glisse
     [not found]                   ` <20170710162542.GB4964-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-07-10 16:36                     ` Michal Hocko
2017-07-10 16:36                       ` Michal Hocko
2017-07-10 16:36                       ` Michal Hocko
2017-07-10 16:54                       ` Jerome Glisse
2017-07-10 16:54                         ` Jerome Glisse
2017-07-10 16:54                         ` Jerome Glisse
2017-07-10 17:48                         ` Michal Hocko
2017-07-10 17:48                           ` Michal Hocko
     [not found]                           ` <20170710174857.GF7071-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2017-07-10 18:10                             ` Jerome Glisse
2017-07-10 18:10                               ` Jerome Glisse
2017-07-10 18:10                               ` Jerome Glisse
2017-07-03 21:14 ` [PATCH 5/5] mm/memcontrol: support MEMORY_DEVICE_PRIVATE and MEMORY_DEVICE_PUBLIC Jérôme Glisse
2017-07-03 21:14   ` Jérôme Glisse
2017-07-03 21:14   ` Jérôme Glisse

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=20170711145744.GA5347@redhat.com \
    --to=jglisse@redhat.com \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=balbirs@au1.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=bsingharora@gmail.com \
    --cc=dan.j.williams@intel.com \
    --cc=dnellans@nvidia.com \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=ross.zwisler@linux.intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.