Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp4619743rwb; Wed, 17 Aug 2022 03:20:29 -0700 (PDT) X-Google-Smtp-Source: AA6agR6ox6VLp3gs/mHNCOCb5otIfZ1inH6bPZAWcJF7G3Hj90N7NOIobqXswjA+r180JTO1j+OZ X-Received: by 2002:a05:6a00:1c87:b0:52d:cf00:84de with SMTP id y7-20020a056a001c8700b0052dcf0084demr25064885pfw.38.1660731629759; Wed, 17 Aug 2022 03:20:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660731629; cv=none; d=google.com; s=arc-20160816; b=nFw/0PzBLgqj/tzagretWPEolbARo+T03CB+Vos9dUYwI+nqyySPSrL3wa/wXcb2tf msMryz4fYmUBvXDY8Y6rc+QFRKSTNCXLOV/OrXOvwo9dfmdmWrRxV+JT1vz0WFYuXmTC 4XyT5aJaXk0nHR84hxHU85FOTZErlO7iEx0ynNObRdgtkRqvRq6IqLkMwODs/vRCycXP 4xnKE+WhkAaIrtOa4tcdmeperCdHkvEerAgBp61IRnVH3ArbQZPAlBcISQ913Ec9iCD3 9t0SNpKyCngyy6I5xDaMFKK4B0OoRYyDYw4X86bK/xrSD29XOAraC0IXkiU7GNWNsEzO wBZg== 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=tDTv3vZnR9/PvaAjnBRirZEX7Fr+/0sZsRYtaHvjniQ=; b=YEO+WCB46o9YJvu5z5TccJbbmh8VfswBpC+mWlX/pRLO7OJTmw8JWU4IgFEuH3hdpK qvYtlvHrtvUSQqhh5giCiJv0bvUhSW2KNeW0gcBgWDNlKmAKKb/xV9FGe7UWTRFvfCXk 6NcBbMotIPId+EaV3mjx/3CqBO8vEsUOyfvI6g+Re3dQlRxbRoazMML0AOZouuGkjCWg oIack4XYz6Le5kaNAavZGFvRXZ6K6QoNqhMpk1wrXaCNKds8T+9j9O/+uBCWtfaWtduY /CRVRJ0oxR/QideML2FiHUcHYpSCFimX9aLsBHwyC+dB1i4OmR5F4Xmqw6A9wEYhMs3P mMqA== 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 p12-20020a170902e74c00b0016a6381f70esi1266360plf.42.2022.08.17.03.20.19; Wed, 17 Aug 2022 03:20:29 -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 S235233AbiHQKQV (ORCPT + 99 others); Wed, 17 Aug 2022 06:16:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229627AbiHQKQP (ORCPT ); Wed, 17 Aug 2022 06:16:15 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43B7E54CB2 for ; Wed, 17 Aug 2022 03:16:15 -0700 (PDT) Received: from fraeml744-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4M73nW64MGz67NYP; Wed, 17 Aug 2022 18:15:59 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml744-chm.china.huawei.com (10.206.15.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 17 Aug 2022 12:16:13 +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.24; Wed, 17 Aug 2022 11:16:11 +0100 From: John Garry To: , , CC: , , John Garry Subject: [PATCH 2/3] iova: Remove magazine BUG_ON() checks Date: Wed, 17 Aug 2022 18:09:43 +0800 Message-ID: <1660730984-30333-3-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1660730984-30333-1-git-send-email-john.garry@huawei.com> References: <1660730984-30333-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 --- 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