Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp3234486rwb; Mon, 5 Sep 2022 08:21:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR4FF2XAdtBwgIjt7x9HOpTDa+qouomnEVtnw2hubeCP5BXeHJ8ag1uJu3YEnD9vUc3TU+DP X-Received: by 2002:a05:6402:50d4:b0:448:c43f:2ee1 with SMTP id h20-20020a05640250d400b00448c43f2ee1mr26929388edb.185.1662391307728; Mon, 05 Sep 2022 08:21:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662391307; cv=none; d=google.com; s=arc-20160816; b=GOfJDaMXhdlFJPVQlT+zN+bZK9poqyAzn6jk6NEILY+1I4ac73fLVDEvlu7YlS5CeS q/XD9ubAzRygFPXlQn1Pq0xiMnU6YB4/2dqET97t8iM+uju+X8hOCqfo2tsAX2yAF9MT j1jbXNHqOxgP0cArK/LAm71JmZbtRWU9eGIsV6UD3a3MMrVJFMQ5eESYQn2t/FKWCnLZ Fl8R3Jz3x+EAetyz52YP/BcWfF/WzlMgB3MEDqB3MjwiUMVvVDLHVUTgCSldeRE9TqPp dKxmcyAyFr0sK2uFqQbgMRCb+KunddlfKETVHUeJ6bG0hoCP2pRU39gS9sgVWsGL8Grx pudQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=dgfFwixXVehi1PSvEZVFU5vKRx86AcuJqWkFha0PYcg=; b=Oe6nYpeuJqCUk1903c5UrmT9kUXRxj2kqXrBnPATMqm5q3/8FuZ42h+gClBlAn4Acg 49AsK641mTUvEKZwvVev9463u/R9PCFRW20irLMzW2yKH4KCPO/BDSl0kIc9K7v0ovVc ERE+yh25XDrm3COR9dbrFEeocoKSfqqVs0anByUcWCnV63BV342NlI21TZsln7ORMnlU 37mcd6sCMMVKQOfsXtuuEYxrL5Zf3+eI7lkxLrN2j6+wPfxzg8/cP/8znJq+oFxr1d+u UiV+JpQEJvkye3+dwt/zKXLjCBQiZvrmWJUNCV2GpTwNbosQkXSQ9vNvSv364PFQDqfT lfQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="gunWS/hJ"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hd42-20020a17090796aa00b0073d6782db80si8747886ejc.599.2022.09.05.08.21.22; Mon, 05 Sep 2022 08:21:47 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="gunWS/hJ"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238584AbiIEPGy (ORCPT + 99 others); Mon, 5 Sep 2022 11:06:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238513AbiIEPGq (ORCPT ); Mon, 5 Sep 2022 11:06:46 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70771357F9 for ; Mon, 5 Sep 2022 08:06:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662390404; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=dgfFwixXVehi1PSvEZVFU5vKRx86AcuJqWkFha0PYcg=; b=gunWS/hJ/UPUi1glXfNGWU86nXA3pWKALEgZ75veQmprh7S4g5yqR7N+rwFPPSMtRyS1i0 dOFt6ecJrPko6FOk0BRf05YdEhCwJtd0ALz/jwfLyzOwQp3JcaARLhQhA+DWm5URHZK1vB Sco3HmqqHPr5WVzrxKSw+Z+CpJhVUHU= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-578-I8SrJWGROD6jbOsjoryd7Q-1; Mon, 05 Sep 2022 11:06:34 -0400 X-MC-Unique: I8SrJWGROD6jbOsjoryd7Q-1 Received: by mail-qk1-f199.google.com with SMTP id bk21-20020a05620a1a1500b006be9f844c59so7035670qkb.9 for ; Mon, 05 Sep 2022 08:06:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=dgfFwixXVehi1PSvEZVFU5vKRx86AcuJqWkFha0PYcg=; b=spGIeKXailPToqnsuPLh20XPgoJxYIcGyxah+Ys7dhQ9MIpHiYslBXxMeM9wh1MqM6 9VGAhbhne3TPcwPqbFkVTFzsK93+t+tzZ09uC0LwOgKEanI4jLzy6rWTePPrLYyx9wLl TsRM/6Z1hblB/eUoXVkO4aL7Qinx0Cs0/JaCNXFNLdsAShNEpBGI9u1O71KzStW7Ycqg sRLAK2L7D+xqfk4lsFEC57ppLL6kYNC7+pVvR/H6IAbFV+P1RbT5l9dFAd/npAly3Y4L /2WD44iIi5R1+ngzXJyL2v9MI04ozfauLqoe+Nwl8OioggbXJbZ7d1F2DkAIkbV6Pr9n xKeA== X-Gm-Message-State: ACgBeo1PRsbLQPeCEGogWM9IkxuaDb79cTGYuYzmfWZlLNBlw9ghfxC1 7uOGdxLagkILJDlzjvRmX/BeasELLb40gOtfi1cSDBgMK8YginDTXSYByQ9c8zmpiSpdBAhzMhb cxb97rZkVB1Z9grgXuqZGbXdO X-Received: by 2002:a37:a02:0:b0:6bb:17af:a8e6 with SMTP id 2-20020a370a02000000b006bb17afa8e6mr32109761qkk.80.1662390393319; Mon, 05 Sep 2022 08:06:33 -0700 (PDT) X-Received: by 2002:a37:a02:0:b0:6bb:17af:a8e6 with SMTP id 2-20020a370a02000000b006bb17afa8e6mr32109742qkk.80.1662390393051; Mon, 05 Sep 2022 08:06:33 -0700 (PDT) Received: from localhost (ip98-179-76-75.ph.ph.cox.net. [98.179.76.75]) by smtp.gmail.com with ESMTPSA id b5-20020ac812c5000000b00344883d3ef8sm7135554qtj.84.2022.09.05.08.06.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 08:06:32 -0700 (PDT) Date: Mon, 5 Sep 2022 08:06:30 -0700 From: Jerry Snitselaar To: John Garry 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 Message-ID: <20220905150630.boe7zy2nwcgb5jb6@cantor> References: <1662369083-238529-1-git-send-email-john.garry@huawei.com> <1662369083-238529-3-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1662369083-238529-3-git-send-email-john.garry@huawei.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 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 > 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.35.3 >