Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp5754724rwb; Wed, 7 Sep 2022 07:33:57 -0700 (PDT) X-Google-Smtp-Source: AA6agR6If5IFstyjahCxcvrB2kQPP/xnU5fhmqRG1phq28uJ0R/uIizRhY5K8pyCqVoiib1balvL X-Received: by 2002:a17:903:41ce:b0:175:2565:9ddb with SMTP id u14-20020a17090341ce00b0017525659ddbmr3984142ple.161.1662561237436; Wed, 07 Sep 2022 07:33:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662561237; cv=none; d=google.com; s=arc-20160816; b=gJbHE/7Iq8me7vwjHeQ5gcMW5Nl+BDcX/ljX/REoZvtCfnunDqRC/ZatVgV56tmNDr nkTspUp73gOiRo1j00OqWFHiU3v/gRZeiUfvi3dfC0vNaAFnmyx7nO93l0X6oKwzPbTo /vvZxqD/jqT+H/U5Ee053JBaeRJOisyoaiMBc2ni3Xx1s7vBDM02o1BzN0/1Pi1y7oEf 7nNMP7c8KSwk+tA41ah/JZjMhMZl35nUSV6qF2VEtVmALAnWkiWP1JfJP50fBQvP10Y/ zpJXIxDrg9ektv3ALdzC0myl9XvcubhYMWhiLByMC4OIG11j45SnHWCjriY2K+2Urf2+ ghoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=TvEIpbZtZRJzsD+N6PTxdxO2dd9cYEo85SKXJYufkT0=; b=pgyrKBNue18z9yf8LbTZciFwmIgXJ9Gp5Pd1N2aSFSNIzOp515JPyhq4xFRa9RvL4M qmq/XrBmEH6sUx228T9R6bADgaijFThTE0af175Bp1Qkql5PQbpvAu+9whp4jot99hNl sm36Z9O4hwh5uMachpVQeWqjlTr875LFaIQ05D30dC6atgd/uJO16cTyh30Z/NFp6nyR r83FQKqpB6XyxX42phHj4PXFkDYORpMeZlzKlC1RodOSaP+OK7G9Qfl7QvtrlTV2+OD8 LsAjOTViVnzcQbKOXTRh6Srr9FlcFkHj6xCvn0k9vPjgN1iLHIJuDiBS2Zj+AOmQmBJ2 AfiA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h18-20020a63f912000000b0041bdf3cfd7dsi3193904pgi.565.2022.09.07.07.33.45; Wed, 07 Sep 2022 07:33:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229512AbiIGNnq (ORCPT + 99 others); Wed, 7 Sep 2022 09:43:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229847AbiIGNnN (ORCPT ); Wed, 7 Sep 2022 09:43:13 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 816C5A1D73 for ; Wed, 7 Sep 2022 06:41:58 -0700 (PDT) Received: from fraeml704-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MN3L33G1tz688nD; Wed, 7 Sep 2022 21:40:43 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml704-chm.china.huawei.com (10.206.15.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.31; Wed, 7 Sep 2022 15:41:25 +0200 Received: from localhost.localdomain (10.69.192.58) by lhrpeml500003.china.huawei.com (7.191.162.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 7 Sep 2022 14:41:23 +0100 From: John Garry To: , , CC: , , , , , John Garry Subject: [PATCH v4 2/3] iova: Remove magazine BUG_ON() checks Date: Wed, 7 Sep 2022 21:34:40 +0800 Message-ID: <1662557681-145906-3-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1662557681-145906-1-git-send-email-john.garry@huawei.com> References: <1662557681-145906-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To lhrpeml500003.china.huawei.com (7.191.162.67) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Acked-by: Robin Murphy Reviewed-by: Jerry Snitselaar --- 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.25.1