Message ID | 20210311233142.7900-10-logang@deltatee.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add support to dma_map_sg for P2PDMA | expand |
On Thu, Mar 11, 2021 at 04:31:39PM -0700, Logan Gunthorpe wrote: > Create a specific error code for when P2PDMA pages are passed to a block > devices that cannot map them (due to no IOMMU support or ACS protections). > > This makes request errors in these cases more informative of as to what > caused the error. I really don't think we should bother with a specific error code here, we don't add a new status for every single possible logic error in the caller.
On 2021-03-16 2:00 a.m., Christoph Hellwig wrote: > On Thu, Mar 11, 2021 at 04:31:39PM -0700, Logan Gunthorpe wrote: >> Create a specific error code for when P2PDMA pages are passed to a block >> devices that cannot map them (due to no IOMMU support or ACS protections). >> >> This makes request errors in these cases more informative of as to what >> caused the error. > > I really don't think we should bother with a specific error code here, > we don't add a new status for every single possible logic error in the > caller. I originally had BLK_STS_IOERR but those errors suggested to people that the hardware had failed on the request when in fact it was a user error. I'll try BLK_STS_TARGET unless there's any objection or someone thinks another error code would make more sense. Logan
diff --git a/block/blk-core.c b/block/blk-core.c index fc60ff208497..2cc75b56ac43 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -192,6 +192,8 @@ static const struct { [BLK_STS_ZONE_OPEN_RESOURCE] = { -ETOOMANYREFS, "open zones exceeded" }, [BLK_STS_ZONE_ACTIVE_RESOURCE] = { -EOVERFLOW, "active zones exceeded" }, + [BLK_STS_P2PDMA] = { -EREMOTEIO, "P2PDMA to invalid device" }, + /* everything else not covered above: */ [BLK_STS_IOERR] = { -EIO, "I/O" }, }; diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index db026b6ec15a..728a0898cb34 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -142,6 +142,13 @@ typedef u8 __bitwise blk_status_t; */ #define BLK_STS_ZONE_ACTIVE_RESOURCE ((__force blk_status_t)16) +/* + * BLK_STS_P2PDMA is returned from the driver if P2PDMA memory fails to be + * mapped to the target device. This is a permanent error and the request + * should not be retried. + */ +#define BLK_STS_P2PDMA ((__force blk_status_t)17) + /** * blk_path_error - returns true if error may be path related * @error: status the request was completed with
Create a specific error code for when P2PDMA pages are passed to a block devices that cannot map them (due to no IOMMU support or ACS protections). This makes request errors in these cases more informative of as to what caused the error. Signed-off-by: Logan Gunthorpe <logang@deltatee.com> --- block/blk-core.c | 2 ++ include/linux/blk_types.h | 7 +++++++ 2 files changed, 9 insertions(+)