Print this page
NEX-6018 Return of the walking dead idm_refcnt_wait_ref comstar threads
Reviewed by:  Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by:  Evan Layton <evan.layton@nexenta.com>
NEX-5428 Backout the 5.0 changes
NEX-2937 Continuous write_same starves all other commands
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Steve Peng <steve.peng@nexenta.com>
NEX-3622 COMSTAR should have per remote port kstats for I/O and latency
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
NEX-3169 STMF has duplicate code in 6 places which is error prone.
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
Reviewby by: Steve Ping <steve.ping@nexenta.com>
Re #6790 backspace should perform delete on console
VAAI (XXX ATS support for COMSTAR, YYY Block-copy support for COMSTAR)

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/comstar/stmf/stmf_impl.h
          +++ new/usr/src/uts/common/io/comstar/stmf/stmf_impl.h
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
       23 + *
       24 + * Copyright 2016 Nexenta Systems, Inc.  All rights reserved.
  23   25   * Copyright (c) 2013 by Delphix. All rights reserved.
  24   26   */
  25   27  #ifndef _STMF_IMPL_H
  26   28  #define _STMF_IMPL_H
  27   29  
  28   30  #include <sys/stmf_defines.h>
  29   31  #include <sys/stmf_ioctl.h>
  30   32  
  31   33  #ifdef  __cplusplus
  32   34  extern "C" {
↓ open down ↓ 49 lines elided ↑ open up ↑
  82   84          struct stmf_i_lu *ilu_prev;
  83   85          char            *ilu_alias;
  84   86          char            ilu_ascii_hex_guid[STMF_GUID_INPUT + 1];
  85   87          kmutex_t        ilu_task_lock;
  86   88          uint32_t        ilu_task_cntr1;
  87   89          uint32_t        ilu_task_cntr2;
  88   90          uint32_t        *ilu_cur_task_cntr;
  89   91          uint32_t        ilu_ntasks;      /* # of tasks in the ilu_task list */
  90   92          uint32_t        ilu_ntasks_free;        /* # of tasks that are free */
  91   93          uint32_t        ilu_ntasks_min_free; /* # minimal free tasks */
  92      -        uint32_t        rsvd1;
       94 +        uint32_t        ilu_additional_ref;
  93   95          uint32_t        ilu_proxy_registered;
  94   96          uint64_t        ilu_reg_msgid;
  95   97          struct stmf_i_scsi_task *ilu_tasks;
  96   98          struct stmf_i_scsi_task *ilu_free_tasks;
  97   99          struct stmf_itl_data    *ilu_itl_list;
  98  100          kstat_t         *ilu_kstat_info;
  99  101          kstat_t         *ilu_kstat_io;
 100  102          kmutex_t        ilu_kstat_lock;
 101  103          kcondvar_t      ilu_offline_pending_cv;
 102  104  
↓ open down ↓ 54 lines elided ↑ open up ↑
 157  159  #define STMF_AVG_ONLINE_INTERVAL        (30 * drv_usectohz(1000000))
 158  160  
 159  161  #define MAX_IRPORT                      0x10000
 160  162  
 161  163  typedef struct stmf_i_remote_port {
 162  164          struct scsi_devid_desc  *irport_id;
 163  165          kmutex_t                irport_mutex;
 164  166          int                     irport_refcnt;
 165  167          id_t                    irport_instance;
 166  168          avl_node_t              irport_ln;
      169 +        /* number of active read tasks */
      170 +        uint32_t                irport_nread_tasks;
      171 +        /* number of active write tasks */
      172 +        uint32_t                irport_nwrite_tasks;
      173 +        hrtime_t                irport_rdstart_timestamp;
      174 +        hrtime_t                irport_rddone_timestamp;
      175 +        hrtime_t                irport_wrstart_timestamp;
      176 +        hrtime_t                irport_wrdone_timestamp;
      177 +        kstat_t                 *irport_kstat_info;
      178 +        kstat_t                 *irport_kstat_io;
      179 +        kstat_t                 *irport_kstat_estat;    /* extended stats */
      180 +        boolean_t               irport_info_dirty;
 167  181  } stmf_i_remote_port_t;
 168  182  
 169  183  /*
 170  184   * ilport flags
 171  185   */
 172  186  #define ILPORT_FORCED_OFFLINE           0x01
 173  187  #define ILPORT_SS_GOT_INITIAL_LUNS      0x02
 174  188  
 175  189  typedef struct stmf_i_scsi_session {
 176  190          stmf_scsi_session_t     *iss_ss;
↓ open down ↓ 53 lines elided ↑ open up ↑
 230  244          uint32_t                ta_itask_flags;
 231  245          stmf_data_buf_t         *ta_dbuf;
 232  246          timespec_t              ta_timestamp;
 233  247  } stmf_task_audit_rec_t;
 234  248  
 235  249  struct stmf_worker;
 236  250  typedef struct stmf_i_scsi_task {
 237  251          scsi_task_t             *itask_task;
 238  252          uint32_t                itask_alloc_size;
 239  253          uint32_t                itask_flags;
      254 +        kmutex_t                itask_mutex; /* protects flags and lists */
 240  255          uint64_t                itask_proxy_msg_id;
 241  256          stmf_data_buf_t         *itask_proxy_dbuf;
 242  257          struct stmf_worker      *itask_worker;
 243  258          uint32_t                *itask_ilu_task_cntr;
 244  259          struct stmf_i_scsi_task *itask_worker_next;
 245  260          struct stmf_i_scsi_task *itask_lu_next;
 246  261          struct stmf_i_scsi_task *itask_lu_prev;
 247  262          struct stmf_i_scsi_task *itask_lu_free_next;
 248      -        struct stmf_i_scsi_task *itask_abort_next;
 249  263          struct stmf_itl_data    *itask_itl_datap;
 250  264          clock_t                 itask_start_time;       /* abort and normal */
 251  265          /* For now we only support 4 parallel buffers. Should be enough. */
 252  266          stmf_data_buf_t         *itask_dbufs[4];
 253  267          clock_t                 itask_poll_timeout;
 254  268          uint8_t                 itask_cmd_stack[ITASK_MAX_NCMDS];
 255  269          uint8_t                 itask_ncmds;
 256  270          uint8_t                 itask_allocated_buf_map;
 257  271          uint16_t                itask_cdb_buf_size;
 258  272  
 259  273          /* Task profile data */
 260  274          hrtime_t                itask_start_timestamp;
 261  275          hrtime_t                itask_done_timestamp;
      276 +        hrtime_t                itask_xfer_done_timestamp;
 262  277          hrtime_t                itask_waitq_enter_timestamp;
 263  278          hrtime_t                itask_waitq_time;
 264  279          hrtime_t                itask_lu_read_time;
 265  280          hrtime_t                itask_lu_write_time;
 266  281          hrtime_t                itask_lport_read_time;
 267  282          hrtime_t                itask_lport_write_time;
 268  283          uint64_t                itask_read_xfer;
 269  284          uint64_t                itask_write_xfer;
 270  285          kmutex_t                itask_audit_mutex;
 271  286          uint8_t                 itask_audit_index;
 272  287          stmf_task_audit_rec_t   itask_audit_records[ITASK_TASK_AUDIT_DEPTH];
 273  288  } stmf_i_scsi_task_t;
 274  289  
 275  290  #define ITASK_DEFAULT_ABORT_TIMEOUT     5
 276  291  
 277  292  /*
      293 + * Common code to encode an itask onto the worker_task queue is placed
      294 + * in this macro to simplify future maintenace activity.
      295 + */
      296 +#define STMF_ENQUEUE_ITASK(w, i) \
      297 +        ASSERT((itask->itask_flags & ITASK_IN_FREE_LIST) == 0); \
      298 +        ASSERT(mutex_owned(&itask->itask_mutex)); \
      299 +        ASSERT(mutex_owned(&w->worker_lock)); \
      300 +        i->itask_worker_next = NULL; \
      301 +        if (w->worker_task_tail) { \
      302 +                w->worker_task_tail->itask_worker_next = i; \
      303 +        } else { \
      304 +                w->worker_task_head = i; \
      305 +        } \
      306 +        w->worker_task_tail = i; \
      307 +        if (++(w->worker_queue_depth) > w->worker_max_qdepth_pu) { \
      308 +                w->worker_max_qdepth_pu = w->worker_queue_depth; \
      309 +        } \
      310 +        atomic_inc_32(&w->worker_ref_count); \
      311 +        atomic_or_32(&itask->itask_flags, ITASK_IN_WORKER_QUEUE); \
      312 +        i->itask_waitq_enter_timestamp = gethrtime(); \
      313 +        if ((w->worker_flags & STMF_WORKER_ACTIVE) == 0) \
      314 +                cv_signal(&w->worker_cv);
      315 +
      316 +#define STMF_DEQUEUE_ITASK(w, itask) \
      317 +        ASSERT(mutex_owned(&w->worker_lock)); \
      318 +        if ((itask = w->worker_task_head) != NULL) { \
      319 +                w->worker_task_head = itask->itask_worker_next; \
      320 +                if (w->worker_task_head == NULL) { \
      321 +                        w->worker_task_tail = NULL; \
      322 +                } \
      323 +        } else { \
      324 +                w->worker_task_tail = NULL; \
      325 +        }
      326 +
      327 +/*
 278  328   * itask_flags
 279  329   */
 280  330  #define ITASK_IN_FREE_LIST              0x0001
 281  331  #define ITASK_IN_TRANSITION             0x0002
 282  332  #define ITASK_IN_WORKER_QUEUE           0x0004
 283  333  #define ITASK_BEING_ABORTED             0x0008
 284  334  #define ITASK_BEING_COMPLETED           0x0010
 285  335  #define ITASK_KNOWN_TO_TGT_PORT         0x0020
 286  336  #define ITASK_KNOWN_TO_LU               0x0040
 287  337  #define ITASK_LU_ABORT_CALLED           0x0080
↓ open down ↓ 112 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX