From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B8447440A20 for ; Thu, 23 Jul 2026 20:43:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784839388; cv=none; b=JuMwcPSJEQiDV5x7gCR3f5u4BiWfoRG9Z0x01bG3U7QV7QznjOu+x6ydLiA4hmhN2HlmSjLlhiuAMjzxYWaIryR/rpw2tQJ9Kx1xx6kX7Y2BtsTNGLpS8XoHryz4QYhlL68cjzWUHuTILcGqM9Luot96mC8NFu+HDq5Hq+DHqN4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784839388; c=relaxed/simple; bh=cRH7W6syefYxFA3VhhN4QvzFBoE55r52A/E6t9wrD1M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HeNU9axSdKFGm3MLxkwClLTdFkjj40zUcmoRcgP+zuPxv2ot7Tb6TaVg1dWPF/emICEf2QmewHMdKQEQqCz0gGmAD3LAodb1p+y3Hy1F3b1fpNLQo+tpYdxU6TN1zplCTeEir7jjPGaorfTTN/GElvQaprC1O1xhUDGqlYvQH5w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meshstor.io; spf=pass smtp.mailfrom=meshstor.io; dkim=pass (2048-bit key) header.d=meshstor.io header.i=@meshstor.io header.b=SesB9aK6; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meshstor.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=meshstor.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=meshstor.io header.i=@meshstor.io header.b="SesB9aK6" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-47362928f65so1026825f8f.2 for ; Thu, 23 Jul 2026 13:43:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meshstor.io; s=google; t=1784839375; x=1785444175; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=LNWXk+rlZiNRYyXRDGVV7qCvY4AZPHPO/XYCzCCpSWs=; b=SesB9aK6CHrwPAFEI1B193p8OPva428cDKaNqpizhHiUhewUqHwqrmjD/xRwufSFok C0QIDvLbdC9pPZ+CEdXlIOyILZKCt6tsMZk99YsEvzEVMMXsNcXjvcShGE7KV9h62HlJ oyLFTnuqUYUO/StJAprXzTVNjytYoEhdeRDI21Aw4klritgm4+4yPAYSIaUwQVxtIrAr U+vpIpCu+rXzhzxyPyWR2tBGmf/yyfgr1Pw3Vt60fpaT+bjvDrn5gmUldtn9AlpfwEOR YUhDPe/enCYSdSa5Bm/9KVvO/O4FfEjHycGze1EOP2z7Zz1ZeqgPV1ph5RSwUjsi9PbK eQQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784839375; x=1785444175; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=LNWXk+rlZiNRYyXRDGVV7qCvY4AZPHPO/XYCzCCpSWs=; b=ItM9+dnPlNEqh+PR0uYz13Sn9Wu8Ms6zQSBONTVMycYj/hOakSzacNufozkA2pQBPu W59a4WoUHeJfxnf/XLr1QdG9+1hNozq2vbPvP86NjRPqjVcBbrphavUU1+RM0r7/jElz Y4e3SdGzWNRzFKP6ojcj8/oXMJjlWYjsF055YKptvrpvOKR1au225uA5NSMQZf4rLmRM M/cmaZD0h1Qjcf46gkRQnzT+AaTjCDyroXDDIcjNexdeizin/lQV3H9R1GsiW5PeB13z NCgOawLMdqbKcqOsTcQ9bxw+3ROQa06w20puTk8ppogOhAIwSCmdeWAHsM5Zer1fYzS7 fXIg== X-Forwarded-Encrypted: i=1; AHgh+RpvhP69ui4e3vX9JLZzL88f7QO73aDQeQpq8aE6HCMAs9wPCNvHsl9K6c4oHRfBAN6N8KkCIY4GVelqBYc=@vger.kernel.org X-Gm-Message-State: AOJu0YyQGbxGqBIUcA923tl6wXbWziUrAxcvqlqq/Qko1qoOlXjeQCrB 4gfTh3D6LYLzEQctb4PH5WU040t2fG9tl0voytAR2kB2GGG9n0p98m87rytm/reVNg== X-Gm-Gg: AR+sD12pr0u/hpquatresx3H90MZsPtzw0ERnwdQ+gftxtl/K/C2+MuS+Lol86hKhAK wxNKGZ0oW1autHB7vkmrNzM7QklrvZCIhBq3kMI3FfBBtWkWhtIJaCWefUtMKzaSxDbUPM1SN4G Bp0WFWBy5+PU4O2VWJwlpTyNpf97XyBIR/9e+l4IOtX6YYnUZAwzKxy+gt/zXtWGQAiObRCGwTW X1cbFfIeRV89kjvyBS4UlVutem0JVeukhJ55iq/LoPfMFq+zFlOb3O5K3Wx2BXn6WQnhty/5XoV hqpfSKznIGJWvYIbMekGG3+239qEni+/6P54oV9VcEAE6rqkO6VuoddqgfKf83bZShltAQIiYFB Dt1g1UEvgZx9VJLXs/qJtYbOmsynF4RBn5Gz+u6eIpaGTGkMnvHK6l95iI5gyA2s2MS4aeh/fot OC+pV8LYqCpFJ8nurO6YUUUxLf8Ngf4I3uPL4zg8o/Z0RZeMwhG1525RwHGAf8ACIOxSa1PXo9Z 1ifP3Hp0Eh0YB5uV8975wGNFV9Yrff5YYUboDGaEw== X-Received: by 2002:a05:6000:240b:b0:47f:87f9:6d06 with SMTP id ffacd0b85a97d-47f8da5e25bmr5949800f8f.61.1784839375286; Thu, 23 Jul 2026 13:42:55 -0700 (PDT) Received: from meshstor-pc ([185.87.42.56]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f85c52fc0sm18268192f8f.23.2026.07.23.13.42.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2026 13:42:54 -0700 (PDT) From: Mykola Marzhan To: Jens Axboe , Song Liu , Yu Kuai , Keith Busch , Christoph Hellwig , Sagi Grimberg , linux-block@vger.kernel.org, linux-raid@vger.kernel.org, linux-nvme@lists.infradead.org Cc: Li Nan , Xiao Ni , Guoqing Jiang , Leon Romanovsky , Jason Gunthorpe , Kiran Kumar Modukuri , Chaitanya Kulkarni , Logan Gunthorpe , Bjorn Helgaas , Shivaji Kant , Pranjal Shrivastava , Henrique Carvalho , stable@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v5 01/10] block: add BLK_STS_P2PDMA for unsupported peer-to-peer transfers Date: Thu, 23 Jul 2026 22:41:57 +0200 Message-ID: <20260723204206.76930-2-mykola@meshstor.io> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260723204206.76930-1-mykola@meshstor.io> References: <20260723204206.76930-1-mykola@meshstor.io> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Logan Gunthorpe blk_dma_map_iter_start() reports BLK_STS_INVAL when a P2PDMA transfer is attempted between two devices whose PCIe topology cannot route it. blk_path_error() treats INVAL as retryable, so multipath requeues the I/O forever, and callers cannot tell it apart from an invalid request. md also ignores it for member failures, so a mirror silently diverges. Restoring the old BLK_STS_TARGET would stay ambiguous -- nvme maps NS_NOT_READY, LBA_RANGE and CMD_INTERRUPTED to it too. Add a dedicated BLK_STS_P2PDMA, non-retryable in blk_path_error(), and return it from blk_dma_map_iter_start(). Fixes: 858299dc6160 ("block: add scatterlist-less DMA mapping helpers") Fixes: 7ce3c1dd78fc ("nvme-pci: convert the data mapping to blk_rq_dma_map") Cc: stable@vger.kernel.org # v6.17 Signed-off-by: Logan Gunthorpe Signed-off-by: Mykola Marzhan --- block/blk-core.c | 3 +++ block/blk-mq-dma.c | 3 ++- include/linux/blk_types.h | 10 ++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/block/blk-core.c b/block/blk-core.c index 365641266c9e..83cb5464265f 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -177,6 +177,9 @@ static const struct { /* Command duration limit device-side timeout */ ENT(DURATION_LIMIT, -ETIME, "duration limit exceeded"), + + /* no PCIe P2PDMA route between initiator and target */ + ENT(P2PDMA, -EREMOTEIO, "peer-to-peer transfer unroutable"), ENT(INVAL, -EINVAL, "invalid"), /* everything else not covered above: */ diff --git a/block/blk-mq-dma.c b/block/blk-mq-dma.c index bfdb9ed70741..e88d6b3524e6 100644 --- a/block/blk-mq-dma.c +++ b/block/blk-mq-dma.c @@ -189,8 +189,9 @@ static bool blk_dma_map_iter_start(struct request *req, struct device *dma_dev, */ case PCI_P2PDMA_MAP_NONE: break; + case PCI_P2PDMA_MAP_NOT_SUPPORTED: default: - iter->status = BLK_STS_INVAL; + iter->status = BLK_STS_P2PDMA; return false; } diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index 8808ee76e73c..c8de7809320a 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -165,6 +165,15 @@ typedef u16 blk_short_t; */ #define BLK_STS_DURATION_LIMIT ((__force blk_status_t)17) +/* + * BLK_STS_P2PDMA is returned when a peer-to-peer DMA transfer cannot be + * mapped (typically because there is no route between the initiator and the + * target that the platform's PCIe topology and ACS settings allow). This + * is a property of the initiator/target pair, not of the target device's + * health. This error should never be retried. + */ +#define BLK_STS_P2PDMA ((__force blk_status_t)18) + /* * Invalid size or alignment. */ @@ -188,6 +197,7 @@ static inline bool blk_path_error(blk_status_t error) case BLK_STS_NOTSUPP: case BLK_STS_NOSPC: case BLK_STS_TARGET: + case BLK_STS_P2PDMA: case BLK_STS_RESV_CONFLICT: case BLK_STS_MEDIUM: case BLK_STS_PROTECTION: -- 2.52.0