Skip to content

Commit c87ba9c

Browse files
Nicholas BellingerNicholas Bellinger
authored andcommitted
target: Add counters for ABORT_TASK success + failure
This patch introduces two counters for ABORT_TASK success + failure under: /sys/kernel/config/target/core/$HBA/$DEV/statistics/scsi_tgt_dev/ that are useful for diagnosing various backend device latency and front fabric issues. Normally when folks see alot of aborts_complete happening, it means the backend device I/O completion latency is high, and not returning completions fast enough before host side timeouts trigger. And normally when folks see alot of aborts_no_task, it means completions are being posted by target-core into fabric driver code, but the responses aren't making it back to the host. Signed-off-by: Nicholas Bellinger <[email protected]>
1 parent 17c61ad commit c87ba9c

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

drivers/target/target_core_stat.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,28 @@ static ssize_t target_stat_tgt_resets_show(struct config_item *item,
158158
atomic_long_read(&to_stat_tgt_dev(item)->num_resets));
159159
}
160160

161+
static ssize_t target_stat_tgt_aborts_complete_show(struct config_item *item,
162+
char *page)
163+
{
164+
return snprintf(page, PAGE_SIZE, "%lu\n",
165+
atomic_long_read(&to_stat_tgt_dev(item)->aborts_complete));
166+
}
167+
168+
static ssize_t target_stat_tgt_aborts_no_task_show(struct config_item *item,
169+
char *page)
170+
{
171+
return snprintf(page, PAGE_SIZE, "%lu\n",
172+
atomic_long_read(&to_stat_tgt_dev(item)->aborts_no_task));
173+
}
174+
161175
CONFIGFS_ATTR_RO(target_stat_tgt_, inst);
162176
CONFIGFS_ATTR_RO(target_stat_tgt_, indx);
163177
CONFIGFS_ATTR_RO(target_stat_tgt_, num_lus);
164178
CONFIGFS_ATTR_RO(target_stat_tgt_, status);
165179
CONFIGFS_ATTR_RO(target_stat_tgt_, non_access_lus);
166180
CONFIGFS_ATTR_RO(target_stat_tgt_, resets);
181+
CONFIGFS_ATTR_RO(target_stat_tgt_, aborts_complete);
182+
CONFIGFS_ATTR_RO(target_stat_tgt_, aborts_no_task);
167183

168184
static struct configfs_attribute *target_stat_scsi_tgt_dev_attrs[] = {
169185
&target_stat_tgt_attr_inst,
@@ -172,6 +188,8 @@ static struct configfs_attribute *target_stat_scsi_tgt_dev_attrs[] = {
172188
&target_stat_tgt_attr_status,
173189
&target_stat_tgt_attr_non_access_lus,
174190
&target_stat_tgt_attr_resets,
191+
&target_stat_tgt_attr_aborts_complete,
192+
&target_stat_tgt_attr_aborts_no_task,
175193
NULL,
176194
};
177195

drivers/target/target_core_tmr.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,15 @@ void core_tmr_abort_task(
190190
printk("ABORT_TASK: Sending TMR_FUNCTION_COMPLETE for"
191191
" ref_tag: %llu\n", ref_tag);
192192
tmr->response = TMR_FUNCTION_COMPLETE;
193+
atomic_long_inc(&dev->aborts_complete);
193194
return;
194195
}
195196
spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags);
196197

197198
printk("ABORT_TASK: Sending TMR_TASK_DOES_NOT_EXIST for ref_tag: %lld\n",
198199
tmr->ref_task_tag);
199200
tmr->response = TMR_TASK_DOES_NOT_EXIST;
201+
atomic_long_inc(&dev->aborts_no_task);
200202
}
201203

202204
static void core_tmr_drain_tmr_list(

include/target/target_core_base.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,8 @@ struct se_device {
766766
u32 dev_index;
767767
u64 creation_time;
768768
atomic_long_t num_resets;
769+
atomic_long_t aborts_complete;
770+
atomic_long_t aborts_no_task;
769771
atomic_long_t num_cmds;
770772
atomic_long_t read_bytes;
771773
atomic_long_t write_bytes;

0 commit comments

Comments
 (0)