Linux IOMMU Development
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Steven Sistare <steven.sistare@oracle.com>
Cc: iommu@lists.linux.dev, Kevin Tian <kevin.tian@intel.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	Cornelia Huck <cohuck@redhat.com>
Subject: Re: [PATCH V2 3/4] iommufd: Add IOMMU_IOAS_CHANGE_PROCESS
Date: Fri, 4 Oct 2024 17:20:39 -0300	[thread overview]
Message-ID: <20241004202039.GL1365916@nvidia.com> (raw)
In-Reply-To: <c5d6690f-e743-4a69-9b83-20d5515feb2e@oracle.com>

On Fri, Oct 04, 2024 at 03:43:32PM -0400, Steven Sistare wrote:
> On 10/2/2024 1:51 PM, Jason Gunthorpe wrote:
> > On Thu, Sep 26, 2024 at 06:53:47AM -0700, Steve Sistare wrote:
> > 
> > > +static int charge_current(unsigned long *npinned)
> > > +{
> > > +	struct iopt_pages tmp = {
> > > +		.source_mm = current->mm,
> > > +		.source_task = current->group_leader,
> > > +		.source_user = current_user(),
> > > +	};
> > > +	unsigned int account_mode;
> > > +	int rc;
> > 
> > This seems like it needs a bit more protection, we shouldn't be
> > touching pages that are not set to current otherwise it will corrupt
> > the counts during the uncharge?
> > 
> > Maybe the whole operation should fail if any areas are not owned by
> > this process?
> 
> I don't follow.  In a typical scenario, none of the areas are owned by the
> current process when IOMMU_IOAS_CHANGE_PROCESS is called.

Oh I see, I didn't quite remember this all correctly. It is OK then,
you are taking ownership of all ares to the current process and it
does correctly de-account for any prior area owner.

> be more efficient, albeit in a less traveled error path.  I'll add it for
> symmetry.

Yeah symmetry.

Jason

  reply	other threads:[~2024-10-04 20:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-26 13:53 [PATCH V2 0/4] iommufd live update Steve Sistare
2024-09-26 13:53 ` [PATCH V2 1/4] iommufd: Export do_update_pinned Steve Sistare
2024-10-02 17:34   ` Jason Gunthorpe
2024-09-26 13:53 ` [PATCH V2 2/4] iommufd: Lock all objects Steve Sistare
2024-10-07 16:18   ` Steven Sistare
2024-10-07 16:43     ` Jason Gunthorpe
2024-09-26 13:53 ` [PATCH V2 3/4] iommufd: Add IOMMU_IOAS_CHANGE_PROCESS Steve Sistare
2024-10-02 17:51   ` Jason Gunthorpe
2024-10-04 19:43     ` Steven Sistare
2024-10-04 20:20       ` Jason Gunthorpe [this message]
2024-09-26 13:53 ` [PATCH V2 4/4] iommufd: IOMMU_IOAS_CHANGE_PROCESS selftest Steve Sistare
2024-10-07 16:05   ` Steven Sistare
2024-10-07 16:56     ` 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=20241004202039.GL1365916@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=alex.williamson@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=iommu@lists.linux.dev \
    --cc=kevin.tian@intel.com \
    --cc=steven.sistare@oracle.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox