Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp4674750rwb; Wed, 17 Aug 2022 04:22:38 -0700 (PDT) X-Google-Smtp-Source: AA6agR7BlIBYqDKhOcLsD4S3OTICHreBiTWXApdJAen1p6jNixD1AoL5Ep7Z9IzQb/Wc7emuGIqS X-Received: by 2002:a17:907:160f:b0:731:55b2:1c1f with SMTP id hb15-20020a170907160f00b0073155b21c1fmr16668305ejc.731.1660735358488; Wed, 17 Aug 2022 04:22:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660735358; cv=none; d=google.com; s=arc-20160816; b=Sptm+jzHSnbfv2gjwgxgTO88yz8diV47/DxeWrMt1nK/dmtR7g92ckh+C9Npfu9BDZ vXBw3daacairsRuNdQwVhGnCyV6hPR6qQtMtdJQd4AXnHAP1L+JM7siTaBs3cPHcmQsN R6UPmUM3gQGb7jcLjBI+42oyPyGr98Sqq6ayOvYvRV5joudHllbkCvwhsx3+k5pPzD2Y eV1OS9hrkq4dqqBeX8dXpoWn4bwH96hmICl8CR1BMflvKhRGl1fAag8IyQVLKPANnINl CuTkl34kMCNBuADarNItxQXgW22j0z9Q6Yo3w+bISyUIQkaRl3pNqKRloy/y7NTuEiw4 RxVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=FqHJk9I6fo9A5iborL4I/8hzh0LVIYbUtHj22jaw2g8=; b=R2v2Gs0V8CKRa0a+Klzd3bU5Hhk/InKa+El54/fipSLzJUPN4o4HgIqFS1TweUw3Qa DMEtkVeN4fLIsrx0za/MjsLPEseI5L+0e1ZBqNBtYo5KxxTLg7+NWvG1fOIyYTonQ7zt lv+6CgOTDatesHQCMmf6pI4qcq8MF+XN1VEO3wGbFFLHiQOCkyXL4Ek65FIEe7lEK76q utAa7ZJRm39Lf+FQ9844SZZZOb+hvhEl1xkuaL9z7cEekeC7928zJuApZFJA4fy0Xtdo spP+JZMLNU/5VocFdrgiEtixY9vuY4xAfCWk+LrRRjDwqjhFK3zyvpaTJ5zjJe0Mbg2M 7ksQ== 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=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eb13-20020a0564020d0d00b00440e4be2c8bsi176544edb.507.2022.08.17.04.22.13; Wed, 17 Aug 2022 04:22:38 -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=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236054AbiHQKgd (ORCPT + 99 others); Wed, 17 Aug 2022 06:36:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232195AbiHQKgb (ORCPT ); Wed, 17 Aug 2022 06:36:31 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 727FC51A33 for ; Wed, 17 Aug 2022 03:36:30 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 06EF7113E; Wed, 17 Aug 2022 03:36:31 -0700 (PDT) Received: from [10.57.13.141] (unknown [10.57.13.141]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 530193F67D; Wed, 17 Aug 2022 03:36:29 -0700 (PDT) Message-ID: <388efa0d-d8b8-a837-b301-ef04ba3d6e4e@arm.com> Date: Wed, 17 Aug 2022 11:36:25 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH 1/3] iova: Remove some magazine pointer NULL checks Content-Language: en-GB To: John Garry , joro@8bytes.org, will@kernel.org Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org References: <1660730984-30333-1-git-send-email-john.garry@huawei.com> <1660730984-30333-2-git-send-email-john.garry@huawei.com> From: Robin Murphy In-Reply-To: <1660730984-30333-2-git-send-email-john.garry@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_NONE,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 On 2022-08-17 11:09, John Garry wrote: > Since commit 32e92d9f6f87 ("iommu/iova: Separate out rcache init") it > has not been possible to have NULL CPU rcache "loaded" or "prev" magazine > pointers. As such, the checks in iova_magazine_full(), > iova_magazine_empty(), and iova_magazine_free_pfns() may be dropped. Reviewed-by: Robin Murphy > Signed-off-by: John Garry > --- > drivers/iommu/iova.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c > index 47d1983dfa2a..580fdf669922 100644 > --- a/drivers/iommu/iova.c > +++ b/drivers/iommu/iova.c > @@ -661,9 +661,6 @@ iova_magazine_free_pfns(struct iova_magazine *mag, struct iova_domain *iovad) > unsigned long flags; > int i; > > - if (!mag) > - return; > - > spin_lock_irqsave(&iovad->iova_rbtree_lock, flags); > > for (i = 0 ; i < mag->size; ++i) { > @@ -683,12 +680,12 @@ iova_magazine_free_pfns(struct iova_magazine *mag, struct iova_domain *iovad) > > static bool iova_magazine_full(struct iova_magazine *mag) > { > - return (mag && mag->size == IOVA_MAG_SIZE); > + return mag->size == IOVA_MAG_SIZE; > } > > static bool iova_magazine_empty(struct iova_magazine *mag) > { > - return (!mag || mag->size == 0); > + return mag->size == 0; > } > > static unsigned long iova_magazine_pop(struct iova_magazine *mag,