Re: [PATCH v4 04/34] pgtable: Create struct ptdesc

2023-06-20 Thread Jason Gunthorpe
On Tue, Jun 20, 2023 at 01:01:39PM -0700, Vishal Moola wrote: > On Fri, Jun 16, 2023 at 5:38 AM Jason Gunthorpe wrote: > > > > On Mon, Jun 12, 2023 at 02:03:53PM -0700, Vishal Moola (Oracle) wrote: > > > Currently, page table information is stored within struct page. As p

Re: [PATCH v4 04/34] pgtable: Create struct ptdesc

2023-06-16 Thread Jason Gunthorpe
On Mon, Jun 12, 2023 at 02:03:53PM -0700, Vishal Moola (Oracle) wrote: > Currently, page table information is stored within struct page. As part > of simplifying struct page, create struct ptdesc for page table > information. > > Signed-off-by: Vishal Moola (Oracle) > --- >

Re: [PATCH v2 00/34] Split ptdesc from struct page

2023-05-18 Thread Jason Gunthorpe
On Mon, May 01, 2023 at 12:27:55PM -0700, Vishal Moola (Oracle) wrote: > The MM subsystem is trying to shrink struct page. This patchset > introduces a memory descriptor for page table tracking - struct ptdesc. > > This patchset introduces ptdesc, splits ptdesc from struct page, and > converts

Re: [PATCH v2] PCI/MSI: Correct use of can_mask in msi_add_msi_desc()

2022-08-26 Thread Jason Gunthorpe
On Fri, Aug 05, 2022 at 10:53:36AM -0500, Bjorn Helgaas wrote: > On Fri, Aug 05, 2022 at 09:10:41AM -0300, Jason Gunthorpe wrote: > > On Fri, Aug 05, 2022 at 12:03:15PM +0200, Josef Johansson wrote: > > > On 2/14/22 11:07, Josef Johansson wrote: > > > > From: Josef J

Re: [PATCH v2] PCI/MSI: Correct use of can_mask in msi_add_msi_desc()

2022-08-05 Thread Jason Gunthorpe
amp;& > >!desc.pci.msi_attrib.is_virtual; > > - if (!desc.pci.msi_attrib.can_mask) { > > + if (desc.pci.msi_attrib.can_mask) { > > addr = pci_msix_desc_addr(); > > desc.pci.msix_ctrl = readl(addr + > > PCI_MSIX_ENTRY_VECTOR_CTRL); > > } > > Reviewed-by: Jason Gunthorpe Bjorn, please take it? Jason

Re: blocking vs. non-blocking mmu notifiers

2022-03-23 Thread Jason Gunthorpe
On Wed, Mar 23, 2022 at 05:49:43PM +0100, Michal Hocko wrote: > > The bug here is that prior to commit a81461b0546c ("xen/gntdev: update > > to new mmu_notifier semantic") wired the mn_invl_range_start() which > > takes a mutex to invalidate_page, which is defined to run in an atomic > > context.

Re: blocking vs. non-blocking mmu notifiers

2022-03-23 Thread Jason Gunthorpe
On Wed, Mar 23, 2022 at 10:45:30AM +0100, Michal Hocko wrote: > [Let me add more people to the CC list - I am not really sure who is the > most familiar with all the tricks that mmu notifiers might do] > > On Wed 23-03-22 09:43:59, Juergen Gross wrote: > > Hi, > > > > during analysis of a

Re: [PATCH] PCI/MSI: msix_setup_msi_descs: Restore logic for msi_attrib.can_mask

2022-02-10 Thread Jason Gunthorpe
On Thu, Feb 10, 2022 at 05:55:32PM -0600, Bjorn Helgaas wrote: > > Commit 71020a3c0dff4 ("PCI/MSI: Use msi_add_msi_desc()") modifies > > the logic of checking msi_attrib.can_mask, without any reason. > > > > This commits restores that logic. > > I agree, this looks like a typo in

Re: [patch V3 27/35] PCI/MSI: Use __msi_get_virq() in pci_get_vector()

2021-12-13 Thread Jason Gunthorpe
; --- > V2: Handle the INTx case directly instead of trying to be overly smart - Marc > --- > drivers/pci/msi/msi.c | 25 + > 1 file changed, 5 insertions(+), 20 deletions(-) Reviewed-by: Jason Gunthorpe Jason

Re: [patch V3 26/35] genirq/msi: Provide interface to retrieve Linux interrupt number

2021-12-13 Thread Jason Gunthorpe
> 2 files changed, 38 insertions(+) Reviewed-by: Jason Gunthorpe Jason

Re: [patch V3 25/35] powerpc/pseries/msi: Let core code check for contiguous entries

2021-12-13 Thread Jason Gunthorpe
c: "Cédric Le Goater" > Cc: linuxppc-...@lists.ozlabs.org > > --- > V2: Remove it completely - Cedric > --- > arch/powerpc/platforms/pseries/msi.c | 33 - > 1 file changed, 8 insertions(+), 25 deletions(-) Reviewed-by: Jason Gunthorpe Jason

Re: [patch V3 06/35] powerpc/pseries/msi: Use PCI device properties

2021-12-13 Thread Jason Gunthorpe
_enabled - Jason > --- > arch/powerpc/platforms/pseries/msi.c |3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) Reviewed-by: Jason Gunthorpe > --- a/arch/powerpc/platforms/pseries/msi.c > +++ b/arch/powerpc/platforms/pseries/msi.c > @@ -448,8 +4

Re: [patch V3 05/35] powerpc/cell/axon_msi: Use PCI device property

2021-12-13 Thread Jason Gunthorpe
lists.ozlabs.org > --- > V3: Use pci_dev property - Jason > V2: Invoke the function with the correct number of arguments - Andy > --- > arch/powerpc/platforms/cell/axon_msi.c |5 + > 1 file changed, 1 insertion(+), 4 deletions(-) Reviewed-by: Jason Gunthorpe Jason

Re: [patch V3 04/35] genirq/msi: Use PCI device property

2021-12-13 Thread Jason Gunthorpe
> kernel/irq/msi.c | 17 ++--- > 1 file changed, 2 insertions(+), 15 deletions(-) Reviewed-by: Jason Gunthorpe Jason

Re: [patch V3 03/35] x86/apic/msi: Use PCI device MSI property

2021-12-13 Thread Jason Gunthorpe
5 + > 1 file changed, 1 insertion(+), 4 deletions(-) Reviewed-by: Jason Gunthorpe Jason

Re: [patch V3 02/35] x86/pci/XEN: Use PCI device property

2021-12-13 Thread Jason Gunthorpe
d. > --- > arch/x86/pci/xen.c |9 ++--- > 1 file changed, 2 insertions(+), 7 deletions(-) Reviewed-by: Jason Gunthorpe Jason

Re: [patch V3 01/35] PCI/MSI: Set pci_dev::msi[x]_enabled early

2021-12-13 Thread Jason Gunthorpe
s Gleixner > --- > V3: New patch > --- > drivers/pci/msi/msi.c | 23 +-- > 1 file changed, 17 insertions(+), 6 deletions(-) Reviewed-by: Jason Gunthorpe Jason

Re: [patch V2 00/31] genirq/msi, PCI/MSI: Spring cleaning - Part 3

2021-12-08 Thread Jason Gunthorpe
On Mon, Dec 06, 2021 at 11:51:02PM +0100, Thomas Gleixner wrote: > This is the third part of [PCI]MSI refactoring which aims to provide the > ability of expanding MSI-X vectors after enabling MSI-X. I read through this and didn't have any substantive remarks Reviewed-by: Jason Gunthorpe Jason

Re: [patch V2 02/31] genirq/msi: Add mutex for MSI list protection

2021-12-08 Thread Jason Gunthorpe
On Mon, Dec 06, 2021 at 11:51:05PM +0100, Thomas Gleixner wrote: > +++ b/kernel/irq/msi.c > @@ -127,12 +127,37 @@ int msi_setup_device_data(struct device > return -ENOMEM; > > INIT_LIST_HEAD(>list); > + mutex_init(>mutex); > dev->msi.data = md; >

Re: [patch V2 19/36] PCI/MSI: Store properties in device::msi::data

2021-12-08 Thread Jason Gunthorpe
On Mon, Dec 06, 2021 at 11:39:26PM +0100, Thomas Gleixner wrote: > Store the properties which are interesting for various places so the MSI > descriptor fiddling can be removed. > > Signed-off-by: Thomas Gleixner > --- > V2: Use the setter function > --- > drivers/pci/msi/msi.c |8

Re: [patch V2 23/36] powerpc/cell/axon_msi: Use MSI device properties

2021-12-08 Thread Jason Gunthorpe
On Mon, Dec 06, 2021 at 11:39:33PM +0100, Thomas Gleixner wrote: > @@ -209,10 +209,10 @@ static int setup_msi_msg_address(struct > return -ENODEV; > } > > - entry = first_pci_msi_entry(dev); > + is_64bit = msi_device_has_property(>dev, MSI_PROP_64BIT); How about

Re: [patch V2 20/36] x86/pci/XEN: Use device MSI properties

2021-12-08 Thread Jason Gunthorpe
On Mon, Dec 06, 2021 at 11:39:28PM +0100, Thomas Gleixner wrote: > instead of fiddling with MSI descriptors. > > Signed-off-by: Thomas Gleixner > Reviewed-by: Greg Kroah-Hartman > Reviewed-by: Jason Gunthorpe > arch/x86/pci/xen.c |6 ++ > 1 file changed, 2 inser

Re: [patch V2 24/36] powerpc/pseries/msi: Use MSI device properties

2021-12-08 Thread Jason Gunthorpe
On Mon, Dec 06, 2021 at 11:39:34PM +0100, Thomas Gleixner wrote: > instead of fiddling with MSI descriptors. > > Signed-off-by: Thomas Gleixner > Reviewed-by: Greg Kroah-Hartman > Reviewed-by: Jason Gunthorpe > arch/powerpc/platforms/pseries/msi.c |4 ++-- > 1 file

Re: [patch V2 21/36] x86/apic/msi: Use device MSI properties

2021-12-08 Thread Jason Gunthorpe
On Mon, Dec 06, 2021 at 11:39:29PM +0100, Thomas Gleixner wrote: > instead of fiddling with MSI descriptors. > > Signed-off-by: Thomas Gleixner > Reviewed-by: Greg Kroah-Hartman > Reviewed-by: Jason Gunthorpe > --- > arch/x86/kernel/apic/msi.c |5 + > 1 file ch

Re: [patch V2 20/23] PCI/MSI: Move msi_lock to struct pci_dev

2021-12-08 Thread Jason Gunthorpe
msi.c |2 +- > drivers/pci/probe.c|4 +++- > include/linux/device.h |2 -- > include/linux/pci.h|1 + > 5 files changed, 5 insertions(+), 5 deletions(-) Reviewed-by: Jason Gunthorpe > --- a/drivers/base/core.c > +++ b/drivers/base/core.c > @@ -2875,7

Re: [patch 00/22] genirq/msi, PCI/MSI: Spring cleaning - Part 1

2021-11-27 Thread Jason Gunthorpe
ff all that well anymore, but I read through all the patches and only noticed a small spello [patch 02/22] PCI/MSI: Fix pci_irq_vector()/pci_irq_get_attinity() ff It all seems good, I especially like the splitting of msi.c and removal of ops.. Reviewed-by: Jason Gunthorpe Thanks, Jason

Re: [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-23 Thread Jason Gunthorpe
On Fri, Nov 20, 2020 at 12:21:39PM -0600, Gustavo A. R. Silva wrote: > IB/hfi1: Fix fall-through warnings for Clang > IB/mlx4: Fix fall-through warnings for Clang > IB/qedr: Fix fall-through warnings for Clang > RDMA/mlx5: Fix fall-through warnings for Clang I picked these four to the

REGRESSION: Re: [patch V2 00/46] x86, PCI, XEN, genirq ...: Prepare for device MSI

2020-11-12 Thread Jason Gunthorpe
On Wed, Aug 26, 2020 at 01:16:28PM +0200, Thomas Gleixner wrote: > This is the second version of providing a base to support device MSI (non > PCI based) and on top of that support for IMS (Interrupt Message Storm) > based devices in a halfways architecture independent way. Hi Thomas, Our test

Re: [RFC] treewide: cleanup unreachable breaks

2020-10-19 Thread Jason Gunthorpe
On Mon, Oct 19, 2020 at 12:42:15PM -0700, Nick Desaulniers wrote: > On Sat, Oct 17, 2020 at 10:43 PM Greg KH wrote: > > > > On Sat, Oct 17, 2020 at 09:09:28AM -0700, t...@redhat.com wrote: > > > From: Tom Rix > > > > > > This is a upcoming change to clean up a new warning treewide. > > > I am

Re: [patch V2 24/46] PCI: vmd: Mark VMD irqdomain with DOMAIN_BUS_VMD_MSI

2020-09-30 Thread Jason Gunthorpe
On Wed, Sep 30, 2020 at 01:08:27PM +, Derrick, Jonathan wrote: > +Megha > > On Wed, 2020-09-30 at 09:57 -0300, Jason Gunthorpe wrote: > > On Wed, Sep 30, 2020 at 12:45:30PM +, Derrick, Jonathan wrote: > > > Hi Jason > > > > > > On Mon, 2020-0

Re: [patch V2 24/46] PCI: vmd: Mark VMD irqdomain with DOMAIN_BUS_VMD_MSI

2020-09-30 Thread Jason Gunthorpe
On Wed, Sep 30, 2020 at 12:45:30PM +, Derrick, Jonathan wrote: > Hi Jason > > On Mon, 2020-08-31 at 11:39 -0300, Jason Gunthorpe wrote: > > On Wed, Aug 26, 2020 at 01:16:52PM +0200, Thomas Gleixner wrote: > > > From: Thomas Gleixner > > > > > > De

Re: [patch V2 00/46] x86, PCI, XEN, genirq ...: Prepare for device MSI

2020-09-30 Thread Jason Gunthorpe
On Wed, Sep 30, 2020 at 08:41:48AM +0200, Thomas Gleixner wrote: > On Tue, Sep 29 2020 at 16:03, Megha Dey wrote: > > On 8/26/2020 4:16 AM, Thomas Gleixner wrote: > >> #9 is obviously just for the folks interested in IMS > >> > > > > I see that the tip tree (as of 9/29) has most of these patches

Re: [patch V2 46/46] irqchip: Add IMS (Interrupt Message Storm) driver - NOT FOR MERGING

2020-08-31 Thread Jason Gunthorpe
On Wed, Aug 26, 2020 at 01:17:14PM +0200, Thomas Gleixner wrote: > + * ims_queue_info - Information to create an IMS queue domain > + * @queue_lock: Callback which informs the device driver that > + * an interrupt management operation starts. > + *

Re: [patch V2 24/46] PCI: vmd: Mark VMD irqdomain with DOMAIN_BUS_VMD_MSI

2020-08-31 Thread Jason Gunthorpe
On Wed, Aug 26, 2020 at 01:16:52PM +0200, Thomas Gleixner wrote: > From: Thomas Gleixner > > Devices on the VMD bus use their own MSI irq domain, but it is not > distinguishable from regular PCI/MSI irq domains. This is required > to exclude VMD devices from getting the irq domain pointer set by

Re: [patch V2 34/46] PCI/MSI: Make arch_.*_msi_irq[s] fallbacks selectable

2020-08-28 Thread Jason Gunthorpe
On Fri, Aug 28, 2020 at 01:47:59PM +0100, Marc Zyngier wrote: > > So the arch_setup_msi_irq/etc is not really an arch hook, but some > > infrastructure to support those 4 PCI root port drivers. > > I happen to have a *really old* patch addressing Tegra [1], which > I was never able to test (no

Re: [patch V2 34/46] PCI/MSI: Make arch_.*_msi_irq[s] fallbacks selectable

2020-08-28 Thread Jason Gunthorpe
On Fri, Aug 28, 2020 at 12:21:42PM +0100, Lorenzo Pieralisi wrote: > On Thu, Aug 27, 2020 at 01:20:40PM -0500, Bjorn Helgaas wrote: > > [...] > > > And I can't figure out what's special about tegra, rcar, and xilinx > > that makes them need it as well. Is there something I could grep for > > to

Re: [patch RFC 38/38] irqchip: Add IMS array driver - NOT FOR MERGING

2020-08-22 Thread Jason Gunthorpe
On Sat, Aug 22, 2020 at 03:34:45AM +0200, Thomas Gleixner wrote: > >> One question is whether the device can see partial updates to that > >> memory due to the async 'swap' of context from the device CPU. > > > > It is worse than just partial updates.. The device operation is much > > more like

Re: [patch RFC 38/38] irqchip: Add IMS array driver - NOT FOR MERGING

2020-08-21 Thread Jason Gunthorpe
On Sat, Aug 22, 2020 at 01:47:12AM +0200, Thomas Gleixner wrote: > On Fri, Aug 21 2020 at 17:17, Jason Gunthorpe wrote: > > On Fri, Aug 21, 2020 at 09:47:43PM +0200, Thomas Gleixner wrote: > >> So if I understand correctly then the queue memory where the MSI > >>

Re: [patch RFC 38/38] irqchip: Add IMS array driver - NOT FOR MERGING

2020-08-21 Thread Jason Gunthorpe
On Fri, Aug 21, 2020 at 09:47:43PM +0200, Thomas Gleixner wrote: > On Fri, Aug 21 2020 at 09:45, Jason Gunthorpe wrote: > > On Fri, Aug 21, 2020 at 02:25:02AM +0200, Thomas Gleixner wrote: > >> +static void ims_mask_irq(struct irq_data *data) > >> +{ &g

Re: [patch RFC 38/38] irqchip: Add IMS array driver - NOT FOR MERGING

2020-08-21 Thread Jason Gunthorpe
On Fri, Aug 21, 2020 at 02:25:02AM +0200, Thomas Gleixner wrote: > +static void ims_mask_irq(struct irq_data *data) > +{ > + struct msi_desc *desc = irq_data_get_msi_desc(data); > + struct ims_array_slot __iomem *slot = desc->device_msi.priv_iomem; > + u32 __iomem *ctrl = >ctrl; > + >

Re: [Xen-devel] [PATCH] xen/gntdev: Do not use mm notifiers with autotranslating guests

2020-01-28 Thread Jason Gunthorpe
this looks like it for the ptemod miss, thanks Reviewed-by: Jason Gunthorpe Jason ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH v3 02/14] mm/mmu_notifier: add an interval tree notifier

2019-11-23 Thread Jason Gunthorpe
On Fri, Nov 22, 2019 at 04:54:08PM -0800, Ralph Campbell wrote: > Actually, I think you can remove the "need_wake" variable since it is > unconditionally set to "true". Oh, yes, thank you. An earlier revision had a different control flow > Also, the comment in__mmu_interval_notifier_insert()

Re: [Xen-devel] [PATCH v3 02/14] mm/mmu_notifier: add an interval tree notifier

2019-11-13 Thread Jason Gunthorpe
On Wed, Nov 13, 2019 at 05:59:52AM -0800, Christoph Hellwig wrote: > > +int mmu_interval_notifier_insert(struct mmu_interval_notifier *mni, > > + struct mm_struct *mm, unsigned long start, > > + unsigned long length, > > +

[Xen-devel] [PATCH v3 14/14] xen/gntdev: use mmu_interval_notifier_insert

2019-11-12 Thread Jason Gunthorpe
From: Jason Gunthorpe gntdev simply wants to monitor a specific VMA for any notifier events, this can be done straightforwardly using mmu_interval_notifier_insert() over the VMA's VA range. The notifier should be attached until the original VMA is destroyed. It is unclear if any

[Xen-devel] [PATCH v3 05/14] RDMA/odp: Use mmu_interval_notifier_insert()

2019-11-12 Thread Jason Gunthorpe
From: Jason Gunthorpe Replace the internal interval tree based mmu notifier with the new common mmu_interval_notifier_insert() API. This removes a lot of code and fixes a deadlock that can be triggered in ODP: zap_page_range() mmu_notifier_invalidate_range_start

[Xen-devel] [PATCH v3 11/14] drm/amdgpu: Use mmu_interval_insert instead of hmm_mirror

2019-11-12 Thread Jason Gunthorpe
From: Jason Gunthorpe Remove the interval tree in the driver and rely on the tree maintained by the mmu_notifier for delivering mmu_notifier invalidation callbacks. For some reason amdgpu has a very complicated arrangement where it tries to prevent duplicate entries in the interval_tree

[Xen-devel] [PATCH v3 04/14] mm/hmm: define the pre-processor related parts of hmm.h even if disabled

2019-11-12 Thread Jason Gunthorpe
From: Jason Gunthorpe Only the function calls are stubbed out with static inlines that always fail. This is the standard way to write a header for an optional component and makes it easier for drivers that only optionally need HMM_MIRROR. Reviewed-by: Jérôme Glisse Tested-by: Ralph Campbell

[Xen-devel] [PATCH v3 02/14] mm/mmu_notifier: add an interval tree notifier

2019-11-12 Thread Jason Gunthorpe
From: Jason Gunthorpe Of the 13 users of mmu_notifiers, 8 of them use only invalidate_range_start/end() and immediately intersect the mmu_notifier_range with some kind of internal list of VAs. 4 use an interval tree (i915_gem, radeon_mn, umem_odp, hfi1). 4 use a linked list of some kind

[Xen-devel] [PATCH v3 12/14] drm/amdgpu: Use mmu_interval_notifier instead of hmm_mirror

2019-11-12 Thread Jason Gunthorpe
From: Jason Gunthorpe Convert the collision-retry lock around hmm_range_fault to use the one now provided by the mmu_interval notifier. Although this driver does not seem to use the collision retry lock that hmm provides correctly, it can still be converted over to use the mmu_interval_notifier

[Xen-devel] [PATCH v3 09/14] nouveau: use mmu_interval_notifier instead of hmm_mirror

2019-11-12 Thread Jason Gunthorpe
From: Jason Gunthorpe Remove the hmm_mirror object and use the mmu_interval_notifier API instead for the range, and use the normal mmu_notifier API for the general invalidation callback. While here re-organize the pagefault path so the locking pattern is clear. nouveau is the only driver

[Xen-devel] [PATCH v3 13/14] mm/hmm: remove hmm_mirror and related

2019-11-12 Thread Jason Gunthorpe
From: Jason Gunthorpe The only two users of this are now converted to use mmu_interval_notifier, delete all the code and update hmm.rst. Reviewed-by: Jérôme Glisse Tested-by: Ralph Campbell Signed-off-by: Jason Gunthorpe --- Documentation/vm/hmm.rst | 105 --- include/linux

[Xen-devel] [PATCH v3 10/14] drm/amdgpu: Call find_vma under mmap_sem

2019-11-12 Thread Jason Gunthorpe
From: Jason Gunthorpe find_vma() must be called under the mmap_sem, reorganize this code to do the vma check after entering the lock. Further, fix the unlocked use of struct task_struct's mm, instead use the mm from hmm_mirror which has an active mm_grab. Also the mm_grab must be converted

[Xen-devel] [PATCH v3 06/14] RDMA/hfi1: Use mmu_interval_notifier_insert for user_exp_rcv

2019-11-12 Thread Jason Gunthorpe
From: Jason Gunthorpe This converts one of the two users of mmu_notifiers to use the new API. The conversion is fairly straightforward, however the existing use of notifiers here seems to be racey. Tested-by: Dennis Dalessandro Signed-off-by: Jason Gunthorpe --- drivers/infiniband/hw/hfi1

[Xen-devel] [PATCH v3 08/14] nouveau: use mmu_notifier directly for invalidate_range_start

2019-11-12 Thread Jason Gunthorpe
From: Jason Gunthorpe There is no reason to get the invalidate_range_start() callback via an indirection through hmm_mirror, just register a normal notifier directly. Tested-by: Ralph Campbell Signed-off-by: Jason Gunthorpe --- drivers/gpu/drm/nouveau/nouveau_svm.c | 95

[Xen-devel] [PATCH v3 07/14] drm/radeon: use mmu_interval_notifier_insert

2019-11-12 Thread Jason Gunthorpe
From: Jason Gunthorpe The new API is an exact match for the needs of radeon. For some reason radeon tries to remove overlapping ranges from the interval tree, but interval trees (and mmu_interval_notifier_insert()) support overlapping ranges directly. Simply delete all this code. Since

[Xen-devel] [PATCH v3 01/14] mm/mmu_notifier: define the header pre-processor parts even if disabled

2019-11-12 Thread Jason Gunthorpe
From: Jason Gunthorpe Now that we have KERNEL_HEADER_TEST all headers are generally compile tested, so relying on makefile tricks to avoid compiling code that depends on CONFIG_MMU_NOTIFIER is more annoying. Instead follow the usual pattern and provide most of the header with only the functions

[Xen-devel] [PATCH v3 03/14] mm/hmm: allow hmm_range to be used with a mmu_interval_notifier or hmm_mirror

2019-11-12 Thread Jason Gunthorpe
From: Jason Gunthorpe hmm_mirror's handling of ranges does not use a sequence count which results in this bug: CPU0 CPU1 hmm_range_wait_until_valid(range) valid == true

[Xen-devel] [PATCH hmm v3 00/14] Consolidate the mmu notifier interval_tree and locking

2019-11-12 Thread Jason Gunthorpe
From: Jason Gunthorpe 8 of the mmu_notifier using drivers (i915_gem, radeon_mn, umem_odp, hfi1, scif_dma, vhost, gntdev, hmm) drivers are using a common pattern where they only use invalidate_range_start/end and immediately check the invalidating range against some driver data structure to tell

Re: [Xen-devel] [PATCH v2 02/15] mm/mmu_notifier: add an interval tree notifier

2019-11-08 Thread Jason Gunthorpe
On Thu, Nov 07, 2019 at 09:00:34PM -0500, Jerome Glisse wrote: > On Fri, Nov 08, 2019 at 12:32:25AM +0000, Jason Gunthorpe wrote: > > On Thu, Nov 07, 2019 at 04:04:08PM -0500, Jerome Glisse wrote: > > > On Thu, Nov 07, 2019 at 08:11:06PM +0000, Jason Gunthorpe wrote: > >

Re: [Xen-devel] [PATCH v2 02/15] mm/mmu_notifier: add an interval tree notifier

2019-11-08 Thread Jason Gunthorpe
On Thu, Nov 07, 2019 at 12:53:56PM -0800, John Hubbard wrote: > > > > +/** > > > > + * struct mmu_range_notifier_ops > > > > + * @invalidate: Upon return the caller must stop using any SPTEs > > > > within this > > > > + * range, this function can sleep. Return false if > > > >

Re: [Xen-devel] [PATCH v2 09/15] xen/gntdev: use mmu_range_notifier_insert

2019-11-08 Thread Jason Gunthorpe
On Thu, Nov 07, 2019 at 05:54:52PM -0500, Boris Ostrovsky wrote: > On 11/7/19 3:36 PM, Jason Gunthorpe wrote: > > On Tue, Nov 05, 2019 at 10:16:46AM -0500, Boris Ostrovsky wrote: > > > >>> So, I suppose it can be relaxed to a null test and a WARN_ON that it > >

Re: [Xen-devel] [PATCH v2 02/15] mm/mmu_notifier: add an interval tree notifier

2019-11-07 Thread Jason Gunthorpe
On Thu, Nov 07, 2019 at 04:04:08PM -0500, Jerome Glisse wrote: > On Thu, Nov 07, 2019 at 08:11:06PM +0000, Jason Gunthorpe wrote: > > On Wed, Nov 06, 2019 at 09:08:07PM -0500, Jerome Glisse wrote: > > > > > > > > > > Extra credit: IMHO, t

Re: [Xen-devel] [PATCH v2 09/15] xen/gntdev: use mmu_range_notifier_insert

2019-11-07 Thread Jason Gunthorpe
On Tue, Nov 05, 2019 at 10:16:46AM -0500, Boris Ostrovsky wrote: > > So, I suppose it can be relaxed to a null test and a WARN_ON that it > > hasn't changed? > > You mean > > if (use_ptemod) { >     WARN_ON(map->vma != vma); >     ... > > > Yes, that sounds good. I amended my copy of

Re: [Xen-devel] [PATCH v2 02/15] mm/mmu_notifier: add an interval tree notifier

2019-11-07 Thread Jason Gunthorpe
On Wed, Nov 06, 2019 at 09:08:07PM -0500, Jerome Glisse wrote: > > > > Extra credit: IMHO, this clearly deserves to all be in a new > > mmu_range_notifier.h > > header file, but I know that's extra work. Maybe later as a follow-up patch, > > if anyone has the time. > > The range notifier

Re: [Xen-devel] [PATCH v2 02/15] mm/mmu_notifier: add an interval tree notifier

2019-11-07 Thread Jason Gunthorpe
On Wed, Nov 06, 2019 at 04:23:21PM -0800, John Hubbard wrote: > Nice design, I love the seq foundation! So far, I'm not able to spot anything > actually wrong with the implementation, sorry about that. Alas :( I feel there must be a bug in here still, but onwards! One of the main sad points

Re: [Xen-devel] [PATCH v2 01/15] mm/mmu_notifier: define the header pre-processor parts even if disabled

2019-11-06 Thread Jason Gunthorpe
On Tue, Nov 05, 2019 at 01:23:46PM -0800, John Hubbard wrote: > On 10/28/19 1:10 PM, Jason Gunthorpe wrote: > > From: Jason Gunthorpe > > > > Now that we have KERNEL_HEADER_TEST all headers are generally compile > > tested, so relying on makefile tricks to avoid

Re: [Xen-devel] [PATCH v2 09/15] xen/gntdev: use mmu_range_notifier_insert

2019-11-04 Thread Jason Gunthorpe
On Mon, Nov 04, 2019 at 05:03:31PM -0500, Boris Ostrovsky wrote: > On 10/28/19 4:10 PM, Jason Gunthorpe wrote: > > @@ -445,17 +438,9 @@ static void gntdev_vma_close(struct vm_area_struct > > *vma) > > struct gntdev_priv *priv = file->private_data; > > > >

Re: [Xen-devel] [PATCH v2 00/15] Consolidate the mmu notifier interval_tree and locking

2019-11-04 Thread Jason Gunthorpe
On Fri, Nov 01, 2019 at 01:54:45PM -0700, Ralph Campbell wrote: > You can add my Tested-by for the mm and nouveau changes. > IOW, patches 1-4, 10-11, and 15. > > Tested-by: Ralph Campbell Got it, thanks Jason ___ Xen-devel mailing list

Re: [Xen-devel] [PATCH v2 00/15] Consolidate the mmu notifier interval_tree and locking

2019-11-01 Thread Jason Gunthorpe
On Mon, Oct 28, 2019 at 05:10:17PM -0300, Jason Gunthorpe wrote: > From: Jason Gunthorpe > > 8 of the mmu_notifier using drivers (i915_gem, radeon_mn, umem_odp, hfi1, > scif_dma, vhost, gntdev, hmm) drivers are using a common pattern where > they only use invalidate_

Re: [Xen-devel] [PATCH v2 14/15] drm/amdgpu: Use mmu_range_notifier instead of hmm_mirror

2019-11-01 Thread Jason Gunthorpe
On Fri, Nov 01, 2019 at 07:45:22PM +, Yang, Philip wrote: > > This must be done inside the notifier_lock, after checking > > mmu_range_read_retry(), all handling of the struct page must be > > structured like that. > > > Below change will fix this, then driver will call mmu_range_read_retry

Re: [Xen-devel] [PATCH v2 09/15] xen/gntdev: use mmu_range_notifier_insert

2019-11-01 Thread Jason Gunthorpe
On Fri, Nov 01, 2019 at 02:51:46PM -0400, Boris Ostrovsky wrote: > On 11/1/19 1:48 PM, Jason Gunthorpe wrote: > > On Wed, Oct 30, 2019 at 12:55:37PM -0400, Boris Ostrovsky wrote: > >> On 10/28/19 4:10 PM, Jason Gunthorpe wrote: > >>> From: Jason Gunthorpe &

[Xen-devel] [PATCH v2a 14/15] drm/amdgpu: Use mmu_range_notifier instead of hmm_mirror

2019-11-01 Thread Jason Gunthorpe
without too much trouble. This also deletes another place where a driver is associating additional data (struct amdgpu_mn) with a mmu_struct. Signed-off-by: Philip Yang Reviewed-by: Philip Yang Tested-by: Philip Yang Signed-off-by: Jason Gunthorpe --- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c

Re: [Xen-devel] [PATCH v2 08/15] xen/gntdev: Use select for DMA_SHARED_BUFFER

2019-11-01 Thread Jason Gunthorpe
On Mon, Oct 28, 2019 at 05:10:25PM -0300, Jason Gunthorpe wrote: > From: Jason Gunthorpe > > DMA_SHARED_BUFFER can not be enabled by the user (it represents a library > set in the kernel). The kconfig convention is to use select for such > symbols so they are turned on implicitl

Re: [Xen-devel] [PATCH v2 14/15] drm/amdgpu: Use mmu_range_notifier instead of hmm_mirror

2019-11-01 Thread Jason Gunthorpe
On Fri, Nov 01, 2019 at 02:44:51PM +, Yang, Philip wrote: > @@ -854,12 +853,20 @@ int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, > struct page **pages) > r = -EPERM; > goto out_unlock; > } > + up_read(>mmap_sem); > + timeout = jiffies +

Re: [Xen-devel] [PATCH v2 09/15] xen/gntdev: use mmu_range_notifier_insert

2019-11-01 Thread Jason Gunthorpe
On Wed, Oct 30, 2019 at 12:55:37PM -0400, Boris Ostrovsky wrote: > On 10/28/19 4:10 PM, Jason Gunthorpe wrote: > > From: Jason Gunthorpe > > > > gntdev simply wants to monitor a specific VMA for any notifier events, > > this can be done straightforwardly using mmu_r

Re: [Xen-devel] [PATCH v2 14/15] drm/amdgpu: Use mmu_range_notifier instead of hmm_mirror

2019-11-01 Thread Jason Gunthorpe
On Fri, Nov 01, 2019 at 03:59:26PM +, Yang, Philip wrote: > > This test for range_blockable should be before mutex_lock, I can move > > it up > > > yes, thanks. Okay, I wrote it like this: if (mmu_notifier_range_blockable(range)) mutex_lock(>notifier_lock);

Re: [Xen-devel] [PATCH v2 14/15] drm/amdgpu: Use mmu_range_notifier instead of hmm_mirror

2019-11-01 Thread Jason Gunthorpe
On Fri, Nov 01, 2019 at 02:44:51PM +, Yang, Philip wrote: > > > On 2019-10-29 3:25 p.m., Jason Gunthorpe wrote: > > On Tue, Oct 29, 2019 at 07:22:37PM +, Yang, Philip wrote: > >> Hi Jason, > >> > >> I did quick test after merging amd-staging-

Re: [Xen-devel] [PATCH v2 13/15] drm/amdgpu: Use mmu_range_insert instead of hmm_mirror

2019-10-29 Thread Jason Gunthorpe
On Tue, Oct 29, 2019 at 10:14:29PM +, Kuehling, Felix wrote: > > +static const struct mmu_range_notifier_ops amdgpu_mn_hsa_ops = { > > + .invalidate = amdgpu_mn_invalidate_hsa, > > +}; > > + > > +static int amdgpu_mn_sync_pagetables(struct hmm_mirror *mirror, > > +

Re: [Xen-devel] [PATCH v2 02/15] mm/mmu_notifier: add an interval tree notifier

2019-10-29 Thread Jason Gunthorpe
On Tue, Oct 29, 2019 at 10:04:45PM +, Kuehling, Felix wrote: > >* because mm->mm_users > 0 during mmu_notifier_register and exit_mmap > > @@ -52,17 +286,24 @@ struct mmu_notifier_mm { > >* can't go away from under us as exit_mmap holds an mm_count pin > >* itself. > >*/ > >

Re: [Xen-devel] [PATCH v2 14/15] drm/amdgpu: Use mmu_range_notifier instead of hmm_mirror

2019-10-29 Thread Jason Gunthorpe
On Tue, Oct 29, 2019 at 07:22:37PM +, Yang, Philip wrote: > Hi Jason, > > I did quick test after merging amd-staging-drm-next with the > mmu_notifier branch, which includes this set changes. The test result > has different failures, app stuck intermittently, GUI no display etc. I > am

Re: [Xen-devel] [PATCH v2 12/15] drm/amdgpu: Call find_vma under mmap_sem

2019-10-29 Thread Jason Gunthorpe
On Tue, Oct 29, 2019 at 04:28:43PM +, Kuehling, Felix wrote: > On 2019-10-28 4:10 p.m., Jason Gunthorpe wrote: > > From: Jason Gunthorpe > > > > find_vma() must be called under the mmap_sem, reorganize this code to > > do the vma check after entering the

Re: [Xen-devel] [PATCH v2 13/15] drm/amdgpu: Use mmu_range_insert instead of hmm_mirror

2019-10-29 Thread Jason Gunthorpe
On Tue, Oct 29, 2019 at 07:51:30AM +, Koenig, Christian wrote: > > +static bool amdgpu_mn_invalidate_gfx(struct mmu_range_notifier *mrn, > > +const struct mmu_notifier_range *range) > > { > > - struct amdgpu_bo *bo; > > + struct amdgpu_bo *bo =

Re: [Xen-devel] [PATCH v2 06/15] RDMA/hfi1: Use mmu_range_notifier_inset for user_exp_rcv

2019-10-29 Thread Jason Gunthorpe
On Tue, Oct 29, 2019 at 08:19:20AM -0400, Dennis Dalessandro wrote: > On 10/28/2019 4:10 PM, Jason Gunthorpe wrote: > > From: Jason Gunthorpe > > > > This converts one of the two users of mmu_notifiers to use the new API. > > The conversion is fairly straightforwar

[Xen-devel] [PATCH v2 13/15] drm/amdgpu: Use mmu_range_insert instead of hmm_mirror

2019-10-28 Thread Jason Gunthorpe
From: Jason Gunthorpe Remove the interval tree in the driver and rely on the tree maintained by the mmu_notifier for delivering mmu_notifier invalidation callbacks. For some reason amdgpu has a very complicated arrangement where it tries to prevent duplicate entries in the interval_tree

[Xen-devel] [PATCH v2 15/15] mm/hmm: remove hmm_mirror and related

2019-10-28 Thread Jason Gunthorpe
From: Jason Gunthorpe The only two users of this are now converted to use mmu_range_notifier, delete all the code and update hmm.rst. Reviewed-by: Jérôme Glisse Signed-off-by: Jason Gunthorpe --- Documentation/vm/hmm.rst | 105 --- include/linux/hmm.h | 183

[Xen-devel] [PATCH v2 14/15] drm/amdgpu: Use mmu_range_notifier instead of hmm_mirror

2019-10-28 Thread Jason Gunthorpe
From: Jason Gunthorpe Convert the collision-retry lock around hmm_range_fault to use the one now provided by the mmu_range notifier. Although this driver does not seem to use the collision retry lock that hmm provides correctly, it can still be converted over to use the mmu_range_notifier api

[Xen-devel] [PATCH v2 02/15] mm/mmu_notifier: add an interval tree notifier

2019-10-28 Thread Jason Gunthorpe
From: Jason Gunthorpe Of the 13 users of mmu_notifiers, 8 of them use only invalidate_range_start/end() and immediately intersect the mmu_notifier_range with some kind of internal list of VAs. 4 use an interval tree (i915_gem, radeon_mn, umem_odp, hfi1). 4 use a linked list of some kind

[Xen-devel] [PATCH v2 07/15] drm/radeon: use mmu_range_notifier_insert

2019-10-28 Thread Jason Gunthorpe
From: Jason Gunthorpe The new API is an exact match for the needs of radeon. For some reason radeon tries to remove overlapping ranges from the interval tree, but interval trees (and mmu_range_notifier_insert) support overlapping ranges directly. Simply delete all this code. Since this driver

[Xen-devel] [PATCH v2 08/15] xen/gntdev: Use select for DMA_SHARED_BUFFER

2019-10-28 Thread Jason Gunthorpe
From: Jason Gunthorpe DMA_SHARED_BUFFER can not be enabled by the user (it represents a library set in the kernel). The kconfig convention is to use select for such symbols so they are turned on implicitly when the user enables a kconfig that needs them. Otherwise the XEN_GNTDEV_DMABUF kconfig

[Xen-devel] [PATCH v2 05/15] RDMA/odp: Use mmu_range_notifier_insert()

2019-10-28 Thread Jason Gunthorpe
From: Jason Gunthorpe Replace the internal interval tree based mmu notifier with the new common mmu_range_notifier_insert() API. This removes a lot of code and fixes a deadlock that can be triggered in ODP: zap_page_range() mmu_notifier_invalidate_range_start

[Xen-devel] [PATCH v2 01/15] mm/mmu_notifier: define the header pre-processor parts even if disabled

2019-10-28 Thread Jason Gunthorpe
From: Jason Gunthorpe Now that we have KERNEL_HEADER_TEST all headers are generally compile tested, so relying on makefile tricks to avoid compiling code that depends on CONFIG_MMU_NOTIFIER is more annoying. Instead follow the usual pattern and provide most of the header with only the functions

[Xen-devel] [PATCH v2 12/15] drm/amdgpu: Call find_vma under mmap_sem

2019-10-28 Thread Jason Gunthorpe
From: Jason Gunthorpe find_vma() must be called under the mmap_sem, reorganize this code to do the vma check after entering the lock. Further, fix the unlocked use of struct task_struct's mm, instead use the mm from hmm_mirror which has an active mm_grab. Also the mm_grab must be converted

[Xen-devel] [PATCH v2 10/15] nouveau: use mmu_notifier directly for invalidate_range_start

2019-10-28 Thread Jason Gunthorpe
From: Jason Gunthorpe There is no reason to get the invalidate_range_start() callback via an indirection through hmm_mirror, just register a normal notifier directly. Cc: Ben Skeggs Cc: dri-de...@lists.freedesktop.org Cc: nouv...@lists.freedesktop.org Cc: Ralph Campbell Signed-off-by: Jason

[Xen-devel] [PATCH v2 03/15] mm/hmm: allow hmm_range to be used with a mmu_range_notifier or hmm_mirror

2019-10-28 Thread Jason Gunthorpe
From: Jason Gunthorpe hmm_mirror's handling of ranges does not use a sequence count which results in this bug: CPU0 CPU1 hmm_range_wait_until_valid(range) valid == true

[Xen-devel] [PATCH v2 11/15] nouveau: use mmu_range_notifier instead of hmm_mirror

2019-10-28 Thread Jason Gunthorpe
From: Jason Gunthorpe Remove the hmm_mirror object and use the mmu_range_notifier API instead for the range, and use the normal mmu_notifier API for the general invalidation callback. While here re-organize the pagefault path so the locking pattern is clear. nouveau is the only driver

[Xen-devel] [PATCH v2 00/15] Consolidate the mmu notifier interval_tree and locking

2019-10-28 Thread Jason Gunthorpe
From: Jason Gunthorpe 8 of the mmu_notifier using drivers (i915_gem, radeon_mn, umem_odp, hfi1, scif_dma, vhost, gntdev, hmm) drivers are using a common pattern where they only use invalidate_range_start/end and immediately check the invalidating range against some driver data structure to tell

[Xen-devel] [PATCH v2 04/15] mm/hmm: define the pre-processor related parts of hmm.h even if disabled

2019-10-28 Thread Jason Gunthorpe
From: Jason Gunthorpe Only the function calls are stubbed out with static inlines that always fail. This is the standard way to write a header for an optional component and makes it easier for drivers that only optionally need HMM_MIRROR. Reviewed-by: Jérôme Glisse Signed-off-by: Jason

[Xen-devel] [PATCH v2 06/15] RDMA/hfi1: Use mmu_range_notifier_inset for user_exp_rcv

2019-10-28 Thread Jason Gunthorpe
From: Jason Gunthorpe This converts one of the two users of mmu_notifiers to use the new API. The conversion is fairly straightforward, however the existing use of notifiers here seems to be racey. Cc: Mike Marciniszyn Cc: Dennis Dalessandro Signed-off-by: Jason Gunthorpe --- drivers

[Xen-devel] [PATCH v2 09/15] xen/gntdev: use mmu_range_notifier_insert

2019-10-28 Thread Jason Gunthorpe
From: Jason Gunthorpe gntdev simply wants to monitor a specific VMA for any notifier events, this can be done straightforwardly using mmu_range_notifier_insert() over the VMA's VA range. The notifier should be attached until the original VMA is destroyed. It is unclear if any of this is even

Re: [Xen-devel] [PATCH hmm 08/15] xen/gntdev: Use select for DMA_SHARED_BUFFER

2019-10-21 Thread Jason Gunthorpe
On Wed, Oct 16, 2019 at 06:35:15AM +, Oleksandr Andrushchenko wrote: > On 10/16/19 8:11 AM, Jürgen Groß wrote: > > On 15.10.19 20:12, Jason Gunthorpe wrote: > >> From: Jason Gunthorpe > >> > >> DMA_SHARED_BUFFER can not be enabled by the user (it

  1   2   >