From 618897d1aff290cd2e0bcc2507774be896622d94 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Tue, 28 Jun 2011 01:13:44 +0000 Subject: [PATCH] Merged revisions 3635 via svnmerge from https://vlnb@scst.svn.sourceforge.net/svnroot/scst/trunk ........ r3635 | vlnb | 2011-06-27 21:08:31 -0400 (Mon, 27 Jun 2011) | 5 lines - Added CPU barriers around io_context_ready manipulations - Docs updates - Cleanups ........ git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.1.0.x@3636 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/README | 22 ++++++++++++++++++---- scst/README_in-tree | 22 ++++++++++++++++++---- scst/src/scst_lib.c | 4 ++-- scst/src/scst_main.c | 1 + scst/src/scst_targ.c | 1 + 5 files changed, 40 insertions(+), 10 deletions(-) diff --git a/scst/README b/scst/README index 5cfc4bbc9..7f35d0eca 100644 --- a/scst/README +++ b/scst/README @@ -277,6 +277,8 @@ in/out in Makefile: kernel log and your initiator returns an error. Also report those messages in the SCST mailing list scst-devel@lists.sourceforge.net. Note, that not all SCSI transports support supplying expected values. + You should try to enable this option if you have a not working with + SCST pass-through device, for instance, an SATA CDROM. - CONFIG_SCST_DEBUG_TM - if defined, turns on task management functions debugging, when on LUN 6 some of the commands will be delayed for @@ -383,6 +385,22 @@ had a major change, which made it heavily incompatible with pre-2.6.26 version. If you need pre-2.6.26 kernel, you need to use obsolete procfs interface (see below). +SCST sysfs interface designed to be self descriptive and self +containing. This means that a high level managament tool for it can be +written once and automatically support any future sysfs interface +changes (attributes additions or removals, new target drivers and dev +handlers, etc.) without any modifications. Scstadmin is an example of +such management tool. + +To implement that an management tool should not be implemented around +drivers and their attributes, but around common rules those drivers and +attributes follow. You can find those rules in SysfsRules file. For +instance, each SCST sysfs file (attribute) can contain in the last line +mark "[key]". It is automatically added to allow scstadmin and other +management tools to see which attributes it should save in the config +file. If you are doing manual attributes manipulations, you can ignore +this mark. + Root of SCST sysfs interface is /sys/kernel/scst_tgt. It has the following entries: @@ -432,10 +450,6 @@ following entries: completed, it will return the result of this operation (0 for success or -errno for error). -Each SCST sysfs file (attribute) can contain in the last line mark -"[key]". It is automatically added mark used to allow scstadmin to see -which attributes it should save in the config file. You can ignore it. - "Devices" subdirectory contains subdirectories for each SCST devices. Content of each device's subdirectory is dev handler specific. See diff --git a/scst/README_in-tree b/scst/README_in-tree index 38fe9a880..5b3ffed17 100644 --- a/scst/README_in-tree +++ b/scst/README_in-tree @@ -171,6 +171,8 @@ your favorite kernel configuration Makefile target, e.g. "make xconfig": kernel log and your initiator returns an error. Also report those messages in the SCST mailing list scst-devel@lists.sourceforge.net. Note, that not all SCSI transports support supplying expected values. + You should try to enable this option if you have a not working with + SCST pass-through device, for instance, an SATA CDROM. - CONFIG_SCST_DEBUG_TM - if defined, turns on task management functions debugging, when on LUN 6 some of the commands will be delayed for @@ -251,6 +253,22 @@ Module scst supports the following parameters: SCST sysfs interface -------------------- +SCST sysfs interface designed to be self descriptive and self +containing. This means that a high level managament tool for it can be +written once and automatically support any future sysfs interface +changes (attributes additions or removals, new target drivers and dev +handlers, etc.) without any modifications. Scstadmin is an example of +such management tool. + +To implement that an management tool should not be implemented around +drivers and their attributes, but around common rules those drivers and +attributes follow. You can find those rules in SysfsRules file. For +instance, each SCST sysfs file (attribute) can contain in the last line +mark "[key]". It is automatically added to allow scstadmin and other +management tools to see which attributes it should save in the config +file. If you are doing manual attributes manipulations, you can ignore +this mark. + Root of SCST sysfs interface is /sys/kernel/scst_tgt. It has the following entries: @@ -300,10 +318,6 @@ following entries: completed, it will return the result of this operation (0 for success or -errno for error). -Each SCST sysfs file (attribute) can contain in the last line mark -"[key]". It is automatically added mark used to allow scstadmin to see -which attributes it should save in the config file. You can ignore it. - "Devices" subdirectory contains subdirectories for each SCST devices. Content of each device's subdirectory is dev handler specific. See diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index ec37ae943..105ee853d 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -2018,7 +2018,7 @@ void scst_zero_write_rest(struct scst_cmd *cmd) TRACE_ENTRY(); len = scst_get_sg_buf_first(cmd, &buf, *cmd->write_sg, - *cmd->write_sg_cnt); + *cmd->write_sg_cnt); while (len > 0) { int cur_offs; @@ -3077,9 +3077,9 @@ found: TRACE_MGMT_DBG("IO context for t %p not yet " "initialized, waiting...", t); msleep(100); - barrier(); goto found; } + smp_rmb(); TRACE_MGMT_DBG("Going to share IO context %p (res %p, ini %s, " "dev %s, cmd_threads %p, grouping type %d)", res->active_cmd_threads->io_context, res, diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index b85e00328..113cb47df 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -1668,6 +1668,7 @@ out_wait: "initialized", cmd_threads); msleep(50); } + smp_rmb(); } if (res != 0) diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index d53960493..499aa8986 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -4328,6 +4328,7 @@ int scst_cmd_thread(void *arg) mutex_unlock(&p_cmd_threads->io_context_mutex); #endif + smp_wmb(); p_cmd_threads->io_context_ready = true; spin_lock_irq(&p_cmd_threads->cmd_list_lock);