Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1765899lqa; Mon, 29 Apr 2024 20:28:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUIwJhIzvWis00sCfWcYUWaBPVW8QKBzz0g/s9PQ4z9SEY1akAC5xJcrv+L/gZTTbrUcpD883wMuaiVpKrWEMPExKa/IIqm4oaXDRuRAw== X-Google-Smtp-Source: AGHT+IE7fCQTMIiHUghet91cmlHm8QuP9hJdKZMZFwISwDpynzZ1L4I8Eu9IlL4AlWXV33FOFUPP X-Received: by 2002:ac8:5846:0:b0:43a:db39:89ae with SMTP id h6-20020ac85846000000b0043adb3989aemr1553579qth.59.1714447694591; Mon, 29 Apr 2024 20:28:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714447694; cv=pass; d=google.com; s=arc-20160816; b=Pi+uGF+gVDpVJAgqFgL7e4cNCZ5b02eTMmSV/7TvFSKBdSPJlPWySPv0CLSbm8lEts vtG1ORN27fSgmYUnY1T4cvBv5+WiWzJM/R3gclvO0EPlCzv1tQ+c6mgU/NCdwuUrkBJa GoZ7fQC0P+Gpqpz5QfjPJGHvJ73xjjyk+FkvuyWIoKIrzH/Em0s1cyx79ukhhRc0zNun lDONUnlUKdpViBfIHBz+nrccJ+TdxyYmMiPp08KZpkPBbA2FLtRACCcVtn0tFVa7mYR0 FtsymCwtRQ2Au+5BXxlVYJ0qn9tHAx/fHYb5XXjhRbis5r3Tz1xvuT2hDgibSkZUNhLO d+Zg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=nI6GVHFEnKQIyhOQ+dRjVDZL1gDFD6/whs+wpxDGxhE=; fh=4yQFO3Ppz5zS/zwQtSlk+TkExe+V0fg3V9i6aB+pwGw=; b=bgQHAHrv1pxq695dGLqtn99676rjuZ9m/VNwnSwUN/y12F9Czv1G1O84tp3nAQ3kYO VIfxc6dd2pBahrR+0WR5VW83ZZWKI02lQUY7Aga8GvU7SmIt+CpgReAZUbmPF3cpP/vi RKhc05XnbpjeUfD6G7xc6mzYd1MlsyWIfp6JzFgt2w7gaZpLrF1MPBb5YAHdkl/etzSp GCbTCyDAOieoorhm/9NJLplqgn+LVdv26gZSGxZntXfqEcFxj7ef/nFh0083x7xiVfdf tJeLBcXiCvBigcsbAJKLa0RztYob/Y8JlDyzVDcYhj9/j7gTQ7ZmzblB1pqMcqTXpGqL E3gQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dtxGhOZ9; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-crypto+bounces-3944-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-crypto+bounces-3944-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id bv19-20020a05622a0a1300b0043a574ee497si11710210qtb.724.2024.04.29.20.28.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 20:28:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-3944-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dtxGhOZ9; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-crypto+bounces-3944-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-crypto+bounces-3944-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 558581C21737 for ; Tue, 30 Apr 2024 03:28:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8CBDC10A35; Tue, 30 Apr 2024 03:28:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="dtxGhOZ9" X-Original-To: linux-crypto@vger.kernel.org Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F95510A01 for ; Tue, 30 Apr 2024 03:28:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714447687; cv=none; b=NNJqKKzhqvex5UjPoFt5PmAz0FygrezLGShybNDO4uX7Ql2epagVplmJz9hJIFds5QjN3KuoP/bZ4gLx+e2SgpEVrX/ilOF36oiqEaggR6Qci1EaY64snkHaDnviXDnM2kps0xHZK0rXSs0AXurygvusKfPuBfgNe/68IIq0obk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714447687; c=relaxed/simple; bh=X7+tzh36SwxdnVhNwvviplK8DkcDG2Wj7K7DH1U7s+8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ce7EmBIpoykUuyU8PAIHZi4YHV3miM91qedf9XK7vuXna7tp+YYBokoej/x3iPh5zq75UNeEhfBi5ZGIKbOD0VHGwZciXGMPuh6p0dIf8EG59XXBYcP2LZwCuRGRFlLUTiKDwFipWWqP41XkwllXniQUb4X6kzh3XZsJZcilqDI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=dtxGhOZ9; arc=none smtp.client-ip=209.85.215.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-5e4f79007ffso3384333a12.2 for ; Mon, 29 Apr 2024 20:28:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714447685; x=1715052485; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=nI6GVHFEnKQIyhOQ+dRjVDZL1gDFD6/whs+wpxDGxhE=; b=dtxGhOZ93rEnTgzqWE3kQTUtrc18Pe+clV1pLmQDsB9i28Oh9L0ib/XAHlWIiJJD6o RIMWhqk2RkuCHYrjUrgJru5MaMfKS9a58BX5RCPOBtyqHwJYH20elvZPNnDIIjOzmzuq gH2x01sHfn1CT0bgb0SAvVYI+GkuXE1o9iLfA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714447685; x=1715052485; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=nI6GVHFEnKQIyhOQ+dRjVDZL1gDFD6/whs+wpxDGxhE=; b=AXEXTQjY4rtVChRm4tja/153xHKopYIXkfk337LeLNhL25wRdVedWH5PE4uG+A8j8C OEqP5o4ogoBNes0szLCZYkBR82lURQJz+1jXEHahAGWaZr+74RIoF2GeW3CXUQtQ28/q B+hKuCIUYAOIX9Y1vCgExE5KVq5aTf+Mpgl2ieT7NFwVEmBmEMr6zvDRCOK1dAr5X1sQ /aUazdvGcICNyPTgs/zCo7xCnR7DMd3CQ1SLgurWWd0nQgIIsCix6+7ATvf8Gy0PNQa1 w3rT3F81kPx2H0TRZrGpYcw7VD/Qr0pHUt+S4Kpyya40KdIxeMddi2hcpJ8zqUjAOl9r 8qXQ== X-Forwarded-Encrypted: i=1; AJvYcCXCgyUzLWDpv/3JauWeI7quWjb6r6E2/+Iq93gSB305G9D7UTBSJjPrPb7xHnAVT2cJamlheCnbxv6biUEKH9Ichj9k5ezKLDSJu0lq X-Gm-Message-State: AOJu0YxExAQp5fHNebwAOg93B/5bpDjdgy8021vm8Ho1KwaqMfpm+kQJ CAcCMq0/BE68tErgEYCx1aRE35HFIyK96hH5pSxtjr5+roxyQ7iaGbeu0BPhjw== X-Received: by 2002:a05:6a20:7f9e:b0:1aa:6167:b6d6 with SMTP id d30-20020a056a207f9e00b001aa6167b6d6mr1793420pzj.42.1714447685254; Mon, 29 Apr 2024 20:28:05 -0700 (PDT) Received: from google.com ([2401:fa00:8f:203:e55f:86cd:c9e1:6daf]) by smtp.gmail.com with ESMTPSA id m14-20020a17090a668e00b002a6e67e197dsm19946952pjj.45.2024.04.29.20.28.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 20:28:04 -0700 (PDT) Date: Tue, 30 Apr 2024 12:28:00 +0900 From: Sergey Senozhatsky To: Eric Biggers Cc: Sergey Senozhatsky , Herbert Xu , "David S. Miller" , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC] crypto: passing configuration parameters to comp algos Message-ID: <20240430032800.GF14947@google.com> References: <20240430030447.GE14947@google.com> <20240430031847.GB10165@sol.localdomain> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240430031847.GB10165@sol.localdomain> On (24/04/29 20:18), Eric Biggers wrote: > On Tue, Apr 30, 2024 at 12:04:47PM +0900, Sergey Senozhatsky wrote: > > Hi, > > > > We'd like to be able to pass algorithm-specific parameters to > > comp backends. As of this moment, crypto usees hard-coded default > > values and does not permit any run-time algorithm configuration, > > which in some cases simply disables the most interesting functionality. > > E.g. zstd can be configured to use a pre-trained (in the user-space) > > compression dictionary, which significantly changes algorithms > > characteristics. Another, obvious and trivial example, is algorithms > > compression level. > > > > The problem is that we need to pass params to cra_init() function, > > because for some algorithms that's the only place where configuration > > can take place (e.g. zstd). Changing cra_init() to accept additional > > `struct crypto_comp_params` looks to be a little intrusive so before > > I write any patches I'd like to hear your thoughts. > > > > Have you considered just using the zstd library () directly? Yes, sort of. > Which kernel subsystem are you working on that uses compression? Forgot to mention - this is for zram primarily (and potentially for zswap). Both of which take advantage of crypto API and can be configured to use various compression algorithms (per-device). So, on the zram side, in theory, I can stop using crypto API and start calling lzo/zstd/lz4/etc. compression/decompression functions directly (in fact we used to do that many many years ago, before we switched to cypto API).