All of lore.kernel.org
 help / color / mirror / Atom feed
From: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: <linux-crypto@vger.kernel.org>, <qat-linux@intel.com>,
	Vlad Dronov <vdronov@redhat.com>,
	Wojciech Ziemba <wojciech.ziemba@intel.com>,
	"Adam Guerin" <adam.guerin@intel.com>
Subject: Re: [PATCH 8/9] crypto: qat - expose deflate through acomp api for QAT GEN2
Date: Thu, 15 Sep 2022 14:09:11 +0100	[thread overview]
Message-ID: <YyMj9yKMSTC4Iw0s@gcabiddu-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <Yw3TpwuF7a46SZDI@gondor.apana.org.au>

Hi Herbert,

On Tue, Aug 30, 2022 at 05:08:55PM +0800, Herbert Xu wrote:
> On Fri, Aug 26, 2022 at 03:21:15PM +0100, Giovanni Cabiddu wrote:
> >
> > It would be nice if the user of the api could provide a hint for the
> > size of the destination buffer in acomp_req.dlen.
> 
> The whole point of this is that the user has no idea how big
> the result will be.  If anyone would have a clue, it would be
> whoever is doing the decompression.
> 
> Ideally the hardware would take an SG list, dump whatever result
> that fits into it, and then stop the decompression, dump the
> interim state somewhere so that it can be resumed, ask for memory
> from the driver, and then resume the decompression.
> 
> I understand that hardware already exists that cannot perform
> such an incremental process.  In that case we should hide this
> inadequacy in the driver.
> 
> 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*.

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.

Can we go with this solution since we have a user waiting for the acomp
implementation in the qat driver?

*Brief description of the prototyped solution:
When the callback detects an overflow condition on a request with a NULL
destination buffer, it schedules a new workqueue. This is since the
callback is running in the context of a tasklet and we want to avoid
atomic allocations.
The workqueue allocates additional pages for the destination buffer, map
those pages, re-construct the FW destination buffer list and re-send the
request to the device, making sure that the request is actually
enqueued.

Regards,

-- 
Giovanni


  reply	other threads:[~2022-09-15 13:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-18 18:01 [PATCH 0/9] crypto: qat - enable compression deflate algorithm Giovanni Cabiddu
2022-08-18 18:01 ` [PATCH 1/9] crypto: qat - relocate bufferlist logic Giovanni Cabiddu
2022-08-18 18:01 ` [PATCH 2/9] crypto: qat - change bufferlist logic interface Giovanni Cabiddu
2022-08-18 18:01 ` [PATCH 3/9] crypto: qat - generalize crypto request buffers Giovanni Cabiddu
2022-08-18 18:01 ` [PATCH 4/9] crypto: qat - extend buffer list interface Giovanni Cabiddu
2022-08-18 18:01 ` [PATCH 5/9] crypto: qat - relocate backlog related structures Giovanni Cabiddu
2022-08-18 18:01 ` [PATCH 6/9] crypto: qat - relocate qat_algs_alloc_flags() Giovanni Cabiddu
2022-08-18 18:01 ` [PATCH 7/9] crypto: qat - rename and relocate GEN2 config function Giovanni Cabiddu
2022-08-18 18:01 ` [PATCH 8/9] crypto: qat - expose deflate through acomp api for QAT GEN2 Giovanni Cabiddu
2022-08-26 10:28   ` Herbert Xu
2022-08-26 14:21     ` Giovanni Cabiddu
2022-08-30  9:08       ` Herbert Xu
2022-09-15 13:09         ` Giovanni Cabiddu [this message]
2022-09-16  9:41           ` Herbert Xu
2022-08-18 18:01 ` [PATCH 9/9] crypto: qat - enable deflate for QAT GEN4 Giovanni Cabiddu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YyMj9yKMSTC4Iw0s@gcabiddu-mobl1.ger.corp.intel.com \
    --to=giovanni.cabiddu@intel.com \
    --cc=adam.guerin@intel.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=qat-linux@intel.com \
    --cc=vdronov@redhat.com \
    --cc=wojciech.ziemba@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.