From patchwork Sun Feb 25 20:11:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Zanussi X-Patchwork-Id: 206127 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1766773dyb; Sun, 25 Feb 2024 14:40:13 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVMSZsfbyoYXZeeug+eitrxKo3EMBCBiZsfsuofSkatATMTEWtLDXiQ/uZcoTprrmk2moBCpZPBt/Lkawyy/6JfXOneeQ== X-Google-Smtp-Source: AGHT+IEjnwaD4AScpYq53wOFFGvy1vGNhHhwKW3x74XYNhNyNr6f/tICsIn8HR9JkD6V650DncNA X-Received: by 2002:a05:6a20:c78f:b0:1a0:dfd8:f759 with SMTP id hk15-20020a056a20c78f00b001a0dfd8f759mr4490569pzb.21.1708900813234; Sun, 25 Feb 2024 14:40:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708900813; cv=pass; d=google.com; s=arc-20160816; b=uaOW31zXUSfRvv4sTFVfwW0Xt+sFxo3ltfDw3OvVkYcZ4mZVh6xf60Xot4PPYASHyW 9I1vuNdxdIKeTe6pC2XDq+58Xz83QGQrdVXzPNxttpgydedncK8d35UEN9fqN+qo6zUp YPs6UK1rPqlPD3oVbo48aiJaalmJfPdqCjTuRKfI6spKUjEi3+w9QxjHKl1RYsnf99hU ltrdb1pzqUy9VPy7Vo0we5pTa6vIPRJyQ4sAI/u4bXMP786WQ48yy+jTbaqMBQYTM7FM AaB0HyrZ8+FVXBRnoEFZy3r8wz7NrIyxwMFyz6g3D40iuyy8EtQbVX5Ibz5d8Ee3VS+u Vviw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=99SJ6krGZISeqhUaB2NtUM5U58TOUyXoLvnxmiPrxOw=; fh=0qCTQRDCb+599bA+KXtNfhxrUJVOEUXmrKQb3JXIj5A=; b=l4brh/qeFoq1SgWg/UEqLByBFXOckGoY/pnGejH1PBBka2/kS00DoRQpZbvaiTazA4 VvxhlqUAbsLtymjKPUxM3xPWNAP5KLzF0hCcYWXke07fbACADlYErfEuxlSsL5DXPtMk behBgTZwDQJFbf6orbg1zXm4m+GErGhJ7jWz8GkRt1l/T7WvEXHz6viML5LX6CTFIeMN tSgWU8uTGt07q5x+FXGanlx8X8zNtNogNhB8Cu6PhzWkY3K/hEuAPvy5qctSGflH2DbR IrS2XAys+nkBdZ03kYk348kmrafrJ+rcr3Puo0iy/6e5u5rUycKkp+Vbffj/h0HsUEyB BJkQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nWwBQbqf; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-80268-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80268-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id f10-20020a17090ab94a00b002990deb1ddcsi4446443pjw.171.2024.02.25.14.40.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 14:40:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80268-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nWwBQbqf; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-80268-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80268-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id BEF88282E74 for ; Sun, 25 Feb 2024 20:12:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 072A51BDE1; Sun, 25 Feb 2024 20:12:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="nWwBQbqf" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9B5B1B94E; Sun, 25 Feb 2024 20:11:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708891917; cv=none; b=crrEQs3dzHCEsMMcvmXHV5sQKrdbHVoFcAWQiupECDCBSj/qe18OkXbDsc9ueouTxZRZ4kwQodXg2+KLVkWntCXizNrxkFFhlHSbN4wfvlGAEffnqfANpO+oo8ug15qVNZjNx2GTtGDkCvJqoXqvaN72G3z4vadH0LBmVthM0LQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708891917; c=relaxed/simple; bh=RrgThNA6gJ27x/H2iomavl1lACtwfsXPwPzv+anoH2Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qH1S0AtFMpfUyrv8umFZVOz83M0Cc0LyvzLYm5GEXNhael0CxxZf+PngZy9wesS1B3Jhphv3MiPloIy8IYqKiMAyxlcIvBvDM7iL/arkadNOer5i7LSSHVqwF8H7InzZdXLIclElaV+BdJ1pBcm3+5ku7J2wVyoRQR9Mh2a6ULc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=nWwBQbqf; arc=none smtp.client-ip=198.175.65.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708891916; x=1740427916; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RrgThNA6gJ27x/H2iomavl1lACtwfsXPwPzv+anoH2Y=; b=nWwBQbqfbKLUzUnCpUx48LWGHb49/4H+Q4jXmEGGqrCFiKt/KsV7zHMR J9i7iSm3MlfgX7/QxfrSiJImfW1DmG1V/+XGMD7xCh0npI+/g6Jq/5nQV wLkp8RQgzAINlIC0elOQC9U0ZxSYwjmJnlyz5N6PW0NvTzvRI1Q+W+8X1 Zci6M16t/lWCYaNEC4SuWxS3/x/CkLEWxDHtQs9SaHwux+RUtuNFkMMkU O/YJ33QbRz1Z9dqrA9NKd14KeY48CCf3FENM/B0hS0W3+8C+mtoAH6YCS RURpGTlVgnIATZeWeRgNUZhdAJ6/fFNOBmrPOoY3IryrDuxdUWMIEa8Sg w==; X-IronPort-AV: E=McAfee;i="6600,9927,10995"; a="25639530" X-IronPort-AV: E=Sophos;i="6.06,185,1705392000"; d="scan'208";a="25639530" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Feb 2024 12:11:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,185,1705392000"; d="scan'208";a="29632551" Received: from rfredric-mobl.amr.corp.intel.com (HELO tzanussi-mobl1.amr.corp.intel.com) ([10.213.171.152]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Feb 2024 12:11:55 -0800 From: Tom Zanussi To: herbert@gondor.apana.org.au, davem@davemloft.net Cc: rex.zhang@intel.com, andre.glover@linux.intel.com, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, dmaengine@vger.kernel.org Subject: [PATCH 1/2] crypto: iaa - Fix async_disable descriptor leak Date: Sun, 25 Feb 2024 14:11:33 -0600 Message-Id: <20240225201134.759335-2-tom.zanussi@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240225201134.759335-1-tom.zanussi@linux.intel.com> References: <20240225201134.759335-1-tom.zanussi@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791912378748805048 X-GMAIL-MSGID: 1791912378748805048 The disable_async paths of iaa_compress/decompress() don't free idxd descriptors in the async_disable case. Currently this only happens in the testcases where req->dst is set to null. Add a test to free them in those paths. Signed-off-by: Tom Zanussi --- drivers/crypto/intel/iaa/iaa_crypto_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/intel/iaa/iaa_crypto_main.c b/drivers/crypto/intel/iaa/iaa_crypto_main.c index 39a5fc905c4d..85ee4c965ccf 100644 --- a/drivers/crypto/intel/iaa/iaa_crypto_main.c +++ b/drivers/crypto/intel/iaa/iaa_crypto_main.c @@ -1222,7 +1222,7 @@ static int iaa_compress(struct crypto_tfm *tfm, struct acomp_req *req, *compression_crc = idxd_desc->iax_completion->crc; - if (!ctx->async_mode) + if (!ctx->async_mode || disable_async) idxd_free_desc(wq, idxd_desc); out: return ret; @@ -1468,7 +1468,7 @@ static int iaa_decompress(struct crypto_tfm *tfm, struct acomp_req *req, *dlen = req->dlen; - if (!ctx->async_mode) + if (!ctx->async_mode || disable_async) idxd_free_desc(wq, idxd_desc); /* Update stats */ From patchwork Sun Feb 25 20:11:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Zanussi X-Patchwork-Id: 206121 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1749022dyb; Sun, 25 Feb 2024 13:30:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXPTM/uH+9heRDK42ZVAQVmnEN6wI+SJAzKXuM+odjNLMBg5lDmt6EpGiZBSDuTDdx303A8O4xe6VTS6XWw0sNz2xmF4w== X-Google-Smtp-Source: AGHT+IGiTlcv/y/xX31jzYn5h6PBH9VOcEaiVHqsvV2pGY8KjOBVuTsP/wE/bN0FVPyW3IqOzjGo X-Received: by 2002:a05:620a:1230:b0:784:71a6:f8df with SMTP id v16-20020a05620a123000b0078471a6f8dfmr6744709qkj.44.1708896616916; Sun, 25 Feb 2024 13:30:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708896616; cv=pass; d=google.com; s=arc-20160816; b=V1i67sw+Sa2OfOFuV42HXH8sUgMAOBkvLoAPGmI5kx6eBdTaH63E9rH5sLeU+tv7Js p6v+HQOJJkqYJyXORook7w6Bj5JNAtwReO3J3oCdYzB+3kqY2fYCezXC1APZfXDZX78t mPLgP+uXkqmLo6sf3YJPwdKMz/Lps7E3Rhg3c6wqnnmTw9wYNN43RDiVp1J83icVo9Q/ mXQjb1ud6pOpWrqC9n73NZ/JcxfAMl+MPp2MtWkCaV6OVnJkB4uNUQhT8muPEYD0CGZF w6ee4tgiO6GoPkFR+JbW6gNLOh29RMw4gm4FwMJh40XdndnhlytNZuQFQ+ZJtGHFbcfY pLqw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=qWKoAqMW+GhA1jOrFbeGBHzQfHhDUAcr38jeOUEnKPQ=; fh=0qCTQRDCb+599bA+KXtNfhxrUJVOEUXmrKQb3JXIj5A=; b=eQxl3jHGbjM3Ef/tCj55xgR/EqdZ5R3TFCNB8qgiRfOV/nDNYXMDBYJsaBIT84PrU+ 4gutAdc4wRU7aAQoI+uq+gFC+Vk/Ui1HAwcil6SfGayuYCtD+T1xdV2gw0PxjGH3RMJQ u0Zbl9Glns3S/3oIss/Zqawd673X8+PPKSRrqMl4PgvpJdtRRQcDYcuHxSYWXT/51yCz Fxt3MQLw/vZarbvPHXB5pvYlsMIyEtiHWqTkiVrcb2uNgELkJnfaEGMpX1vsJQEOJ3JR ML2K6NkmwZpaEzn8kY9tWZqxqS3lsF+EmWNAFhkSUdUB5ase6GyAIXYAzNWtcGY4sxJp qCzQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TMi3W9cp; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-80269-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80269-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id vu27-20020a05620a561b00b00787c49c96d6si3405797qkn.578.2024.02.25.13.30.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 13:30:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80269-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TMi3W9cp; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-80269-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80269-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 A3DBF1C2180B for ; Sun, 25 Feb 2024 20:12:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0BCA11C683; Sun, 25 Feb 2024 20:12:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="TMi3W9cp" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6BAF1BC2F; Sun, 25 Feb 2024 20:11:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708891919; cv=none; b=D+LygMI9rzAe6bRXsFN1Dwug9YZyJGIX2mtGOSgODNMmU0Pi2H2/n1LPHBQw6TMM8QZBUExkj4Yk1X7D1EU5tvOPOE6lWa0J9WN+ckg0ZLrQM40/Nc+szcRYgVLMpmVZmxAr+MQHEwqqmJyUqtimwcEKkKUHA9AGZ/FHTTpxBEU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708891919; c=relaxed/simple; bh=2ZHJPk46orqg1Qb+fXEa/VDYyDsc6n+YD/UPcHAmhuA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YxY5bqz7iZH4ZIkONPz7kfaW6d6VDEm6Qq/b+uSOwoKjZKHw1lUuuVZBXtr5Alo0TYVz1qB+NlFtk8TpRSllXcNbLK7OZsB94lFPhYANKaxR7xwXh6oC+F3EDbDcFjzxfzDbP6w6JJvFYRCoiNZlIp7m3EImtWSwtX6KQT/AX94= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=TMi3W9cp; arc=none smtp.client-ip=198.175.65.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708891918; x=1740427918; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2ZHJPk46orqg1Qb+fXEa/VDYyDsc6n+YD/UPcHAmhuA=; b=TMi3W9cpMI+oqVydVw/2r3f6C/FNnYRZSQkgKEyfZYCqxQ+8O6zTtWyJ 8eNJg10rSEyPa7ivUpXG3mw2FdshTE4ANI7zYKUABiuUlJLIluPrjuEXH Zy/AO0PZlucMOK+lwcGn8tCPX7hpWuJ3R7sgOvnDV2rOxARyFZZW8VdbN rWik3Su/u7wDL4ob8d4vrT0ZOQcUndEVj8aKY/KRCCTq0NkCQ779aPKGN c9NwRbDXWZGggqAxt+XTOajD+fofvmdP36j9PRX5GMf81/Itd8FW+jRTm sERlCkSMw0SF3WcLcIoP2tx5ZR/PijoVFW4pru3YJg8RQmJRVKzxs5KlS A==; X-IronPort-AV: E=McAfee;i="6600,9927,10995"; a="25639535" X-IronPort-AV: E=Sophos;i="6.06,185,1705392000"; d="scan'208";a="25639535" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Feb 2024 12:11:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,185,1705392000"; d="scan'208";a="29632554" Received: from rfredric-mobl.amr.corp.intel.com (HELO tzanussi-mobl1.amr.corp.intel.com) ([10.213.171.152]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Feb 2024 12:11:57 -0800 From: Tom Zanussi To: herbert@gondor.apana.org.au, davem@davemloft.net Cc: rex.zhang@intel.com, andre.glover@linux.intel.com, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, dmaengine@vger.kernel.org Subject: [PATCH 2/2] crypto: iaa - Fix comp/decomp delay statistics Date: Sun, 25 Feb 2024 14:11:34 -0600 Message-Id: <20240225201134.759335-3-tom.zanussi@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240225201134.759335-1-tom.zanussi@linux.intel.com> References: <20240225201134.759335-1-tom.zanussi@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791907978526033991 X-GMAIL-MSGID: 1791907978526033991 The comp/decomp delay statistics currently have no callers; somehow they were dropped during refactoring. There originally were also two sets, one for the async algorithm, the other for the synchronous version. Because the synchronous algorithm was dropped, one set should be removed. To keep it consistent with the rest of the stats, and since there's no ambiguity, remove the acomp/adecomp versions. Also add back the callers. Reported-by: Rex Zhang Signed-off-by: Tom Zanussi --- drivers/crypto/intel/iaa/iaa_crypto_main.c | 9 +++++++ drivers/crypto/intel/iaa/iaa_crypto_stats.c | 28 --------------------- drivers/crypto/intel/iaa/iaa_crypto_stats.h | 8 +++--- 3 files changed, 13 insertions(+), 32 deletions(-) diff --git a/drivers/crypto/intel/iaa/iaa_crypto_main.c b/drivers/crypto/intel/iaa/iaa_crypto_main.c index 85ee4c965ccf..b54f93c64033 100644 --- a/drivers/crypto/intel/iaa/iaa_crypto_main.c +++ b/drivers/crypto/intel/iaa/iaa_crypto_main.c @@ -1494,6 +1494,7 @@ static int iaa_comp_acompress(struct acomp_req *req) u32 compression_crc; struct idxd_wq *wq; struct device *dev; + u64 start_time_ns; int order = -1; compression_ctx = crypto_tfm_ctx(tfm); @@ -1567,8 +1568,10 @@ static int iaa_comp_acompress(struct acomp_req *req) " req->dlen %d, sg_dma_len(sg) %d\n", dst_addr, nr_sgs, req->dst, req->dlen, sg_dma_len(req->dst)); + start_time_ns = iaa_get_ts(); ret = iaa_compress(tfm, req, wq, src_addr, req->slen, dst_addr, &req->dlen, &compression_crc, disable_async); + update_max_comp_delay_ns(start_time_ns); if (ret == -EINPROGRESS) return ret; @@ -1615,6 +1618,7 @@ static int iaa_comp_adecompress_alloc_dest(struct acomp_req *req) struct iaa_wq *iaa_wq; struct device *dev; struct idxd_wq *wq; + u64 start_time_ns; int order = -1; cpu = get_cpu(); @@ -1671,8 +1675,10 @@ static int iaa_comp_adecompress_alloc_dest(struct acomp_req *req) dev_dbg(dev, "dma_map_sg, dst_addr %llx, nr_sgs %d, req->dst %p," " req->dlen %d, sg_dma_len(sg) %d\n", dst_addr, nr_sgs, req->dst, req->dlen, sg_dma_len(req->dst)); + start_time_ns = iaa_get_ts(); ret = iaa_decompress(tfm, req, wq, src_addr, req->slen, dst_addr, &req->dlen, true); + update_max_decomp_delay_ns(start_time_ns); if (ret == -EOVERFLOW) { dma_unmap_sg(dev, req->dst, sg_nents(req->dst), DMA_FROM_DEVICE); req->dlen *= 2; @@ -1703,6 +1709,7 @@ static int iaa_comp_adecompress(struct acomp_req *req) int nr_sgs, cpu, ret = 0; struct iaa_wq *iaa_wq; struct device *dev; + u64 start_time_ns; struct idxd_wq *wq; if (!iaa_crypto_enabled) { @@ -1762,8 +1769,10 @@ static int iaa_comp_adecompress(struct acomp_req *req) " req->dlen %d, sg_dma_len(sg) %d\n", dst_addr, nr_sgs, req->dst, req->dlen, sg_dma_len(req->dst)); + start_time_ns = iaa_get_ts(); ret = iaa_decompress(tfm, req, wq, src_addr, req->slen, dst_addr, &req->dlen, false); + update_max_decomp_delay_ns(start_time_ns); if (ret == -EINPROGRESS) return ret; diff --git a/drivers/crypto/intel/iaa/iaa_crypto_stats.c b/drivers/crypto/intel/iaa/iaa_crypto_stats.c index cbf87d0effe3..c9f83af4b307 100644 --- a/drivers/crypto/intel/iaa/iaa_crypto_stats.c +++ b/drivers/crypto/intel/iaa/iaa_crypto_stats.c @@ -22,8 +22,6 @@ static u64 total_decomp_calls; static u64 total_sw_decomp_calls; static u64 max_comp_delay_ns; static u64 max_decomp_delay_ns; -static u64 max_acomp_delay_ns; -static u64 max_adecomp_delay_ns; static u64 total_comp_bytes_out; static u64 total_decomp_bytes_in; static u64 total_completion_einval_errors; @@ -92,26 +90,6 @@ void update_max_decomp_delay_ns(u64 start_time_ns) max_decomp_delay_ns = time_diff; } -void update_max_acomp_delay_ns(u64 start_time_ns) -{ - u64 time_diff; - - time_diff = ktime_get_ns() - start_time_ns; - - if (time_diff > max_acomp_delay_ns) - max_acomp_delay_ns = time_diff; -} - -void update_max_adecomp_delay_ns(u64 start_time_ns) -{ - u64 time_diff; - - time_diff = ktime_get_ns() - start_time_ns; - - if (time_diff > max_adecomp_delay_ns) - max_adecomp_delay_ns = time_diff; -} - void update_wq_comp_calls(struct idxd_wq *idxd_wq) { struct iaa_wq *wq = idxd_wq_get_private(idxd_wq); @@ -151,8 +129,6 @@ static void reset_iaa_crypto_stats(void) total_sw_decomp_calls = 0; max_comp_delay_ns = 0; max_decomp_delay_ns = 0; - max_acomp_delay_ns = 0; - max_adecomp_delay_ns = 0; total_comp_bytes_out = 0; total_decomp_bytes_in = 0; total_completion_einval_errors = 0; @@ -280,10 +256,6 @@ int __init iaa_crypto_debugfs_init(void) iaa_crypto_debugfs_root, &max_comp_delay_ns); debugfs_create_u64("max_decomp_delay_ns", 0644, iaa_crypto_debugfs_root, &max_decomp_delay_ns); - debugfs_create_u64("max_acomp_delay_ns", 0644, - iaa_crypto_debugfs_root, &max_comp_delay_ns); - debugfs_create_u64("max_adecomp_delay_ns", 0644, - iaa_crypto_debugfs_root, &max_decomp_delay_ns); debugfs_create_u64("total_comp_calls", 0644, iaa_crypto_debugfs_root, &total_comp_calls); debugfs_create_u64("total_decomp_calls", 0644, diff --git a/drivers/crypto/intel/iaa/iaa_crypto_stats.h b/drivers/crypto/intel/iaa/iaa_crypto_stats.h index c10b87b86fa4..c916ca83f070 100644 --- a/drivers/crypto/intel/iaa/iaa_crypto_stats.h +++ b/drivers/crypto/intel/iaa/iaa_crypto_stats.h @@ -15,8 +15,6 @@ void update_total_sw_decomp_calls(void); void update_total_decomp_bytes_in(int n); void update_max_comp_delay_ns(u64 start_time_ns); void update_max_decomp_delay_ns(u64 start_time_ns); -void update_max_acomp_delay_ns(u64 start_time_ns); -void update_max_adecomp_delay_ns(u64 start_time_ns); void update_completion_einval_errs(void); void update_completion_timeout_errs(void); void update_completion_comp_buf_overflow_errs(void); @@ -26,6 +24,8 @@ void update_wq_comp_bytes(struct idxd_wq *idxd_wq, int n); void update_wq_decomp_calls(struct idxd_wq *idxd_wq); void update_wq_decomp_bytes(struct idxd_wq *idxd_wq, int n); +static inline u64 iaa_get_ts(void) { return ktime_get_ns(); } + #else static inline int iaa_crypto_debugfs_init(void) { return 0; } static inline void iaa_crypto_debugfs_cleanup(void) {} @@ -37,8 +37,6 @@ static inline void update_total_sw_decomp_calls(void) {} static inline void update_total_decomp_bytes_in(int n) {} static inline void update_max_comp_delay_ns(u64 start_time_ns) {} static inline void update_max_decomp_delay_ns(u64 start_time_ns) {} -static inline void update_max_acomp_delay_ns(u64 start_time_ns) {} -static inline void update_max_adecomp_delay_ns(u64 start_time_ns) {} static inline void update_completion_einval_errs(void) {} static inline void update_completion_timeout_errs(void) {} static inline void update_completion_comp_buf_overflow_errs(void) {} @@ -48,6 +46,8 @@ static inline void update_wq_comp_bytes(struct idxd_wq *idxd_wq, int n) {} static inline void update_wq_decomp_calls(struct idxd_wq *idxd_wq) {} static inline void update_wq_decomp_bytes(struct idxd_wq *idxd_wq, int n) {} +static inline u64 iaa_get_ts(void) { return 0; } + #endif // CONFIG_CRYPTO_DEV_IAA_CRYPTO_STATS #endif