From patchwork Thu Nov 10 18:44:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 13039153 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8075BC433FE for ; Thu, 10 Nov 2022 18:46:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230294AbiKJSqL (ORCPT ); Thu, 10 Nov 2022 13:46:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230223AbiKJSqJ (ORCPT ); Thu, 10 Nov 2022 13:46:09 -0500 Received: from mx0a-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26A8A4B982 for ; Thu, 10 Nov 2022 10:46:06 -0800 (PST) Received: from pps.filterd (m0089730.ppops.net [127.0.0.1]) by m0089730.ppops.net (8.17.1.5/8.17.1.5) with ESMTP id 2AAIf48u024751 for ; Thu, 10 Nov 2022 10:46:06 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=s2048-2021-q4; bh=BXZxQzxpzsSb6WYew1FH2hUh44ALjDUiAxoc3nDvP2w=; b=UgIRXLq1+3o7VytUQIz6nN01Z1GUZxKS4xthU3SKJamzgvLaTUBhq9VTphHnaz3E8OOx oiILE+l2d16yw2uGLZydfQTesDc7tFISl9YoP+CvaAQrxnc/KnumjwmvGAsXMS8hXFXo MWViYZoQ76zHwgZAAs7MCfd23sKIhF6vn83lbYJ6MEZKXRnBZa233mq9YoFuHMCzzd/C HcK0GHIykJJDsVpvUuYeE/kXt6MrMbGOT8NrvovxmZf8HcCBfDWxsVrfSDw1/vFNDxpm zg3i9z/gq3Apn1fTsculDnnamFxzfHq6TA4v3F3dVGlAMGe8kE7CqRvhFtb7dP2MV96C 8Q== Received: from maileast.thefacebook.com ([163.114.130.16]) by m0089730.ppops.net (PPS) with ESMTPS id 3krmwrfev1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 10 Nov 2022 10:46:06 -0800 Received: from twshared2001.03.ash8.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:82::d) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 10 Nov 2022 10:45:24 -0800 Received: by devbig007.nao1.facebook.com (Postfix, from userid 544533) id C27D1B08CDE2; Thu, 10 Nov 2022 10:45:02 -0800 (PST) From: Keith Busch To: , , CC: , , , , Keith Busch , Christoph Hellwig Subject: [PATCHv2 1/5] block: make dma_alignment a stacking queue_limit Date: Thu, 10 Nov 2022 10:44:57 -0800 Message-ID: <20221110184501.2451620-2-kbusch@meta.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221110184501.2451620-1-kbusch@meta.com> References: <20221110184501.2451620-1-kbusch@meta.com> MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-GUID: vOZO3IN6mH7OgXIeVvbZ0N0PigFJNuer X-Proofpoint-ORIG-GUID: vOZO3IN6mH7OgXIeVvbZ0N0PigFJNuer X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-10_12,2022-11-09_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Keith Busch Device mappers had always been getting the default 511 dma mask, but the underlying device might have a larger alignment requirement. Since this value is used to determine alloweable direct-io alignment, this needs to be a stackable limit. Signed-off-by: Keith Busch Reviewed-by: Christoph Hellwig --- block/blk-core.c | 1 - block/blk-settings.c | 8 +++++--- include/linux/blkdev.h | 15 ++++++++------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index 17667159482e..5487912befe8 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -425,7 +425,6 @@ struct request_queue *blk_alloc_queue(int node_id, bool alloc_srcu) PERCPU_REF_INIT_ATOMIC, GFP_KERNEL)) goto fail_stats; - blk_queue_dma_alignment(q, 511); blk_set_default_limits(&q->limits); q->nr_requests = BLKDEV_DEFAULT_RQ; diff --git a/block/blk-settings.c b/block/blk-settings.c index 8bb9eef5310e..4949ed3ce7c9 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -57,6 +57,7 @@ void blk_set_default_limits(struct queue_limits *lim) lim->misaligned = 0; lim->zoned = BLK_ZONED_NONE; lim->zone_write_granularity = 0; + lim->dma_alignment = 511; } EXPORT_SYMBOL(blk_set_default_limits); @@ -600,6 +601,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, t->io_min = max(t->io_min, b->io_min); t->io_opt = lcm_not_zero(t->io_opt, b->io_opt); + t->dma_alignment = max(t->dma_alignment, b->dma_alignment); /* Set non-power-of-2 compatible chunk_sectors boundary */ if (b->chunk_sectors) @@ -773,7 +775,7 @@ EXPORT_SYMBOL(blk_queue_virt_boundary); **/ void blk_queue_dma_alignment(struct request_queue *q, int mask) { - q->dma_alignment = mask; + q->limits.dma_alignment = mask; } EXPORT_SYMBOL(blk_queue_dma_alignment); @@ -795,8 +797,8 @@ void blk_queue_update_dma_alignment(struct request_queue *q, int mask) { BUG_ON(mask > PAGE_SIZE); - if (mask > q->dma_alignment) - q->dma_alignment = mask; + if (mask > q->limits.dma_alignment) + q->limits.dma_alignment = mask; } EXPORT_SYMBOL(blk_queue_update_dma_alignment); diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 50e358a19d98..9898e34b2c2d 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -311,6 +311,13 @@ struct queue_limits { unsigned char discard_misaligned; unsigned char raid_partial_stripes_expensive; enum blk_zoned_model zoned; + + /* + * Drivers that set dma_alignment to less than 511 must be prepared to + * handle individual bvec's that are not a multiple of a SECTOR_SIZE + * due to possible offsets. + */ + unsigned int dma_alignment; }; typedef int (*report_zones_cb)(struct blk_zone *zone, unsigned int idx, @@ -456,12 +463,6 @@ struct request_queue { unsigned long nr_requests; /* Max # of requests */ unsigned int dma_pad_mask; - /* - * Drivers that set dma_alignment to less than 511 must be prepared to - * handle individual bvec's that are not a multiple of a SECTOR_SIZE - * due to possible offsets. - */ - unsigned int dma_alignment; #ifdef CONFIG_BLK_INLINE_ENCRYPTION struct blk_crypto_profile *crypto_profile; @@ -1324,7 +1325,7 @@ static inline sector_t bdev_zone_sectors(struct block_device *bdev) static inline int queue_dma_alignment(const struct request_queue *q) { - return q ? q->dma_alignment : 511; + return q ? q->limits.dma_alignment : 511; } static inline unsigned int bdev_dma_alignment(struct block_device *bdev) From patchwork Thu Nov 10 18:44:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 13039149 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 680CFC433FE for ; Thu, 10 Nov 2022 18:45:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229528AbiKJSpS (ORCPT ); Thu, 10 Nov 2022 13:45:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230235AbiKJSpR (ORCPT ); Thu, 10 Nov 2022 13:45:17 -0500 Received: from mx0a-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A05C10067 for ; Thu, 10 Nov 2022 10:45:16 -0800 (PST) Received: from pps.filterd (m0089730.ppops.net [127.0.0.1]) by m0089730.ppops.net (8.17.1.5/8.17.1.5) with ESMTP id 2AAIf51h024763 for ; Thu, 10 Nov 2022 10:45:15 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-type : content-transfer-encoding : mime-version; s=s2048-2021-q4; bh=UHEhmaMtY8UgsBKpwlSNUDAWJ7UAF41+m7Jc670rni0=; b=Fp+o74kupHeSQAqJSwxMyrafVmwtPttFZUR4SpvhdtoNwU1lGizuMhkdBbukMUXY1LoV ndDbYynCLlFHY3Hpq4L2AFw+abeJlDTJRUuq+EaU5PvyLr4uozewrCpw4X9yNuWSQnUK jWa4yrOWN1F/ihKYSU8EgWoynitqS7cywyE9B1SqyEx3LBr+A/UHZ/h3x89WFbptl0Ya /wnNm7RqrtSyB8Osk2nZ3tlC94pDjA1mxyMX4zWrShOFtdPGglNValJHwNDeGhkuoAZO hxgxxB7YFMQBYkhxyDwf1PRJxI4fx7zyYKwDa+P0FmEav0TU8xEoBEPREvGmDSxfExGB Vw== Received: from maileast.thefacebook.com ([163.114.130.16]) by m0089730.ppops.net (PPS) with ESMTPS id 3krmwrfekb-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 10 Nov 2022 10:45:15 -0800 Received: from twshared9088.05.ash9.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:83::4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 10 Nov 2022 10:45:14 -0800 Received: by devbig007.nao1.facebook.com (Postfix, from userid 544533) id 2BFD2B08CDE8; Thu, 10 Nov 2022 10:45:02 -0800 (PST) From: Keith Busch To: , , CC: , , , , Keith Busch Subject: [PATCHv2 2/5] dm-crypt: provide dma_alignment limit in io_hints Date: Thu, 10 Nov 2022 10:44:58 -0800 Message-ID: <20221110184501.2451620-3-kbusch@meta.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221110184501.2451620-1-kbusch@meta.com> References: <20221110184501.2451620-1-kbusch@meta.com> X-FB-Internal: Safe X-Proofpoint-GUID: yELAMZbh_ewgeb2VqqunOxXlfTCP9q_O X-Proofpoint-ORIG-GUID: yELAMZbh_ewgeb2VqqunOxXlfTCP9q_O X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-10_12,2022-11-09_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Keith Busch This device mapper needs bio vectors to be sized and memory aligned to the logical block size. Set the minimum required queue limit accordingly. Link: https://lore.kernel.org/linux-block/20221101001558.648ee024@xps.demsh.org/ Fixes: b1a000d3b8ec5 ("block: relax direct io memory alignment") Reportred-by: Eric Biggers Reported-by: Dmitrii Tcvetkov Signed-off-by: Keith Busch Reviewed-by: Mike Snitzer --- drivers/md/dm-crypt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 159c6806c19b..2653516bcdef 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -3630,6 +3630,7 @@ static void crypt_io_hints(struct dm_target *ti, struct queue_limits *limits) limits->physical_block_size = max_t(unsigned, limits->physical_block_size, cc->sector_size); limits->io_min = max_t(unsigned, limits->io_min, cc->sector_size); + limits->dma_alignment = limits->logical_block_size - 1; } static struct target_type crypt_target = { From patchwork Thu Nov 10 18:44:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 13039152 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B90CEC433FE for ; Thu, 10 Nov 2022 18:46:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230195AbiKJSqH (ORCPT ); Thu, 10 Nov 2022 13:46:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229622AbiKJSqG (ORCPT ); Thu, 10 Nov 2022 13:46:06 -0500 Received: from mx0b-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07B4B1005B for ; Thu, 10 Nov 2022 10:46:04 -0800 (PST) Received: from pps.filterd (m0109331.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2AAIf7Cx020213 for ; Thu, 10 Nov 2022 10:46:04 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=s2048-2021-q4; bh=t/1hhYaJpYvNHhaVQIuZetdlJs1ckoYF//KTiN2SMYY=; b=BG9gR5coBSh/xucDyhY2D8qzHpDLA0LUTGdfEBIEHTHqc5fKJKRTxxUEfXGL3DuhzxcF vWyxIZUnjQiI+zeKcW75MhW7kditVEmmvjASfPmplhP9DAUE61PIMLOZXzTGPyxuOfgm iEprJrqGAQWHktmxpzdTjRlhmR3FM9M89ed2mUn8nU7/x7EZBRhtjIhGJaUyiGA3FV0s h0f+94aXsmppnvE8pJzX1YHpq1XKmrY1uzzJUpc5KhuuHD+roD4R9galUjNF9a21jKUT T+XNuqZ7OFf1ucc0VpTyXHVls72FmYQkoXkzqF3Oq8aVcnHe7v2O+EswDYYioBJoZQzP xQ== Received: from mail.thefacebook.com ([163.114.132.120]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3ks34kj2fx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 10 Nov 2022 10:46:04 -0800 Received: from snc-exhub201.TheFacebook.com (2620:10d:c085:21d::7) by snc-exhub204.TheFacebook.com (2620:10d:c085:21d::4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 10 Nov 2022 10:46:03 -0800 Received: from twshared27579.05.ash9.facebook.com (2620:10d:c085:108::8) by mail.thefacebook.com (2620:10d:c085:21d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 10 Nov 2022 10:45:33 -0800 Received: by devbig007.nao1.facebook.com (Postfix, from userid 544533) id C6B08B08CDEB; Thu, 10 Nov 2022 10:45:03 -0800 (PST) From: Keith Busch To: , , CC: , , , , Keith Busch , Christoph Hellwig Subject: [PATCHv2 3/5] block: make blk_set_default_limits() private Date: Thu, 10 Nov 2022 10:44:59 -0800 Message-ID: <20221110184501.2451620-4-kbusch@meta.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221110184501.2451620-1-kbusch@meta.com> References: <20221110184501.2451620-1-kbusch@meta.com> MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-ORIG-GUID: uGJz2WhY_ztAQ7K0A8UhMeEkZUw7CRZJ X-Proofpoint-GUID: uGJz2WhY_ztAQ7K0A8UhMeEkZUw7CRZJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-10_12,2022-11-09_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Keith Busch There are no external users of this function. Signed-off-by: Keith Busch Reviewed-by: Christoph Hellwig --- block/blk-settings.c | 1 - block/blk.h | 1 + include/linux/blkdev.h | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/block/blk-settings.c b/block/blk-settings.c index 4949ed3ce7c9..8ac1038d0c79 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -59,7 +59,6 @@ void blk_set_default_limits(struct queue_limits *lim) lim->zone_write_granularity = 0; lim->dma_alignment = 511; } -EXPORT_SYMBOL(blk_set_default_limits); /** * blk_set_stacking_limits - set default limits for stacking devices diff --git a/block/blk.h b/block/blk.h index d6ea0d1a6db0..a186ea20f39d 100644 --- a/block/blk.h +++ b/block/blk.h @@ -331,6 +331,7 @@ void blk_rq_set_mixed_merge(struct request *rq); bool blk_rq_merge_ok(struct request *rq, struct bio *bio); enum elv_merge blk_try_merge(struct request *rq, struct bio *bio); +void blk_set_default_limits(struct queue_limits *lim); int blk_dev_init(void); /* diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 9898e34b2c2d..891f8cbcd043 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -945,7 +945,6 @@ extern void blk_queue_io_min(struct request_queue *q, unsigned int min); extern void blk_limits_io_opt(struct queue_limits *limits, unsigned int opt); extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt); extern void blk_set_queue_depth(struct request_queue *q, unsigned int depth); -extern void blk_set_default_limits(struct queue_limits *lim); extern void blk_set_stacking_limits(struct queue_limits *lim); extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, sector_t offset); From patchwork Thu Nov 10 18:45:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 13039150 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1864FC4332F for ; Thu, 10 Nov 2022 18:45:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230323AbiKJSpe (ORCPT ); Thu, 10 Nov 2022 13:45:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230223AbiKJSpd (ORCPT ); Thu, 10 Nov 2022 13:45:33 -0500 Received: from mx0b-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B916764CE for ; Thu, 10 Nov 2022 10:45:32 -0800 (PST) Received: from pps.filterd (m0109332.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2AAIf5vF016747 for ; Thu, 10 Nov 2022 10:45:32 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=s2048-2021-q4; bh=bRGAEXe8GKpvjXjC0/98Zh/J75WOQ5GbUJ0TpUBKgug=; b=UqZAYq92lh0EqiRGYCanR/+HieWxl2ausqAVvLEumHnIXaUtSQ2oEbr8FztpzBid4vVk bQ9L2RJa0+zHnTwxyYEbQQ9ItY/N1xHR1np+k7Fd6Qfp/JJWkTGQwnebmDSKWxD5vKzI PUxdNjDjd46iNsO1F0hDqIB+ig443DUhWuAfc91pXpQbsgLnCTZqPXJctRZ+HLmpFR9I P9QNG7jvJemZUZftbUMbxcxOtknTlEE3GfmfiPCIuKxmdKfKoLn4Tdg3zBdIwTGlMfAY Aip8jOiP2Sjgo9BJRyoJUluSmjMKJEV215FXieEfZnZjf5Q2oaCzVjnB6BNKEPBLZV5h Uw== Received: from mail.thefacebook.com ([163.114.132.120]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3kr3jpfdrt-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 10 Nov 2022 10:45:31 -0800 Received: from twshared9088.05.ash9.facebook.com (2620:10d:c085:208::11) by mail.thefacebook.com (2620:10d:c085:21d::4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 10 Nov 2022 10:45:28 -0800 Received: by devbig007.nao1.facebook.com (Postfix, from userid 544533) id 93DDBB08CDF1; Thu, 10 Nov 2022 10:45:04 -0800 (PST) From: Keith Busch To: , , CC: , , , , Keith Busch Subject: [PATCHv2 4/5] dm-integrity: set dma_alignment limit in io_hints Date: Thu, 10 Nov 2022 10:45:00 -0800 Message-ID: <20221110184501.2451620-5-kbusch@meta.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221110184501.2451620-1-kbusch@meta.com> References: <20221110184501.2451620-1-kbusch@meta.com> MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-GUID: kZq5GpnylRoUg6SpYNjYkGH0p5w3FxT4 X-Proofpoint-ORIG-GUID: kZq5GpnylRoUg6SpYNjYkGH0p5w3FxT4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-10_12,2022-11-09_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Keith Busch This device mapper needs bio vectors to be sized and memory aligned to the logical block size. Set the minimum required queue limit accordingly. Signed-off-by: Keith Busch Reviewed-by: Mike Snitzer --- drivers/md/dm-integrity.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c index aaf2472df6e5..e1e7b205573f 100644 --- a/drivers/md/dm-integrity.c +++ b/drivers/md/dm-integrity.c @@ -3370,6 +3370,7 @@ static void dm_integrity_io_hints(struct dm_target *ti, struct queue_limits *lim limits->logical_block_size = ic->sectors_per_block << SECTOR_SHIFT; limits->physical_block_size = ic->sectors_per_block << SECTOR_SHIFT; blk_limits_io_min(limits, ic->sectors_per_block << SECTOR_SHIFT); + limits->dma_alignment = limits->logical_block_size - 1; } } From patchwork Thu Nov 10 18:45:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 13039151 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E58CBC43217 for ; Thu, 10 Nov 2022 18:45:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229889AbiKJSpf (ORCPT ); Thu, 10 Nov 2022 13:45:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230450AbiKJSpe (ORCPT ); Thu, 10 Nov 2022 13:45:34 -0500 Received: from mx0b-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FD0E64CE for ; Thu, 10 Nov 2022 10:45:33 -0800 (PST) Received: from pps.filterd (m0109332.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2AAIf5vH016747 for ; Thu, 10 Nov 2022 10:45:33 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=s2048-2021-q4; bh=Ll0sgKlomAV+roxD3aMEq7jXr8qS91KLuWJSCi6hOAk=; b=XT40UE2+dcwVBJyQqp2dMh607UYRnv3AvwVRb1iTA9a7tUXzQwYCCdlHuDp/KESTe2AI YcgjvDJiVQO3++LuObHY2A90nzLXPkpNep6tM/D1bRjL09J5SswfCeSz/cjV9NKtt/mt AaQ8CUvDxBPvXn2MVqQap1MxYp32VbYbpIk/U/E2TCKpAkmefPUA1FgEwPHavZW0tcOk t8edFxZwrp5Yw8GnYyOmOxKuUsJF1eGoM92zdPmGZyMzsviEZAwT+e1mw5T0SnpQzvrv CIvDlrLulcN2TfPP3sraZm+jNPcjcTmfJ5W9boO+qTcU4Q2z27JBjJcnyWdqo3Ww2xFr 4Q== Received: from mail.thefacebook.com ([163.114.132.120]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3kr3jpfdrt-8 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 10 Nov 2022 10:45:32 -0800 Received: from twshared9088.05.ash9.facebook.com (2620:10d:c085:108::4) by mail.thefacebook.com (2620:10d:c085:21d::4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 10 Nov 2022 10:45:29 -0800 Received: by devbig007.nao1.facebook.com (Postfix, from userid 544533) id 40874B08CDF4; Thu, 10 Nov 2022 10:45:04 -0800 (PST) From: Keith Busch To: , , CC: , , , , Keith Busch Subject: [PATCHv2 5/5] dm-log-writes: set dma_alignment limit in io_hints Date: Thu, 10 Nov 2022 10:45:01 -0800 Message-ID: <20221110184501.2451620-6-kbusch@meta.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221110184501.2451620-1-kbusch@meta.com> References: <20221110184501.2451620-1-kbusch@meta.com> MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-GUID: JA7bgonllFV0y60UgJKz_raTwVWap2jm X-Proofpoint-ORIG-GUID: JA7bgonllFV0y60UgJKz_raTwVWap2jm X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-10_12,2022-11-09_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Keith Busch This device mapper needs bio vectors to be sized and memory aligned to the logical block size. Set the minimum required queue limit accordingly. Signed-off-by: Keith Busch Reviewed-by: Mike Snitzer --- drivers/md/dm-log-writes.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/md/dm-log-writes.c b/drivers/md/dm-log-writes.c index 20fd688f72e7..178e13a5b059 100644 --- a/drivers/md/dm-log-writes.c +++ b/drivers/md/dm-log-writes.c @@ -875,6 +875,7 @@ static void log_writes_io_hints(struct dm_target *ti, struct queue_limits *limit limits->logical_block_size = bdev_logical_block_size(lc->dev->bdev); limits->physical_block_size = bdev_physical_block_size(lc->dev->bdev); limits->io_min = limits->physical_block_size; + limits->dma_alignment = limits->logical_block_size - 1; } #if IS_ENABLED(CONFIG_FS_DAX)