[PATCH kernel 05/15] powerpc/iommu: Stop using @current in mm_iommu_xxx

Michael Ellerman mpe at ellerman.id.au
Fri Aug 5 17:00:34 AEST 2016

Alexey Kardashevskiy <aik at ozlabs.ru> writes:

> In some situations the userspace memory context may live longer than
> the userspace process itself so if we need to do proper memory context
> cleanup, we better cache @mm and use it later when the process is gone
> (@current or @current->mm are NULL).
> This changes mm_iommu_xxx API to receive mm_struct instead of using one
> from @current.
> This is needed by the following patch to do proper cleanup in time.
> This depends on "powerpc/powernv/ioda: Fix endianness when reading TCEs"
> to do proper cleanup via tce_iommu_clear() patch.
> To keep API consistent, this replaces mm_context_t with mm_struct;
> we stick to mm_struct as mm_iommu_adjust_locked_vm() helper needs
> access to &mm->mmap_sem.
> This should cause no behavioral change.

Is this a theoretical bug, or do we hit it in practice?

In other words, should I merge this as a fix for 4.8, or can it wait for
4.9 with the rest of the series?

> Signed-off-by: Alexey Kardashevskiy <aik at ozlabs.ru>
> ---
>  arch/powerpc/include/asm/mmu_context.h | 20 +++++++------
>  arch/powerpc/kernel/setup-common.c     |  2 +-
>  arch/powerpc/mm/mmu_context_book3s64.c |  4 +--
>  arch/powerpc/mm/mmu_context_iommu.c    | 54 ++++++++++++++--------------------

>  drivers/vfio/vfio_iommu_spapr_tce.c    | 41 ++++++++++++++++----------

I'd need an ACK from Alex for that part.


More information about the Linuxppc-dev mailing list