From patchwork Tue Jun 11 03:48:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 13692888 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1A404C25B76 for ; Tue, 11 Jun 2024 03:50:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=v63IEeQE1OFhGw9eaHX10jEDjUl5MvQwJrx29/vEn4I=; b=Je1JDlK4Uvz7mI 184rqsI6wMe6wTcS3H0JoGQ6pidET8O6jcdtZ58pDPAJLhJTZVWrZiZMVDpoF/gQvK9EGxPx10cOa Linn+TjHfpyv4VIvpYjgk/4EWfLWpOL0AqWxHLtsPVrPhG3qQgKsxYfcBX0aSk7Rv1SCS3XJv6IsG 0ihZTOl+c45z2Dl4ZyGd1RKdAelRnWyjM0SAmq/XGUYlxV6e2kiahYuqLRWLCUuJtKplCATneYeQk HRTSMiXhq8TsOsj+T0uudOH7UMPswbtRf1tm/b5ubsjn9tbVVx3xZe9T0VzteQ3rZORTNkyMX4fec JvpfocpP1qLHSYBytQCA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sGsWY-00000007Iui-3gRq; Tue, 11 Jun 2024 03:50:18 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sGsVm-00000007IMT-2OS9 for linux-arm-kernel@bombadil.infradead.org; Tue, 11 Jun 2024 03:49:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=btkK1VOq4ZqgXFKiGdy1Isa8V1yTMlaiGvgEXncMUtU=; b=HuEOGDSTLpcUhob3MnOqYMio9K pgr4kWRd2uz1LngcLs5n3/Pzrj+jF6EBa2+7jvPTuURYYnHcZOyN9SdVA6Q9Fzr2r3Yfym6Sd++k1 vOqh0ME1ydvCJ+K3M3sjDqDBxWwAamcLYU2PDt3ehEZziUs8HOc/De0USW5q7Zz3E9e5eXd/ejteM Svk7VcvBWYkw6FHAPmgFWXCrv5+NqopgPcOMUPMh+XqF3Lhrqjfy/qMovuVjOzjwk2c5ci7+jA+OC do63jdV+h7u15FOgu5Um61nm0TrCePKSUMXSk6RyPN4b6H67q4Zi7EwSQnDH9n7ZgVF2Uu/hSZ0PJ zG89jL5w==; Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sGsVb-00000001s05-2RIq for linux-arm-kernel@lists.infradead.org; Tue, 11 Jun 2024 03:49:29 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 1243B60C88; Tue, 11 Jun 2024 03:49:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97374C4AF1C; Tue, 11 Jun 2024 03:49:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718077754; bh=ukGSgX5MesqBbGJj7yzKjyDULlLyq2Ow1gHuSG/PLIk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fhpkSPeaAOYUhZnC1IAvTG86aeMudfDvPq1AJ6d6PBVbWVNiywtoyarmcuYIVIRgT mt0/r3cn4fzilUMhCwJ1eZndrcwxywUR+FtWNh8uxCsfANn6/0Mq2lD9u6PZ05I/mD /mU6ttCVE6/nJOtzF70jguI/TQy8ARn0fQC5r2FnWiIibMSiQ3ozGBG6h1j2bjbut4 w+71Z7NyZWRqgc2Zv1cPBRT38X4gYHu5L2hb2JwTkGYX6ZYyL3UmAAQc01fLBC0D4o I5vibPzddTy2imZTf+oBNSPIy6dWOwbuAlQpVdorpq6gg5NAv6W8xbYK4ov+gFE0ap sLw30XMUFPUbg== From: Eric Biggers To: linux-crypto@vger.kernel.org, fsverity@lists.linux.dev, dm-devel@lists.linux.dev Cc: x86@kernel.org, linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Sami Tolvanen , Bart Van Assche , Herbert Xu Subject: [PATCH v5 10/15] dm-verity: provide dma_alignment limit in io_hints Date: Mon, 10 Jun 2024 20:48:17 -0700 Message-ID: <20240611034822.36603-11-ebiggers@kernel.org> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240611034822.36603-1-ebiggers@kernel.org> References: <20240611034822.36603-1-ebiggers@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240611_044925_884867_51C1EE54 X-CRM114-Status: GOOD ( 11.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Eric Biggers Since Linux v6.1, some filesystems support submitting direct I/O that is aligned to only dma_alignment instead of the logical_block_size alignment that was required before. I/O that is not aligned to the logical_block_size is difficult to handle in device-mapper targets that do cryptographic processing of data, as it makes the units of data that are hashed or encrypted possibly be split across pages, creating rarely used and rarely tested edge cases. As such, dm-crypt and dm-integrity have already opted out of this by setting dma_alignment to 'logical_block_size - 1'. Although dm-verity does have code that handles these cases (or at least is intended to do so), supporting direct I/O with such a low amount of alignment is not really useful on dm-verity devices. So, opt dm-verity out of it too so that it's not necessary to handle these edge cases. Signed-off-by: Eric Biggers --- drivers/md/dm-verity-target.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c index 4ef814a7faf4..c6a0e3280e39 100644 --- a/drivers/md/dm-verity-target.c +++ b/drivers/md/dm-verity-target.c @@ -1021,10 +1021,12 @@ static void verity_io_hints(struct dm_target *ti, struct queue_limits *limits) if (limits->physical_block_size < 1 << v->data_dev_block_bits) limits->physical_block_size = 1 << v->data_dev_block_bits; blk_limits_io_min(limits, limits->logical_block_size); + + limits->dma_alignment = limits->logical_block_size - 1; } static void verity_dtr(struct dm_target *ti) { struct dm_verity *v = ti->private;