Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp2871201rwb; Mon, 5 Sep 2022 02:56:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR7nCKU962bdFMwQYkCjwgIweW4k2hypkKU7r9kAY5p48BzgiFFL/Q87X4k5UBTp1QgL0XO6 X-Received: by 2002:a62:ed08:0:b0:537:17a6:57aa with SMTP id u8-20020a62ed08000000b0053717a657aamr49842174pfh.6.1662371801878; Mon, 05 Sep 2022 02:56:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662371801; cv=none; d=google.com; s=arc-20160816; b=fpnKdlrClGIv7eDz+SQ5T0f2CKQj2PBzI0H72YjAU7wQ7o1DaHhcthCRRQgZJ2vgef slHZhG6dNl58el3kuYyI+vhoUdZlggW42LR/940aDUrf+APduDvjSxKLf8xVNqSiKbpp hjGMM3Qb0k4OTg5xDOMZNRUAwtG8F1QwGNi5NqjHinS5oENUK7WjNRAsOFPOThArKkEZ 12MdCG29L0lDpWlSrAYIsbN6lcf2LnGK2bw1DRcvyp92VYJlYxmdCh9BPiZO7BnaQa8l Nfm1caGofbv0ZNMUJaloy8zP4FxhwM7hihHPCNQp15wNCI7EwGxVPhKnEORyoupPgKH9 moQQ== 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=UxKMQdrzoJ+j1RwrAJyZe8PAHJVCau1UlVJhEP/KbIo=; b=TwOfoWW1OjSrpsMrdi43g0jRIzRxWRWxjkzl6VaUmkxmX8QH78VQk3rZyih+cixl+o a7lOuEY5bUSyfkLGl01iZ8A7habN+7NJ3gFJt6PIndstKzvGYqoHLsO9jwOKOpfDKNtB 3V8hlQ4CmQP5w/hnytRdbcZrGlziXXu17KPvoGPm7A9d1fB04iEOS7Hkf59wijHF5fay vG/AjKJSaWn8y7YT/sgolQn4IqDBXrI1d06f2Vor2RZ1JcimFtugZxvYvlO5FeKH1vKV frk5DoUZbGNyZBxrnN0xDvUg9JbEiVfCTy2xvFZbXuVXY5/FtDqGEXLyY+ziFKYiZlxA mvEQ== 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 k10-20020aa79d0a000000b00536c90581f9si9292403pfp.150.2022.09.05.02.56.30; Mon, 05 Sep 2022 02:56:41 -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 S237379AbiIEJR7 (ORCPT + 99 others); Mon, 5 Sep 2022 05:17:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237150AbiIEJR5 (ORCPT ); Mon, 5 Sep 2022 05:17:57 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17FEE3D589 for ; Mon, 5 Sep 2022 02:17:56 -0700 (PDT) Received: from fraeml707-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MLjW76yYLz689NN; Mon, 5 Sep 2022 17:13:55 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml707-chm.china.huawei.com (10.206.15.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 5 Sep 2022 11:17:54 +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; Mon, 5 Sep 2022 10:17:51 +0100 From: John Garry To: , , CC: , , , John Garry Subject: [PATCH v2 2/2] iova: Remove magazine BUG_ON() checks Date: Mon, 5 Sep 2022 17:11:23 +0800 Message-ID: <1662369083-238529-3-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1662369083-238529-1-git-send-email-john.garry@huawei.com> References: <1662369083-238529-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: dggems702-chm.china.huawei.com (10.3.19.179) 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 --- 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