Message ID | 20230706130930.64283-2-nmi@metaspace.dk |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp2558442vqx; Thu, 6 Jul 2023 06:24:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlHQkU1TeTr9WMPWlM1jK3t7fBV0JeBx/pSTLBilUkScCszmT+Gt+HqR+iTz0ClK9CqYIY8t X-Received: by 2002:a17:902:7792:b0:1b6:b024:b072 with SMTP id o18-20020a170902779200b001b6b024b072mr1562005pll.38.1688649872411; Thu, 06 Jul 2023 06:24:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688649872; cv=none; d=google.com; s=arc-20160816; b=YWaCtUk6dNPeLiYzuMLViEY6Mb7+KCIHGn/GGVB3EifG0DCM2r1XmQzjjTnMZ4T4F/ pLwUeOYefE3qxDtUaCUmNzZjLaQ4djbUdNZGz0qtlMaV7SCjy5hU8c9mbJ3QXXhwtslp zZGnWumft75xMZ541gvkZnTI3YeghzDYcYgsvnzguykBpiOQFFXe2EXe7mP3Kx9BJIsJ rkU9+exGW8HssuMciPAX+RqOm0uAFt68J+SG9+/or/ClTbfRf6ixw5C1Tre5QuJiwYqg dNeXilOqltvjhrRUpyoAqu91G926VJu4R/gEWlmQErE2r03sQ0D4660fxnf+dCO/BRoz iPsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1EOry6f369fvQkUnyMG3t5Th65xx1GNMnGXjzZ7Sktk=; fh=hMdgxxsl9tYkO69YX4aPzTvF7kBpDiInwjZJ/g4Eeno=; b=Y9lRJnPN5+ZdgOza6PObCbssHGtEebnlLU/J8yWfcaPiKJjdwKBHNrB3zrKlkuxlXw mA9bj1hBHwp9csUJklKxc2hQJXkVFuu6eQYRoQeoHl3FIojnvdsSJevXOfWY13Ki+L5I iz95O9ngMXjZXDlc6Q5D76ZISZtQPM6BzA3EQ/MROFphciyn8lpNkT+Gq+sHzCBHRXcR wE1Sug3LElJvyefqX+higK86XcHQKvy3fxg55c3Id69ygUO24PqiW5N42dG0r0qFu94b 5bpi4B8n4IaSifhOGEazSUeURjjFzJZLEyGP7YD+H+aFAsyaj4GYRVNCHEVcFDn9LMF4 bIiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@metaspace-dk.20221208.gappssmtp.com header.s=20221208 header.b=dfywl8JP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z14-20020a170903018e00b001b89b7aea8fsi1297304plg.493.2023.07.06.06.24.16; Thu, 06 Jul 2023 06:24:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@metaspace-dk.20221208.gappssmtp.com header.s=20221208 header.b=dfywl8JP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232520AbjGFNJp (ORCPT <rfc822;hadasmailinglist@gmail.com> + 99 others); Thu, 6 Jul 2023 09:09:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232440AbjGFNJj (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 6 Jul 2023 09:09:39 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E64941BEF for <linux-kernel@vger.kernel.org>; Thu, 6 Jul 2023 06:09:33 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3fbc587febfso6709675e9.2 for <linux-kernel@vger.kernel.org>; Thu, 06 Jul 2023 06:09:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=metaspace-dk.20221208.gappssmtp.com; s=20221208; t=1688648972; x=1691240972; 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; bh=1EOry6f369fvQkUnyMG3t5Th65xx1GNMnGXjzZ7Sktk=; b=dfywl8JPlp9ZCl8GxiDO4TDStloyouxD0OECa20lsBhiqESxahTL1UltyGErsPsSrW BgA2s15zimiozXfVDDUZqaJLgrpqT4KL0n5hY8/eP/y/bn6y8DNmoD9e8WiO6iPeGevs twSLcPrQF6G5UmqTLVe3x88w3VKoNXzFJVCcgAlZ30R6J15qbgb6uyxh6cjpsuC0HiS3 ZxxcYcf63FlnCp188xLXGfTmU+wZKbz91rLR0EODjORS85x/0yKTxQMQU6njBs7lavnm 3EP869ulePPDC/NopKaXUrML9ziS0uQp9c63qdrc2rugGOSw2H1YZg1BRNCMqH8rcla/ 3fpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688648972; x=1691240972; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1EOry6f369fvQkUnyMG3t5Th65xx1GNMnGXjzZ7Sktk=; b=T5oT3SqQGvcXlEU2lLxhByOZSk4w5pnS9cboe8n/EilBiy32mfLgj+phCK+mr8egHg +5tLM+t9CXtRHmYqTZB3qM3bTWrIh1FIVWLe+mBC1N8827AeWTBfSZ5HmNttmxZQG5WX 6OvpK2U+mWheppEv0uQy8RvIlCXhN9L03UhGhR99fNEhNmB+oCS8gVWO7QoZnIh8TKr+ 95CmSzuAw8PpAyriEGs6UCHz0bBeS5oHMFTUF2o9z3cRl3cYpjHdtTgxOrlG5WYnnWaC URhpKVFd4WU3XdYiQtpnHXduvFg4MZrLqcjYWac9OYnTb913dK5X5pXIHwrCa2S47Xuv 16kQ== X-Gm-Message-State: ABy/qLbCOl5jv8wx3S6Ijwnm1ty0u25W2jMrCYhwk16xGijxYdqd/0+X 9BRNt5ty28amG/VchY9ZlWYw0w== X-Received: by 2002:a1c:4b18:0:b0:3fb:ab76:164b with SMTP id y24-20020a1c4b18000000b003fbab76164bmr1292940wma.13.1688648972313; Thu, 06 Jul 2023 06:09:32 -0700 (PDT) Received: from localhost ([147.161.155.79]) by smtp.gmail.com with ESMTPSA id y4-20020a1c4b04000000b003fa999cefc0sm2062661wma.36.2023.07.06.06.09.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jul 2023 06:09:32 -0700 (PDT) From: Andreas Hindborg <nmi@metaspace.dk> To: Ming Lei <ming.lei@redhat.com> Cc: linux-kernel@vger.kernel.org (open list), linux-block@vger.kernel.org (open list:BLOCK LAYER), Andreas Hindborg <a.hindborg@samsung.com>, Minwoo Im <minwoo.im.dev@gmail.com>, Matias Bjorling <Matias.Bjorling@wdc.com>, gost.dev@samsung.com, Jens Axboe <axboe@kernel.dk>, Aravind Ramesh <Aravind.Ramesh@wdc.com>, Johannes Thumshirn <jth@kernel.org>, Hans Holmberg <Hans.Holmberg@wdc.com>, Christoph Hellwig <hch@infradead.org>, Damien Le Moal <dlemoal@kernel.org> Subject: [PATCH v6 1/3] ublk: add opcode offsets for DRV_IN/DRV_OUT Date: Thu, 6 Jul 2023 15:09:28 +0200 Message-ID: <20230706130930.64283-2-nmi@metaspace.dk> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230706130930.64283-1-nmi@metaspace.dk> References: <20230706130930.64283-1-nmi@metaspace.dk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770677728631700063?= X-GMAIL-MSGID: =?utf-8?q?1770677728631700063?= |
Series |
ublk: enable zoned storage support
|
|
Commit Message
Andreas Hindborg
July 6, 2023, 1:09 p.m. UTC
From: Andreas Hindborg <a.hindborg@samsung.com> Ublk zoned storage support relies on DRV_IN handling for zone report. Prepare for this change by adding offsets for the DRV_IN/DRV_OUT commands. Also add parenthesis to existing opcodes for better macro hygiene. Signed-off-by: Andreas Hindborg <a.hindborg@samsung.com> --- include/uapi/linux/ublk_cmd.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
Comments
On 7/6/23 22:09, Andreas Hindborg wrote: > From: Andreas Hindborg <a.hindborg@samsung.com> > > Ublk zoned storage support relies on DRV_IN handling for zone report. > Prepare for this change by adding offsets for the DRV_IN/DRV_OUT commands. > > Also add parenthesis to existing opcodes for better macro hygiene. > > Signed-off-by: Andreas Hindborg <a.hindborg@samsung.com> > --- > include/uapi/linux/ublk_cmd.h | 18 ++++++++++++++---- > 1 file changed, 14 insertions(+), 4 deletions(-) > > diff --git a/include/uapi/linux/ublk_cmd.h b/include/uapi/linux/ublk_cmd.h > index 4b8558db90e1..2ebb8d5d827a 100644 > --- a/include/uapi/linux/ublk_cmd.h > +++ b/include/uapi/linux/ublk_cmd.h > @@ -229,12 +229,22 @@ struct ublksrv_ctrl_dev_info { > __u64 reserved2; > }; > > -#define UBLK_IO_OP_READ 0 > +#define UBLK_IO_OP_READ 0 > #define UBLK_IO_OP_WRITE 1 > #define UBLK_IO_OP_FLUSH 2 > -#define UBLK_IO_OP_DISCARD 3 > -#define UBLK_IO_OP_WRITE_SAME 4 > -#define UBLK_IO_OP_WRITE_ZEROES 5 > +#define UBLK_IO_OP_DISCARD 3 > +#define UBLK_IO_OP_WRITE_SAME 4 > +#define UBLK_IO_OP_WRITE_ZEROES 5 > +/* > + * Passthrough (driver private) operation codes range between This is unclear... Here, what does "driver" refer to ? If it is the ublk kernel driver, than these commands should not be defined in the uapi header file, they should be defined in drivers/block/ublk.h. However, if these are for the user space driver, like all the other operations, then let's clearly state so. But then, I still not understand why these need a different naming pattern using the "__UBLK" prefix... > + * __UBLK_IO_OP_DRV_IN_START and __UBLK_IO_OP_DRV_IN_END for REQ_OP_DRV_IN type > + * operations and between __UBLK_IO_OP_DRV_OUT_START and > + * __UBLK_IO_OP_DRV_OUT_END for REQ_OP_DRV_OUT type operations. > + */ > +#define __UBLK_IO_OP_DRV_IN_START 32 > +#define __UBLK_IO_OP_DRV_IN_END 96 > +#define __UBLK_IO_OP_DRV_OUT_START __UBLK_IO_OP_DRV_IN_END > +#define __UBLK_IO_OP_DRV_OUT_END 160 > > #define UBLK_IO_F_FAILFAST_DEV (1U << 8) > #define UBLK_IO_F_FAILFAST_TRANSPORT (1U << 9)
On Fri, Jul 07, 2023 at 08:50:01AM +0900, Damien Le Moal wrote: > On 7/6/23 22:09, Andreas Hindborg wrote: > > From: Andreas Hindborg <a.hindborg@samsung.com> > > > > Ublk zoned storage support relies on DRV_IN handling for zone report. > > Prepare for this change by adding offsets for the DRV_IN/DRV_OUT commands. > > > > Also add parenthesis to existing opcodes for better macro hygiene. > > > > Signed-off-by: Andreas Hindborg <a.hindborg@samsung.com> > > --- > > include/uapi/linux/ublk_cmd.h | 18 ++++++++++++++---- > > 1 file changed, 14 insertions(+), 4 deletions(-) > > > > diff --git a/include/uapi/linux/ublk_cmd.h b/include/uapi/linux/ublk_cmd.h > > index 4b8558db90e1..2ebb8d5d827a 100644 > > --- a/include/uapi/linux/ublk_cmd.h > > +++ b/include/uapi/linux/ublk_cmd.h > > @@ -229,12 +229,22 @@ struct ublksrv_ctrl_dev_info { > > __u64 reserved2; > > }; > > > > -#define UBLK_IO_OP_READ 0 > > +#define UBLK_IO_OP_READ 0 > > #define UBLK_IO_OP_WRITE 1 > > #define UBLK_IO_OP_FLUSH 2 > > -#define UBLK_IO_OP_DISCARD 3 > > -#define UBLK_IO_OP_WRITE_SAME 4 > > -#define UBLK_IO_OP_WRITE_ZEROES 5 > > +#define UBLK_IO_OP_DISCARD 3 > > +#define UBLK_IO_OP_WRITE_SAME 4 > > +#define UBLK_IO_OP_WRITE_ZEROES 5 > > +/* > > + * Passthrough (driver private) operation codes range between > > This is unclear... Here, what does "driver" refer to ? If it is the ublk > kernel driver, than these commands should not be defined in the uapi > header file, they should be defined in drivers/block/ublk.h. However, if > these are for the user space driver, like all the other operations, then Like normal IO, these passthrough requests needs userspace to handle too, usually they just belong to specific ublk target, such as report zones., so here it is part of UAPI. But yes, we should document it clearly, maybe something below? Ublk passthrough operation code ranges, and each passthrough operation provides generic interface between ublk kernel driver and ublk userspace, and this interface is usually used for handling generic block layer request, such as command of zoned report zones. Passthrough operation is only needed iff ublk kernel driver has to be involved for handling this operation. > let's clearly state so. But then, I still not understand why these need > a different naming pattern using the "__UBLK" prefix... I think __UBLK just meant we don't suggest userspace to use it directly, since the added macros are just for making ranges for DRV_IN and DRV_OUT, so we can check command direction easily be using this start/end info in both sides. Thanks, Ming
On 7/7/23 09:59, Ming Lei wrote: > On Fri, Jul 07, 2023 at 08:50:01AM +0900, Damien Le Moal wrote: >> On 7/6/23 22:09, Andreas Hindborg wrote: >>> From: Andreas Hindborg <a.hindborg@samsung.com> >>> >>> Ublk zoned storage support relies on DRV_IN handling for zone report. >>> Prepare for this change by adding offsets for the DRV_IN/DRV_OUT commands. >>> >>> Also add parenthesis to existing opcodes for better macro hygiene. >>> >>> Signed-off-by: Andreas Hindborg <a.hindborg@samsung.com> >>> --- >>> include/uapi/linux/ublk_cmd.h | 18 ++++++++++++++---- >>> 1 file changed, 14 insertions(+), 4 deletions(-) >>> >>> diff --git a/include/uapi/linux/ublk_cmd.h b/include/uapi/linux/ublk_cmd.h >>> index 4b8558db90e1..2ebb8d5d827a 100644 >>> --- a/include/uapi/linux/ublk_cmd.h >>> +++ b/include/uapi/linux/ublk_cmd.h >>> @@ -229,12 +229,22 @@ struct ublksrv_ctrl_dev_info { >>> __u64 reserved2; >>> }; >>> >>> -#define UBLK_IO_OP_READ 0 >>> +#define UBLK_IO_OP_READ 0 >>> #define UBLK_IO_OP_WRITE 1 >>> #define UBLK_IO_OP_FLUSH 2 >>> -#define UBLK_IO_OP_DISCARD 3 >>> -#define UBLK_IO_OP_WRITE_SAME 4 >>> -#define UBLK_IO_OP_WRITE_ZEROES 5 >>> +#define UBLK_IO_OP_DISCARD 3 >>> +#define UBLK_IO_OP_WRITE_SAME 4 >>> +#define UBLK_IO_OP_WRITE_ZEROES 5 >>> +/* >>> + * Passthrough (driver private) operation codes range between >> >> This is unclear... Here, what does "driver" refer to ? If it is the ublk >> kernel driver, than these commands should not be defined in the uapi >> header file, they should be defined in drivers/block/ublk.h. However, if >> these are for the user space driver, like all the other operations, then > > Like normal IO, these passthrough requests needs userspace to handle too, > usually they just belong to specific ublk target, such as report zones., > so here it is part of UAPI. > > But yes, we should document it clearly, maybe something below? > > Ublk passthrough operation code ranges, and each passthrough > operation provides generic interface between ublk kernel driver > and ublk userspace, and this interface is usually used for handling > generic block layer request, such as command of zoned report zones. > Passthrough operation is only needed iff ublk kernel driver has to > be involved for handling this operation. Yes, that is better. > >> let's clearly state so. But then, I still not understand why these need >> a different naming pattern using the "__UBLK" prefix... > > I think __UBLK just meant we don't suggest userspace to use it directly, > since the added macros are just for making ranges for DRV_IN and DRV_OUT, > so we can check command direction easily be using this start/end info in > both sides. Personally, I would still prefer to not add this "__" prefix as these are operations that the ublk user driver will have to deal with, like the other ones. So I do not see the point of that prefix. But no strong feeling about that :) > > > Thanks, > Ming >
On Fri, Jul 07, 2023 at 08:59:03AM +0800, Ming Lei wrote: > > let's clearly state so. But then, I still not understand why these need > > a different naming pattern using the "__UBLK" prefix... > > I think __UBLK just meant we don't suggest userspace to use it directly, > since the added macros are just for making ranges for DRV_IN and DRV_OUT, > so we can check command direction easily be using this start/end info in > both sides. Folks, please stop coupling a uapi (or on-disk protocol) too tightly to Linux internals. Think of what makes sense as a communication protocol, not what is an internal kernel interface. REPORT_ZONES is a sensible command, and supported in ATA/SCSI/NVMe in one way or another. In Linux it is a synchronous method call right now for one reason or another, and most implementation map it to a passthrough command - be that the actual protocol command or something internal for virtio. So for ublk this is just another command like any other, that needs to be defined and documented. Nothing internal or driver specific.
On Sun, Jul 09, 2023 at 11:52:39PM -0700, Christoph Hellwig wrote: > On Fri, Jul 07, 2023 at 08:59:03AM +0800, Ming Lei wrote: > > > let's clearly state so. But then, I still not understand why these need > > > a different naming pattern using the "__UBLK" prefix... > > > > I think __UBLK just meant we don't suggest userspace to use it directly, > > since the added macros are just for making ranges for DRV_IN and DRV_OUT, > > so we can check command direction easily be using this start/end info in > > both sides. > > Folks, please stop coupling a uapi (or on-disk protocol) too tightly > to Linux internals. Think of what makes sense as a communication > protocol, not what is an internal kernel interface. > > REPORT_ZONES is a sensible command, and supported in ATA/SCSI/NVMe in > one way or another. In Linux it is a synchronous method call right now > for one reason or another, and most implementation map it to a > passthrough command - be that the actual protocol command or something > internal for virtio. > > So for ublk this is just another command like any other, that needs to > be defined and documented. Nothing internal or driver specific. Yes, that is exactly what we are doing. The added macros of UBLK_IO_OP_DRV_IN_START[END] are just for supporting more ublk passthrough commands, and the motivation is for running check(such as buffer direction) in two sides easily. However, I think it is just fine to delay to add it until introducing the 2nd ublk pt command. Thanks, Ming
On Mon, Jul 10, 2023 at 05:27:23PM +0800, Ming Lei wrote: > Yes, that is exactly what we are doing. > > The added macros of UBLK_IO_OP_DRV_IN_START[END] are just for supporting > more ublk passthrough commands, and the motivation is for running > check(such as buffer direction) in two sides easily. > > However, I think it is just fine to delay to add it until introducing > the 2nd ublk pt command. The concept of a passthrough command just doesn't make sense for an on the wire protocol. It is a linux concept that distinguished between the Linux synthetic command like REQ_OP_READ/WRITE/DISCARD etc that are well defined and can be used by file systems and other consumers, and ways to pass through arbitrary blobs only known by the driver. Anything in a wire protocol needs to be very well defined in that protocol completely indpendent of what Linux concept it maps to. Especially as the Linux concepts can change, and fairly frequently do.
On Mon, Jul 10, 2023 at 02:32:44AM -0700, Christoph Hellwig wrote: > On Mon, Jul 10, 2023 at 05:27:23PM +0800, Ming Lei wrote: > > Yes, that is exactly what we are doing. > > > > The added macros of UBLK_IO_OP_DRV_IN_START[END] are just for supporting > > more ublk passthrough commands, and the motivation is for running > > check(such as buffer direction) in two sides easily. > > > > However, I think it is just fine to delay to add it until introducing > > the 2nd ublk pt command. > > The concept of a passthrough command just doesn't make sense for an > on the wire protocol. It is a linux concept that distinguished between > the Linux synthetic command like REQ_OP_READ/WRITE/DISCARD etc that are > well defined and can be used by file systems and other consumers, and > ways to pass through arbitrary blobs only known by the driver. > > Anything in a wire protocol needs to be very well defined in that > protocol completely indpendent of what Linux concept it maps to. > Especially as the Linux concepts can change, and fairly frequently do. Yeah, you are right wrt. linux pt command, and here we shouldn't use the term of passthrough. Actually the UAPI is trying to define interface between driver and userspace, which is just like interface between driver and hardware, such as, how nvme/sd_zbc is dealing with actual hardware wrt. reporting zones. Thanks, Ming
Christoph Hellwig <hch@infradead.org> writes: > On Mon, Jul 10, 2023 at 05:27:23PM +0800, Ming Lei wrote: >> Yes, that is exactly what we are doing. >> >> The added macros of UBLK_IO_OP_DRV_IN_START[END] are just for supporting >> more ublk passthrough commands, and the motivation is for running >> check(such as buffer direction) in two sides easily. >> >> However, I think it is just fine to delay to add it until introducing >> the 2nd ublk pt command. > > The concept of a passthrough command just doesn't make sense for an > on the wire protocol. It is a linux concept that distinguished between > the Linux synthetic command like REQ_OP_READ/WRITE/DISCARD etc that are > well defined and can be used by file systems and other consumers, and > ways to pass through arbitrary blobs only known by the driver. Yet most on-the-wire protocols for actual hardware does support this some way or another. But I agree that for ublk it is probably not needed. It would probably be easier to talk to the ublk daemon through other means than passthrough in the block layer. > > Anything in a wire protocol needs to be very well defined in that > protocol completely indpendent of what Linux concept it maps to. > Especially as the Linux concepts can change, and fairly frequently do. I somewhat agree in the sense that for consistency, we should either move zone management commands to the DRV_OUT range OR move report_zones out of this special range and just next to the zone management operations. I like the latter option better, and I would love to see the block layer do the same at some point. It feels backwards that report_zones get special treatment all over the place. Best regards, Andreas
On Tue, Jul 11, 2023 at 08:23:40AM +0200, Andreas Hindborg (Samsung) wrote: > Yet most on-the-wire protocols for actual hardware does support this > some way or another. Supports what? Passthrough? No. > I somewhat agree in the sense that for consistency, we should either > move zone management commands to the DRV_OUT range OR move report_zones > out of this special range and just next to the zone management > operations. I like the latter option better, and I would love to see the > block layer do the same at some point. It feels backwards that > report_zones get special treatment all over the place. DRV_IN/OUT is purely a Linux concept. It doesn't make any sense for a wire protocol.
Christoph Hellwig <hch@infradead.org> writes: > On Tue, Jul 11, 2023 at 08:23:40AM +0200, Andreas Hindborg (Samsung) wrote: >> Yet most on-the-wire protocols for actual hardware does support this >> some way or another. > > Supports what? Passthrough? No. Both SCSI and NVMe has command identifier ranges reserved for vendor specific commands. I would assume that one use of these is to implement passthrough channels to a device for testing out new interfaces. Just guessing though. > >> I somewhat agree in the sense that for consistency, we should either >> move zone management commands to the DRV_OUT range OR move report_zones >> out of this special range and just next to the zone management >> operations. I like the latter option better, and I would love to see the >> block layer do the same at some point. It feels backwards that >> report_zones get special treatment all over the place. > > DRV_IN/OUT is purely a Linux concept. It doesn't make any sense for > a wire protocol. Ok 👍 BR Andreas
On Tue, Jul 11, 2023 at 11:02:15AM +0200, Andreas Hindborg (Samsung) wrote: > > Christoph Hellwig <hch@infradead.org> writes: > > > On Tue, Jul 11, 2023 at 08:23:40AM +0200, Andreas Hindborg (Samsung) wrote: > >> Yet most on-the-wire protocols for actual hardware does support this > >> some way or another. > > > > Supports what? Passthrough? No. > > Both SCSI and NVMe has command identifier ranges reserved for vendor > specific commands. I would assume that one use of these is to implement > passthrough channels to a device for testing out new interfaces. Just > guessing though. Vendor specific commands is an entirely different concept from Linux passthrough requests.
Christoph Hellwig <hch@infradead.org> writes: > On Tue, Jul 11, 2023 at 11:02:15AM +0200, Andreas Hindborg (Samsung) wrote: >> >> Christoph Hellwig <hch@infradead.org> writes: >> >> > On Tue, Jul 11, 2023 at 08:23:40AM +0200, Andreas Hindborg (Samsung) wrote: >> >> Yet most on-the-wire protocols for actual hardware does support this >> >> some way or another. >> > >> > Supports what? Passthrough? No. >> >> Both SCSI and NVMe has command identifier ranges reserved for vendor >> specific commands. I would assume that one use of these is to implement >> passthrough channels to a device for testing out new interfaces. Just >> guessing though. > > Vendor specific commands is an entirely different concept from Linux > passthrough requests. And yet they are somewhat similar, in the sense that they allow the user of a protocol to express semantics that is not captured in the established protocol. Uring command passthrough -> request passthrough -> vendor specific commands. They sort of map well in terms of what they allow the user to achieve. Or did I misunderstand something completely?
On Tue, Jul 11, 2023 at 12:15:18PM +0200, Andreas Hindborg (Samsung) wrote: > And yet they are somewhat similar, in the sense that they allow the user > of a protocol to express semantics that is not captured in the > established protocol. Uring command passthrough -> request passthrough > -> vendor specific commands. They sort of map well in terms of what they > allow the user to achieve. Or did I misunderstand something completely? Well, there is a relationship, but it's one way. Vendor specific command are basically always going to be used through a passthrough interface, because they aren't standardized. But most commands used through a passthrough interface are normal standardized commands, just either used in a way not supported by the normal Linux interface or just in creative ways.
diff --git a/include/uapi/linux/ublk_cmd.h b/include/uapi/linux/ublk_cmd.h index 4b8558db90e1..2ebb8d5d827a 100644 --- a/include/uapi/linux/ublk_cmd.h +++ b/include/uapi/linux/ublk_cmd.h @@ -229,12 +229,22 @@ struct ublksrv_ctrl_dev_info { __u64 reserved2; }; -#define UBLK_IO_OP_READ 0 +#define UBLK_IO_OP_READ 0 #define UBLK_IO_OP_WRITE 1 #define UBLK_IO_OP_FLUSH 2 -#define UBLK_IO_OP_DISCARD 3 -#define UBLK_IO_OP_WRITE_SAME 4 -#define UBLK_IO_OP_WRITE_ZEROES 5 +#define UBLK_IO_OP_DISCARD 3 +#define UBLK_IO_OP_WRITE_SAME 4 +#define UBLK_IO_OP_WRITE_ZEROES 5 +/* + * Passthrough (driver private) operation codes range between + * __UBLK_IO_OP_DRV_IN_START and __UBLK_IO_OP_DRV_IN_END for REQ_OP_DRV_IN type + * operations and between __UBLK_IO_OP_DRV_OUT_START and + * __UBLK_IO_OP_DRV_OUT_END for REQ_OP_DRV_OUT type operations. + */ +#define __UBLK_IO_OP_DRV_IN_START 32 +#define __UBLK_IO_OP_DRV_IN_END 96 +#define __UBLK_IO_OP_DRV_OUT_START __UBLK_IO_OP_DRV_IN_END +#define __UBLK_IO_OP_DRV_OUT_END 160 #define UBLK_IO_F_FAILFAST_DEV (1U << 8) #define UBLK_IO_F_FAILFAST_TRANSPORT (1U << 9)