mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
To: Jacob Pan <jacob.jun.pan@linux.intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	iommu@lists.linux.dev, Jason Gunthorpe <jgg@nvidia.com>,
	Lu Baolu <baolu.lu@linux.intel.com>,
	Joerg Roedel <joro@8bytes.org>,
	Jean-Philippe Brucker <jean-philippe@linaro.com>,
	Robin Murphy <robin.murphy@arm.com>,
	Will Deacon <will@kernel.org>,
	David Woodhouse <dwmw2@infradead.org>,
	Raj Ashok <ashok.raj@intel.com>,
	"Tian, Kevin" <kevin.tian@intel.com>, Yi Liu <yi.l.liu@intel.com>
Subject: Re: [PATCH v2 2/3] iommu/sva: Stop using ioasid_set for SVA
Date: Fri, 24 Feb 2023 17:44:32 +0000	[thread overview]
Message-ID: <Y/j3gO1GsqS6svhO@myrica> (raw)
In-Reply-To: <20230215133651.776a1553@jacob-builder>

On Wed, Feb 15, 2023 at 01:36:51PM -0800, Jacob Pan wrote:
> > > -	pasid = ioasid_alloc(&iommu_sva_pasid, min, max, mm);
> > > -	if (!pasid_valid(pasid))
> > > -		ret = -ENOMEM;
> > > -	else
> > > -		mm_pasid_set(mm, pasid);
> > > +	ret = ida_alloc_range(&iommu_global_pasid_ida, min, max,
> > > GFP_KERNEL);
> > > +	if (ret < min)  
> > 
> > Just check ret < 0
> yes, but i thought < min is safe too. 

It is, but 'ret < 0' is the standard used everywhere else. So someone
reading this code will stop and spend time trying to figure out why this
isn't 'ret < 0', wonder what's special here, inspect the ida_alloc_range()
doc, etc. No big deal, but I think it's unnecessary.

Thanks,
Jean

  reply	other threads:[~2023-02-24 17:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-14  6:44 [PATCH v2 0/3] Remove VT-d virtual command interface and IOASID Jacob Pan
2023-02-14  6:44 ` [PATCH v2 1/3] iommu/vt-d: Remove virtual command interface Jacob Pan
2023-02-14 11:26   ` Baolu Lu
2023-02-14  6:44 ` [PATCH v2 2/3] iommu/sva: Stop using ioasid_set for SVA Jacob Pan
2023-02-14  9:39   ` Jean-Philippe Brucker
2023-02-15 21:36     ` Jacob Pan
2023-02-24 17:44       ` Jean-Philippe Brucker [this message]
2023-02-15  3:24   ` Tian, Kevin
2023-02-15 18:38     ` Jacob Pan
2023-02-15 18:46       ` Jason Gunthorpe
2023-02-14  6:44 ` [PATCH v2 3/3] iommu: Remove ioasid infrastructure Jacob Pan
2023-02-14  9:32   ` Jean-Philippe Brucker
2023-02-14 13:06     ` Jason Gunthorpe
2023-02-14 17:31       ` Jacob Pan
2023-02-14 17:57         ` Jason Gunthorpe
2023-02-14 21:33           ` Jacob Pan
2023-02-15 12:49             ` Jason Gunthorpe
2023-02-14 17:04     ` Jacob Pan
2023-02-15  3:27       ` Tian, Kevin

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=Y/j3gO1GsqS6svhO@myrica \
    --to=jean-philippe@linaro.org \
    --cc=ashok.raj@intel.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux.dev \
    --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=robin.murphy@arm.com \
    --cc=will@kernel.org \
    --cc=yi.l.liu@intel.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

all inboxes | Powered by JetHome®