From: Christoph Hellwig <hch@infradead.org>
To: Jacob Pan <jacob.jun.pan@linux.intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
iommu@lists.linux-foundation.org, Joerg Roedel <joro@8bytes.org>,
Lu Baolu <baolu.lu@linux.intel.com>,
Jean-Philippe Brucker <jean-philippe@linaro.com>,
"Tian, Kevin" <kevin.tian@intel.com>,
Dave Jiang <dave.jiang@intel.com>,
Raj Ashok <ashok.raj@intel.com>,
vkoul@kernel.org, Jason Gunthorpe <jgg@nvidia.com>,
zhangfei.gao@linaro.org
Subject: Re: [PATCH v2 2/2] iommu/sva: Remove mm parameter from SVA bind API
Date: Thu, 15 Apr 2021 07:44:59 +0100 [thread overview]
Message-ID: <20210415064459.GB1938497@infradead.org> (raw)
In-Reply-To: <1618414077-28808-3-git-send-email-jacob.jun.pan@linux.intel.com>
> *
> * Returns 0 on success and < 0 on error.
> @@ -28,6 +28,9 @@ int iommu_sva_alloc_pasid(struct mm_struct *mm, ioasid_t min, ioasid_t max)
> int ret = 0;
> ioasid_t pasid;
>
> + if (mm != current->mm)
> + return -EINVAL;
> +
Why not remove the parameter entirely?
> @@ -2989,8 +2990,11 @@ iommu_sva_bind_device(struct device *dev, struct mm_struct *mm, unsigned int fla
> return ERR_PTR(-ENODEV);
>
> /* Supervisor SVA does not need the current mm */
> - if ((flags & IOMMU_SVA_BIND_SUPERVISOR) && mm)
> - return ERR_PTR(-EINVAL);
> + if (!(flags & IOMMU_SVA_BIND_SUPERVISOR)) {
> + mm = get_task_mm(current);
> + if (!mm)
> + return ERR_PTR(-EINVAL);
> + }
I don't see why we need the reference. I think we should just stop
passing the mm to ->sva_bind and let the low-level driver deal with
any reference to current->mm where needed.
next prev parent reply other threads:[~2021-04-15 6:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-14 15:27 [PATCH v2 0/2] Simplify and restrict IOMMU SVA APIs Jacob Pan
2021-04-14 15:27 ` [PATCH v2 1/2] iommu/sva: Tighten SVA bind API with explicit flags Jacob Pan
2021-04-15 6:40 ` Christoph Hellwig
2021-04-15 18:53 ` Jacob Pan
2021-04-14 15:27 ` [PATCH v2 2/2] iommu/sva: Remove mm parameter from SVA bind API Jacob Pan
2021-04-15 6:44 ` Christoph Hellwig [this message]
2021-04-15 21:18 ` Jacob Pan
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=20210415064459.GB1938497@infradead.org \
--to=hch@infradead.org \
--cc=ashok.raj@intel.com \
--cc=baolu.lu@linux.intel.com \
--cc=dave.jiang@intel.com \
--cc=iommu@lists.linux-foundation.org \
--cc=jacob.jun.pan@linux.intel.com \
--cc=jean-philippe@linaro.com \
--cc=jgg@nvidia.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=vkoul@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®