From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752808AbcFGGNu (ORCPT ); Tue, 7 Jun 2016 02:13:50 -0400 Received: from LGEAMRELO13.lge.com ([156.147.23.53]:35089 "EHLO lgeamrelo13.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751368AbcFGGNt (ORCPT ); Tue, 7 Jun 2016 02:13:49 -0400 X-Original-SENDERIP: 156.147.1.151 X-Original-MAILFROM: minchan@kernel.org X-Original-SENDERIP: 165.244.98.204 X-Original-MAILFROM: minchan@kernel.org X-Original-SENDERIP: 10.177.223.161 X-Original-MAILFROM: minchan@kernel.org Date: Tue, 7 Jun 2016 15:14:50 +0900 From: Minchan Kim To: Sergey Senozhatsky CC: Andrew Morton , Joonsoo Kim , , Sergey Senozhatsky Subject: Re: [PATCH v3 3/7] zram: use crypto api to check alg availability Message-ID: <20160607061450.GA13528@bbox> References: <20160604024902.11778-1-sergey.senozhatsky@gmail.com> <20160604024902.11778-4-sergey.senozhatsky@gmail.com> MIME-Version: 1.0 In-Reply-To: <20160604024902.11778-4-sergey.senozhatsky@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-MIMETrack: Itemize by SMTP Server on LGEKRMHUB02/LGE/LG Group(Release 8.5.3FP6|November 21, 2013) at 2016/06/07 15:13:45, Serialize by Router on LGEKRMHUB02/LGE/LG Group(Release 8.5.3FP6|November 21, 2013) at 2016/06/07 15:13:45, Serialize complete at 2016/06/07 15:13:45 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 04, 2016 at 11:48:58AM +0900, Sergey Senozhatsky wrote: > There is no way to get a string with all the crypto comp > algorithms supported by the crypto comp engine, so we need > to maintain our own backends list. At the same time we > additionally need to use crypto_has_comp() to make sure > that the user has requested a compression algorithm that is > recognized by the crypto comp engine. Relying on /proc/crypto > is not an options here, because it does not show not-yet-inserted > compression modules. > > Example: > > modprobe zram > cat /proc/crypto | grep -i lz4 > modprobe lz4 > cat /proc/crypto | grep -i lz4 > name : lz4 > driver : lz4-generic > module : lz4 > > So the user can't tell exactly if the lz4 is really supported > from /proc/crypto output, unless someone or something has loaded > it. > > This patch also adds crypto_has_comp() to zcomp_available_show(). > We store all the compression algorithms names in zcomp's `backends' > array, regardless the CONFIG_CRYPTO_FOO configuration, but show > only those that are also supported by crypto engine. This helps > user to know the exact list of compression algorithms that can be > used. > > Example: > module lz4 is not loaded yet, but is supported by the crypto > engine. /proc/crypto has no information on this module, while > zram's `comp_algorithm' lists it: > > cat /proc/crypto | grep -i lz4 > > cat /sys/block/zram0/comp_algorithm > [lzo] lz4 deflate lz4hc 842 > > We still use the `backends' array to determine if the requested > compression backend is known to crypto api. This array, however, > may not contain some entries, therefore as the last step we call > crypto_has_comp() function which attempts to insmod the requested > compression algorithm to determine if crypto api supports it. The > advantage of this method is that now we permit the usage of > out-of-tree crypto compression modules (implementing S/W or H/W > compression). > > Signed-off-by: Sergey Senozhatsky Acked-by: Minchan Kim