From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 17C86384CF6 for ; Wed, 22 Jul 2026 18:59:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784746745; cv=none; b=QZKxMGJahuKU5mMfhJvHHiFRUsugoSCo0z6U6hUglYEWSLrhVf2GsOi+DfirWsWINuYKIbglFfXzjg4OHvuSPfMmlBPcIAwhzniUEDEzewuGSxW7+5NXWPP54fJ7wZVp/+bnxzRRlLYjI/rOnNxm/S+8J27ekqH/KmcXwBP99aY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784746745; c=relaxed/simple; bh=cRH7W6syefYxFA3VhhN4QvzFBoE55r52A/E6t9wrD1M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qtrLx2Z/93vM3L9aZ9+M/IgI+pLWz5zA0LP3QhI57Nj2dUA/60UC0xHV8p/OKCUL6KO5AMwaSZjc8eaIsScA3/iGw55sWyLJpZoAB6bperL2L0aJpJMjcA394n+O0qKkbMQyHhEloO2VawjPzFqm7V/5okrDAgsvuNWohfzL488= 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=PjXrY8sk; arc=none smtp.client-ip=209.85.128.52 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="PjXrY8sk" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4954dff6536so36841725e9.0 for ; Wed, 22 Jul 2026 11:59:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meshstor.io; s=google; t=1784746740; x=1785351540; 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=PjXrY8skVYXsu0ZtujioERfZepLyP1Qucn4GVHfDugrdZIMyqzKP0f+V5fm7jWQZ8g HLp++x8eJH9DsAyezDkUmpzHkQbk1hTzyR61GBUpSIzsPgI/OZtI/CEsA9yOvmTioqYZ /CRuZt6aNksbCpDhZYuIJaeUJ6K4Hc0R5olcuxheTb+V6wG/OViRjutmcg2b9S/3QHmu jaDuIAFDCkHkdZOyesapOVYEojFY26oBMqu4Epv6nn02TbXBG9sD1+lkzyqkCT5tn6it O5xlT1JYU4URKGXBMXg+rB5D8kZ46hAbEO9K9OKJgAacrlFZytEkvLV7278vvyJrp4+T bmUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784746740; x=1785351540; 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=K88C7Rf4505N5yxyQhXmg+M9l/NYzp0L0BFcUGHtkblqGcCIcDnhjOak5kM/hCI1Xt Dqget0hKaGZOuKjbMktDNvZ+t9jSrvUx1XRjgH6OS9kv1ERj2/YaXVPWwu3tSGoAKexr HVlw891X+0nzMOw9pJby8jDpLZYdPUJyt7R4C9qz+40GVn6c0LAVt+rjd3ZTswoXQ7Km 9e/Zae6O2aahLMcof7hY6HzYhzoq2u/nSIStLftRqQ5ivxkLcYAm+E03LYX8o05mo0Bq jLeyh5rDKCHcyEEYeV+5wFKkt95LFwHIZFqY+8uym0K6V7ylrDpnNy6py2XBAG//4KCw I2xg== X-Forwarded-Encrypted: i=1; AHgh+RrAXQLa3oPABLeiQOeukat65ItNlKPXlHUKh5saVL9V8x/Knk85cR8c5VH0LNC+QgkzDFOFAELzscJCtQw=@vger.kernel.org X-Gm-Message-State: AOJu0YwcHxmS3BDXYg+pIszoyWX6iCcaF63L9TDEy2RO7HVc0uDBW4ri gwae76OLadCaENGrxocrASO/4j6hdqNSUEYPHR+WMtgWfklGpY4koLTINk4AV+uG3g== X-Gm-Gg: AR+sD104APD8MxbMNyo2cmVS+q8nDgbZ/Ac5A2crhr3kh/aEuFrAyOnDCgsxTpPcRGS IDyunKp83Kx3kYR/44k/QQGbsaB9+Y0aRdVn6DlvPlGnKoCeFzwmblBj+4UZwBQsjA7rXDHZaaE R+RLf1uZB+1ragIJk6e+Ku/WvrPZIcNdhZ3no0j5br2KLthAWC2K/GkotemBJhfHVQeF8mP3XNf CDIkHclqRdBlnpKmyLicScj+djmeimSXr+ofpBvBhRNx7tPd29Sf9cx13NciCZwH1nLO4hOnNum 2eYWyN8OgL5mbP412mgbxtFxHUCLIISVg/R+IijNqjav4ReOCjZ0uKUpqlXOxBik1aREM4acaT4 JcTIUdk1geFnvT3xt4TUkN7wf4uD1+/clshc/oSPnduJBX698Gq5ySNqtYOh4Bt5j+BeJYaTcGT AZ1ZGiyl01V794lZqe5vseNvemO5gy+IBdyEK/07oDdw9XnpU= X-Received: by 2002:a05:600c:3153:b0:493:e97c:216e with SMTP id 5b1f17b1804b1-4954a41382fmr294367705e9.39.1784746740281; Wed, 22 Jul 2026 11:59:00 -0700 (PDT) Received: from ai-pc ([46.172.241.174]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-495730353d9sm13740055e9.12.2026.07.22.11.58.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2026 11:58:59 -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 , linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v4 1/9] block: add BLK_STS_P2PDMA for unsupported peer-to-peer transfers Date: Wed, 22 Jul 2026 20:58:33 +0200 Message-ID: <20260722185841.449934-2-mykola@meshstor.io> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260722185841.449934-1-mykola@meshstor.io> References: <20260722185841.449934-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