Re: [Nouveau] [PATCH 2/7] mm: Free device private pages have zero refcount

2022-09-29 Thread Dan Williams
Alistair Popple wrote: > > Dan Williams writes: > > > Alistair Popple wrote: > >> > >> Jason Gunthorpe writes: > >> > >> > On Mon, Sep 26, 2022 at 04:03:06PM +1000, Alistair Popple wrote: > >> >> Since 27674ef6c73f (&q

Re: [Nouveau] [PATCH 2/7] mm: Free device private pages have zero refcount

2022-09-29 Thread Dan Williams
Alistair Popple wrote: > > Jason Gunthorpe writes: > > > On Mon, Sep 26, 2022 at 04:03:06PM +1000, Alistair Popple wrote: > >> Since 27674ef6c73f ("mm: remove the extra ZONE_DEVICE struct page > >> refcount") device private pages have no longer had an extra reference > >> count when the page is

Re: [Nouveau] [PATCH v2 16/28] resource: Introduce alloc_free_mem_region()

2022-07-21 Thread Dan Williams
[ add dri-devel and nouveau ] Dan Williams wrote: > The core of devm_request_free_mem_region() is a helper that searches for > free space in iomem_resource and performs __request_region_locked() on > the result of that search. The policy choices of the implementation > con

Re: [Nouveau] [PATCH 7/8] mm: remove the extra ZONE_DEVICE struct page refcount

2022-02-08 Thread Dan Williams
ge cache. This looks ok to me, and passes my tests. So given I'm still working my way back to fixing the references properly I'm ok for this hack to replace the more broken hack that is there presently. Reviewed-by: Dan Williams

Re: [Nouveau] [PATCH 6/8] mm: don't include in

2022-02-08 Thread Dan Williams
On Mon, Feb 7, 2022 at 3:49 PM Dan Williams wrote: > > On Sun, Feb 6, 2022 at 10:33 PM Christoph Hellwig wrote: > > > > Move the check for the actual pgmap types that need the free at refcount > > one behavior into the out of line helper, and thus avoid the need to >

Re: [Nouveau] [PATCH 6/8] mm: don't include in

2022-02-07 Thread Dan Williams
e. Reviewed-by: Dan Williams > > Signed-off-by: Christoph Hellwig > --- > arch/arm64/mm/mmu.c| 1 + > drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 1 + > drivers/gpu/drm/drm_cache.c| 2 +- > drivers/gpu/drm/nouveau/nouveau_dmem.c | 1 + > d

Re: [Nouveau] [PATCH 5/8] mm: simplify freeing of devmap managed pages

2022-02-07 Thread Dan Williams
On Sun, Feb 6, 2022 at 10:33 PM Christoph Hellwig wrote: > > Make put_devmap_managed_page return if it took charge of the page > or not and remove the separate page_is_devmap_managed helper. Looks good to me: Reviewed-by: Dan Williams

Re: [Nouveau] [PATCH 4/8] mm: move free_devmap_managed_page to memremap.c

2022-02-07 Thread Dan Williams
On Sun, Feb 6, 2022 at 10:33 PM Christoph Hellwig wrote: > > free_devmap_managed_page has nothing to do with the code in swap.c, > move it to live with the rest of the code for devmap handling. > Looks good. Reviewed-by: Dan Williams

Re: [Nouveau] [PATCH 2/8] mm: remove the __KERNEL__ guard from

2022-02-07 Thread Dan Williams
On Sun, Feb 6, 2022 at 10:33 PM Christoph Hellwig wrote: > > __KERNEL__ ifdefs don't make sense outside of include/uapi/. Yes. Reviewed-by: Dan Williams

Re: [Nouveau] [PATCH 1/8] mm: remove a pointless CONFIG_ZONE_DEVICE check in memremap_pages

2022-02-07 Thread Dan Williams
On Sun, Feb 6, 2022 at 10:33 PM Christoph Hellwig wrote: > > memremap.c is only built when CONFIG_ZONE_DEVICE is set, so remove > the superflous extra check. Looks good to me. Reviewed-by: Dan Williams

Re: [Nouveau] [RFC] treewide: cleanup unreachable breaks

2020-10-17 Thread Dan Williams
/claim.c > +++ b/drivers/nvdimm/claim.c > @@ -200,11 +200,10 @@ ssize_t nd_namespace_store(struct device *dev, > } > break; > default: > len = -EBUSY; > goto out_attach; > - break; > } Acked-by: Dan Williams ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau

Re: [Nouveau] [PATCH v2] mm/hmm: make device private reference counts zero based

2020-10-12 Thread Dan Williams
On Mon, Oct 12, 2020 at 10:46 AM Ralph Campbell wrote: > > ZONE_DEVICE struct pages have an extra reference count that complicates the > code for put_page() and several places in the kernel that need to check the > reference count to see that a page is not being used (gup, compaction, >

Re: [Nouveau] [RFC PATCH v3 0/2] mm: remove extra ZONE_DEVICE struct page refcount

2020-10-05 Thread Dan Williams
On Thu, Oct 1, 2020 at 11:17 AM Ralph Campbell wrote: > > This is still an RFC because after looking at the pmem/dax code some > more, I realized that the ZONE_DEVICE struct pages are being inserted > into the process' page tables with vmf_insert_mixed() and a zero > refcount on the ZONE_DEVICE

Re: [Nouveau] [PATCH 1/2] ext4/xfs: add page refcount helper

2020-09-25 Thread Dan Williams
On Fri, Sep 25, 2020 at 1:45 PM Ralph Campbell wrote: > > There are several places where ZONE_DEVICE struct pages assume a reference > count == 1 means the page is idle and free. Instead of open coding this, > add a helper function to hide this detail. > > Signed-off-by: Ralph Campbell > --- >

Re: [Nouveau] [PATCH] mm: remove extra ZONE_DEVICE struct page refcount

2020-09-17 Thread Dan Williams
uses normal pages to fake this up, so > > I was wrong about the third caller. But I think we can just call > > set_page_count just before freeing the page there with a comment > > explaining what is goin on. > > Dan Williams thought that having the ZONE_DEVICE struct pages >

Re: [Nouveau] [PATCH] mm: remove extra ZONE_DEVICE struct page refcount

2020-09-14 Thread Dan Williams
On Mon, Sep 14, 2020 at 3:45 PM Ralph Campbell wrote: > > ZONE_DEVICE struct pages have an extra reference count that complicates the > code for put_page() and several places in the kernel that need to check the > reference count to see that a page is not being used (gup, compaction, > migration,

Re: [PATCH 04/15] mm: remove the pgmap field from struct hmm_vma_walk

2019-08-16 Thread Dan Williams
On Fri, Aug 16, 2019 at 5:24 AM Jason Gunthorpe wrote: > > On Thu, Aug 15, 2019 at 08:54:46PM -0700, Dan Williams wrote: > > > > However, this means we cannot do any processing of ZONE_DEVICE pages > > > outside the driver lock, so eg, doing

Re: [PATCH 04/15] mm: remove the pgmap field from struct hmm_vma_walk

2019-08-15 Thread Dan Williams
On Thu, Aug 15, 2019 at 5:41 PM Jason Gunthorpe wrote: > > On Thu, Aug 15, 2019 at 01:47:12PM -0700, Dan Williams wrote: > > On Thu, Aug 15, 2019 at 1:41 PM Jason Gunthorpe wrote: > > > > > > On Thu, Aug 15, 2019 at 04:33:06PM -0400, Jerome Glisse wrote: >

Re: [Nouveau] [PATCH 04/15] mm: remove the pgmap field from struct hmm_vma_walk

2019-08-15 Thread Dan Williams
On Thu, Aug 15, 2019 at 1:41 PM Jason Gunthorpe wrote: > > On Thu, Aug 15, 2019 at 04:33:06PM -0400, Jerome Glisse wrote: > > > So nor HMM nor driver should dereference the struct page (i do not > > think any iommu driver would either), > > Er, they do technically deref the struct page: > >

Re: [Nouveau] [PATCH 04/15] mm: remove the pgmap field from struct hmm_vma_walk

2019-08-15 Thread Dan Williams
On Thu, Aug 15, 2019 at 12:44 PM Jerome Glisse wrote: > > On Thu, Aug 15, 2019 at 12:36:58PM -0700, Dan Williams wrote: > > On Thu, Aug 15, 2019 at 11:07 AM Jerome Glisse wrote: > > > > > > On Wed, Aug 14, 2019 at 07:48:28AM -0700, Dan Williams wrote: > >

Re: [Nouveau] [PATCH 04/15] mm: remove the pgmap field from struct hmm_vma_walk

2019-08-15 Thread Dan Williams
On Thu, Aug 15, 2019 at 11:07 AM Jerome Glisse wrote: > > On Wed, Aug 14, 2019 at 07:48:28AM -0700, Dan Williams wrote: > > On Wed, Aug 14, 2019 at 6:28 AM Jason Gunthorpe wrote: > > > > > > On Wed, Aug 14, 2019 at 09:38:54AM +0200, Christoph Hellwig wrote: > &g

Re: [Nouveau] [PATCH 04/15] mm: remove the pgmap field from struct hmm_vma_walk

2019-08-14 Thread Dan Williams
On Wed, Aug 14, 2019 at 6:28 AM Jason Gunthorpe wrote: > > On Wed, Aug 14, 2019 at 09:38:54AM +0200, Christoph Hellwig wrote: > > On Tue, Aug 13, 2019 at 06:36:33PM -0700, Dan Williams wrote: > > > Section alignment constraints somewhat save us here. The only example >

Re: [Nouveau] [PATCH 04/15] mm: remove the pgmap field from struct hmm_vma_walk

2019-08-07 Thread Dan Williams
On Wed, Aug 7, 2019 at 10:45 AM Jason Gunthorpe wrote: > > On Tue, Aug 06, 2019 at 07:05:42PM +0300, Christoph Hellwig wrote: > > There is only a single place where the pgmap is passed over a function > > call, so replace it with local variables in the places where we deal > > with the pgmap. > >

Re: [Nouveau] dev_pagemap related cleanups v4

2019-07-02 Thread Dan Williams
On Tue, Jul 2, 2019 at 11:42 AM Jason Gunthorpe wrote: > > On Mon, Jul 01, 2019 at 10:25:17AM +0200, Christoph Hellwig wrote: > > And I've demonstrated that I can't send patch series.. While this > > has all the right patches, it also has the extra patches already > > in the hmm tree, and four

Re: [Nouveau] [PATCH 16/25] device-dax: use the dev_pagemap internal refcount

2019-06-28 Thread Dan Williams
On Fri, Jun 28, 2019 at 12:02 PM Christoph Hellwig wrote: > > On Fri, Jun 28, 2019 at 11:59:19AM -0700, Dan Williams wrote: > > It's a bug that the call to put_devmap_managed_page() was gated by > > MEMORY_DEVICE_PUBLIC in release_pages(). That path is also applicable > >

Re: [PATCH 16/25] device-dax: use the dev_pagemap internal refcount

2019-06-28 Thread Dan Williams
On Fri, Jun 28, 2019 at 11:52 AM Christoph Hellwig wrote: > > On Fri, Jun 28, 2019 at 11:44:35AM -0700, Dan Williams wrote: > > There is a problem with the series in CH's tree. It removes the > > ->page_free() callback from the release_pages() path because it goes &g

Re: [PATCH 16/25] device-dax: use the dev_pagemap internal refcount

2019-06-28 Thread Dan Williams
On Fri, Jun 28, 2019 at 11:29 AM Jason Gunthorpe wrote: > > On Fri, Jun 28, 2019 at 10:10:12AM -0700, Dan Williams wrote: > > On Fri, Jun 28, 2019 at 10:08 AM Dan Williams > > wrote: > > > > > > On Fri, Jun 28, 2019 at 10:02 AM Jason Gunthorpe > > >

Re: [PATCH 16/25] device-dax: use the dev_pagemap internal refcount

2019-06-28 Thread Dan Williams
On Fri, Jun 28, 2019 at 10:08 AM Dan Williams wrote: > > On Fri, Jun 28, 2019 at 10:02 AM Jason Gunthorpe wrote: > > > > On Fri, Jun 28, 2019 at 09:27:44AM -0700, Dan Williams wrote: > > > On Fri, Jun 28, 2019 at 8:39 AM Jason Gunthorpe wrote: > > > > >

Re: [PATCH 16/25] device-dax: use the dev_pagemap internal refcount

2019-06-28 Thread Dan Williams
On Fri, Jun 28, 2019 at 10:02 AM Jason Gunthorpe wrote: > > On Fri, Jun 28, 2019 at 09:27:44AM -0700, Dan Williams wrote: > > On Fri, Jun 28, 2019 at 8:39 AM Jason Gunthorpe wrote: > > > > > > On Wed, Jun 26, 2019 at 02:27:15PM +0200, Christoph Hellwig wr

Re: [Nouveau] [PATCH 16/25] device-dax: use the dev_pagemap internal refcount

2019-06-28 Thread Dan Williams
On Fri, Jun 28, 2019 at 8:39 AM Jason Gunthorpe wrote: > > On Wed, Jun 26, 2019 at 02:27:15PM +0200, Christoph Hellwig wrote: > > The functionality is identical to the one currently open coded in > > device-dax. > > > > Signed-off-by: Christoph Hellwig > > Reviewed-by: Ira Weiny > > --- > >

Re: [Nouveau] [PATCH 05/22] mm: export alloc_pages_vma

2019-06-26 Thread Dan Williams
On Tue, Jun 25, 2019 at 10:46 PM Michal Hocko wrote: > > On Tue 25-06-19 12:52:18, Dan Williams wrote: > [...] > > > Documentation/process/stable-api-nonsense.rst > > > > That document has failed to preclude symbol export fights in the past > > and t

Re: [Nouveau] [PATCH 04/25] mm: remove MEMORY_DEVICE_PUBLIC support

2019-06-26 Thread Dan Williams
[ add Ira ] On Wed, Jun 26, 2019 at 5:27 AM Christoph Hellwig wrote: > > The code hasn't been used since it was added to the tree, and doesn't > appear to actually be usable. > > Signed-off-by: Christoph Hellwig > Reviewed-by: Jason Gunthorpe > Acked-by: Michal Hocko [..] > diff --git

Re: [Nouveau] [PATCH 05/22] mm: export alloc_pages_vma

2019-06-25 Thread Dan Williams
On Tue, Jun 25, 2019 at 12:01 PM Michal Hocko wrote: > > On Tue 25-06-19 11:03:53, Dan Williams wrote: > > On Tue, Jun 25, 2019 at 8:01 AM Michal Hocko wrote: > > > > > > On Tue 25-06-19 09:23:17, Christoph Hellwig wrote: > > > > On Mon, Jun 24, 20

Re: [Nouveau] [PATCH 05/22] mm: export alloc_pages_vma

2019-06-25 Thread Dan Williams
On Tue, Jun 25, 2019 at 8:01 AM Michal Hocko wrote: > > On Tue 25-06-19 09:23:17, Christoph Hellwig wrote: > > On Mon, Jun 24, 2019 at 11:24:48AM -0700, Dan Williams wrote: > > > I asked for this simply because it was not exported historically. In > > > general I wan

Re: [PATCH 05/22] mm: export alloc_pages_vma

2019-06-24 Thread Dan Williams
On Thu, Jun 20, 2019 at 12:17 PM Michal Hocko wrote: > > On Thu 13-06-19 11:43:08, Christoph Hellwig wrote: > > noveau is currently using this through an odd hmm wrapper, and I plan > > to switch it to the real thing later in this series. > > > > Signed-off-by: Christoph Hellwig > > --- > >

Re: [Nouveau] [PATCH 18/22] mm: mark DEVICE_PUBLIC as broken

2019-06-19 Thread Dan Williams
On Wed, Jun 19, 2019 at 12:42 PM Jason Gunthorpe wrote: > > On Thu, Jun 13, 2019 at 06:23:04PM -0700, John Hubbard wrote: > > On 6/13/19 5:43 PM, Ira Weiny wrote: > > > On Thu, Jun 13, 2019 at 07:58:29PM +, Jason Gunthorpe wrote: > > >> On Thu, Jun 13, 2019 at 12:53:02PM -0700, Ralph Campbell

Re: [Nouveau] dev_pagemap related cleanups v2

2019-06-19 Thread Dan Williams
On Wed, Jun 19, 2019 at 9:37 AM Jason Gunthorpe wrote: > > On Wed, Jun 19, 2019 at 11:40:32AM +0200, Christoph Hellwig wrote: > > On Tue, Jun 18, 2019 at 12:47:10PM -0700, Dan Williams wrote: > > > > Git tree: > > > > > > > > git://git.infra

Re: [Nouveau] dev_pagemap related cleanups v2

2019-06-18 Thread Dan Williams
tidbits from the reviews Attached is my incremental fixups on top of this series, with those integrated you can add: Tested-by: Dan Williams ...to the patches that touch kernel/memremap.c, drivers/dax, and drivers/nvdimm. You can also add: Reviewed-by: Dan Williams ...for the series. diff --git a/dr

Re: [Nouveau] [PATCH 15/25] device-dax: use the dev_pagemap internal refcount

2019-06-18 Thread Dan Williams
s/dax/device.c | 43 --- > 2 files changed, 47 deletions(-) This needs the mock devm_memremap_pages() to setup the common percpu_ref. Incremental patch attached: From 875e71489c8485448a5b7df2d8a8b2ed77d2b555 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 18 Jun 2019 11:58:24 -0700 Sub

Re: [Nouveau] [PATCH 08/25] memremap: move dev_pagemap callbacks into a separate structure

2019-06-17 Thread Dan Williams
On Mon, Jun 17, 2019 at 12:59 PM Christoph Hellwig wrote: > > On Mon, Jun 17, 2019 at 10:51:35AM -0700, Dan Williams wrote: > > > - struct dev_pagemap *pgmap = _pgmap; > > > > Whoops, needed to keep this line to avoid: > > > > tools/testing/nv

Re: [Nouveau] [PATCH 07/25] memremap: validate the pagemap type passed to devm_memremap_pages

2019-06-17 Thread Dan Williams
On Mon, Jun 17, 2019 at 12:59 PM Christoph Hellwig wrote: > > On Mon, Jun 17, 2019 at 12:02:09PM -0700, Dan Williams wrote: > > Need a lead in patch that introduces MEMORY_DEVICE_DEVDAX, otherwise: > > Or maybe a MEMORY_DEVICE_DEFAULT = 0 shared by fsdax and p2pdma

Re: [Nouveau] [PATCH 10/25] memremap: lift the devmap_enable manipulation into devm_memremap_pages

2019-06-17 Thread Dan Williams
On Mon, Jun 17, 2019 at 5:28 AM Christoph Hellwig wrote: > > Just check if there is a ->page_free operation set and take care of the > static key enable, as well as the put using device managed resources. > Also check that a ->page_free is provided for the pgmaps types that > require it, and

Re: [Nouveau] [PATCH 07/25] memremap: validate the pagemap type passed to devm_memremap_pages

2019-06-17 Thread Dan Williams
On Mon, Jun 17, 2019 at 5:27 AM Christoph Hellwig wrote: > > Most pgmap types are only supported when certain config options are > enabled. Check for a type that is valid for the current configuration > before setting up the pagemap. > > Signed-off-by: Christoph Hellwig > --- >

Re: [PATCH 08/25] memremap: move dev_pagemap callbacks into a separate structure

2019-06-17 Thread Dan Williams
On Mon, Jun 17, 2019 at 5:27 AM Christoph Hellwig wrote: > > The dev_pagemap is a growing too many callbacks. Move them into a > separate ops structure so that they are not duplicated for multiple > instances, and an attacker can't easily overwrite them. > > Signed-off-by: Christoph Hellwig >

Re: [PATCH 06/25] mm: factor out a devm_request_free_mem_region helper

2019-06-17 Thread Dan Williams
On Mon, Jun 17, 2019 at 5:27 AM Christoph Hellwig wrote: > > Keep the physical address allocation that hmm_add_device does with the > rest of the resource code, and allow future reuse of it without the hmm > wrapper. > > Signed-off-by: Christoph Hellwig > Reviewed-by: Jason Gunthorpe >

Re: [Nouveau] dev_pagemap related cleanups

2019-06-15 Thread Dan Williams
On Sat, Jun 15, 2019 at 1:34 AM Christoph Hellwig wrote: > > On Fri, Jun 14, 2019 at 06:14:45PM -0700, Dan Williams wrote: > > On Thu, Jun 13, 2019 at 11:14 PM Christoph Hellwig wrote: > > > > > > On Thu, Jun 13, 2019 at 11:27:39AM -0700, Dan Williams wrote: > &

Re: [Nouveau] dev_pagemap related cleanups

2019-06-14 Thread Dan Williams
On Thu, Jun 13, 2019 at 11:14 PM Christoph Hellwig wrote: > > On Thu, Jun 13, 2019 at 11:27:39AM -0700, Dan Williams wrote: > > It also turns out the nvdimm unit tests crash with this signature on > > that branch where base v5.2-rc3 passes: > > How do you run that test

Re: dev_pagemap related cleanups

2019-06-13 Thread Dan Williams
On Thu, Jun 13, 2019 at 1:18 PM Logan Gunthorpe wrote: > > > > On 2019-06-13 12:27 p.m., Dan Williams wrote: > > On Thu, Jun 13, 2019 at 2:43 AM Christoph Hellwig wrote: > >> > >> Hi Dan, Jérôme and Jason, > >> > >> below i

Re: [Nouveau] [PATCH 08/22] memremap: pass a struct dev_pagemap to ->kill

2019-06-13 Thread Dan Williams
n he introduced the > callback[1]. > > Reviewed-by: Logan Gunthorpe Reviewed-by: Dan Williams Reported-by: Logan Gunthorpe :) > > Logan > > [1] > https://lore.kernel.org/lkml/8f0cae82-130f-8a64-cfbd-fda5fd76b...@deltatee.com/T/#u > ___

Re: [PATCH 09/22] memremap: lift the devmap_enable manipulation into devm_memremap_pages

2019-06-13 Thread Dan Williams
On Thu, Jun 13, 2019 at 12:35 PM Jason Gunthorpe wrote: > > On Thu, Jun 13, 2019 at 11:43:12AM +0200, Christoph Hellwig wrote: > > Just check if there is a ->page_free operation set and take care of the > > static key enable, as well as the put using device managed resources. > > diff --git

Re: [Nouveau] dev_pagemap related cleanups

2019-06-13 Thread Dan Williams
On Thu, Jun 13, 2019 at 2:43 AM Christoph Hellwig wrote: > > Hi Dan, Jérôme and Jason, > > below is a series that cleans up the dev_pagemap interface so that > it is more easily usable, which removes the need to wrap it in hmm > and thus allowing to kill a lot of code > > Diffstat: > > 22 files

Re: [Nouveau] [PATCH v1] ACPI: Switch to use generic UUID API

2017-05-06 Thread Dan Williams
esterb...@linux.intel.com> > Cc: Borislav Petkov <b...@suse.de> > Cc: Dan Williams <dan.j.willi...@intel.com> > Cc: Amir Goldstein <amir7...@gmail.com> > Cc: Jarkko Sakkinen <jarkko.sakki...@linux.intel.com> > Cc: Jani Nikula <jani.nik...@linux.intel.co