From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C768C282DE for ; Wed, 5 Mar 2025 18:54:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B52CE28001B; Wed, 5 Mar 2025 13:53:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A6176280002; Wed, 5 Mar 2025 13:53:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8DD4728001B; Wed, 5 Mar 2025 13:53:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 63ABC280002 for ; Wed, 5 Mar 2025 13:53:59 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 39EED120857 for ; Wed, 5 Mar 2025 16:25:54 +0000 (UTC) X-FDA: 83188023828.24.834C58D Received: from out-180.mta0.migadu.com (out-180.mta0.migadu.com [91.218.175.180]) by imf06.hostedemail.com (Postfix) with ESMTP id 2A97618000B for ; Wed, 5 Mar 2025 16:25:51 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=iZHQl6Vy; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf06.hostedemail.com: domain of yosry.ahmed@linux.dev designates 91.218.175.180 as permitted sender) smtp.mailfrom=yosry.ahmed@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1741191952; a=rsa-sha256; cv=none; b=OVWuEetqLdnoAh9mSxUFyYgqi3zCvvjvNJXqKEF2Z40imd3ZbWTTDsIytT5/7Awk6QFUYw HSzzX4Rt7uQOOZLvOY1/kIw391OQ+1Y3seljnc6iiFiDyOWaTGO4Xa0KxnCwBfz6yShGcB 8CxYfaG4ckarCItNgehMmUYNRsDwjDE= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=iZHQl6Vy; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf06.hostedemail.com: domain of yosry.ahmed@linux.dev designates 91.218.175.180 as permitted sender) smtp.mailfrom=yosry.ahmed@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1741191952; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=BvzCwylmaHDh0dH7GwicN8+TVMfSuvEGvsOBD/vsXco=; b=qLIaf1Os20a3ndAt8x2UXFCSt6O2DEItqeY4UJgKh/24CIwbWaQ6wCn41sphE0Gs31yzuK yMF/nKAfGS1UnWvFRFabUZy48D12ke+T02HeZxHzFePjifmlkEbx97PuVbQPA99OtKr8zV WOIvVJ09UK8X8oBt8z4WEBd1yzh06xg= Date: Wed, 5 Mar 2025 16:25:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1741191948; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BvzCwylmaHDh0dH7GwicN8+TVMfSuvEGvsOBD/vsXco=; b=iZHQl6VySrCKvj/CpQVbXv35cw0/uaPgAFE8E9uNu4117Vwv3YHP/hHCo+NWQ6sUM5j6Y5 pNd80Mv8L6Q9zNTvcJV9lpP9BYtTNLTcLkdlb44pDq76vhNVf5sueV9xkNTz1p8QAEWG8J tByHf2tlTOecQq+ZpnO9katFgT6Xw5Q= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Yosry Ahmed To: Herbert Xu Cc: Sergey Senozhatsky , Eric Biggers , Linux Crypto Mailing List , linux-mm@kvack.org Subject: Re: [RFC PATCH 7/7] mm: zswap: Use acomp virtual address interface Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 2A97618000B X-Stat-Signature: ptzh8dywdc6ar5edosgjgy56q9y8wy1c X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1741191951-28499 X-HE-Meta: U2FsdGVkX19tNrMMzFUmnUpoCnmdzbgFEApypI1wbpukesXOFBLJ6UpYQleJ+IMrlte5Bvd9IZapB66p3ROes4v7fZwffkqa5AjzKR8D93QkjF5QUxtYBVHrcRxpOfoOHBZpKWVLrpTgHq5B3mhf1NgIzXHRtias8n09vpuDFkyQJYtOmRhtgyMn3gyicUpXbDxO/WB4QcOpoESA6BV6/o9ZKDisJdJ0/zZ0xQrOKpAQHvcsQFcMaCsf8aX6O/gAu4ov8URQ1s/eOhb6uHNwlmkeZNXTDM1Kr5TTaYA46AWIQU8WRoVIfVSdY8EsyMTQn3wDbOmBBxHTJs0xsETkbK0ogCQ/PK83HQUUU3Aa7ojbCJDHi+vg7e2i5Fm9GhtFMRmG2udFQ7dB6RIZjtxSyvbhBNxWnKQXgPJ/bJUVHZ6s0SV+DOKXOFrkqXx1lso8PhAmLApJTZMSaPEXBKC5eiyB0NJjW4tsX7rgIQNp3Ak+dg91FHSwNdDsYqX/5qDMNLDJNLIjxLvVkIJSIe98ye0tX+QfIBdPv3E/XpzOhWdqCA+W2BEN7LOj/yKvO/Tji+PtIYrnz6HnguxTl4/FH3uBkOjNVv5QUVjzALbPz+91GQ4ImY0IZ6SpKGgrzsubH81fRGabTjMUqxZLAa7maEEHuHBDCLF4olv5MMxmqlXHVMmCPd2gwlqtmJSMwNfoXw4Qhic5Wm+DBfkqA/vbfPSLNay5mYtEE/h6JuA7EX+1XbDf3jBATh51hhX/81WalnKh3g3X7fRb6I+P92UzoTCuUHlHmOMiyqhiGNo52ZQqiSY+jy5fs0SrKu8f0Z8SZkEMVphNWOd2d9cd6H4xfrv47cCe0Qx2lXOmiepme2ZESPjODqPdCyqCAy4o5mp/qY73OrBAcCbFIH6tBq2SUYQMGr5PpZo62yjZK+s0AfJDPKWyRl05dCCQ9DaW6kx9t4qlw3WM3YV5Y0kkTEA qR5h4eGR fPEtCBoDnC/yWKI3dIrTpw7cOH3KYfWd5ZEJhw8hMyx2lyhu90Q6C15SBkYTTDdfCBsqRlSv7j2XKzMDea71zEmxyIhPnkPupmySevwiTiLkcTWfvcRSpusRIm0zCnogwJMS0zaz7yn4madpeJAmgxQHuSyx7iCBeVvsDbPaCxbnFMCirM6TFSsRZeezfbrKzxylDXDcos+ojtS5cAmARslVkMQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, Mar 05, 2025 at 10:10:46PM +0800, Herbert Xu wrote: > On Wed, Mar 05, 2025 at 03:46:18PM +0800, Herbert Xu wrote: > > > > > Also, please take a look at patch 2 in this series for another reason, I > > > want to make sure if your virtual address series can be used to remove > > > the !virt_addr_valid() memcpy() case completely. > > > > Yes it should work provided that you specify the memory as nondma. > > Actually you can do better than that, specify the memory as nondma > if IS_ENABLED(CONFIG_HIGHMEM), and otherwise as virt. > > The idea is that we only have two hardware offload drivers, both > from Intel and they're probably not going to be used on platforms > with HIGHMEM. > > So something like: > > if (IS_ENABLED(CONFIG_HIGHMEM)) > acomp_request_set_nondma(acomp_ctx->req, src, dst, entry->length, PAGE_SIZE); > else > acomp_request_set_virt(acomp_ctx->req, src, dst, entry->length, PAGE_SIZE); Well, ideally it would be based on whether the address itself is a highmem address or not, it may not be, even if CONFIG_HIGHMEM is enabled. > > Of course all this would disappear if we used SG lists properly. Zswap is already using an SG list when calling into the crypto API. The problem is that SGs (i.e. sg_init_one()) does not support kmap highmem addresses. Is there a fundamental reason this can't happen, or is it just sg_set_bug() using virt_to_page(). Also, since the crypto API is using SG lists internally as far as I can tell, how does acomp_request_set_nondma() essentially deal with this? I don't understand why we need to use a separate nondma API for highmem.