linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jerry Snitselaar <jsnitsel@redhat.com>
To: John Garry <john.garry@huawei.com>
Cc: robin.murphy@arm.com, joro@8bytes.org, will@kernel.org,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
	linuxarm@huawei.com
Subject: Re: [PATCH v2 2/2] iova: Remove magazine BUG_ON() checks
Date: Mon, 5 Sep 2022 08:06:30 -0700	[thread overview]
Message-ID: <20220905150630.boe7zy2nwcgb5jb6@cantor> (raw)
In-Reply-To: <1662369083-238529-3-git-send-email-john.garry@huawei.com>

On Mon, Sep 05, 2022 at 05:11:23PM +0800, John Garry wrote:
> Two of the magazine helpers have BUG_ON() checks, as follows:
> - iova_magazine_pop() - here we ensure that the mag is not empty. However we
>   already ensure that in the only caller, __iova_rcache_get().
> - iova_magazine_push() - here we ensure that the mag is not full. However
>   we already ensure that in the only caller, __iova_rcache_insert().
> 
> As described, the two bug checks are pointless so drop them.
> 
> Signed-off-by: John Garry <john.garry@huawei.com>
> Acked-by: Robin Murphy <robin.murphy@arm.com>

Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com

> ---
>  drivers/iommu/iova.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c
> index 580fdf669922..8aece052ce72 100644
> --- a/drivers/iommu/iova.c
> +++ b/drivers/iommu/iova.c
> @@ -694,8 +694,6 @@ static unsigned long iova_magazine_pop(struct iova_magazine *mag,
>  	int i;
>  	unsigned long pfn;
>  
> -	BUG_ON(iova_magazine_empty(mag));
> -
>  	/* Only fall back to the rbtree if we have no suitable pfns at all */
>  	for (i = mag->size - 1; mag->pfns[i] > limit_pfn; i--)
>  		if (i == 0)
> @@ -710,8 +708,6 @@ static unsigned long iova_magazine_pop(struct iova_magazine *mag,
>  
>  static void iova_magazine_push(struct iova_magazine *mag, unsigned long pfn)
>  {
> -	BUG_ON(iova_magazine_full(mag));
> -
>  	mag->pfns[mag->size++] = pfn;
>  }
>  
> -- 
> 2.35.3
> 


      reply	other threads:[~2022-09-05 15:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-05  9:11 [PATCH v2 0/2] iova: Some misc changes John Garry
2022-09-05  9:11 ` [PATCH v2 1/2] iova: Remove some magazine pointer NULL checks John Garry
2022-09-05 15:06   ` Jerry Snitselaar
2022-09-06  9:28   ` Ethan Zhao
2022-09-06 10:50     ` John Garry
2022-09-06 13:37       ` Robin Murphy
2022-09-06 17:36         ` John Garry
2022-09-06 18:25           ` Robin Murphy
2022-09-07  8:46             ` John Garry
2022-09-07  9:05               ` Robin Murphy
2022-09-07  9:58               ` Ethan Zhao
2022-09-07 10:10                 ` John Garry
2022-09-07  9:33       ` Ethan Zhao
2022-09-07  9:53         ` John Garry
2022-09-05  9:11 ` [PATCH v2 2/2] iova: Remove magazine BUG_ON() checks John Garry
2022-09-05 15:06   ` Jerry Snitselaar [this message]

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=20220905150630.boe7zy2nwcgb5jb6@cantor \
    --to=jsnitsel@redhat.com \
    --cc=iommu@lists.linux.dev \
    --cc=john.garry@huawei.com \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.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;
as well as URLs for NNTP newsgroup(s).