Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2506226lqp; Mon, 25 Mar 2024 00:11:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV4C/tsyTAmKN4lJLQpluzRKOrkRC6tLSdYMK52RwneGWsBIu3xrhx88p59JcPGH/U2LZEGnrl0qy+mUAVzAboxBzHGLyX9f+Tip8CFvQ== X-Google-Smtp-Source: AGHT+IF8KYrMn6rE1784TB5dv9Q96SqrbYAxZYjn9+DpZprLMJ3EpaboITH4N9L0vMJeWO7zbh/F X-Received: by 2002:a17:906:29c3:b0:a46:b1b3:aba0 with SMTP id y3-20020a17090629c300b00a46b1b3aba0mr3920044eje.17.1711350664632; Mon, 25 Mar 2024 00:11:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711350664; cv=pass; d=google.com; s=arc-20160816; b=LtMaWPBY7fbbVKqkyRGZmPsI63PAzgwkLufQPmXgZttls0f25J+d+JY6CyhvUWQlVN YJIRevb/DernI65rJ1IUZ8UyUldtrjjrs7Lbj4eY5gyjwHRqQnO4GsMTliOCr+esbvC8 F40CEQAGHyBFmgqDlyMBWOGgVR015/TXLvGEudqbNcHxCskyDjw0HbsWCPoBjuZWs67f GnpuPHny5Om6G466t3TeEQNp8+dsuySHeTNWiKtlZumM4vcLzshWHW2C9cEhblVHU66O jbBHe5pBHEUzABaQG8lSbaMPuCylMyJiWbSLzVopfW+OHQjpa7hr/1RfiMiHvJXA1pLn HS/w== 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=WU91QYDO+brQxV/LqLwf2JxVHq1KR5i1naZ3wsbs8q4=; fh=gztaZlEV/IhaCTI9OXrOTx7G3T0xX7o1SJxZFm84PTI=; b=OtfaN9+Nlg4eYU6USk5q+T++9wp56yROzKcpAb8ULKnJmMj2UJrBhhm5HQsvPi0ZQ4 Is71wd3N//Jicy1i+38n1kcUj9H4EROvijqX1pkISdj4CeqYTfQlnty4EG2uTm+CJ18+ 0V5iSDIgkEzsfwekMzAFGyTlsoepolcAsDSG/CIop8oZAptPsSXutAsCjnKSHZ8rFgMP Vu/v7/v2ID/XRSRgQIWYKXjUieQiHksOGXv3GijjSXQOVMP2x/FxMZVhhOHcUNLazNxZ CvKNO8PI6eBuJxR6heVTP5cFao+cWR8flQxTlA2YFdFa+KaSdovb+H95+RXw6e7mGH3s qePw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="i/QUK6VT"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-114939-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-114939-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id k4-20020a1709061c0400b00a466e738516si2170098ejg.802.2024.03.25.00.11.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 00:11:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-114939-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="i/QUK6VT"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-114939-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-114939-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 5F7B51F2F0C1 for ; Mon, 25 Mar 2024 07:11:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 508471BE802; Mon, 25 Mar 2024 00:56:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="i/QUK6VT" 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 F04C1179FBA; Sun, 24 Mar 2024 23:40:47 +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=1711323649; cv=none; b=GvK5XA6pyZFdJ5dKFY1iF0yyO2L4R1GPXbSIsLIg9pwu2aQ9uAeD7FBNyvdJKzVrJ8mt5rt2tY7vJD41R2Dgazcd4MQkg3g5TWsYBvt5GyLeBqgRhQdJOrpPDlPeNuDBU01E/+tzneETUay/6qIEELWrizs0eqiMbD+6vHn0wik= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711323649; c=relaxed/simple; bh=rV1Chya9Fs80M7pKnqpi+2koMxxRjn3q/NRZJ9hXBPA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ELg98MuHKge83TQSmiUV32EPvR9pAVkyKuf/r04RkPzTdHiT5sNwKoRP96U+jFHvV4FIoKiG6waMUTpixhB6t3VB5+eBIBgYnmwsBiOqKNfttqbkhFLBCBL1TjpqutioDcEr6KG2OVpRewhjc9wzEk8NXrHsbOoBahDwMaA5yTw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=i/QUK6VT; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22F8DC43390; Sun, 24 Mar 2024 23:40:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711323647; bh=rV1Chya9Fs80M7pKnqpi+2koMxxRjn3q/NRZJ9hXBPA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i/QUK6VTo8/QzTfceR9d4rUZkvtx233wHaRlQaaqSWO4W4KjggP8qLxfkjFfGuJgl ARFxTnp2XOwseEFeOnqaO2/JD/Ef0+n74vY06psoC/PsUTHzvYeuehKXphqVBW0ua4 uoipSZL74M7WxZFbUq4X2O3OoVeb8/DhTuoNewAtWTCRM5daAbWLKN3td1mT9QdoCQ ZkH2wr6i5+B9/kFOoAYDIJphRRxtOJAo+qGyd85dQOJ25CXuEztn7M+CCxzWUdJNrW wmEa1wXsA941lpOBi5e0I2B6ssdm4EwDUtFO6g6piEAVJeOXzXyIo3aEJa8nE/iqsA 6RmTXYBl4o9Kw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mikulas Patocka , Mike Snitzer , Sasha Levin Subject: [PATCH 5.10 019/238] dm-verity, dm-crypt: align "struct bvec_iter" correctly Date: Sun, 24 Mar 2024 19:36:47 -0400 Message-ID: <20240324234027.1354210-20-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324234027.1354210-1-sashal@kernel.org> References: <20240324234027.1354210-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 5edcdcee91c23..5deda6c6fa2e7 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -48,11 +48,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