All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Fenghua Yu <fenghua.yu@intel.com>
Cc: Jean-Philippe Brucker <jean-philippe@linaro.org>,
	arnd@arndb.de, gregkh@linuxfoundation.org,
	iommu@lists.linux-foundation.org, zhangfei.gao@linaro.org,
	linux-accelerators@lists.ozlabs.org
Subject: Re: [PATCH 0/2] iommu: Remove iommu_sva_ops::mm_exit()
Date: Thu, 9 Apr 2020 09:12:29 -0300	[thread overview]
Message-ID: <20200409121229.GF11886@ziepe.ca> (raw)
In-Reply-To: <20200408234901.GA209499@romley-ivt3.sc.intel.com>

On Wed, Apr 08, 2020 at 04:49:01PM -0700, Fenghua Yu wrote:

> > > Isn't the idea of mmu_notifier is to avoid holding the mm reference and
> > > rely on the notifier to tell us when mm is going away?
> > 
> > The notifier only holds a mmgrab(), not a mmget() - this allows
> > exit_mmap to proceed, but the mm_struct memory remains.
> > 
> > This is also probably why it is a bad idea to tie the lifetime of
> > something like a pasid to the mmdrop as a evil user could cause a
> > large number of mm structs to be released but not freed, probably
> > defeating cgroup limits and so forth (not sure)
> 
> The max number of processes can be limited for a user. PASID is per
> address space so the max number of PASID can be limited for the user.
> So the user cannot exhaust PASID so easily, right?

With the patch Jacob pointed to the PASID lifetime is tied to mmdrop,
and I think (but did not check) that the cgroup accounting happens
before mmdrop.

> Binding the PASID to the mm and freeing the PASID in __mmdrop() can get
> ride of the complexity.

This is a much more reasonable explanation and should be in the patch
commit instead of what is there.

However, it still seems unnecessary to reach for arch code - the
singleton notifier can be arranged to live until exit_mmap or fd
release, whichever is longer by putting a mmu_notififer_put() in the
release() method

Jason
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2020-04-09 12:12 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-08 14:04 [PATCH 0/2] iommu: Remove iommu_sva_ops::mm_exit() Jean-Philippe Brucker
2020-04-08 14:04 ` [PATCH 1/2] uacce: Remove mm_exit() op Jean-Philippe Brucker
2020-04-09  9:07   ` Zhangfei Gao
2020-04-09  9:44     ` Jean-Philippe Brucker
2020-04-08 14:04 ` [PATCH 2/2] iommu: Remove iommu_sva_ops::mm_exit() Jean-Philippe Brucker
2020-04-08 18:35 ` [PATCH 0/2] " Jacob Pan
2020-04-08 19:02   ` Jason Gunthorpe
2020-04-08 21:35     ` Jacob Pan
2020-04-08 22:32       ` Jason Gunthorpe
2020-04-08 23:48         ` Jacob Pan
2020-04-09  6:39           ` Jean-Philippe Brucker
2020-04-09 14:14             ` Jacob Pan
2020-04-09 14:25               ` Jason Gunthorpe
2020-04-09 16:21                 ` Jacob Pan
2020-04-09 16:58                   ` Jason Gunthorpe
2020-04-09 14:50               ` Jean-Philippe Brucker
2020-04-09 16:27                 ` Jacob Pan
2020-04-10 15:52                 ` Jacob Pan
2020-04-15  7:47                   ` Jean-Philippe Brucker
2020-04-16 20:58                     ` Jacob Pan
2020-04-20  8:02                       ` Jean-Philippe Brucker
2020-04-09 12:08           ` Jason Gunthorpe
2020-04-09 16:31             ` Jacob Pan
2020-04-08 23:49         ` Fenghua Yu
2020-04-09 12:12           ` Jason Gunthorpe [this message]
2020-04-08 19:04 ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200409121229.GF11886@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=arnd@arndb.de \
    --cc=fenghua.yu@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jean-philippe@linaro.org \
    --cc=linux-accelerators@lists.ozlabs.org \
    --cc=zhangfei.gao@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.