Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1930766pxm; Fri, 4 Mar 2022 06:18:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJyKZ5Yn63R0zQ/Cypsza7QIWpxDSoYQv3nERVR7j0MoB9YwTQfwHEvtQx5Sd8jfSGwYfMhA X-Received: by 2002:a05:6402:f1f:b0:415:d1a3:eb4e with SMTP id i31-20020a0564020f1f00b00415d1a3eb4emr9348841eda.311.1646403533807; Fri, 04 Mar 2022 06:18:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646403533; cv=none; d=google.com; s=arc-20160816; b=aLOl6Kfc0d2G9EOhKNpEGhDd4dNATV6ZhWAtF+5WXEOllGFVLKA2yLR2qX/VrIPB7j ZKia5Gs7bEwOLieBcFb/f1I9qLLSShA6K28EhwiOiS2RiwdJVLj1FQhAydtJ+ES9ZCb/ IZVSKWh3CurIn9MRBo8+WO2KyYDu2crSMGcJe0bFmXpI+Qc4SozdqLztSDAb8mgIRHvY K4fT7M//Ee3noAbI3ceBbZhW5jPYnARtaGfGICmaEBXZesnnYygEzK+EVoC627FFHY4v 56R4HLaDlnJqPF9Rt1q54pcPeGS5MT3wRtBOAbXmnym2mLHysqscO9HjJTwCiPTP1C50 GNvg== 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; bh=Uhnw6XiQCZvzUgVV44RRA0HJRVFFtCKMgObTbq586Mw=; b=uPxGOd5UI3JAc0NeDRHQyB6QTMwGfMqZF0QgjHPGAq6sD8rMbLW7x/91jlTOmHoKob aZ/NREc0Ix5QexJb1IfbgCK7MVXvWxl59p/KqMZpyWRQhDJPDYtAveoIl4ekvaUwMvSl inPpyuh2KQyF0MMR4ucYYOgMyCDkxPVtaC6ItrixBpwSRRLaGbNzKxGYMr14ZsyBCdKF lICqT6tY2a/nFRsJN5erdnVdFFkDIIEV9XV18KTFh7CBY4HZlEgK/IwRZ5lFDVXYIxGe jPFb+oQ//gxfuB4WFHhZFplSNtmFDa/1Tx7+YAQjTo0FqfACwNs6MpTWXeBjZFyM7SjR v4yg== 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=8bytes.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb35-20020a1709071ca300b006d79f3419c3si3804977ejc.417.2022.03.04.06.18.29; Fri, 04 Mar 2022 06:18:53 -0800 (PST) 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=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238926AbiCDJnX (ORCPT + 99 others); Fri, 4 Mar 2022 04:43:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239282AbiCDJmV (ORCPT ); Fri, 4 Mar 2022 04:42:21 -0500 Received: from theia.8bytes.org (8bytes.org [IPv6:2a01:238:4383:600:38bc:a715:4b6d:a889]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A66CC153380 for ; Fri, 4 Mar 2022 01:41:33 -0800 (PST) Received: by theia.8bytes.org (Postfix, from userid 1000) id 4DEE39BF; Fri, 4 Mar 2022 10:41:32 +0100 (CET) Date: Fri, 4 Mar 2022 10:41:31 +0100 From: Joerg Roedel To: Miles Chen Cc: robin.murphy@arm.com, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, will@kernel.org, wsd_upstream@mediatek.com, yf.wang@mediatek.com, stable@vger.kernel.org Subject: Re: [PATCH] iommu/iova: Improve 32-bit free space estimate Message-ID: References: <033815732d83ca73b13c11485ac39336f15c3b40.1646318408.git.robin.murphy@arm.com> <20220303233646.13773-1-miles.chen@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220303233646.13773-1-miles.chen@mediatek.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, 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 On Fri, Mar 04, 2022 at 07:36:46AM +0800, Miles Chen wrote: > Hi Robin, > > > For various reasons based on the allocator behaviour and typical > > use-cases at the time, when the max32_alloc_size optimisation was > > introduced it seemed reasonable to couple the reset of the tracked > > size to the update of cached32_node upon freeing a relevant IOVA. > > However, since subsequent optimisations focused on helping genuine > > 32-bit devices make best use of even more limited address spaces, it > > is now a lot more likely for cached32_node to be anywhere in a "full" > > 32-bit address space, and as such more likely for space to become > > available from IOVAs below that node being freed. > > > > At this point, the short-cut in __cached_rbnode_delete_update() really > > doesn't hold up any more, and we need to fix the logic to reliably > > provide the expected behaviour. We still want cached32_node to only move > > upwards, but we should reset the allocation size if *any* 32-bit space > > has become available. > > > > Reported-by: Yunfei Wang > > Signed-off-by: Robin Murphy > > Would you mind adding: > > Cc: Applied without stable tag for now. If needed, please consider re-sending it for stable when this patch is merged upstream. Regards, Joerg