Received: from mx0b-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) (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 BC781288535 for ; Tue, 12 Aug 2025 13:54:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.153.30 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755006861; cv=none; b=O6I+HEN9XqKr+W3NzeD0eynVlpAfIbOzPjTK2IdVw43BRfmoq5ZNioiTFVVT90HUxkqpNbFRYZdh0NkiwKJe2bzSoETxXwVUCR71RaNclmeKulmwsX03TLkTH/fWEJQfcWwBvOtC8AVQhQe+r7VQMSWUuXQSLCkIe0pyO54hUYU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755006861; c=relaxed/simple; bh=I+z3oVVuCqCHPRjI3PEnVOseEaFoiVykI3UkrYKAwls=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ij2BQzByl0C/zd0N9cCYJvwj/Jvj7Csu61YulyjCbDc/4QV44iyu+LDHc2MmQoM/tKerHUVUrsFM/K22U5GO8P8ToP5biUTfRtPpyfKbdhFlV8gpm8HH9sxNZPb2KYTy6epK7CTKKxvQXoJncjp2QVKqf8aLq3WAsHjPpBAiJ7A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meta.com; spf=pass smtp.mailfrom=meta.com; dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com header.b=ZEqb600D; arc=none smtp.client-ip=67.231.153.30 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meta.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=meta.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com header.b="ZEqb600D" Received: from pps.filterd (m0148460.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 57CDpjkf006845 for ; Tue, 12 Aug 2025 06:54:18 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=s2048-2025-q2; bh=XsOLd/P3RODy7Knzd0+Ybcgm4ptMayJ32tMsQS355Oo=; b=ZEqb600DCXiW +JElDwELrcWXvzo+M1pTbrLseNcY7mi31cqmcp1vo+e4TRruGnwuPrPB6NB7GK0b 0ojHdgiPczuQk9mkxHzy5j8gZL7EbBWfEOEggkrH2Jt1oNghVv0SdbtLaj0x2NRl fFrE5gDvuCflYOJOt4dbOZbMDoM7gtX+i4WINM+Kx3ph0QhH2ebBCiWXXYc7ji6j MdGhSBaAPaS/DtaFlfpQr77Q8e1IpTWcWOFdtgW741LXtY3HtbIPk3UBJel4e8aD qLZjJKN6LHZCzxrPVkSLUCLCUSgzUOjZYwkmNbpEKjesH+PVpUSHMJE3b2489qbu Vlc5o75gZw== Received: from maileast.thefacebook.com ([163.114.135.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 48g120b14n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 12 Aug 2025 06:54:17 -0700 (PDT) Received: from twshared52133.15.frc2.facebook.com (2620:10d:c0a8:1b::30) by mail.thefacebook.com (2620:10d:c0a9:6f::237c) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.17; Tue, 12 Aug 2025 13:52:18 +0000 Received: by devbig197.nha3.facebook.com (Postfix, from userid 544533) id C0EA08D407C; Tue, 12 Aug 2025 06:52:11 -0700 (PDT) From: Keith Busch To: , CC: , , , Keith Busch Subject: [PATCHv6 4/8] blk-mq: remove REQ_P2PDMA flag Date: Tue, 12 Aug 2025 06:52:06 -0700 Message-ID: <20250812135210.4172178-5-kbusch@meta.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20250812135210.4172178-1-kbusch@meta.com> References: <20250812135210.4172178-1-kbusch@meta.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-FB-Internal: Safe Content-Type: text/plain X-Authority-Analysis: v=2.4 cv=KJdaDEFo c=1 sm=1 tr=0 ts=689b478a cx=c_pps a=MfjaFnPeirRr97d5FC5oHw==:117 a=MfjaFnPeirRr97d5FC5oHw==:17 a=2OwXVqhp2XgA:10 a=VwQbUJbxAAAA:8 a=O3ANi3fbfI-XDrvcMKkA:9 X-Proofpoint-ORIG-GUID: oiO9MeDtSN0jZciY_J3ExXMpS1hZHAup X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwODEyMDEzNCBTYWx0ZWRfXztqoUjueYD2y S1voWhHXuWLhg4HirHyFttVSMPXnp0LWx762dnKcR841Jnzv7Oiph/+jL6wsmCTJk77kpAr5SE8 PES1XTDCm6lbFbQa8dbMUpubudXhW0TQ+Hfe+ubWP4xpPXtjDaIv/5liozd/YyEhQdPDtIxeJtg oLd5CpqbFEVkQrJestE8nbKeDNwahGxctvR2fxX1oiAmmnEuC27/BSwex8nbY1WOJWh3nJnoM1Y 56Jch0BcNxqoDuUYTiQ1UX4uRDC3CSdyiQe998En9feWPt/PVF1gR6DIx6Kuzp95725NKofrWIt REH5TMIr/Xf+4lyltoD7zeuAUiRWBvhtZnhpoqiAiJZ11z+Emkp6ZC2W/HhipBXQeemgYz+yZA2 VXrVovCHc5hPt6WmMhpK4GG3Q+SdMqeTWtSjA1yXZEngobsYZv0JeDZXClc6UzWYy5vgECrS X-Proofpoint-GUID: oiO9MeDtSN0jZciY_J3ExXMpS1hZHAup X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-08-12_07,2025-08-11_01,2025-03-28_01 From: Keith Busch It's not serving any particular purpose. pci_p2pdma_state() already has all the appropriate checks, so the config and flag checks are not guarding anything. Signed-off-by: Keith Busch Reviewed-by: Christoph Hellwig --- block/bio.c | 2 +- block/blk-mq-dma.c | 30 ++++++++++++++---------------- include/linux/blk_types.h | 2 -- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/block/bio.c b/block/bio.c index 3b371a5da159e..44c43b9703875 100644 --- a/block/bio.c +++ b/block/bio.c @@ -981,7 +981,7 @@ void __bio_add_page(struct bio *bio, struct page *pag= e, WARN_ON_ONCE(bio_full(bio, len)); =20 if (is_pci_p2pdma_page(page)) - bio->bi_opf |=3D REQ_P2PDMA | REQ_NOMERGE; + bio->bi_opf |=3D REQ_NOMERGE; =20 bvec_set_page(&bio->bi_io_vec[bio->bi_vcnt], page, len, off); bio->bi_iter.bi_size +=3D len; diff --git a/block/blk-mq-dma.c b/block/blk-mq-dma.c index 8f41fe740b465..58defab218823 100644 --- a/block/blk-mq-dma.c +++ b/block/blk-mq-dma.c @@ -180,22 +180,20 @@ bool blk_rq_dma_map_iter_start(struct request *req,= struct device *dma_dev, if (!blk_map_iter_next(req, &iter->iter, &vec)) return false; =20 - if (IS_ENABLED(CONFIG_PCI_P2PDMA) && (req->cmd_flags & REQ_P2PDMA)) { - switch (pci_p2pdma_state(&iter->p2pdma, dma_dev, - phys_to_page(vec.paddr))) { - case PCI_P2PDMA_MAP_BUS_ADDR: - return blk_dma_map_bus(iter, &vec); - case PCI_P2PDMA_MAP_THRU_HOST_BRIDGE: - /* - * P2P transfers through the host bridge are treated the - * same as non-P2P transfers below and during unmap. - */ - req->cmd_flags &=3D ~REQ_P2PDMA; - break; - default: - iter->status =3D BLK_STS_INVAL; - return false; - } + switch (pci_p2pdma_state(&iter->p2pdma, dma_dev, + phys_to_page(vec.paddr))) { + case PCI_P2PDMA_MAP_BUS_ADDR: + return blk_dma_map_bus(iter, &vec); + case PCI_P2PDMA_MAP_THRU_HOST_BRIDGE: + /* + * P2P transfers through the host bridge are treated the + * same as non-P2P transfers below and during unmap. + */ + case PCI_P2PDMA_MAP_NONE: + break; + default: + iter->status =3D BLK_STS_INVAL; + return false; } =20 if (blk_can_dma_map_iova(req, dma_dev) && diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index 09b99d52fd365..930daff207df2 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -386,7 +386,6 @@ enum req_flag_bits { __REQ_DRV, /* for driver use */ __REQ_FS_PRIVATE, /* for file system (submitter) use */ __REQ_ATOMIC, /* for atomic write operations */ - __REQ_P2PDMA, /* contains P2P DMA pages */ /* * Command specific flags, keep last: */ @@ -419,7 +418,6 @@ enum req_flag_bits { #define REQ_DRV (__force blk_opf_t)(1ULL << __REQ_DRV) #define REQ_FS_PRIVATE (__force blk_opf_t)(1ULL << __REQ_FS_PRIVATE) #define REQ_ATOMIC (__force blk_opf_t)(1ULL << __REQ_ATOMIC) -#define REQ_P2PDMA (__force blk_opf_t)(1ULL << __REQ_P2PDMA) =20 #define REQ_NOUNMAP (__force blk_opf_t)(1ULL << __REQ_NOUNMAP) =20 --=20 2.47.3