From nobody Wed Dec 17 10:46:36 2025 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 C77DB313E1B; Tue, 4 Nov 2025 09:12:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762247566; cv=none; b=d2pJ5u9Q5NXnKn7ytckuGKVrNxjnygaomn93Iy0dNqFaci+SyLsti95ab3DoSK+2cndTR53+PTtV0DS8D8Kc2xlLD9Vi0m4oD4RCz8PK4Ppne5JCdnlMzSIs08O6Y7XckenkE+pHKo1j4h9MitsrNZwB6HnUNrL7fMTYN9vcU9I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762247566; c=relaxed/simple; bh=oPLPiJah8d2OlF+hWiEDugRJhKLZBvrW8tTZckTAras=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XWfUxzAvDYo/balmwa5pHi90xlQi8x0OIihrwcKFEq3SWqXlD4MNbblIo1uvNuw0KoPHW66a5qIzNDJfJz8Zt2UEoJ/TEsp/ySDwbcH9ekOQGDMhtKoP6q17DTFhv7UpC6ijaZ0nIsH0qykVjRVyaCNeLiOsKl0JUrfN49XjTTA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=I4O82oOZ; arc=none smtp.client-ip=192.198.163.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="I4O82oOZ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1762247564; x=1793783564; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oPLPiJah8d2OlF+hWiEDugRJhKLZBvrW8tTZckTAras=; b=I4O82oOZUwPG6UB+6RLwK48wwQ/g5NuhI+r5Cmqls4rhUpSeejsBgmhK zzjLbQIO/NTf6LNK///98ei4CvF4npl5TqGxBxjLqELv7v+DxEysloW8i sLxYQYsvVdfLg40MpToUpGt2uLiouvUQqptop8RuBwc0aZUbG1lHdwdI1 JgY6DbuLX7ZEKYoHMWdDrWzqGrbLu8tDoeGvYsqWN2GQlHVeaIpgPN4Ko GB6HCgabbWBjaTS9uw0FKFCUIOahYnrolorS38yEJkc1s0uZfOXZBKDKc QqTgbl2GDCv295FJiwzYHQR8RjJQfmqIFzChcpW9Hfeht8I5HL1IeAwXS Q==; X-CSE-ConnectionGUID: M4e/hb3YR06UBH0a8kgHDQ== X-CSE-MsgGUID: VvKVBUazRbykvP4V6lVsrg== X-IronPort-AV: E=McAfee;i="6800,10657,11602"; a="89798680" X-IronPort-AV: E=Sophos;i="6.19,278,1754982000"; d="scan'208";a="89798680" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2025 01:12:37 -0800 X-CSE-ConnectionGUID: u4P3K0AWQ/KWptIHKn0nBQ== X-CSE-MsgGUID: 06kZgNKdS1yNCN6N6aM5bw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,278,1754982000"; d="scan'208";a="186795797" Received: from jf5300-b11a338t.jf.intel.com ([10.242.51.115]) by orviesa009.jf.intel.com with ESMTP; 04 Nov 2025 01:12:38 -0800 From: Kanchana P Sridhar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, hannes@cmpxchg.org, yosry.ahmed@linux.dev, nphamcs@gmail.com, chengming.zhou@linux.dev, usamaarif642@gmail.com, ryan.roberts@arm.com, 21cnbao@gmail.com, ying.huang@linux.alibaba.com, akpm@linux-foundation.org, senozhatsky@chromium.org, sj@kernel.org, kasong@tencent.com, linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au, davem@davemloft.net, clabbe@baylibre.com, ardb@kernel.org, ebiggers@google.com, surenb@google.com, kristen.c.accardi@intel.com, vinicius.gomes@intel.com Cc: wajdi.k.feghali@intel.com, vinodh.gopal@intel.com, kanchana.p.sridhar@intel.com Subject: [PATCH v13 08/22] crypto: iaa - Simplified, efficient job submissions for non-irq mode. Date: Tue, 4 Nov 2025 01:12:21 -0800 Message-Id: <20251104091235.8793-9-kanchana.p.sridhar@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20251104091235.8793-1-kanchana.p.sridhar@intel.com> References: <20251104091235.8793-1-kanchana.p.sridhar@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This patch adds a new procedure, iaa_submit_desc_movdir64b(), that directly calls movdir64b. The core iaa_crypto routines that submit compress and decompress jobs now invoke iaa_submit_desc_movdir64b() in non-irq driver modes, instead of idxd_submit_desc(). idxd_submit_desc() is called only in irq mode. This improves latency for the most commonly used iaa_crypto usage (i.e., async non-irq) in zswap by eliminating redundant computes that would otherwise be incurred in idxd_submit_desc(): For a single-threaded madvise-based workload with the Silesia.tar dataset, these are the before/after batch compression latencies for a compress batch of 8 pages: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D p50 (ns) p99 (ns) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D before 5,568 6,056 after 5,472 5,848 Change -96 -208 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Signed-off-by: Kanchana P Sridhar --- drivers/crypto/intel/iaa/iaa_crypto_main.c | 30 ++++++++++++++-------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/drivers/crypto/intel/iaa/iaa_crypto_main.c b/drivers/crypto/in= tel/iaa/iaa_crypto_main.c index 697e98785335..dfc67109e81e 100644 --- a/drivers/crypto/intel/iaa/iaa_crypto_main.c +++ b/drivers/crypto/intel/iaa/iaa_crypto_main.c @@ -1788,6 +1788,24 @@ iaa_setup_decompress_hw_desc(struct idxd_desc *idxd_= desc, return desc; } =20 +/* + * Call this for non-irq, non-enqcmds job submissions. + */ +static __always_inline void iaa_submit_desc_movdir64b(struct idxd_wq *wq, + struct idxd_desc *desc) +{ + void __iomem *portal =3D idxd_wq_portal_addr(wq); + + /* + * The wmb() flushes writes to coherent DMA data before + * possibly triggering a DMA read. The wmb() is necessary + * even on UP because the recipient is a device. + */ + wmb(); + + iosubmit_cmds512(portal, desc->hw, 1); +} + static int iaa_compress(struct crypto_tfm *tfm, struct acomp_req *req, struct idxd_wq *wq, dma_addr_t src_addr, unsigned int slen, @@ -1826,11 +1844,7 @@ static int iaa_compress(struct crypto_tfm *tfm, stru= ct acomp_req *req, ctx->mode, iaa_device->compression_modes[ctx->mode]); =20 if (likely(!ctx->use_irq)) { - ret =3D idxd_submit_desc(wq, idxd_desc); - if (ret) { - dev_dbg(dev, "submit_desc failed ret=3D%d\n", ret); - goto out; - } + iaa_submit_desc_movdir64b(wq, idxd_desc); =20 /* Update stats */ update_total_comp_calls(); @@ -1918,11 +1932,7 @@ static int iaa_decompress(struct crypto_tfm *tfm, st= ruct acomp_req *req, desc =3D iaa_setup_decompress_hw_desc(idxd_desc, src_addr, slen, dst_addr= , *dlen); =20 if (likely(!ctx->use_irq)) { - ret =3D idxd_submit_desc(wq, idxd_desc); - if (ret) { - dev_dbg(dev, "submit_desc failed ret=3D%d\n", ret); - goto fallback_software_decomp; - } + iaa_submit_desc_movdir64b(wq, idxd_desc); =20 /* Update stats */ update_total_decomp_calls(); --=20 2.27.0