- Docs updated

- Switches debug<->performance<->release builds added
 - Cosmetics 

A    trunk/usr-full_perf.patch
M    trunk/iscsi-scst/README
A    trunk/iscsi-full_perf.patch
A    trunk/debug2perf
A    trunk/perf2debug
A    trunk/usr-release.patch
A    trunk/qla2x00t-full_perf.patch
A    trunk/iscsi-release.patch
A    trunk/scst-full_perf.patch
A    trunk/qla2x00t-release.patch
A    trunk/scst-release.patch
A    trunk/README
A    trunk/usr/fileio/README
A    trunk/debug2release
A    trunk/release2debug
M    trunk/scst/src/scst_lib.c
M    trunk/scst/src/scst_mem.c
M    trunk/scst/README
M    trunk/Makefile


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@194 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2007-09-25 09:30:12 +00:00
parent 154a4eda43
commit cc0a16b959
19 changed files with 390 additions and 37 deletions

View File

@@ -63,7 +63,7 @@ help:
@echo " usr_extraclean : usr target: clean + clean dependencies"
@echo " usr_install : usr target: install"
@echo " usr_uninstall : usr target: uninstall"
@echo ""
@echo " Note:"
@echo " - install and uninstall may need root privileges"

25
README Normal file
View File

@@ -0,0 +1,25 @@
This is the SCST development repository. It contains not a single
project SCST as one can think, but a number of them, which are divided
as the following:
1. SCST core in scst/ subdirectory
2. Target drivers in own subdirectories qla2x00t/, iscsi-scst/, etc.
3. User space programs in usr/ subdirectory, like fileio_tgt.
4. Some various docs in doc/ subdirectory.
Those subprojects are in most cases independent from each other,
although some of them depend from the SCST core. They put in the single
repository only to simplify their development, they are released
independently.
Thus, use "make all" only if you really need to build everything.
Otherwise build only what you need, like for iSCSI-SCST:
make scst scst_install iscsi iscsi_install
For more information about each subproject see their README files.
Vladislav Bolkhovitin <vst@vlnb.net>, http://scst.sourceforge.net

8
debug2perf Normal file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
echo "Changing current debug state from full debug to full performance"
patch -p0 <scst-full_perf.patch && \
patch -p0 <usr-full_perf.patch && \
patch -p0 <qla2x00t-full_perf.patch && \
patch -p0 <iscsi-full_perf.patch

8
debug2release Normal file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
echo "Changing current debug state from full debug to release"
patch -p0 <scst-release.patch && \
patch -p0 <usr-release.patch && \
patch -p0 <qla2x00t-release.patch && \
patch -p0 <iscsi-release.patch

16
iscsi-full_perf.patch Normal file
View File

@@ -0,0 +1,16 @@
Index: iscsi-scst/kernel/Makefile
===================================================================
--- iscsi-scst/kernel/Makefile (revision 324)
+++ iscsi-scst/kernel/Makefile (working copy)
@@ -26,9 +26,9 @@ SCST_INC_DIR := $(SUBDIRS)/../../scst/in
EXTRA_CFLAGS += -I$(src)/../include -I$(SCST_INC_DIR)
# -Wextra -Wno-unused-parameter
-EXTRA_CFLAGS += -DEXTRACHECKS
+#EXTRA_CFLAGS += -DEXTRACHECKS
#EXTRA_CFLAGS += -DTRACING
-EXTRA_CFLAGS += -DDEBUG -g
+#EXTRA_CFLAGS += -DDEBUG -g
#EXTRA_CFLAGS += -DDEBUG_DIGEST_FAILURES

17
iscsi-release.patch Normal file
View File

@@ -0,0 +1,17 @@
Index: iscsi-scst/kernel/Makefile
===================================================================
--- iscsi-scst/kernel/Makefile (revision 324)
+++ iscsi-scst/kernel/Makefile (working copy)
@@ -26,9 +26,9 @@ SCST_INC_DIR := $(SUBDIRS)/../../scst/in
EXTRA_CFLAGS += -I$(src)/../include -I$(SCST_INC_DIR)
# -Wextra -Wno-unused-parameter
-EXTRA_CFLAGS += -DEXTRACHECKS
-#EXTRA_CFLAGS += -DTRACING
-EXTRA_CFLAGS += -DDEBUG -g
+#EXTRA_CFLAGS += -DEXTRACHECKS
+EXTRA_CFLAGS += -DTRACING
+#EXTRA_CFLAGS += -DDEBUG -g
#EXTRA_CFLAGS += -DDEBUG_DIGEST_FAILURES

View File

@@ -35,34 +35,48 @@ above.
To use full power of TCP zero-copy transmit functions, especially
dealing with user space supplied via scst_user module memory, iSCSI-SCST
needs to be notified when Linux networking finished data transmission.
Patch put_page_callback.patch provides such functionality. The
corresponding version of it should be applied on your kernel. This is
highly recommended, but not required. If it isn't applied, iSCSI-SCST
will work in the performance degraded mode, when for data transmission:
Patch put_page_callback-<kernel-version>.patch provides such
functionality. The corresponding version of it should be applied on your
kernel. This is highly recommended, but not required. Basically, you
should consider using of this patch as some optimization, which IET
doesn't have, so if you don't use it, you will just revert to the
original IET behavior, when for data transmission:
- For in-kernel allocated memory (scst_vdisk and pass-through
handlers) usage of SGV cache on transmit path (READ-type commands)
will be disabled. The performance hit will be not big, performance
will be disabled. The performance hit will be not big, but performance
will still remain better, than for IET, because SGV cache will remain
used on receive path and IET doesn't have such feature.
- For user space allocated memory (scst_user handler) all transmitted
data will be additionally copied into temporary TCP buffers. The
performance hit will be quite noticiable.
If you need your own version of put_page_callback.patch for your custom
kernel, for which there is no prepared version, you can create it
yourself. For that it is only necessary:
performance hit will be quite noticeable.
1. Apply the closest version of put_page_callback.patch on your kernel.
Resolve only failed hanks from include/ and net/core/utils.c, ignore
other failures.
If you have error messages like:
2. Grep net/ and replace everywhere, except in net/sunrpc/svc.c and
net/core/pktgen.c, put_page() by net_put_page() and get_page() by
net_get_page().
iscsi-scst: ***ERROR*** net_priv isn't NULL and != ref_cmd
That's all.
with the corresponding kernel BUG dump, then put_page_callback patch you
use isn't sufficient for your kernel. This might be because the kernel
you use has some additional patches applied, which affect the
functionality, which put_page_callback patch provides. For example,
Fedora or Gentoo use kernels, which, although have version number like
2.6.18, are greatly differ from the "vanilla" kernel 2.6.18,
maintained by Linus Torvalds for that the put_page_callback patch was
created. In this case I would recommend you either:
- Search net/ in your kernel source for "put_page" and "get_page" functions.
If you find any in some place, except in net/sunrpc/svc.c and
net/core/pktgen.c, then, most likely, you found the reason of your
problem. Replace them by "net_put_page" and "net_get_page"
correspondingly and try again. If the problem is solved, then please
prepare a new put_page_callback patch and send it to the SCST mailing
list scst-devel@lists.sourceforge.net.
or
- Unapply this patch and use iSCSI-SCST without it. Also report this
problem to the SCST mailing list scst-devel@lists.sourceforge.net.
Usage
-----
@@ -71,9 +85,9 @@ ISCSI parameters like iSNS, CHAP and target parameters are configured in
iscsi-scstd.conf. All LUN information is configured using the regular
SCST interface. The LUN information in iscsi-scstd.conf will be ignored.
This is because now responsibilities are divided (as it should be)
between the target driver (iSCSI-SCST) and the SCST core. The target
driver is responsible for handling targets and their parameters, SCST
core is responsible for handling backstorage.
between the target driver (iSCSI-SCST) and the SCST core as it logically
should be: the target driver is responsible for handling targets and
their parameters, SCST core is responsible for handling backstorage.
If you need to configure different LUs for different targets you should
create for each target group "Default_target_name", where target name
@@ -98,6 +112,26 @@ in/out in the kernel's module Makefile:
- DEBUG_DIGEST_FAILURES - simulates digest failures in random places.
Creating version of put_page_callback patch for your kernel
-----------------------------------------------------------
If you need your own version of put_page_callback patch for your custom
kernel, for which there is no prepared version, you can create it
yourself. This is pretty mechanical work, you don't need to understand
how it works, you only need to do the following two steps:
1. Apply the closest version of put_page_callback-<kernel-version>.patch
on your kernel. Resolve only failed hanks from include/ and
net/core/utils.c, ignore other failures.
2. Search net/ in your kernel source for "put_page" and "get_page"
functions. Replace them by "net_put_page" and "net_get_page"
correspondingly.
That's all. Then please send your new
put_page_callback-<kernel-version>.patch to the SCST mailing list
scst-devel@lists.sourceforge.net.
Credits
-------

8
perf2debug Normal file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
echo "Changing current debug state from full performance to full debug"
patch -p0 -R <scst-full_perf.patch && \
patch -p0 -R <usr-full_perf.patch && \
patch -p0 -R <qla2x00t-full_perf.patch && \
patch -p0 -R <iscsi-full_perf.patch

17
qla2x00t-full_perf.patch Normal file
View File

@@ -0,0 +1,17 @@
Index: qla2x00t/qla2x00-target/Makefile
===================================================================
--- qla2x00t/qla2x00-target/Makefile (revision 324)
+++ qla2x00t/qla2x00-target/Makefile (working copy)
@@ -35,10 +35,10 @@ INSTALL_DIR := /lib/modules/$(shell unam
EXTRA_CFLAGS += -I$(SCST_INC_DIR) -DFC_TARGET_SUPPORT -Wextra -Wno-unused-parameter
-EXTRA_CFLAGS += -DEXTRACHECKS
+#EXTRA_CFLAGS += -DEXTRACHECKS
#EXTRA_CFLAGS += -DTRACING
-EXTRA_CFLAGS += -DDEBUG_TGT -g
+#EXTRA_CFLAGS += -DDEBUG_TGT -g
#EXTRA_CFLAGS += -DDEBUG_WORK_IN_THREAD
#EXTRA_CFLAGS += -DDEBUG_SRR

18
qla2x00t-release.patch Normal file
View File

@@ -0,0 +1,18 @@
Index: qla2x00t/qla2x00-target/Makefile
===================================================================
--- qla2x00t/qla2x00-target/Makefile (revision 324)
+++ qla2x00t/qla2x00-target/Makefile (working copy)
@@ -35,10 +35,10 @@ INSTALL_DIR := /lib/modules/$(shell unam
EXTRA_CFLAGS += -I$(SCST_INC_DIR) -DFC_TARGET_SUPPORT -Wextra -Wno-unused-parameter
-EXTRA_CFLAGS += -DEXTRACHECKS
-#EXTRA_CFLAGS += -DTRACING
+#EXTRA_CFLAGS += -DEXTRACHECKS
+EXTRA_CFLAGS += -DTRACING
-EXTRA_CFLAGS += -DDEBUG_TGT -g
+#EXTRA_CFLAGS += -DDEBUG_TGT -g
#EXTRA_CFLAGS += -DDEBUG_WORK_IN_THREAD
#EXTRA_CFLAGS += -DDEBUG_SRR

8
release2debug Normal file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
echo "Changing current debug state from release to full debug"
patch -p0 -R <scst-release.patch && \
patch -p0 -R <usr-release.patch && \
patch -p0 -R <qla2x00t-release.patch && \
patch -p0 -R <iscsi-release.patch

37
scst-full_perf.patch Normal file
View File

@@ -0,0 +1,37 @@
Index: scst/src/Makefile
===================================================================
--- scst/src/Makefile (revision 324)
+++ scst/src/Makefile (working copy)
@@ -114,13 +114,13 @@ EXTRA_CFLAGS += -I$(SCST_INC_DIR) -Wextr
#EXTRA_CFLAGS += -DSTRICT_SERIALIZING
-EXTRA_CFLAGS += -DEXTRACHECKS
+#EXTRA_CFLAGS += -DEXTRACHECKS
#EXTRA_CFLAGS += -fno-inline
#EXTRA_CFLAGS += -DTRACING
-EXTRA_CFLAGS += -DDEBUG -g
+#EXTRA_CFLAGS += -DDEBUG -g
#EXTRA_CFLAGS += -DDEBUG_TM -DTM_DBG_GO_OFFLINE=0
#EXTRA_CFLAGS += -DDEBUG_RETRY
#EXTRA_CFLAGS += -DDEBUG_OOM
Index: scst/src/dev_handlers/Makefile
===================================================================
--- scst/src/dev_handlers/Makefile (revision 324)
+++ scst/src/dev_handlers/Makefile (working copy)
@@ -68,10 +68,10 @@ endif
EXTRA_CFLAGS += -I$(SUBDIRS) -I$(SCST_INC_DIR) -Wextra -Wno-unused-parameter
-EXTRA_CFLAGS += -DEXTRACHECKS
+#EXTRA_CFLAGS += -DEXTRACHECKS
#EXTRA_CFLAGS += -DTRACING
-EXTRA_CFLAGS += -DDEBUG -g
+#EXTRA_CFLAGS += -DDEBUG -g
clean:
rm -f *.o *.ko .*.cmd *.mod.c .*.d .depend Modules.symvers Module.symvers

39
scst-release.patch Normal file
View File

@@ -0,0 +1,39 @@
Index: scst/src/Makefile
===================================================================
--- scst/src/Makefile (revision 324)
+++ scst/src/Makefile (working copy)
@@ -114,13 +114,13 @@ EXTRA_CFLAGS += -I$(SCST_INC_DIR) -Wextr
#EXTRA_CFLAGS += -DSTRICT_SERIALIZING
-EXTRA_CFLAGS += -DEXTRACHECKS
+#EXTRA_CFLAGS += -DEXTRACHECKS
#EXTRA_CFLAGS += -fno-inline
-#EXTRA_CFLAGS += -DTRACING
+EXTRA_CFLAGS += -DTRACING
-EXTRA_CFLAGS += -DDEBUG -g
+#EXTRA_CFLAGS += -DDEBUG -g
#EXTRA_CFLAGS += -DDEBUG_TM -DTM_DBG_GO_OFFLINE=0
#EXTRA_CFLAGS += -DDEBUG_RETRY
#EXTRA_CFLAGS += -DDEBUG_OOM
Index: scst/src/dev_handlers/Makefile
===================================================================
--- scst/src/dev_handlers/Makefile (revision 324)
+++ scst/src/dev_handlers/Makefile (working copy)
@@ -68,10 +68,10 @@ endif
EXTRA_CFLAGS += -I$(SUBDIRS) -I$(SCST_INC_DIR) -Wextra -Wno-unused-parameter
-EXTRA_CFLAGS += -DEXTRACHECKS
+#EXTRA_CFLAGS += -DEXTRACHECKS
-#EXTRA_CFLAGS += -DTRACING
-EXTRA_CFLAGS += -DDEBUG -g
+EXTRA_CFLAGS += -DTRACING
+#EXTRA_CFLAGS += -DDEBUG -g
clean:
rm -f *.o *.ko .*.cmd *.mod.c .*.d .depend Modules.symvers Module.symvers

View File

@@ -509,14 +509,13 @@ User space mode using scst_user dev handler
-------------------------------------------
User space program fileio_tgt uses interface of scst_user dev handler
and allows to see how it work in various modes. Fileio_tgt provides
mostly the same functionality as scst_vdisk handler with the only
exceptions that it has implemented O_DIRECT mode and doesn't support
BLOCKIO one. O_DIRECT mode is basically the same as BLOCKIO, but also
supports files, so for some loads it could be significantly faster, than
regular FILEIO access. All the words about BLOCKIO from above apply to
O_DIRECT as well. While running fileio_tgt if you don't understand some
its options, use defaults for them, those values are the fastest.
and allows to see how it works in various modes. Fileio_tgt provides
mostly the same functionality as scst_vdisk handler with the most
noticeable difference that it supports O_DIRECT mode. O_DIRECT mode is
basically the same as BLOCKIO, but also supports files, so for some
loads it could be significantly faster, than the regular FILEIO access.
All the words about BLOCKIO from above apply to O_DIRECT as well. See
fileio_tgt's README file for more details.
Performance
-----------
@@ -550,7 +549,10 @@ II. In order to get the maximum performance you should:
IMPORTANT: Some of the compilation options enabled by default, i.e. SCST
========= is optimized currently rather for development and bug hunting,
not for performance.
than for performance.
If you use SCST version taken directly from its SVN repository, you can
set the above options using debug2perf script file.
4. For kernel:

View File

@@ -90,8 +90,7 @@ void scst_set_busy(struct scst_cmd *cmd)
TRACE_ENTRY();
if ((c <= 1) || (cmd->sess->init_phase != SCST_SESS_IPH_READY))
{
if ((c <= 1) || (cmd->sess->init_phase != SCST_SESS_IPH_READY)) {
scst_set_cmd_error_status(cmd, SAM_STAT_BUSY);
TRACE_MGMT_DBG("Sending BUSY status to initiator %s "
"(cmds count %d, queue_type %x, sess->init_phase %d)",

View File

@@ -425,7 +425,7 @@ static int sgv_pool_cached_purge(struct sgv_pool_obj *e, int t,
return 1;
}
/* Called under pool_mgr_lock held, but drops/reaquire it inside */
/* Called under pool_mgr_lock held, but drops/reaquires it inside */
static int sgv_pool_oom_free_objs(int pgs)
{
TRACE_MEM("Shrinking pools about %d pages", pgs);
@@ -478,10 +478,11 @@ static int sgv_pool_hiwmk_check(int pages_to_alloc, int no_fail)
"memory for being executed commands "
"exceeds allowed maximum %dMB, "
"should you increase scst_max_cmd_mem "
"(requested %d pages)? (This message "
"will be shown only the first 100 "
"times)", sgv_pools_mgr.mgr.thr.hi_wmk >>
(20-PAGE_SHIFT), pages_to_alloc);
"(requested %d pages)? (This warning "
"will be shown only %d more times)",
sgv_pools_mgr.mgr.thr.hi_wmk >>
(20-PAGE_SHIFT), pages_to_alloc,
100-q);
}
sgv_pools_mgr.mgr.thr.releases_failed++;
res = -ENOMEM;

16
usr-full_perf.patch Normal file
View File

@@ -0,0 +1,16 @@
Index: usr/fileio/Makefile
===================================================================
--- usr/fileio/Makefile (revision 324)
+++ usr/fileio/Makefile (working copy)
@@ -28,9 +28,9 @@ CFLAGS += -O2 -Wall -Wextra -Wno-unused-
PROGS = fileio_tgt
LIBS = -lpthread
-CFLAGS += -DEXTRACHECKS
+#CFLAGS += -DEXTRACHECKS
#CFLAGS += -DTRACING
-CFLAGS += -DDEBUG -g
+#CFLAGS += -DDEBUG -g
#CFLAGS += -DDEBUG_NOMEM
#CFLAGS += -DDEBUG_SENSE

17
usr-release.patch Normal file
View File

@@ -0,0 +1,17 @@
Index: usr/fileio/Makefile
===================================================================
--- usr/fileio/Makefile (revision 324)
+++ usr/fileio/Makefile (working copy)
@@ -28,9 +28,9 @@ CFLAGS += -O2 -Wall -Wextra -Wno-unused-
PROGS = fileio_tgt
LIBS = -lpthread
-CFLAGS += -DEXTRACHECKS
-#CFLAGS += -DTRACING
-CFLAGS += -DDEBUG -g
+#CFLAGS += -DEXTRACHECKS
+CFLAGS += -DTRACING
+#CFLAGS += -DDEBUG -g
#CFLAGS += -DDEBUG_NOMEM
#CFLAGS += -DDEBUG_SENSE

83
usr/fileio/README Normal file
View File

@@ -0,0 +1,83 @@
User space FILEIO handler
=========================
Version 0.9.6, XX XXX 200X
--------------------------
User space program fileio_tgt uses interface of SCST's scst_user dev
handler as well as allows to see how it works in various modes.
Fileio_tgt provides mostly the same functionality as the kernel space
SCST's scst_vdisk handler with the only exceptions that it supports
O_DIRECT mode and doesn't support BLOCKIO one. O_DIRECT mode is
basically the same as BLOCKIO, but also supports files, so for some
loads it could be significantly faster, than the regular FILEIO access.
All the words about BLOCKIO mode from SCST's README file apply to
O_DIRECT mode as well.
Installation
------------
Make sure you have installed SCST core, if not, see its README file for
details how to do it.
Then run "make all install"
For the best performance make sure you don't have any debug options
(i.e. lines like "CFLAGS += -DDEBUG" containing "-DDEBUG*" string)
enabled in the Makefile.
Usage
-----
Load scst_user module using modprobe or insmod, then start fileio_tgt
program. It can be used as the following:
fileio_tgt [OPTION] name path
Where:
- OPTION - one or several not required options, see below.
- name - name of the virtual device as it will be seen by SCST and used
in the subsequent access management using the corresponding SCST interface.
- path - path to the device file.
The following options are supported:
-b or --block=size: block size, must be power of 2 and >=512
-e or --threads=count: number of threads
-t or --write_through: write through mode
-r or --read_only: read only
-o or --direct: O_DIRECT mode, see above for details
-n or --nullio: NULLIO mode, see SCST's README file for details
-c or --nv_cache: NV_CACHE mode, see SCST's README file for details
-p or --parse=type: parse type, one of "std" (default), "call" or "excpt"
-f or --on_free=type: on free call type, one of "ignore" (default) or "call"
-m or --mem_reuse=type: Memory reuse type, one of "all" (default), "read",
"write" or "none"
-s or --prio_thread: Use separate thread for mgmt (prio) commands
-l or --non_blocking: Use non-blocking operations
Also in the debug builds the following options are supported:
-d or --debug=level: debug tracing level
-g or --debug_tm_ignore: turn on DEBUG_TM_IGNORE, one of the task management
debugging features
If you don't understand some these options, don't use them, default
values provide the best performance.
Vladislav Bolkhovitin <vst@vlnb.net>, http://scst.sourceforge.net