From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: Giovanni Cabiddu <giovanni.cabiddu@intel.com>,
Qu Wenruo <wqu@suse.com>,
clm@fb.com, dsterba@suse.com, terrelln@fb.com,
herbert@gondor.apana.org.au, linux-btrfs@vger.kernel.org,
linux-crypto@vger.kernel.org, qat-linux@intel.com, cyan@meta.com,
brian.will@intel.com, weigang.li@intel.com,
senozhatsky@chromium.org
Subject: Re: [RFC PATCH 16/16] btrfs: add compression hw-accelerated offload
Date: Sat, 29 Nov 2025 02:00:49 +0100 [thread overview]
Message-ID: <20251129010049.GE13846@suse.cz> (raw)
In-Reply-To: <0617afdf-14d4-4642-8298-69ef71f53b4d@gmx.com>
On Sat, Nov 29, 2025 at 10:29:04AM +1030, Qu Wenruo wrote:
>
>
> 在 2025/11/29 09:10, Giovanni Cabiddu 写道:
> > Thanks for your feedback, Qu Wenruo.
> >
> > On Sat, Nov 29, 2025 at 08:25:30AM +1030, Qu Wenruo wrote:
> [...]
> >> Not an compression/crypto expert, thus just comment on the btrfs part.
> >>
> >> sysfs is not a good long-term solution. Since it's already behind
> >> experiemental flags, you can just enable it unconditionally (with proper
> >> checks of-course).
> > The reason for introducing a sysfs attribute is to allow disabling the
> > feature to be able to unload the QAT driver or to assign a QAT device to
> > user space for example to QATlib or DPDK.
> >
> > In the initial implementation, there was no sysfs switch because the
> > acomp tfm was allocated in the data path. With the current design,
> > where the tfm is allocated in the workspace, the driver remains
> > permanently in use.
> >
> > Is there any other alternative to a sysfs attribute to dynamically
> > enable/disable this feature?
>
> For all needed compression algorithm modules are loaded at btrfs module
> load time (not mount time), thus I was expecting the driver being there
> until the btrfs module is removed from kernel.
>
> This is a completely new use case. Have no good idea on this at all.
> Never expected an accelerated algorithm would even get removed halfway.
>
> [...]
> >>
> >> This function get all input/output folios in a batch, but ubifs, which also
> >> uses acomp for compression, seems to only compress one page one time
> >> (ubifs_compress_folio()).
> >>
> >> I'm wondering what's preventing us from doing the existing folio-by-folio
> >> compression.
> >> Is the batch folio acquiring just for performance or something else?
> > There are a few reasons for using batch folio processing instead of
> > folio-by-folio compression:
> >
> > * Performance: for a hardware accelerator like QAT, it is more efficient to
> > process a larger chunk of data in a single request rather than issuing
> > multiple small requests. (BTW, it would be even better if we could batch
> > multiple requests and run them asynchronously!)
> >
> > * API limitations: The current acomp interface is stateless. Supporting
> > folio-by-folio compression with proper streaming would require changes
> > to introduce a stateful API.
>
> BTW, is there any extra benefit of using acomp interface (independent of
> QAT acceleration)?
The promise of the acomp interface is that the CPU can be handed to
other processes while the async hw does the compression. Using the async
requests has some problems with deadlocks and allocation. The async
crypto API has been deprecated or removed where used, IIRC fsverity.
> If so we may consider experiment with it first and migrate btrfs to that
> interface step by step, and making extra accelerated algorithms easier
> to implement.
I had a prototype for acomp and switching to it via sysfs but once I
saw the patches removing acomp I scrapped it. The QAT is a bit different
as it's extensible, the acomp hw engines I assume the interface was made
for were hw cards and accelerators that eg. implemented zlib. With QAT
we can have LZO, ZSTD so it's worth adding the support.
next prev parent reply other threads:[~2025-11-29 1:00 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-28 19:04 [RFC PATCH 00/16] btrfs: offload compression to hardware accelerators Giovanni Cabiddu
2025-11-28 14:25 ` Giovanni Cabiddu
2025-11-28 16:13 ` Chris Mason
2025-11-28 19:04 ` [RFC PATCH 01/16] crypto: zstd - fix double-free in per-CPU stream cleanup Giovanni Cabiddu
2025-11-28 19:04 ` [RFC PATCH 02/16] Revert "crypto: qat - remove unused macros in qat_comp_alg.c" Giovanni Cabiddu
2025-11-28 19:04 ` [RFC PATCH 03/16] Revert "crypto: qat - Remove zlib-deflate" Giovanni Cabiddu
2025-11-28 19:04 ` [RFC PATCH 04/16] crypto: qat - use memcpy_*_sglist() in zlib deflate Giovanni Cabiddu
2025-11-28 19:04 ` [RFC PATCH 05/16] Revert "crypto: testmgr - Remove zlib-deflate" Giovanni Cabiddu
2025-11-28 19:04 ` [RFC PATCH 06/16] crypto: deflate - add support for deflate rfc1950 (zlib) Giovanni Cabiddu
2025-11-28 19:04 ` [RFC PATCH 07/16] crypto: scomp - Add setparam interface Giovanni Cabiddu
2025-11-28 19:04 ` [RFC PATCH 08/16] crypto: acomp " Giovanni Cabiddu
2025-11-28 19:04 ` [RFC PATCH 09/16] crypto: acomp - Add comp_params helpers Giovanni Cabiddu
2025-11-28 19:04 ` [RFC PATCH 10/16] crypto: acomp - add NUMA-aware stream allocation Giovanni Cabiddu
2025-11-28 19:04 ` [RFC PATCH 11/16] crypto: deflate - add support for compression levels Giovanni Cabiddu
2025-11-28 19:05 ` [RFC PATCH 12/16] crypto: zstd " Giovanni Cabiddu
2025-11-28 19:05 ` [RFC PATCH 13/16] crypto: qat - increase number of preallocated sgl descriptors Giovanni Cabiddu
2025-11-28 19:05 ` [RFC PATCH 14/16] crypto: qat - add support for zstd Giovanni Cabiddu
2025-11-28 19:05 ` [RFC PATCH 15/16] crypto: qat - add support for compression levels Giovanni Cabiddu
2025-11-28 19:05 ` [RFC PATCH 16/16] btrfs: add compression hw-accelerated offload Giovanni Cabiddu
2025-11-28 21:55 ` Qu Wenruo
2025-11-28 22:40 ` Giovanni Cabiddu
2025-11-28 23:59 ` Qu Wenruo
2025-11-29 0:23 ` Qu Wenruo
2025-12-01 14:32 ` Giovanni Cabiddu
2025-12-01 15:10 ` Giovanni Cabiddu
2025-12-01 20:57 ` Qu Wenruo
2025-12-01 22:18 ` Giovanni Cabiddu
2025-12-01 23:13 ` Qu Wenruo
2025-12-02 17:09 ` Giovanni Cabiddu
2025-12-02 20:38 ` Qu Wenruo
2025-12-02 22:37 ` Giovanni Cabiddu
2025-12-02 22:59 ` Qu Wenruo
2025-11-29 1:00 ` David Sterba [this message]
2025-11-29 1:08 ` David Sterba
2025-12-02 7:53 ` [RFC PATCH 00/16] btrfs: offload compression to hardware accelerators Christoph Hellwig
2025-12-02 15:46 ` Jani Partanen
2025-12-02 17:19 ` Giovanni Cabiddu
2025-12-03 7:00 ` Christoph Hellwig
2025-12-03 10:15 ` Giovanni Cabiddu
2025-12-04 9:59 ` Christoph Hellwig
2025-12-03 10:47 ` Simon Richter
2025-12-04 10:06 ` Christoph Hellwig
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=20251129010049.GE13846@suse.cz \
--to=dsterba@suse.cz \
--cc=brian.will@intel.com \
--cc=clm@fb.com \
--cc=cyan@meta.com \
--cc=dsterba@suse.com \
--cc=giovanni.cabiddu@intel.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=qat-linux@intel.com \
--cc=quwenruo.btrfs@gmx.com \
--cc=senozhatsky@chromium.org \
--cc=terrelln@fb.com \
--cc=weigang.li@intel.com \
--cc=wqu@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox