Re: [PATCH 1/2] lib: add fast lzo decompressor

From: Andreas Robinson
Date: Thu Apr 02 2009 - 08:30:57 EST


On Thu, 2009-04-02 at 10:40 +1100, Nigel Cunningham wrote:
> Sorry to jump in with a tangential issue, but I just noticed the
> thread
> and it reminded me of an issue :)
>
> Should the lzo code used via cryptoapi (I believe it's the same stuff)
> be SMP safe? I've tried to use it work TuxOnIce and get image corruption
> (test kernel is 64 bit). The same code works fine if I tell it to use
> LZF (which comes with TuxOnIce), no compression or, IIRC, work single
> threaded.

Do you compress or decompress data through the crypto API?

Neither function modifies the input data and there are no static or
global variables in use, so there shouldn't be a problem there.

They do however modify the destination length argument.

But most importantly, each compressor thread needs a private work buffer
allocated through lzo_init() in crypto/lzo.c. So, if you use the crypto
API to compress and share the crypto_tfm struct among threads, that
would explain your breakage.

Cheers,
Andreas

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/