diff mbox series

[v2,1/8] scsi: target: Make write_pending_must_be_called a bit field

Message ID 20230928020907.5730-1-michael.christie@oracle.com (mailing list archive)
State Accepted
Headers show
Series [v2,1/8] scsi: target: Make write_pending_must_be_called a bit field | expand

Commit Message

Mike Christie Sept. 28, 2023, 2:09 a.m. UTC
The next patches add more on/off type of settings to the
target_core_fabric_ops struct so this makes write_pending_must_be_called
a bit field instead of a bool to better organize the settings.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
 drivers/target/iscsi/iscsi_target_configfs.c | 2 +-
 include/target/target_core_fabric.h          | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Mike Christie Sept. 28, 2023, 2:31 a.m. UTC | #1
The following patches were made over Linus's tree but apply over Martin's
branches. They allow userspace to configure how fabric drivers submit cmds
to backend drivers.

Right now loop and vhost use a worker thread, and the other drivers submit
from the contexts they receive/process the cmd from. For multiple LUN
cases where the target can queue more cmds than the backend can handle
then deferring to a worker thread is safest because the backend driver can
block when doing things like waiting for a free request/tag. Deferring also
helps when the target has to handle transport level requests from the
recv context.

For cases where the backend devices can queue everything the target sends,
then there is no need to defer to a workqueue and you can see a perf boost of
up to 26% for small IO workloads. For a nvme device and vhost-scsi I can
see with 4K IOs:

fio jobs        1       2       4       8       10
--------------------------------------------------
workqueue
submit           94K     190K    394K    770K    890K

direct
submit          128K    252K    488K    950K    -



v2:
- Use sysfs_emit.
- Add iSCSI target support so now all targets are supported.
Martin K. Petersen Oct. 13, 2023, 7:57 p.m. UTC | #2
Mike,

> The following patches were made over Linus's tree but apply over Martin's
> branches. They allow userspace to configure how fabric drivers submit cmds
> to backend drivers.

Applied to 6.7/scsi-staging, thanks!
Martin K. Petersen Oct. 17, 2023, 1:11 a.m. UTC | #3
On Wed, 27 Sep 2023 21:31:32 -0500, Mike Christie wrote:

> The following patches were made over Linus's tree but apply over Martin's
> branches. They allow userspace to configure how fabric drivers submit cmds
> to backend drivers.
> 
> Right now loop and vhost use a worker thread, and the other drivers submit
> from the contexts they receive/process the cmd from. For multiple LUN
> cases where the target can queue more cmds than the backend can handle
> then deferring to a worker thread is safest because the backend driver can
> block when doing things like waiting for a free request/tag. Deferring also
> helps when the target has to handle transport level requests from the
> recv context.
> 
> [...]

Applied to 6.7/scsi-queue, thanks!

[1/8] scsi: target: Make write_pending_must_be_called a bit field
      https://git.kernel.org/mkp/scsi/c/40ddd6df93a3
[2/8] scsi: target: Have drivers report if they support direct submissions
      https://git.kernel.org/mkp/scsi/c/194605d45dcb
[3/8] target: Move core_alua_check_nonop_delay call
      https://git.kernel.org/mkp/scsi/c/ee48345e1cca
[4/8] target: Move buffer clearing hack
      https://git.kernel.org/mkp/scsi/c/5c48a4ea3280
[5/8] target: Kill transport_handle_cdb_direct
      https://git.kernel.org/mkp/scsi/c/428926796e7f
[6/8] scsi: target: Allow userspace to request direct submissions
      https://git.kernel.org/mkp/scsi/c/e2f4ea40138e
[7/8] scsi: target: Unexport target_queue_submission
      https://git.kernel.org/mkp/scsi/c/e344c00e7ccd
[8/8] scsi: target: Export fabric driver direct submit settings
      https://git.kernel.org/mkp/scsi/c/6dbc829d101d
diff mbox series

Patch

diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c
index 1cff6052e820..bf190dcb9eee 100644
--- a/drivers/target/iscsi/iscsi_target_configfs.c
+++ b/drivers/target/iscsi/iscsi_target_configfs.c
@@ -1589,5 +1589,5 @@  const struct target_core_fabric_ops iscsi_ops = {
 	.tfc_tpg_nacl_auth_attrs	= lio_target_nacl_auth_attrs,
 	.tfc_tpg_nacl_param_attrs	= lio_target_nacl_param_attrs,
 
-	.write_pending_must_be_called	= true,
+	.write_pending_must_be_called	= 1,
 };
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index b188b1e90e1e..2a6c4c935666 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -113,11 +113,11 @@  struct target_core_fabric_ops {
 	struct configfs_attribute **tfc_tpg_nacl_param_attrs;
 
 	/*
-	 * Set this member variable to true if the SCSI transport protocol
+	 * Set this member variable if the SCSI transport protocol
 	 * (e.g. iSCSI) requires that the Data-Out buffer is transferred in
 	 * its entirety before a command is aborted.
 	 */
-	bool write_pending_must_be_called;
+	unsigned int write_pending_must_be_called:1;
 };
 
 int target_register_template(const struct target_core_fabric_ops *fo);