Re: [PATCH v2 05/10] sysfs: treewide: constify attribute callback of bin_is_visible()

2024-11-04 Thread Jason Gunthorpe
sysfs.c | 2 +- > drivers/usb/core/sysfs.c| 2 +- > include/linux/sysfs.h | 30 +++--- > 12 files changed, 27 insertions(+), 26 deletions(-) For infiniband: Acked-by: Jason Gunthorpe

Re: [RFC PATCH 1/3] powerpc/pseries/iommu: Bring back userspace view for single level TCE tables

2024-10-03 Thread Jason Gunthorpe
On Tue, Mar 19, 2024 at 01:36:51PM -0500, Timothy Pearson wrote: > > On Tue, Mar 12, 2024 at 01:14:20PM -0500, Shivaprasad G Bhat wrote: > >> The commit 090bad39b237a ("powerpc/powernv: Add indirect levels to > >> it_userspace") which implemented the tce indirect levels > >> support for PowerNV end

Re: [RFC PATCH v2 18/20] powerpc/64s: Use contiguous PMD/PUD instead of HUGEPD

2024-05-22 Thread Jason Gunthorpe
On Wed, May 22, 2024 at 11:13:53AM +1000, Nicholas Piggin wrote: > From the mm/ side of things, hugetlb page tables are always walked via > the huge vma which knows the page size and could align address... I > guess except for fast gup? Which should be read-only. So okay you do > need to replicate

Re: [RFC PATCH v2 00/20] Reimplement huge pages without hugepd on powerpc (8xx, e500, book3s/64)

2024-05-17 Thread Jason Gunthorpe
On Fri, May 17, 2024 at 08:59:54PM +0200, Christophe Leroy wrote: > This is the continuation of the RFC v1 series "Reimplement huge pages > without hugepd on powerpc 8xx". It now get rid of hugepd completely > after handling also e500 and book3s/64 This is really amazing, thank you for doing it!

Re: [RFC PATCH v2 0/6] powerpc: pSeries: vfio: iommu: Re-enable support for SPAPR TCE VFIO

2024-05-06 Thread Jason Gunthorpe
On Sat, May 04, 2024 at 12:33:53AM +0530, Shivaprasad G Bhat wrote: > We have legacy workloads using VFIO in userspace/kvm guests running > on downstream distro kernels. We want these workloads to be able to > continue running on our arch. It has been broken since 2018, I don't find this reasoning

Re: [RFC PATCH v2 0/6] powerpc: pSeries: vfio: iommu: Re-enable support for SPAPR TCE VFIO

2024-05-01 Thread Jason Gunthorpe
On Tue, Apr 30, 2024 at 03:05:34PM -0500, Shivaprasad G Bhat wrote: > RFC v1 was posted here [1]. As I was testing more and fixing the > issues, I realized its clean to have the table_group_ops implemented > the way it is done on PowerNV and stop 'borrowing' the DMA windows > for pSeries. > > This

Re: [PATCH v3 00/12] mm/gup: Unify hugetlb, part 2

2024-04-09 Thread Jason Gunthorpe
On Fri, Apr 05, 2024 at 05:42:44PM -0400, Peter Xu wrote: > In short, hugetlb mappings shouldn't be special comparing to other huge pXd > and large folio (cont-pXd) mappings for most of the walkers in my mind, if > not all. I need to look at all the walkers and there can be some tricky > ones, but

Re: [PATCH v3 00/12] mm/gup: Unify hugetlb, part 2

2024-04-05 Thread Jason Gunthorpe
On Thu, Apr 04, 2024 at 05:48:03PM -0400, Peter Xu wrote: > On Tue, Mar 26, 2024 at 11:02:52AM -0300, Jason Gunthorpe wrote: > > The more I look at this the more I think we need to get to Matthew's > > idea of having some kind of generic page table API that is not tight

Re: [RFC PATCH 1/8] mm: Provide pagesize to pmd_populate()

2024-04-04 Thread Jason Gunthorpe
On Wed, Apr 03, 2024 at 06:24:38PM +, Christophe Leroy wrote: > > If it is a software walker there might be value in just aligning to > > the contig pte scheme in all levels and forgetting about the variable > > size page table levels. That quarter page stuff is a PITA to manage > > the memory

Re: [PATCH v4 05/13] mm/arch: Provide pud_pfn() fallback

2024-04-04 Thread Jason Gunthorpe
On Wed, Apr 03, 2024 at 02:25:20PM -0400, Peter Xu wrote: > > I'd say the BUILD_BUG has done it's job and found an issue, fix it by > > not defining pud_leaf? I don't see any calls to pud_leaf in loongarch > > at least > > Yes, that sounds better too to me, however it means we may also risk other

Re: [PATCH v4 05/13] mm/arch: Provide pud_pfn() fallback

2024-04-03 Thread Jason Gunthorpe
On Wed, Apr 03, 2024 at 01:17:06PM +, Christophe Leroy wrote: > > That commit makes it sounds like the arch supports huge PUD's through > > the hugepte mechanism - it says a LTP test failed so something > > populated a huge PUD at least?? > > Not sure, I more see it just like a copy/paste of

Re: [PATCH v4 05/13] mm/arch: Provide pud_pfn() fallback

2024-04-03 Thread Jason Gunthorpe
On Wed, Apr 03, 2024 at 12:26:43PM +, Christophe Leroy wrote: > > > Le 03/04/2024 à 14:08, Jason Gunthorpe a écrit : > > On Tue, Apr 02, 2024 at 07:35:45PM -0400, Peter Xu wrote: > >> On Tue, Apr 02, 2024 at 07:53:20PM -0300, Jason Gunthorpe wrote: > >>>

Re: [PATCH v4 05/13] mm/arch: Provide pud_pfn() fallback

2024-04-03 Thread Jason Gunthorpe
On Tue, Apr 02, 2024 at 07:35:45PM -0400, Peter Xu wrote: > On Tue, Apr 02, 2024 at 07:53:20PM -0300, Jason Gunthorpe wrote: > > On Tue, Apr 02, 2024 at 06:43:56PM -0400, Peter Xu wrote: > > > > > I actually tested this without hitting the issue (even though I didn't

Re: [PATCH v4 05/13] mm/arch: Provide pud_pfn() fallback

2024-04-02 Thread Jason Gunthorpe
On Tue, Apr 02, 2024 at 06:43:56PM -0400, Peter Xu wrote: > I actually tested this without hitting the issue (even though I didn't > mention it in the cover letter..). I re-kicked the build test, it turns > out my "make alldefconfig" on loongarch will generate a config with both > HUGETLB=n && TH

Re: [PATCH v1 3/3] mm: use "GUP-fast" instead "fast GUP" in remaining comments

2024-04-02 Thread Jason Gunthorpe
d-off-by: David Hildenbrand > --- > mm/filemap.c| 2 +- > mm/khugepaged.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) Reviewed-by: Jason Gunthorpe Jason

Re: [PATCH v1 2/3] mm/treewide: rename CONFIG_HAVE_FAST_GUP to CONFIG_HAVE_GUP_FAST

2024-04-02 Thread Jason Gunthorpe
| 10 +- > mm/internal.h | 2 +- > 14 files changed, 22 insertions(+), 22 deletions(-) Reviewed-by: Jason Gunthorpe Jason

Re: [RFC PATCH 1/8] mm: Provide pagesize to pmd_populate()

2024-03-27 Thread Jason Gunthorpe
On Wed, Mar 27, 2024 at 09:58:35AM +, Christophe Leroy wrote: > > Just general remarks on the ones with huge pages: > > > > hash 64k and hugepage 16M/16G > > radix 64k/radix hugepage 2M/1G > > radix 4k/radix hugepage 2M/1G > > nohash 32 > >- I think this is just a normal x86 like s

Re: [PATCH RFC 1/3] mm/gup: consistently name GUP-fast functions

2024-03-27 Thread Jason Gunthorpe
ted() is already properly named > > With "gup_fast()", we now even have a function that is referred to in > comment in mm/mmu_gather.c. > > Signed-off-by: David Hildenbrand > --- > mm/gup.c | 164 ++++--- > 1 file changed, 84 insertions(+), 80 deletions(-) I think it is a great idea, it always takes a moment to figure out if a function is part of the fast callchain or not.. (even better would be to shift the fast stuff into its own file, but I expect that is too much) Reviewed-by: Jason Gunthorpe Jason

Re: [RFC PATCH 1/8] mm: Provide pagesize to pmd_populate()

2024-03-26 Thread Jason Gunthorpe
On Mon, Mar 25, 2024 at 07:05:01PM +, Christophe Leroy wrote: > Not looked into details yet, but I guess so. > > By the way there is a wiki dedicated to huge pages on powerpc, you can > have a look at it here : > https://github.com/linuxppc/wiki/wiki/Huge-pages , maybe you'll find > good i

Re: [PATCH v3 00/12] mm/gup: Unify hugetlb, part 2

2024-03-26 Thread Jason Gunthorpe
On Mon, Mar 25, 2024 at 02:58:48PM -0400, Peter Xu wrote: > > This remark would be a little easier to understand if you refer to > > hugetlb_walk() not huge_pte_offset() - the latter is only used to > > implement hugetlb_walk() and isn't removed by this series, while a > > single hugetlb_walk() wa

Re: [RFC PATCH 0/8] Reimplement huge pages without hugepd on powerpc 8xx

2024-03-25 Thread Jason Gunthorpe
On Mon, Mar 25, 2024 at 03:55:53PM +0100, Christophe Leroy wrote: > This series reimplements hugepages with hugepd on powerpc 8xx. > > Unlike most architectures, powerpc 8xx HW requires a two-level > pagetable topology for all page sizes. So a leaf PMD-contig approach > is not feasible as such. >

Re: [RFC PATCH 4/8] mm: Provide mm_struct and address to huge_ptep_get()

2024-03-25 Thread Jason Gunthorpe
On Mon, Mar 25, 2024 at 03:55:57PM +0100, Christophe Leroy wrote: > arch/arm64/include/asm/hugetlb.h | 2 +- > fs/hugetlbfs/inode.c | 2 +- > fs/proc/task_mmu.c | 8 +++--- > fs/userfaultfd.c | 2 +- > include/asm-generic/hugetlb.h| 2 +- > inclu

Re: [RFC PATCH 1/8] mm: Provide pagesize to pmd_populate()

2024-03-25 Thread Jason Gunthorpe
On Mon, Mar 25, 2024 at 03:55:54PM +0100, Christophe Leroy wrote: > Unlike many architectures, powerpc 8xx hardware tablewalk requires > a two level process for all page sizes, allthough second level only > has one entry when pagesize is 8M. > > To fit with Linux page table topology and without re

Re: [PATCH v3 00/12] mm/gup: Unify hugetlb, part 2

2024-03-22 Thread Jason Gunthorpe
On Thu, Mar 21, 2024 at 06:07:50PM -0400, pet...@redhat.com wrote: > From: Peter Xu > > v3: > - Rebased to latest mm-unstalbe (a824831a082f, of March 21th) > - Dropped patch to introduce pmd_thp_or_huge(), replace such uses (and also > pXd_huge() users) with pXd_leaf() [Jason] > - Add a comment

Re: [PATCH v3 12/12] mm/gup: Handle hugetlb in the generic follow_page_mask code

2024-03-22 Thread Jason Gunthorpe
On Fri, Mar 22, 2024 at 11:55:11AM -0400, Peter Xu wrote: > Jason, > > On Fri, Mar 22, 2024 at 10:30:12AM -0300, Jason Gunthorpe wrote: > > On Thu, Mar 21, 2024 at 06:08:02PM -0400, pet...@redhat.com wrote: > > > > > A quick performance test on an aarch64 V

Re: [PATCH v3 12/12] mm/gup: Handle hugetlb in the generic follow_page_mask code

2024-03-22 Thread Jason Gunthorpe
ath. There are enough important cases where it is just reading already populted page tables, and these days, often with large folios. Reviewed-by: Jason Gunthorpe Jason

Re: [PATCH v3 05/12] mm/gup: Drop folio_fast_pin_allowed() in hugepd processing

2024-03-22 Thread Jason Gunthorpe
toph Hellwig > Cc: Lorenzo Stoakes > Cc: Michael Ellerman > Cc: linuxppc-dev@lists.ozlabs.org > Signed-off-by: Peter Xu > --- > mm/gup.c | 13 - > 1 file changed, 8 insertions(+), 5 deletions(-) Reviewed-by: Jason Gunthorpe Jason

Re: [PATCH v3 04/12] mm: Introduce vma_pgtable_walk_{begin|end}()

2024-03-22 Thread Jason Gunthorpe
stoph Hellwig > Reviewed-by: Muchun Song > Signed-off-by: Peter Xu > --- > include/linux/mm.h | 3 +++ > mm/memory.c| 12 > 2 files changed, 15 insertions(+) is_vm_hugetlb_page(vma) seems weirdly named. Regardless Reviewed-by: Jason Gunthorpe Jason

Re: [PATCH 09/13] mm/powerpc: Redefine pXd_huge() with pXd_leaf()

2024-03-19 Thread Jason Gunthorpe
On Tue, Mar 19, 2024 at 11:07:08PM +, Christophe Leroy wrote: > > > Le 18/03/2024 à 17:15, Jason Gunthorpe a écrit : > > On Thu, Mar 14, 2024 at 01:11:59PM +, Christophe Leroy wrote: > >> > >> > >> Le 14/03/2024 à 13:53, Peter Xu a écrit : >

Re: [RFC PATCH 1/3] powerpc/pseries/iommu: Bring back userspace view for single level TCE tables

2024-03-19 Thread Jason Gunthorpe
On Tue, Mar 12, 2024 at 01:14:20PM -0500, Shivaprasad G Bhat wrote: > The commit 090bad39b237a ("powerpc/powernv: Add indirect levels to > it_userspace") which implemented the tce indirect levels > support for PowerNV ended up removing the single level support > which existed by default(generic tce

Re: [PATCH 11/13] mm/treewide: Replace pXd_huge() with pXd_leaf()

2024-03-18 Thread Jason Gunthorpe
On Thu, Mar 14, 2024 at 08:59:22AM -0400, Peter Xu wrote: > > > --- a/mm/hmm.c > > > +++ b/mm/hmm.c > > > @@ -429,7 +429,7 @@ static int hmm_vma_walk_pud(pud_t *pudp, unsigned > > > long start, unsigned long end, > > > return hmm_vma_walk_hole(start, end, -1, walk); > > >

Re: [PATCH 09/13] mm/powerpc: Redefine pXd_huge() with pXd_leaf()

2024-03-18 Thread Jason Gunthorpe
On Thu, Mar 14, 2024 at 01:11:59PM +, Christophe Leroy wrote: > > > Le 14/03/2024 à 13:53, Peter Xu a écrit : > > On Thu, Mar 14, 2024 at 08:45:34AM +, Christophe Leroy wrote: > >> > >> > >> Le 13/03/2024 à 22:47, pet...@redhat.com a écrit : > >>> From: Peter Xu > >>> > >>> PowerPC book3

Re: [PATCH RFC 13/13] mm: Document pXd_leaf() API

2024-03-08 Thread Jason Gunthorpe
th that the API is > crystal clear on what it implies. > > Signed-off-by: Peter Xu > --- > include/linux/pgtable.h | 24 +++- > 1 file changed, 19 insertions(+), 5 deletions(-) Reviewed-by: Jason Gunthorpe Jason

Re: [PATCH RFC 10/13] mm/gup: Merge pXd huge mapping checks

2024-03-07 Thread Jason Gunthorpe
Time to merge them into one. > > Signed-off-by: Peter Xu > --- > mm/gup.c | 7 +++ > 1 file changed, 3 insertions(+), 4 deletions(-) Much better! Reviewed-by: Jason Gunthorpe Jason

Re: [PATCH RFC 04/13] mm/x86: Change pXd_huge() behavior to exclude swap entries

2024-03-07 Thread Jason Gunthorpe
ries, and it > turns out that I am not the only one thinking so, the question was raised > when the current pmd_huge() for x86 was proposed by Ville Syrjälä: > > https://lore.kernel.org/all/y2wq7i4lxh8iu...@intel.com/ > > I might also be missing something obvious, but why is i

Re: [PATCH RFC 03/13] mm/gup: Check p4d presence before going on

2024-03-07 Thread Jason Gunthorpe
On Wed, Mar 06, 2024 at 06:41:37PM +0800, pet...@redhat.com wrote: > From: Peter Xu > > Currently there should have no p4d swap entries so it may not matter much, > however this may help us to rule out swap entries in pXd_huge() API, which > will include p4d_huge(). The p4d_present() checks make

Re: [PATCH RFC 01/13] mm/hmm: Process pud swap entry without pud_huge()

2024-03-07 Thread Jason Gunthorpe
uge() to only report non-swap mappings for all archs. > > Cc: Alistair Popple > Signed-off-by: Peter Xu > --- > mm/hmm.c | 7 +-- > 1 file changed, 1 insertion(+), 6 deletions(-) Reviewed-by: Jason Gunthorpe > @@ -424,7 +424,7 @@ static int hmm_vma_walk_pud(pud_t *pu

Re: [PATCH v3 04/10] mm/x86: Replace pgd_large() with pgd_leaf()

2024-03-05 Thread Jason Gunthorpe
t; Cc: Dave Hansen > Cc: x...@kernel.org > Signed-off-by: Peter Xu > --- > arch/x86/include/asm/pgtable.h | 4 ++-- > arch/x86/mm/pti.c | 2 +- > 2 files changed, 3 insertions(+), 3 deletions(-) Reviewed-by: Jason Gunthorpe Jason

Re: [PATCH v3 10/10] mm/treewide: Align up pXd_leaf() retval across archs

2024-03-05 Thread Jason Gunthorpe
include/asm/pgtable.h | 8 > include/linux/pgtable.h | 8 > 6 files changed, 14 insertions(+), 14 deletions(-) Reviewed-by: Jason Gunthorpe Jason

Re: [PATCH v2 7/7] mm/treewide: Drop pXd_large()

2024-03-04 Thread Jason Gunthorpe
| 19 +++ > 7 files changed, 16 insertions(+), 29 deletions(-) Reviewed-by: Jason Gunthorpe Jason

Re: [PATCH v2 6/7] mm/treewide: Replace pud_large() with pud_leaf()

2024-03-04 Thread Jason Gunthorpe
ibernate.c | 2 +- > arch/x86/xen/mmu_pv.c | 4 ++-- > 20 files changed, 29 insertions(+), 29 deletions(-) Reviewed-by: Jason Gunthorpe Jason

Re: [PATCH v2 5/7] mm/treewide: Replace pmd_large() with pmd_leaf()

2024-03-04 Thread Jason Gunthorpe
> arch/x86/mm/pti.c| 4 ++-- > arch/x86/power/hibernate.c | 2 +- > arch/x86/xen/mmu_pv.c| 4 ++-- > drivers/misc/sgi-gru/grufault.c | 2 +- > 25 files changed, 49 insertions(+), 49 deletions(-) Reviewed-by: Jason Gunthorpe Jason

Re: [PATCH v2 4/7] mm/x86: Drop two unnecessary pud_leaf() definitions

2024-03-04 Thread Jason Gunthorpe
t; Cc: Dave Hansen > Cc: x...@kernel.org > Signed-off-by: Peter Xu > --- > arch/x86/include/asm/pgtable.h | 1 - > include/asm-generic/pgtable-nopmd.h | 1 - > 2 files changed, 2 deletions(-) Reviewed-by: Jason Gunthorpe > @@ -31,7 +31,6 @@ static inline int pud_none(pud

Re: [PATCH v2 3/7] mm/x86: Replace p4d_large() with p4d_leaf()

2024-03-04 Thread Jason Gunthorpe
h/x86/mm/init_64.c| 2 +- > arch/x86/mm/pat/set_memory.c | 4 ++-- > arch/x86/mm/pti.c| 2 +- > arch/x86/power/hibernate.c | 2 +- > arch/x86/xen/mmu_pv.c| 2 +- > 6 files changed, 8 insertions(+), 8 deletions(-) Reviewed-by: Jason Gunthorpe Jason

Re: [PATCH v2 2/7] mm/ppc: Replace pXd_is_leaf() with pXd_leaf()

2024-03-04 Thread Jason Gunthorpe
+- > arch/powerpc/mm/book3s64/radix_pgtable.c | 14 ++-- > arch/powerpc/mm/pgtable.c| 6 ++--- > arch/powerpc/mm/pgtable_64.c | 6 ++--- > arch/powerpc/xmon/xmon.c | 6 ++--- > 7 files changed, 26 insertions(+), 52 deletions(-) Reviewed-by: Jason Gunthorpe Jason

Re: [PATCH v2 1/7] mm/ppc: Define pXd_large() with pXd_leaf()

2024-03-04 Thread Jason Gunthorpe
> Cc: linuxppc-dev@lists.ozlabs.org > Signed-off-by: Peter Xu > --- > arch/powerpc/include/asm/book3s/64/pgtable.h | 16 ++-- > arch/powerpc/include/asm/pgtable.h | 2 +- > 2 files changed, 3 insertions(+), 15 deletions(-) Reviewed-by: Jason Gunthorpe Jason

Re: [PATCH v2 03/13] mm: Provide generic pmd_thp_or_huge()

2024-02-21 Thread Jason Gunthorpe
On Wed, Feb 21, 2024 at 05:37:37PM +0800, Peter Xu wrote: > On Mon, Jan 15, 2024 at 01:55:51PM -0400, Jason Gunthorpe wrote: > > On Wed, Jan 03, 2024 at 05:14:13PM +0800, pet...@redhat.com wrote: > > > From: Peter Xu > > > > > > ARM defines pmd_thp_or_huge(),

Re: [PATCH v2] powerpc/iommu: Fix the iommu group reference leak during platform domain attach

2024-02-14 Thread Jason Gunthorpe
https://lore.kernel.org/all/274e0d2b-b5cc-475e-94e6-8427e88e2...@linux.vnet.ibm.com > Signed-off-by: Shivaprasad G Bhat > --- > Changelog: > v1: > https://lore.kernel.org/all/170784021983.6249.10039296655906636112.st...@linux.ibm.com/ > - Minor refactor to call the iommu_group_get() only if required. &

Re: [PATCH] powerpc/iommu: Fix the missing iommu_group_put() during platform domain attach

2024-02-14 Thread Jason Gunthorpe
On Wed, Feb 14, 2024 at 11:53:20PM +1100, Michael Ellerman wrote: > Venkat Rao Bagalkote writes: > > Thanks for the patch. Applied this patch and verified and issue is fixed. > > > > This issue way originally reported in the below mail. > > > > https://marc.info/?l=linux-kernel&m=170737160630106&w

Re: [PATCH] powerpc/iommu: Fix the missing iommu_group_put() during platform domain attach

2024-02-13 Thread Jason Gunthorpe
; The patch adds the missing iommu_group_put() call. > > Fixes: a8ca9fc9134c ("powerpc/iommu: Do not do platform domain attach > atctions after probe") > Signed-off-by: Shivaprasad G Bhat > --- > arch/powerpc/kernel/iommu.c |4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) Doh, that is a weird splat for this but thanks for finding it Reviewed-by: Jason Gunthorpe Jason

Re: [PATCH v2] powerpc: iommu: Bring back table group release_ownership() call

2024-02-01 Thread Jason Gunthorpe
s.stglab.ibm.com/ > - Split the common attach_dev call to platform and blocked attach_dev >calls as suggested. > > arch/powerpc/kernel/iommu.c | 37 ++++- > 1 file changed, 28 insertions(+), 9 deletions(-) Reviewed-by: Jason Gunthorpe > @@ -131

Re: [PATCH 1/2] powerpc: iommu: Bring back table group release_ownership() call

2024-01-26 Thread Jason Gunthorpe
On Fri, Jan 26, 2024 at 09:39:56AM -0600, Timothy Pearson wrote: > > Just forget about the weird KVM and SPAPR stuff, leave it under the > > kconfig of the old code and nobody will run it. Almost nobody already > > runs it, apparently. > > We actually use QEMU/KVM/VFIO extensively at Raptor, so ne

Re: [PATCH 1/2] powerpc: iommu: Bring back table group release_ownership() call

2024-01-26 Thread Jason Gunthorpe
On Fri, Jan 26, 2024 at 09:29:55AM -0600, Timothy Pearson wrote: > > On Fri, Jan 26, 2024 at 08:43:12PM +0530, Shivaprasad G Bhat wrote: > >> > Also, is there any chance someone can work on actually fixing this to > >> > be a proper iommu driver? I think that will become important for power > >> >

Re: [PATCH 1/2] powerpc: iommu: Bring back table group release_ownership() call

2024-01-26 Thread Jason Gunthorpe
On Fri, Jan 26, 2024 at 08:43:12PM +0530, Shivaprasad G Bhat wrote: > > Also, is there any chance someone can work on actually fixing this to > > be a proper iommu driver? I think that will become important for power > > to use the common dma_iommu code in the next year... > We are looking into it.

Re: [PATCH 2/2] iommu: Fix the domain type checks when default_domain is set

2024-01-25 Thread Jason Gunthorpe
On Thu, Jan 25, 2024 at 06:08:52AM -0600, Shivaprasad G Bhat wrote: > On PPC64, the iommu_ops.def_domain_type() is not defined and > CONFIG_IOMMU_DMA not enabled. With commit 0f6a90436a57 ("iommu: Do not > use IOMMU_DOMAIN_DMA if CONFIG_IOMMU_DMA is not enabled"), the > iommu_get_default_domain_typ

Re: [PATCH 1/2] powerpc: iommu: Bring back table group release_ownership() call

2024-01-25 Thread Jason Gunthorpe
On Thu, Jan 25, 2024 at 06:08:39AM -0600, Shivaprasad G Bhat wrote: > The commit 2ad56efa80db ("powerpc/iommu: Setup a default domain and > remove set_platform_dma_ops") refactored the code removing the > set_platform_dma_ops(). It missed out the table group > release_ownership() call which would h

Re: [PATCH v2 06/13] mm/gup: Drop folio_fast_pin_allowed() in hugepd processing

2024-01-17 Thread Jason Gunthorpe
On Tue, Jan 16, 2024 at 06:32:32PM +, Christophe Leroy wrote: > >> hugepd is a page directory dedicated to huge pages, where you have huge > >> pages listed instead of regular pages. For instance, on powerpc 32 with > >> each PGD entries covering 4Mbytes, a regular page table has 1024 PTEs. A >

Re: [PATCH v2 06/13] mm/gup: Drop folio_fast_pin_allowed() in hugepd processing

2024-01-16 Thread Jason Gunthorpe
On Tue, Jan 16, 2024 at 06:30:39AM +, Christophe Leroy wrote: > > > Le 15/01/2024 à 19:37, Jason Gunthorpe a écrit : > > On Wed, Jan 03, 2024 at 05:14:16PM +0800, pet...@redhat.com wrote: > >> From: Peter Xu > >> > >> Hugepd format for GUP is only

Re: [PATCH v2 11/13] mm/gup: Handle huge pmd for follow_pmd_mask()

2024-01-15 Thread Jason Gunthorpe
huge_memory.c | 86 + > mm/internal.h| 5 +-- > 3 files changed, 105 insertions(+), 93 deletions(-) Reviewed-by: Jason Gunthorpe Jason

Re: [PATCH v2 10/13] mm/gup: Handle huge pud for follow_pud_mask()

2024-01-15 Thread Jason Gunthorpe
return no_page_table(vma, flags, address); Isn't 'pud_none() || !pud_present()' redundent? A none pud is non-present, by definition? > - if (pud_devmap(pud)) { > + if (pud_huge(pud)) { > ptl = pud_lock(mm, pudp); > - page = follow_devmap_pud(vma, address, pudp, flags, > &ctx->pgmap); > + page = follow_huge_pud(vma, address, pudp, flags, ctx); > spin_unlock(ptl); > if (page) > return page; Otherwise it looks OK to me Reviewed-by: Jason Gunthorpe Jason

Re: [PATCH v2 09/13] mm/gup: Cache *pudp in follow_pud_mask()

2024-01-15 Thread Jason Gunthorpe
(+), 8 deletions(-) I think we have several more case like this, and I ceratinly agree code should not access a READ_ONCE variable more than once :( Reviewed-by: Jason Gunthorpe Jason

Re: [PATCH v2 08/13] mm/gup: Handle hugetlb for no_page_table()

2024-01-15 Thread Jason Gunthorpe
if VM_SHARED. See hugetlb_follow_page_mask(). > > Pass "address" into no_page_table() too, as hugetlb will need it. > > Reviewed-by: Christoph Hellwig > Signed-off-by: Peter Xu > --- > mm/gup.c | 44 ++-- > 1 file changed, 2

Re: [PATCH v2 07/13] mm/gup: Refactor record_subpages() to find 1st small page

2024-01-15 Thread Jason Gunthorpe
so that it will do the nth_page() > calculation. > > Signed-off-by: Peter Xu > --- > mm/gup.c | 25 ++--- > 1 file changed, 14 insertions(+), 11 deletions(-) Reviewed-by: Jason Gunthorpe Jason

Re: [PATCH v2 06/13] mm/gup: Drop folio_fast_pin_allowed() in hugepd processing

2024-01-15 Thread Jason Gunthorpe
On Wed, Jan 03, 2024 at 05:14:16PM +0800, pet...@redhat.com wrote: > From: Peter Xu > > Hugepd format for GUP is only used in PowerPC with hugetlbfs. There are > some kernel usage of hugepd (can refer to hugepd_populate_kernel() for > PPC_8XX), however those pages are not candidates for GUP. >

Re: [PATCH v2 04/13] mm: Make HPAGE_PXD_* macros even if !THP

2024-01-15 Thread Jason Gunthorpe
asons even if !THP. > Reorganize these macros. > > Reviewed-by: Christoph Hellwig > Signed-off-by: Peter Xu > --- > include/linux/huge_mm.h | 17 ++--- > 1 file changed, 6 insertions(+), 11 deletions(-) Reviewed-by: Jason Gunthorpe Jason

Re: [PATCH v2 03/13] mm: Provide generic pmd_thp_or_huge()

2024-01-15 Thread Jason Gunthorpe
On Wed, Jan 03, 2024 at 05:14:13PM +0800, pet...@redhat.com wrote: > From: Peter Xu > > ARM defines pmd_thp_or_huge(), detecting either a THP or a huge PMD. It > can be a helpful helper if we want to merge more THP and hugetlb code > paths. Make it a generic default implementation, only exist w

Re: [PATCH v2 01/13] mm/Kconfig: CONFIG_PGTABLE_HAS_HUGE_LEAVES

2024-01-15 Thread Jason Gunthorpe
comment in the kconfig? Reviewed-by: Jason Gunthorpe Jason

Re: [PATCH 05/26] vfio: KVM: Pass get/put helpers from KVM to VFIO, don't do circular lookup

2023-12-03 Thread Jason Gunthorpe
On Fri, Dec 01, 2023 at 04:51:55PM -0800, Sean Christopherson wrote: > There's one more wrinkle: this patch is buggy in that it doesn't ensure the > liveliness > of KVM-the-module, i.e. nothing prevents userspace from unloading kvm.ko > while VFIO > still holds a reference to a kvm structure, an

Re: Ping? Re: [PATCH rc] kvm: Prevent compiling virt/kvm/vfio.c unless VFIO is selected

2023-11-30 Thread Jason Gunthorpe
On Wed, Nov 29, 2023 at 06:02:08PM -0800, Sean Christopherson wrote: > > > Ah, it's the same warning, I just missed the CONFIG_MODULES=n requirement. > > > > Oh, wait, doesn't that mean the approach won't work? IIRC doesn't > > symbol_get turn into just &fn when non-modular turning this into a >

Re: Ping? Re: [PATCH rc] kvm: Prevent compiling virt/kvm/vfio.c unless VFIO is selected

2023-11-29 Thread Jason Gunthorpe
On Wed, Nov 29, 2023 at 05:07:45PM -0800, Sean Christopherson wrote: > On Wed, Nov 29, 2023, Michael Ellerman wrote: > > Sean Christopherson writes: > > > On Fri, Nov 10, 2023, Michael Ellerman wrote: > > >> Jason Gunthorpe writes: > > >> > There ar

Re: Ping? Re: [PATCH rc] kvm: Prevent compiling virt/kvm/vfio.c unless VFIO is selected

2023-11-29 Thread Jason Gunthorpe
On Tue, Nov 28, 2023 at 06:21:42PM -0800, Sean Christopherson wrote: > diff --git a/include/linux/vfio.h b/include/linux/vfio.h > index 454e9295970c..a65b2513f8cd 100644 > --- a/include/linux/vfio.h > +++ b/include/linux/vfio.h > @@ -289,16 +289,12 @@ void vfio_combine_iova_ranges(struct rb_root_ca

Re: get_user_pages() and EXEC_ONLY mapping.

2023-11-10 Thread Jason Gunthorpe
On Fri, Nov 10, 2023 at 08:27:19PM +0530, Aneesh Kumar K V wrote: > On 11/10/23 8:23 PM, Jason Gunthorpe wrote: > > On Fri, Nov 10, 2023 at 08:19:23PM +0530, Aneesh Kumar K.V wrote: > >> > >> Hello, > >> > >> Some architectures can now support EX

Re: get_user_pages() and EXEC_ONLY mapping.

2023-11-10 Thread Jason Gunthorpe
On Fri, Nov 10, 2023 at 08:19:23PM +0530, Aneesh Kumar K.V wrote: > > Hello, > > Some architectures can now support EXEC_ONLY mappings and I am wondering > what get_user_pages() on those addresses should return. -EPERM > Earlier PROT_EXEC implied PROT_READ and pte_access_permitted() > returned

Re: [Bisected] [commit 2ad56efa80db] [Hotplug] WARNING while performing hotplug operation on 6.6-rc3-next

2023-10-06 Thread Jason Gunthorpe
On Fri, Oct 06, 2023 at 06:50:00PM +0530, Tasmiya Nalatwad wrote: >Greetings, > >Thanks Jason. > >The fix provided by you works. It is not giving WARNING's but i am >seeing below logs. Would you please confirm on the logs. I don't know anything about your environment but those lo

Re: [Bisected] [commit 2ad56efa80db] [Hotplug] WARNING while performing hotplug operation on 6.6-rc3-next

2023-10-06 Thread Jason Gunthorpe
On Fri, Oct 06, 2023 at 01:20:17PM +0530, Tasmiya Nalatwad wrote: > Greetings, > > [linux-next] [6.6.0-rc3-next-20230929] WARNING: CPU: 5 PID: 185612 at > drivers/iommu/iommu.c:3049 iommu_setup_default_domain+0x410/0x680 > > --- Traces --- > > [ 6296.425934] WARNING: CPU: 5 PID: 185612 at driver

[PATCH] powerpc/iommu: Do not do platform domain attach atctions after probe

2023-10-05 Thread Jason Gunthorpe
Fixes: 2ad56efa80db ("powerpc/iommu: Setup a default domain and remove set_platform_dma_ops") Reported-by: Tasmiya Nalatwad Link: https://lore.kernel.org/r/d06cee81-c47f-9d62-dfc6-4c77b6005...@linux.vnet.ibm.com Tested-by: Tasmiya Nalatwad Signed-off-by: Jason Gunthorpe --- arch/powerpc/ker

Re: [Bisected] [commit 2ad56efa80dba89162106c06ebc00b611325e584] [linux-next] WARNING while booting to kernel 6.6.0-rc3-next-20230929

2023-10-04 Thread Jason Gunthorpe
On Wed, Oct 04, 2023 at 04:37:10PM +0530, Tasmiya Nalatwad wrote: >Greetings, > >[linux-next] [6.6.0-rc3-next-20230929] [git bisect -> >2ad56efa80dba89162106c06ebc00b611325e584]WARNING: CPU: 0 PID: 8 at >arch/powerpc/kernel/[1]iommu.c:407 __iommu_free+0x1e4/0x1f0 >gitbisect i

Re: [PATCH v8 20/24] iommu: Require a default_domain for all iommu drivers

2023-10-02 Thread Jason Gunthorpe
On Tue, Oct 03, 2023 at 12:21:59AM +0300, Dmitry Baryshkov wrote: > On Wed, 13 Sept 2023 at 16:45, Jason Gunthorpe wrote: > > > > At this point every iommu driver will cause a default_domain to be > > selected, so we can finally remove this gap from the core code. > &

[PATCH v2 2/9] iommu/vt-d: Update the definition of the blocking domain

2023-09-27 Thread Jason Gunthorpe
The global static should pre-define the type and the NOP free function can be now left as NULL. Reviewed-by: Lu Baolu Signed-off-by: Jason Gunthorpe --- drivers/iommu/intel/iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers

[PATCH v2 0/9] iommu: Convert dart & iommufd to the new domain_alloc_paging()

2023-09-27 Thread Jason Gunthorpe
th Janne - Move some hunks between patches to accommodate Robin's change to the attach_dev switch v1: https://lore.kernel.org/r/0-v1-8060f06462cc+c0a39-dart_paging_...@nvidia.com Jason Gunthorpe (9): iommu: Move IOMMU_DOMAIN_BLOCKED global statics to ops->blocked_domain iommu/

[PATCH v2 9/9] iommu/dart: Remove the force_bypass variable

2023-09-27 Thread Jason Gunthorpe
domains from working, remove that test. The check in apple_dart_of_xlate() is redundant since immediately after the pgsize is checked. Remove it. Remove the variable. Suggested-by: Janne Grunau Signed-off-by: Jason Gunthorpe --- drivers/iommu/apple-dart.c | 20 ++-- 1 file changed

[PATCH v2 4/9] iommufd: Convert to alloc_domain_paging()

2023-09-27 Thread Jason Gunthorpe
Move the global static blocked domain to the ops and convert the unmanaged domain to domain_alloc_paging. Signed-off-by: Jason Gunthorpe --- drivers/iommu/iommufd/selftest.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/iommufd/selftest.c b

[PATCH v2 8/9] iommu/dart: Call apple_dart_finalize_domain() as part of alloc_paging()

2023-09-27 Thread Jason Gunthorpe
In many cases the dev argument will now be !NULL so we should use it to finalize the domain at allocation. Make apple_dart_finalize_domain() accept the correct type. Reviewed-by: Janne Grunau Signed-off-by: Jason Gunthorpe --- drivers/iommu/apple-dart.c | 28 +++- 1

[PATCH v2 5/9] iommu/dart: Use static global identity domains

2023-09-27 Thread Jason Gunthorpe
Move to the new static global for identity domains. Move the identity specific code to apple_dart_attach_dev_identity(). Reviewed-by: Janne Grunau Signed-off-by: Jason Gunthorpe --- drivers/iommu/apple-dart.c | 39 +++--- 1 file changed, 28 insertions(+), 11

[PATCH v2 1/9] iommu: Move IOMMU_DOMAIN_BLOCKED global statics to ops->blocked_domain

2023-09-27 Thread Jason Gunthorpe
Following the pattern of identity domains, just assign the BLOCKED domain global statics to a value in ops. Update the core code to use the global static directly. Update powerpc to use the new scheme and remove its empty domain_alloc callback. Reviewed-by: Lu Baolu Signed-off-by: Jason

[PATCH v2 6/9] iommu/dart: Move the blocked domain support to a global static

2023-09-27 Thread Jason Gunthorpe
Move to the new static global for blocked domains. Move the blocked specific code to apple_dart_attach_dev_blocked(). Reviewed-by: Janne Grunau Signed-off-by: Jason Gunthorpe --- drivers/iommu/apple-dart.c | 53 +++--- 1 file changed, 32 insertions(+), 21

[PATCH v2 7/9] iommu/dart: Convert to domain_alloc_paging()

2023-09-27 Thread Jason Gunthorpe
Since the IDENTITY and BLOCKED behaviors were moved to global statics all that remains is the paging domain. Rename to apple_dart_attach_dev_paging() and remove the left over type check. Reviewed-by: Janne Grunau Signed-off-by: Jason Gunthorpe --- drivers/iommu/apple-dart.c | 13

[PATCH v2 3/9] iommu/vt-d: Use ops->blocked_domain

2023-09-27 Thread Jason Gunthorpe
Trivially migrate to the ops->blocked_domain for the existing global static. Reviewed-by: Lu Baolu Signed-off-by: Jason Gunthorpe --- drivers/iommu/intel/iommu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iomm

Re: [PATCH 6/8] iommu/dart: Move the blocked domain support to a global static

2023-09-27 Thread Jason Gunthorpe
On Tue, Sep 26, 2023 at 09:05:08PM +0200, Janne Grunau wrote: > > +static int apple_dart_attach_dev_blocked(struct iommu_domain *domain, > > +struct device *dev) > > +{ > > + struct apple_dart_master_cfg *cfg = dev_iommu_priv_get(dev); > > + struct apple_dart

Re: [PATCH 3/8] iommu/vt-d: Use ops->blocked_domain

2023-09-25 Thread Jason Gunthorpe
On Mon, Sep 25, 2023 at 10:29:52AM +0800, Baolu Lu wrote: > On 9/23/23 1:07 AM, Jason Gunthorpe wrote: > > Trivially migrate to the ops->blocked_domain for the existing global > > static. > > > > Signed-off-by: Jason Gunthorpe > > --- > > drivers/iommu/

[PATCH 5/8] iommu/dart: Use static global identity domains

2023-09-22 Thread Jason Gunthorpe
Move to the new static global for identity domains. Move the identity specific code to apple_dart_attach_dev_identity(). Signed-off-by: Jason Gunthorpe --- drivers/iommu/apple-dart.c | 41 -- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a

[PATCH 7/8] iommu/dart: Convert to domain_alloc_paging()

2023-09-22 Thread Jason Gunthorpe
Since the IDENTITY and BLOCKED behaviors were moved to global statics all that remains is the paging domain. Rename to apple_dart_attach_dev_paging() and remove the left over cruft. Signed-off-by: Jason Gunthorpe --- drivers/iommu/apple-dart.c | 33 +++-- 1 file

[PATCH 6/8] iommu/dart: Move the blocked domain support to a global static

2023-09-22 Thread Jason Gunthorpe
Move to the new static global for blocked domains. Move the blocked specific code to apple_dart_attach_dev_blocked(). Signed-off-by: Jason Gunthorpe --- drivers/iommu/apple-dart.c | 36 ++-- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/drivers

[PATCH 8/8] iommu/dart: Call apple_dart_finalize_domain() as part of alloc_paging()

2023-09-22 Thread Jason Gunthorpe
In many cases the dev argument will now be !NULL so we should use it to finalize the domain at allocation. Make apple_dart_finalize_domain() accept the correct type. Signed-off-by: Jason Gunthorpe --- drivers/iommu/apple-dart.c | 26 ++ 1 file changed, 18 insertions

[PATCH 4/8] iommufd: Convert to alloc_domain_paging()

2023-09-22 Thread Jason Gunthorpe
Move the global static blocked domain to the ops and convert the unmanaged domain to domain_alloc_paging. Signed-off-by: Jason Gunthorpe --- drivers/iommu/iommufd/selftest.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/iommufd/selftest.c b

[PATCH 1/8] iommu: Move IOMMU_DOMAIN_BLOCKED global statics to ops->blocked_domain

2023-09-22 Thread Jason Gunthorpe
Following the pattern of identity domains, just assign the BLOCKED domain global statics to a value in ops. Update the core code to use the global static directly. Update powerpc to use the new scheme and remove its empty domain_alloc callback. Signed-off-by: Jason Gunthorpe --- arch/powerpc

[PATCH 2/8] iommu/vt-d: Update the definition of the blocking domain

2023-09-22 Thread Jason Gunthorpe
The global static should pre-define the type and the NOP free function can be now left as NULL. Signed-off-by: Jason Gunthorpe --- drivers/iommu/intel/iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index

[PATCH 3/8] iommu/vt-d: Use ops->blocked_domain

2023-09-22 Thread Jason Gunthorpe
Trivially migrate to the ops->blocked_domain for the existing global static. Signed-off-by: Jason Gunthorpe --- drivers/iommu/intel/iommu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 0d0cb253497

[PATCH 0/8] iommu: Convert dart & iommufd to the new domain_alloc_paging()

2023-09-22 Thread Jason Gunthorpe
n.c:.domain_alloc = fsl_pamu_domain_alloc, drivers/iommu/intel/iommu.c:.domain_alloc = intel_iommu_domain_alloc, drivers/iommu/virtio-iommu.c: .domain_alloc = viommu_domain_alloc, The follows the "Make default_domain's mandatory" series Jason Gunthorpe

[PATCH rc] kvm: Prevent compiling virt/kvm/vfio.c unless VFIO is selected

2023-09-20 Thread Jason Gunthorpe
/202309030741.82alacdg-...@intel.com/ Closes: https://lore.kernel.org/oe-kbuild-all/202309110914.qlh0lu6l-...@intel.com/ Cc: Nick Desaulniers Fixes: c1cce6d079b8 ("vfio: Compile vfio_group infrastructure optionally") Signed-off-by: Jason Gunthorpe --- arch/arm64/kvm/Kconfig | 2 +-

  1   2   3   4   5   6   >