Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp1908656rwn; Fri, 16 Sep 2022 02:43:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6A/9NdnlngWTMZwA7R6YbQb/X3LUOsutYhsgSezDLCU2TI5S1MWblKEbgBAHFVoU0iWVB9 X-Received: by 2002:a17:902:ef87:b0:177:ef8c:efb5 with SMTP id iz7-20020a170902ef8700b00177ef8cefb5mr3857665plb.33.1663321435089; Fri, 16 Sep 2022 02:43:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663321435; cv=none; d=google.com; s=arc-20160816; b=dbNgxYLIIHM7OqL5QOUkfySMBLoWy4r37biuUMfM2vT+jBOMcBWm5wJzI+SVCcGkRn dyUtPfB9mxPeO88lGG4CJWMWTWdRkr40Wzif9Ch1qZpsjnis4kXQmmgcTjv+h1BFwH5/ R/3ML2i9Qs3BIUmZ8aw2P05l8NXON2g+i/qIIMrQQaKpCzloHIXr4K3pz4e2LEoFHJ3O h6aucdrXpBzn45TIdmLzZV7qnVWi33nZzJWR32OsEGZQQwVvRgMFcqfrssc1bglpJIrA ali6DWPVLP4rAaRg/wYieJwX6voI+GP9tcQ84ZVMgNW+3U7cOfEF9dEa1h8HO+679gsz iIXQ== 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=9wZPawSXwxgQ+iVQWTrfWH7nZJmRWevQZshYM7aZW90=; b=lDhhWbBkSm8qKnVjrOmzLor75+X8WNqIaswQspZFg05QN0VczKYkQz05E+ffcv6dlD x7rBsvA40iFbGKo3ACvhoLJR4z7VM/52gWvO6vOAeJc0PPY/4dMhVqR32/75IDu3wv6s jijofd71b/4d6TUc5b7S1l06Jd8YWCDbC2nrH8PtoHHvHuPe32NiqBw6OHWf3357QxLE AApWdeAUINKzRjm4qrOzr5QwgGyQfi2nWkMQqDZxB6+LeFNTBHhsOZ+DU6Q3HrPPochn vxK0wNVaMXh5F9OriWueN5iULHDx9HL7mJkhGPl0/HopGujOprD20vv212lpj7m2RXWD zeLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c19-20020a056a000ad300b0052ea6666960si21692300pfl.337.2022.09.16.02.43.40; Fri, 16 Sep 2022 02:43:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230107AbiIPJlU (ORCPT + 99 others); Fri, 16 Sep 2022 05:41:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229629AbiIPJlS (ORCPT ); Fri, 16 Sep 2022 05:41:18 -0400 Received: from fornost.hmeau.com (helcar.hmeau.com [216.24.177.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C035A6C52 for ; Fri, 16 Sep 2022 02:41:17 -0700 (PDT) Received: from gwarestrin.arnor.me.apana.org.au ([192.168.103.7]) by fornost.hmeau.com with smtp (Exim 4.94.2 #2 (Debian)) id 1oZ7qR-005FNV-9l; Fri, 16 Sep 2022 19:41:12 +1000 Received: by gwarestrin.arnor.me.apana.org.au (sSMTP sendmail emulation); Fri, 16 Sep 2022 17:41:11 +0800 Date: Fri, 16 Sep 2022 17:41:11 +0800 From: Herbert Xu To: Giovanni Cabiddu Cc: linux-crypto@vger.kernel.org, qat-linux@intel.com, Vlad Dronov , Wojciech Ziemba , Adam Guerin Subject: Re: [PATCH 8/9] crypto: qat - expose deflate through acomp api for QAT GEN2 Message-ID: References: <20220818180120.63452-1-giovanni.cabiddu@intel.com> <20220818180120.63452-9-giovanni.cabiddu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS 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-crypto@vger.kernel.org On Thu, Sep 15, 2022 at 02:09:11PM +0100, Giovanni Cabiddu wrote: > > > Here's a suggestion. Start with whatever value you want (e.g., > > src * 2), attempt the decompression, if it fails because the > > space is to small, then double it and retry the operation. > > I prototyped the solution you proposed and it introduces complexity, > still doesn't fully solve the problem and it is not performant. See > below*. I don't understand how it can be worse than your existing patch. I'm suggesting that you start with your current estimate, and only fallback to allocating a bigger buffer in case that overflows. So it should be exactly the same as your current patch as the fallback path would only activate in cases where your patch would have failed anyway. > We propose instead to match the destination buffer size used in scomp > for the NULL pointer use case, i.e. 128KB: > https://elixir.bootlin.com/linux/v6.0-rc5/source/include/crypto/internal/scompress.h#L13 > Since the are no users of acomp with this use-case in the kernel, we > believe this will be sufficient. Once we start imposing arbitrary limits in the driver, then users will forever be burdened with this. So that's why I want to avoid adding such limits. The whole point of having this feature in the acomp API is to avoid having users such as ipcomp preallocate huge buffers for the unlikely case of an exceptionally large decompressed result. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt