Re: [PATCH v4 6/8] fsverity: improve performance by using multibuffer hashing

Eric Biggers
2024-06-05T19:14:12Z

On Wed, Jun 05, 2024 at 05:46:27PM +0800, Herbert Xu wrote:
> On Wed, Jun 05, 2024 at 05:22:21PM +0800, Herbert Xu wrote:
> >
> > However, I really dislike the idea of shoehorning this into shash.
> > I know you really like shash, but I think there are some clear
> > benefits to be had by coupling this with ahash.
>
> If we do this properly, we should be able to immediately use the
> mb code with IPsec. In the network stack, we already aggregate
> the data prior to IPsec with GSO. So at the boundary between
> IPsec and the Crypto API, it's dividing chunks of data up to 64K
> into 1500-byte packets and feeding them to crypto one at a time.
>
> It really should be sending the whole chain of packets to us as
> a unit.
>
> Once we have a proper mb interface, we can fix that and immediately
> get the benefit of mb hashing.
>

This would at most apply to AH, not to ESP. Is AH commonly used these days?
Also even for AH, the IPsec code would need to be significantly restructured to
make use of multibuffer hashing. See how the segmentation happens in
xfrm_output_gso(), but the ahash calls happen much lower in the stack.

I'm guessing that you've had the AH use case in mind since your earlier
comments. Given you were originally pushing for this to be supported using the
existing async support in the ahash API (which would have required fewer code
changes on the AH side), but we now agree that is not feasible, maybe it is time
to reconsider whether it would still be worthwhile to make all the changes to
the AH code needed to support this?

Also, even if it would be worthwhile and would use ahash, ahash is almost always
just a wrapper for shash. So the shash support would be needed anyway.

- Eric