Received: by 2002:ab2:3b09:0:b0:1ed:14ea:9113 with SMTP id b9csp155669lqc; Thu, 29 Feb 2024 13:11:11 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXqlYSc+3Rr5G/LrObXzz13LYIKd3I+ykcRYJKC4Kygztev+PZd90ywFF8g76nwv3r4UmHK8I7uuKhq0Jy4PrLx93Qd/d4PpHhPvFdo1Q== X-Google-Smtp-Source: AGHT+IE7jPRJdoZf8Iip/+V/jge3UpbjcRaBI+y9voxoac7awipUABDfab/lsw6bzgSzgVxOdmMl X-Received: by 2002:a05:6a20:c78c:b0:19c:a2ef:c45e with SMTP id hk12-20020a056a20c78c00b0019ca2efc45emr4336274pzb.37.1709241071473; Thu, 29 Feb 2024 13:11:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709241071; cv=pass; d=google.com; s=arc-20160816; b=p2caNZ8V6S2dnnGiZfyFeHU0dR2ZrPLAxM8FcBHISflWFSrBwJyd1aI9VuDEp3EcUf 09AFM2FcNh30CtmyH+Mh4hl8ffs5uzOJUVF3S0HNGbq2W9cdJM3pUgziOcVJ08XrzSz+ lNvBO/72LO1tvMwjayoiGBErg623OqqVyefp4BUe/CgWpbo6A+w/wA6AWyYM8k8Y+urd Ktm3jnDLxVfLp9C0PrBh6SjHw+eSktoBztXWB/BHQJ8+sLz9UQ4WErGFSn1kXZ0p6N8V FJSE7YacvV71u6ckX0t5EziJjJq+ftMB3GMxhGk49sQRtlqpUWObI+jGc6P7mqjwslew TmIg== 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=VPFzExz12fVybC4Ei9zwK/QDt9qdqOc3M17mRVpiUpo=; fh=lbcQL7oIYf/a0JavtqwyVBzHnxY9BvZg7G8H0sf1jLw=; b=er3p2AopfUqisqH3MOcrYAqdaNd65/XQHD+IHZr2wEZDlgtcaoVUfZPVvCwcyGc3ZV vUPALZTdSZXHVDBi2rnwDaRU/vIrgKc+O+hlmIPYOuX3KXsgprQL0HSUKE/yWlRqq+oO QhWvT2290p7PM/tegE7BnI33h8xH24fryDVA9D3pC/UPwLwX4qjQacrH1YAQm5+jg+GJ m2eJFnJbbXuQQqzK0+ulhqnjbqWfoKrVPJWs8PmqHyesOdBE5JixGDyopMRUxCr0vfHM DoKwx7M+OL2DlKXeZ4rhig+Q9dyCN3qVBJv6hP+WkIGdUGw9zX64wnuO2kwGjWl2c7V4 B4qA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=loHF5EoD; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-87504-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87504-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id x63-20020a638642000000b005dc7ee3c62dsi2016482pgd.236.2024.02.29.13.11.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 13:11:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87504-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=loHF5EoD; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-87504-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87504-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id A10C7B25331 for ; Thu, 29 Feb 2024 20:58:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9CFAD1690BD; Thu, 29 Feb 2024 20:41:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="loHF5EoD" 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 B6F561690A1; Thu, 29 Feb 2024 20:41:23 +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=1709239283; cv=none; b=uTA56ZdOEZVVWGcQeZduxKzOkl4NlT68ApRukDnIGZZc89fcQWnSyx0SYtzFJ4NEV2pg3Zv9lmIkGVM3MjA3xc9ElEU0ndJEc1hxONSC3t2C074nB/QCcpAyy92HqVeWTYzXPDdL8gDPley81TQy3sTwL1wbdsvED7knBhEmLlQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709239283; c=relaxed/simple; bh=HgQFFOvD9t8faJspiAQnniBSfen1VpgZbB5fk8QC1SU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LZAWxAWQF+PmQ6r9vTF7rsU0gPV4TGKl2OZMd06eDemSFnjsPpWbej2QvIUBHYWDdk5V29HEynNXS3xxZqXEVhX3dAblJ3f1YeodCNEr/I417jz1uwiRXLSOPewKpL69/DcxKvgfDV/EFoAdqwoieF+KcwxzCL1T0XxO0QE1I6o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=loHF5EoD; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0835C433C7; Thu, 29 Feb 2024 20:41:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709239283; bh=HgQFFOvD9t8faJspiAQnniBSfen1VpgZbB5fk8QC1SU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=loHF5EoDaIXAyYzmohrUeGMbfpS2DCH0ODtWbS5bAurrJlp7Re2+weKy5WmXVLUoX sSI0MuEDZd325096tMum7utDdnH9a3ebObSnw7auBBANrgXM0KLtWLirJ5yfEwXshx r15ACfMks6dZaLZUZaR7OLKFYL1JIjUnkRvwDppHSaQii5mGBlrJ3t2x/TrNdfkx1Z agO6enq0Bxm1uzK6BttVBFglE1RDzOM+gK8VJn+d1G3yUrMiuVVluWArK/gnyYeXOl /pEPI7rZvQl0Iyf19YV2KsD9eEoHZgNklxjU7I8wjWdiqVqg/21ehPTOeGvGyswAzV 67ajeROpmcZfA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mikulas Patocka , Mike Snitzer , Sasha Levin , agk@redhat.com, dm-devel@lists.linux.dev Subject: [PATCH AUTOSEL 5.15 9/9] dm-verity, dm-crypt: align "struct bvec_iter" correctly Date: Thu, 29 Feb 2024 15:41:05 -0500 Message-ID: <20240229204107.2861780-9-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240229204107.2861780-1-sashal@kernel.org> References: <20240229204107.2861780-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 X-stable-base: Linux 5.15.149 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 a428770102a37..edb70cacd805d 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -49,11 +49,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 78d1e51195ada..f61c89c79cf5b 100644 --- a/drivers/md/dm-verity.h +++ b/drivers/md/dm-verity.h @@ -74,11 +74,11 @@ 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 n_blocks; - struct bvec_iter iter; - struct work_struct work; /* -- 2.43.0