Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2552094lqp; Mon, 25 Mar 2024 02:17:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVzODWyVxdePd2JPU+Gs46pkdH3G04nAuIYaf8qvT/AePOldvXRtnk8Y43hE+KT5l5IjvlRNvHRjCgrLugZ2TooiBks7z3Ugggtkm0ixA== X-Google-Smtp-Source: AGHT+IEj62uh/+ahMZy4HstsGG2WTdOZtpOydrOlyl2izaarnyRGO6bARO1W+wkTiTqgvM24FzV0 X-Received: by 2002:a67:bd0c:0:b0:476:f819:8da3 with SMTP id y12-20020a67bd0c000000b00476f8198da3mr1428758vsq.14.1711358230331; Mon, 25 Mar 2024 02:17:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711358230; cv=pass; d=google.com; s=arc-20160816; b=S8pmVUcEeIvkly5F88Bp4JRX2MnCycB9qrlcf1xdZChCp205V0tp9Z/89AVGbJ9e4z 7j/kqLFs17yEY8wApclu2yKM2ctg4tyu1VgX941Ck+XggF8MuiUtW8wieTfBoAM+1Q6i vXqEJ8QHUYHDMif6ROmZqG4tu0I8FQpiFSdgzOYeomc1Yx68uB4DjhOVxPmrfd0/CAl4 8kJUuw084jCZ6uggyFgTr13l6SQkMmdw486PXYkd556Xp6AmSPr3OhvEuRWhossdNpOQ 9pS6I8wrxGUU1azThAdJrkeoim3jnQXDCltH+dcgR9JVRaVXiCLFdCTzUpfd++oE/iM8 A4VA== 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=efh6qRVEd60mI1DWj+nVuD3XBbw57LkV1XyQ7PwVvLM=; fh=gztaZlEV/IhaCTI9OXrOTx7G3T0xX7o1SJxZFm84PTI=; b=Qwrm5BcSq3A6EraGIEy1UEuVxNNJd2+etE5cz9zrVZlSmENF+wTizXK+wiTpsgpSlc gbgw+q/Az1OdQPcOFe2hhZzrDUGMmUGDVSl3fcW0MA1wAUHvXf+fjF7rkAEVMLOmu5s0 NV//lBfp/kJDSqGFBXe8Bcaqw2e0hcls33qS+nYzm714q/aHEYloWuB8GAoei6NjCYvS WzMRTGBS0f63tPLiW2rg3ipQfb50acXtYa/MYsQ0eZFdcXj4nTz40i0VLKSMXRaIMRC2 /sXwPmP4Pb//Ec8xMi2KaG8utRl57gI7djlLSqTGtxXQABJ7AK90E9qX5zFFJGuSf5nw RzRA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=M54M4HVv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115766-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115766-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id a31-20020a05620a439f00b0078a546f0cf0si2382398qkp.479.2024.03.25.02.17.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 02:17:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-115766-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=M54M4HVv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115766-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115766-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 11C3D1C30CAC for ; Mon, 25 Mar 2024 09:17:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9E3A32618D8; Mon, 25 Mar 2024 03:00:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="M54M4HVv" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8D6501448F9; Sun, 24 Mar 2024 23:12:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711321966; cv=none; b=gY6qfk3Da7+i9f5RyqhOB3Ie9nP42G1IF2nXxJZGwRL5tBqownFwBR+KB35O4fF3cOI+RwZrO3UisGdPXt5l+JwxAsbei8dcAwtPOkj+E17SjyWUTaQYDXaUOvMPsTz8eL6YXapgn75q9r4LnUWKkcJtb6uudgioZPyRHB35VNU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711321966; c=relaxed/simple; bh=I8eGADWXPdjdnNTSJAoWWwQMWOP7eoIUp9QQbE5rUWA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lx2EAcanUzfzl7EueYe+ik8fZBT4/Kouii7Ywzw1qhlbORlaAYTtCaxxRkspkhLQb/wll/9Wr7fBI0jaKbn820bFztYyuvtdNKLx+O9X2PXOSR0GvI+xhyQSPEViB4GL/uGrNbJB6n28YVWuiOX+rv0/TH4P4mH2LcUedI7QIDk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=M54M4HVv; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB735C433C7; Sun, 24 Mar 2024 23:12:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711321966; bh=I8eGADWXPdjdnNTSJAoWWwQMWOP7eoIUp9QQbE5rUWA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M54M4HVvGdbg0Poj4jU8CigggmTpTJzTEF3wXBBXHtmXVfN/23uW3bJ7x5DHEfV02 S+KI3vDn28J8rKoiRdxgL91Cn0ptqlb9pKBD2JiH7FujlQohAj9ky2F41VzrpCTTEc IDr/ToZbjybNdOKTy/G+3vhzM36RS0manpaxIxlNsTd/Qa6FgMcp8/QgPhG4hTXn8/ VRj7Opswj3+MYWd1Z4HuGJOgBpRU/okIds3OEAofnTsP5KXIMACCDmgMABFNZdXKuH mmm43zK8rquD4y02AAcpQsCn1GMlBJa4QK29QUoYF9nVmMo7AwMKJVZxMFdYUwofpQ RIax5WFIv6Twg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mikulas Patocka , Mike Snitzer , Sasha Levin Subject: [PATCH 6.1 038/451] dm-verity, dm-crypt: align "struct bvec_iter" correctly Date: Sun, 24 Mar 2024 19:05:14 -0400 Message-ID: <20240324231207.1351418-39-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Mikulas Patocka [ Upstream commit 787f1b2800464aa277236a66eb3c279535edd460 ] "struct bvec_iter" is defined with the __packed attribute, so it is aligned on a single byte. On X86 (and on other architectures that support unaligned addresses in hardware), "struct bvec_iter" is accessed using the 8-byte and 4-byte memory instructions, however these instructions are less efficient if they operate on unaligned addresses. (on RISC machines that don't have unaligned access in hardware, GCC generates byte-by-byte accesses that are very inefficient - see [1]) This commit reorders the entries in "struct dm_verity_io" and "struct convert_context", so that "struct bvec_iter" is aligned on 8 bytes. [1] https://lore.kernel.org/all/ZcLuWUNRZadJr0tQ@fedora/T/ Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin --- drivers/md/dm-crypt.c | 4 ++-- drivers/md/dm-verity.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 3e215aa85b99a..e8c534b5870ac 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -52,11 +52,11 @@ struct convert_context { struct completion restart; struct bio *bio_in; - struct bio *bio_out; struct bvec_iter iter_in; + struct bio *bio_out; struct bvec_iter iter_out; - u64 cc_sector; atomic_t cc_pending; + u64 cc_sector; union { struct skcipher_request *req; struct aead_request *req_aead; diff --git a/drivers/md/dm-verity.h b/drivers/md/dm-verity.h index 4620a98c99561..db93a91169d5e 100644 --- a/drivers/md/dm-verity.h +++ b/drivers/md/dm-verity.h @@ -80,12 +80,12 @@ struct dm_verity_io { /* original value of bio->bi_end_io */ bio_end_io_t *orig_bi_end_io; + struct bvec_iter iter; + sector_t block; unsigned int n_blocks; bool in_tasklet; - struct bvec_iter iter; - struct work_struct work; char *recheck_buffer; -- 2.43.0