From patchwork Fri Jul 21 15:42:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 108491 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp944116qge; Fri, 21 Jul 2017 08:43:15 -0700 (PDT) X-Received: by 10.98.25.8 with SMTP id 8mr7871219pfz.80.1500651795694; Fri, 21 Jul 2017 08:43:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500651795; cv=none; d=google.com; s=arc-20160816; b=xiNtvAQIopVwbwiiaJ9+NMy/v33l8NaXeGP9mPxWYtYGIUQ7YldAwJiphhjfDfvmTA +GcQBBQYnYyLIpAP4Mug52y8vosG9gM8uFNs8vrcvSAk9AUgu9cz0AmjCEuDutVoHUVK KvHZOFsCNBq8CdJQNF02JXbwBiOPDlsmtiEdknOjW1MnDa9hIHBbpcWvawO+A1rTxd0Y FC7jtzIHSY488ylloSePLvbi9mLWq6LKgblPer4Fary0AKY5kjiA/VnT3hybPIKfcc70 L6v7pHup9E4+PL7bpC1PO4vT9Xn8vKHvkjvLv1s24Y4dzacIyGp8NMdpzinDvpoOqXhC y2gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=ZXK1W4yTOz8wMqS1Zbia4z5qY5tQsac93wirA4ssGj4=; b=OYgLwXDkv3NBx6Z8LSZSTypYSrhi61Qy+ktfT5TN6KdFK8fG1VIZ0FW/rghEqDGg41 c3QNXH/JhUbOvUF3iIdcfPPgk2O9NsyAgUGx5gVoTwHJdXMwjWYcydSInICyuL9NcPKO kHxz0owx2zMNH1BoH5UvcLTzVHkCFiERAhx+BZF56eJ5b1H2J46u2wrcDOQTRj/gdl+L UYiZhM+FVIrIqnaJ+6f5IAyk6neOU/G2th1vpw0eN57n7rP3fWvT9zYm6K1lWhsS7xBM 8o+srausJA324nAOe0UCJtD4ps/sX2ZWZBKlddcJfnfSZ2kW433G98B2GwRD4IKiQtrn BzKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=eDucVgy9; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o1si1422656pld.973.2017.07.21.08.43.15; Fri, 21 Jul 2017 08:43:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=eDucVgy9; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751996AbdGUPm5 (ORCPT + 1 other); Fri, 21 Jul 2017 11:42:57 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:34188 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750849AbdGUPmy (ORCPT ); Fri, 21 Jul 2017 11:42:54 -0400 Received: by mail-wm0-f44.google.com with SMTP id l81so4489897wmg.1 for ; Fri, 21 Jul 2017 08:42:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=ZXK1W4yTOz8wMqS1Zbia4z5qY5tQsac93wirA4ssGj4=; b=eDucVgy9Cecto4UqAlq9lPJTUrAm+RziSspfglEoILenG6713rjWTSO3yGlgoqWbje AVEWu7SjeGVcSGx91hReZDRi2/6fyjwd0oZOU0uhjvQVURvNWq7wASRJ6ZwAwc1kSPix B7V4LBMFFHnMCdoaK9bMji2/GYwFYhe3pfIYU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ZXK1W4yTOz8wMqS1Zbia4z5qY5tQsac93wirA4ssGj4=; b=oGFGtliou9SpGfcRh8xS2EVLITrSsicyxuQSdWf0jRiISioxuBXj8GyVJZRxvusv6A rhv/30aBS+xfyuHBVDe7MHThwzC//mr8FhG76vB9luvXCAyenX84lIU4Q52uWmlnuiZN UrefYgFG61HfrA66V3ZzkEMtH7KqRCsebrP0EJnpHiPxL2oJFWIWOy2gw4R5BToCXQAX ft54N37poOUaykJZJukVMjo/+EkBtAaWjXuBndECEygv/vRi6r0PHD/Yk5xqg2aa8Iur pOEwhMhuHOMxEh0NHnBIAI6C8tKIZmR7096JfgJq0MpzJc+CIPvd51PE6+6qoeVEPC5z quqA== X-Gm-Message-State: AIVw110SGpeP02JaTr4wZbNpj7ovcWFFmepnveKTLY+p18j2t4sE6JEy d7QH61rGh59Q9A/kp2SwqA== X-Received: by 10.28.21.72 with SMTP id 69mr5327377wmv.75.1500651772584; Fri, 21 Jul 2017 08:42:52 -0700 (PDT) Received: from localhost.localdomain ([105.148.195.69]) by smtp.gmail.com with ESMTPSA id f203sm1498563wme.39.2017.07.21.08.42.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Jul 2017 08:42:51 -0700 (PDT) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au, giovanni.cabiddu@intel.com Cc: Ard Biesheuvel Subject: [PATCH v2 0/3] crypto: scompress - defer allocation of percpu scratch buffers Date: Fri, 21 Jul 2017 16:42:35 +0100 Message-Id: <20170721154238.21697-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org This is a followup to 'crypto: scompress - eliminate percpu scratch buffers', which attempted to replace the scompress per-CPU buffer entirely, but as Herbert pointed out, this is not going to fly in the targeted use cases. Instead, move the alloc/free of the buffers into the tfm init/exit hooks, so that we only have the per-CPU buffers allocated if their are any acomp ciphers of the right kind (i.e, ones that encapsulate a synchronous implementation) in use (#3) Patches #1 and #2 are fixes for issues I spotted when working on this code. Ard Biesheuvel (3): crypto: scompress - don't sleep with preemption disabled crypto: scompress - free partially allocated scratch buffers on failure crypto: scompress - defer allocation of scratch buffer to first use crypto/scompress.c | 55 ++++++++------------ 1 file changed, 22 insertions(+), 33 deletions(-) -- 2.11.0