From: Bodo Stroesser <bstroesser@ts.fujitsu.com> To: "Martin K. Petersen" <martin.petersen@oracle.com>, Mike Christie <michael.christie@oracle.com>, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Bodo Stroesser <bstroesser@ts.fujitsu.com> Subject: [RFC PATCH 0/8] scsi: target: tcmu: Add TMR notification for tcmu Date: Tue, 30 Jun 2020 10:47:01 +0000 [thread overview] Message-ID: <20200630104709.23066-1-bstroesser@ts.fujitsu.com> (raw) TCM/LIO core handles TMRs without involving backends. But TMR completion message is sent to initiator only after commands aborted by the TMR are completed by the backend. Especially in case of tcmu backend, if userspace executes long running commands and therefore initiator sends ABORT_TASK on timeout, the ABORT itself can time out if core still waits for userspace/tcmu to complete the command. It would be very helpful for userspace to get a notification about received TMR and which commands were aborted by that TMR. Then userspace can decide whether to cancel command processing, and it can send command completion earlier than it would without TMR notification. It is also helpful for userspace traces and device emulation to get notification about TMR events. So this patch series in the first two patches implements in core the usage of a new optional backend callback for TMR notifications. The core calls it before core waits for completion of aborted commands (params: se_dev, TMR type, and list of se_cmds aborted by this TMR). Of course other backends than tcmu can use this part of the series also to implement their own TMR notification if necessary. The further six patches implement the TMR notify callback for tcmu. The new configFS attribute tmr_notification allows to switch on TMR messages on the cmd ring. The default of the attribute is the old behavior without TMR info on the ring, but with following changes: - if tcmu receives an already aborted command, it immediately rejects it. So it will never appear in userspace. - if tcmu finds, that according to TMR notification a cmd on the qfull_queue was aborted, tcmu removes it from qfull_queue and completes it immediately. So userspace will not 'see' those commands. When attribute tmr_notification is set to 1, tcmu additionally prepares a list of cmd_ids from those commands, that are aborted by the TMR and are active in cmd ring (not timed out). This list together with the TMR type is either immediately written to cmd ring (new TMR entry type) or queued in a separate tmr queue if ring space is too small. TMRs in the tmr queue do not time out. If ring space becomes available, tcmu moves TMRs from tmr queue to ring with higher priority than cmds from qfull queue. This mechanism makes sure that userspace receives TMR notifications as early as possible. Userspace can use the list of cmd_ids attached to the TMR notification to identify aborted commands from its list of received and not yet completed commands. In case userspace has meanwhile completed some of the cmd_ids on the list, it can just ignore these cmd_ids. A possible new command having the cmd_id as one of the aborted commands will always appear on the ring after the TMR notification. Bodo Stroesser (8): scsi: target: Modify core_tmr_abort_task() scsi: target: Add tmr_notify backend function scsi: target: tcmu: Use priv pointer in se_cmd scsi: target: tcmu: Do not queue aborted commands scsi: target: tcmu: Factor out new helper ring_insert_padding scsi: target: tcmu: Fix and simplify timeout handling scsi: target: tcmu: Implement tmr_notify callback scsi: target: tcmu: Make TMR notification optional drivers/target/target_core_tmr.c | 36 +++- drivers/target/target_core_transport.c | 1 + drivers/target/target_core_user.c | 377 +++++++++++++++++++++++++++------ include/target/target_core_backend.h | 2 + include/target/target_core_base.h | 1 + include/uapi/linux/target_core_user.h | 25 +++ 6 files changed, 369 insertions(+), 73 deletions(-) -- 2.12.3
WARNING: multiple messages have this Message-ID (diff)
From: Bodo Stroesser <bstroesser@ts.fujitsu.com> To: "Martin K. Petersen" <martin.petersen@oracle.com>, Mike Christie <michael.christie@oracle.com>, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Bodo Stroesser <bstroesser@ts.fujitsu.com> Subject: [RFC PATCH 0/8] scsi: target: tcmu: Add TMR notification for tcmu Date: Tue, 30 Jun 2020 12:47:01 +0200 [thread overview] Message-ID: <20200630104709.23066-1-bstroesser@ts.fujitsu.com> (raw) TCM/LIO core handles TMRs without involving backends. But TMR completion message is sent to initiator only after commands aborted by the TMR are completed by the backend. Especially in case of tcmu backend, if userspace executes long running commands and therefore initiator sends ABORT_TASK on timeout, the ABORT itself can time out if core still waits for userspace/tcmu to complete the command. It would be very helpful for userspace to get a notification about received TMR and which commands were aborted by that TMR. Then userspace can decide whether to cancel command processing, and it can send command completion earlier than it would without TMR notification. It is also helpful for userspace traces and device emulation to get notification about TMR events. So this patch series in the first two patches implements in core the usage of a new optional backend callback for TMR notifications. The core calls it before core waits for completion of aborted commands (params: se_dev, TMR type, and list of se_cmds aborted by this TMR). Of course other backends than tcmu can use this part of the series also to implement their own TMR notification if necessary. The further six patches implement the TMR notify callback for tcmu. The new configFS attribute tmr_notification allows to switch on TMR messages on the cmd ring. The default of the attribute is the old behavior without TMR info on the ring, but with following changes: - if tcmu receives an already aborted command, it immediately rejects it. So it will never appear in userspace. - if tcmu finds, that according to TMR notification a cmd on the qfull_queue was aborted, tcmu removes it from qfull_queue and completes it immediately. So userspace will not 'see' those commands. When attribute tmr_notification is set to 1, tcmu additionally prepares a list of cmd_ids from those commands, that are aborted by the TMR and are active in cmd ring (not timed out). This list together with the TMR type is either immediately written to cmd ring (new TMR entry type) or queued in a separate tmr queue if ring space is too small. TMRs in the tmr queue do not time out. If ring space becomes available, tcmu moves TMRs from tmr queue to ring with higher priority than cmds from qfull queue. This mechanism makes sure that userspace receives TMR notifications as early as possible. Userspace can use the list of cmd_ids attached to the TMR notification to identify aborted commands from its list of received and not yet completed commands. In case userspace has meanwhile completed some of the cmd_ids on the list, it can just ignore these cmd_ids. A possible new command having the cmd_id as one of the aborted commands will always appear on the ring after the TMR notification. Bodo Stroesser (8): scsi: target: Modify core_tmr_abort_task() scsi: target: Add tmr_notify backend function scsi: target: tcmu: Use priv pointer in se_cmd scsi: target: tcmu: Do not queue aborted commands scsi: target: tcmu: Factor out new helper ring_insert_padding scsi: target: tcmu: Fix and simplify timeout handling scsi: target: tcmu: Implement tmr_notify callback scsi: target: tcmu: Make TMR notification optional drivers/target/target_core_tmr.c | 36 +++- drivers/target/target_core_transport.c | 1 + drivers/target/target_core_user.c | 377 +++++++++++++++++++++++++++------ include/target/target_core_backend.h | 2 + include/target/target_core_base.h | 1 + include/uapi/linux/target_core_user.h | 25 +++ 6 files changed, 369 insertions(+), 73 deletions(-) -- 2.12.3
next reply other threads:[~2020-06-30 10:47 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-30 10:47 Bodo Stroesser [this message] 2020-06-30 10:47 ` [RFC PATCH 0/8] scsi: target: tcmu: Add TMR notification for tcmu Bodo Stroesser 2020-06-30 10:47 ` [RFC PATCH 1/8] scsi: target: Modify core_tmr_abort_task() Bodo Stroesser 2020-06-30 10:47 ` Bodo Stroesser 2020-06-30 10:47 ` [RFC PATCH 2/8] scsi: target: Add tmr_notify backend function Bodo Stroesser 2020-06-30 10:47 ` Bodo Stroesser 2020-06-30 10:47 ` [RFC PATCH 3/8] scsi: target: tcmu: Use priv pointer in se_cmd Bodo Stroesser 2020-06-30 10:47 ` Bodo Stroesser 2020-06-30 10:47 ` [RFC PATCH 4/8] scsi: target: tcmu: Do not queue aborted commands Bodo Stroesser 2020-06-30 10:47 ` Bodo Stroesser 2020-06-30 10:47 ` [RFC PATCH 5/8] scsi: target: tcmu: Factor out new helper ring_insert_padding Bodo Stroesser 2020-06-30 10:47 ` Bodo Stroesser 2020-06-30 10:47 ` [RFC PATCH 6/8] scsi: target: tcmu: Fix and simplify timeout handling Bodo Stroesser 2020-06-30 10:47 ` Bodo Stroesser 2020-06-30 10:47 ` [RFC PATCH 7/8] scsi: target: tcmu: Implement tmr_notify callback Bodo Stroesser 2020-06-30 10:47 ` Bodo Stroesser 2020-06-30 10:47 ` [RFC PATCH 8/8] scsi: target: tcmu: Make TMR notification optional Bodo Stroesser 2020-06-30 10:47 ` Bodo Stroesser
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200630104709.23066-1-bstroesser@ts.fujitsu.com \ --to=bstroesser@ts.fujitsu.com \ --cc=linux-scsi@vger.kernel.org \ --cc=martin.petersen@oracle.com \ --cc=michael.christie@oracle.com \ --cc=target-devel@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.