RE: MPT Fusion LSI22320 , Domain validation loops .

2007-03-20 Thread Mr. James W. Laferriere
	Hello Eric ,  Fyi ,  linux-2.6.21-rc4 + mpt-fusion(*) patches from 
Andrew Morton's patch tree .  Still gives me the ever looping reset .  But I 
have just found sometrhing of interest one of the Powersuplies in the cabiinet 
'May be' failing .  I have to test that to be satisfied that is the case .
	I'll report back soon on the PS & please look into this .  There is no 
reason for the driver to keep a system in loop over a failing drive set .

Tia ,  JimL

(*)
ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.21-rc4/2.6.21-rc4-mm1/broken-out/mpt-fusion-handle-pci-layer-error-on-resume.patch
ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.21-rc4/2.6.21-rc4-mm1/broken-out/mpt-fusion-handle-mpt_resume-failure-while-resuming.patch

On Mon, 19 Mar 2007, Moore, Eric wrote:

On Saturday, March 17, 2007 2:33 PM,  James W. Laferriere wrote:

Hello All ,  I am have been having this problem since I
purchased the
controller and after changing out the disks I thought were
the problem .
I am still getting the continous :

mptscsih: ioc1: attempting task abort! (sc=f7a64500)
scsi 3:0:4:0:
 command: Inquiry: 12 00 00 00 60 00
mptbase: Initiating ioc1 recovery
mptscsih: ioc1: task abort: SUCCESS (sc=f7a64500)
  target3:0:4: Domain Validation detected failure, dropping back
  target3:0:4: Domain Validation skipping write tests
  target3:0:4: Ending Domain Validation
  target3:0:4: asynchronous
  target3:0:5: Beginning Domain Validation
mptscsih: ioc0: attempting target reset! (sc=f7a64380)

The acutual device id's change and the driver
continously resets the
busses & starts all over .

The disks are in a HP DS-SL13R-BA 4354R 14drive ultra3
racKmount cabinet
w/ dualbus & dualps ,  Which seems to present a ID6 ,  That
does not show up in
any of the bus scans .

Now I have previously had the same cabinet with 18gb
disks which had the
same problem with this controller .  BUT I also have a LSI
Logic / Symbios
Logic 53c1010 66MHz Ultra3 dual SCSI bus Adapter which works
flawlessly with the
18gb disks in this very same cabinet .
The cables for connecting the adapter(s) to tha cabinet
are less than 24
inches in length .

Would anyone please shed some light on what it is I am
doing wrong or
need to do or ?  Too have this controller recognise these
disk drives in
this cabinet .


There is a seperate mailing list for scsi releated issues, e.g.
[EMAIL PROTECTED]   I've posted a patch to address your issue several times,
however it seems its not been picked up by the scsi subsystem
maintainer.   The last time it was posted was here:
http://marc.info/?l=linux-scsi&m=117089244809072&w=2   An alternative is
you could obtain our latest drivers from the LSI download site, where
these drivers should have this patch
http://www.lsilogic.com/cm/DownloadSearch.do.

Eric




--
+-+
| James   W.   Laferriere | System   Techniques | Give me VMS |
| NetworkEngineer | 663  Beaumont  Blvd |  Give me Linux  |
| [EMAIL PROTECTED] | Pacifica, CA. 94044 |   only  on  AXP |
+-+
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH scsi-misc-2.6] SCSI: kill sht->suspend/resume

2007-03-20 Thread Tejun Heo
With libata converted to use sdev->manage_start_stop for suspend and
resume, sht->suspend/resume() has no user left and low level
suspend/ressume should be taken care of by low level driver's
suspend/resume callbacks (e.g. PCI or PCMCIA driver callbacks).  This
patch removes sht->suspend/resume() callbacks.

This change is suggested by Christoph Hellwig.

Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>
Cc: Christoph Hellwig <[EMAIL PROTECTED]>
---
This patch breaks the existing libata suspend/resume support and thus
should not be applied before libata is updated.  So, please don't
apply it yet.

Thanks.

diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 96db51c..ec64aff 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -280,30 +280,18 @@ static int scsi_bus_suspend(struct device * dev, 
pm_message_t state)
 {
struct device_driver *drv = dev->driver;
struct scsi_device *sdev = to_scsi_device(dev);
-   struct scsi_host_template *sht = sdev->host->hostt;
int err;
 
err = scsi_device_quiesce(sdev);
if (err)
return err;
 
-   /* call HLD suspend first */
if (drv && drv->suspend) {
err = drv->suspend(dev, state);
if (err)
return err;
}
 
-   /* then, call host suspend */
-   if (sht->suspend) {
-   err = sht->suspend(sdev, state);
-   if (err) {
-   if (drv && drv->resume)
-   drv->resume(dev);
-   return err;
-   }
-   }
-
return 0;
 }
 
@@ -311,21 +299,14 @@ static int scsi_bus_resume(struct device * dev)
 {
struct device_driver *drv = dev->driver;
struct scsi_device *sdev = to_scsi_device(dev);
-   struct scsi_host_template *sht = sdev->host->hostt;
-   int err = 0, err2 = 0;
-
-   /* call host resume first */
-   if (sht->resume)
-   err = sht->resume(sdev);
+   int err = 0;
 
-   /* then, call HLD resume */
if (drv && drv->resume)
-   err2 = drv->resume(dev);
+   err = drv->resume(dev);
 
scsi_device_resume(sdev);
 
-   /* favor LLD failure */
-   return err ? err : err2;;
+   return err;
 }
 
 struct bus_type scsi_bus_type = {
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 68f461b..4a2e490 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -339,12 +339,6 @@ struct scsi_host_template {
enum scsi_eh_timer_return (* eh_timed_out)(struct scsi_cmnd *);
 
/*
-* suspend support
-*/
-   int (*resume)(struct scsi_device *);
-   int (*suspend)(struct scsi_device *, pm_message_t state);
-
-   /*
 * Name of proc directory
 */
char *proc_name;

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] sd: implement START/STOP management

2007-03-20 Thread Tejun Heo
James Bottomley wrote:
> On Wed, 2007-03-21 at 02:08 +0900, Tejun Heo wrote:
>> I got too comfortable with libata-dev#upstream and forgot to verify
>> patches against scsi-misc-2.6.  Sorry about that.  If you don't have
>> objection against the content, I'll resubmit the SCSI part against
>> scsi-misc-2.6.  Once it's in scsi-misc-2.6, we can pull it into
>> libata-dev#upstream and do the libata part there.  As the SCSI change
>> doesn't break libata, they can be done separately.
> 
> I should already have it in scsi-misc-2.6 ... you could verify I got the
> merge right ...
> 
> There'll be an additional piece to put the new sd_printk helpers into
> the routines, which I attach below.

Yeap, everything looks fine.  Thanks.

-- 
tejun
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] sd: implement START/STOP management

2007-03-20 Thread Tejun Heo
Hello, Douglas.

Douglas Gilbert wrote:
> Tejun,
> I note at this point that the IMMED bit in the
> START STOP UNIT cdb is clear. [The code might
> note that as well.] All SCSI disks that I have
> seen, implement the IMMED bit and according to
> the SAT standard, so should SAT layers like the
> one in libata.
> 
> With the IMMED bit clear:
>   - on spin up, it will wait until disk is ready.
> Okay unless there are a lot of disks, in
> which case we could ask Matthew Wilcox for help
>   - on spin down, will wait until media is
> stopped. That could be 20 seconds, and if there
> were multiple disks 
> 
> I guess the question is do we need to wait until a
> disk is spun down before dropping power to it
> and suspending.

I think we do.  As we're issuing SYNCHRONIZE CACHE prior to spinning
down disks, it's probably okay to drop power early data-integrity-wise
but still...

We can definitely use IMMED=1 during resume (needs to be throttled
somehow tho).  This helps even when there is only one disk.  We can let
the disk spin up in the background and proceed with the rest of resuming
process.  Unfortunately, libata SAT layer doesn't do IMMED and even if
it does (I've tried and have a patch available) it doesn't really work
because during host resume each port enters EH and resets and
revalidates each device.  Many if not most ATA harddisks don't respond
to reset or IDENTIFY till it's fully spun up meaning libata EH has to
wait for all drives to spin up.  libata EH runs inside SCSI EH thread
meaning SCSI comman issue blocks till libata EH finishes resetting the
port.  So, IMMED or not, sd gotta wait for libata disks.

If we want to do parallel spin down, PM core needs to be updated such
that there are two events - issue and done - somewhat similar to what
SCSI is doing to probe devices parallelly.  If we're gonna do that, we
maybe can apply the same mechanism to resume path so that we can do
things parallelly IMMED or not.

Thanks.

-- 
tejun
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 2.6.21-rc4-git] SCSI newstyle hotplug/coldplug support

2007-03-20 Thread David Brownell
This teaches scsi devices how to support "new style" hotplug/coldplug:
using a modalias sysfs attribute for coldplug, and MODALIAS environment
variable for hotplug.

It also updates the CH, SD, SR, and ST drivers with the aliases needed to
drive them by that mechanism.  (Older OnStream devices use OSST not ST;
left for someone else to sort out.  SG seems best loaded by KMOD.)

Using this, I've seen pure new-style hotplugging drive the loading of all
the relevant driver modules for usb storage devices:  host controller,
usb-storage, scsi core, sd_mod.  Previously, sd_mod never loaded.  (Except
when using the obsolete old-style hotplug scripts ... which are unusable
on ~100 BogoMIPS embedded systems that only run busybox, but may have no
options for lots of external storage other than USB.)  Yep, this is a LOT
faster too.

Signed-off-by: David Brownell <[EMAIL PROTECTED]>
---
 drivers/scsi/ch.c |1 +
 drivers/scsi/scsi_sysfs.c |   24 
 drivers/scsi/sd.c |4 
 drivers/scsi/sr.c |2 ++
 drivers/scsi/st.c |1 +
 5 files changed, 32 insertions(+)

--- g26.orig/drivers/scsi/scsi_sysfs.c  2007-03-16 12:54:22.0 -0700
+++ g26/drivers/scsi/scsi_sysfs.c   2007-03-20 17:27:07.0 -0700
@@ -276,6 +276,18 @@ static int scsi_bus_match(struct device 
return (sdp->inq_periph_qual == SCSI_INQ_PQ_CON)? 1: 0;
 }
 
+/* for hotplug support: modprobe $MODALIAS */
+static int scsi_uevent(struct device *dev, char **envp, int num_envp,
+   char *buffer, int buffer_size)
+{
+   struct scsi_device *sdp = to_scsi_device(dev);
+
+   envp[0] = buffer;
+   snprintf(buffer, buffer_size, "MODALIAS=scsi:type-%02x", (u8)sdp->type);
+   envp[1] = NULL;
+   return 0;
+}
+
 static int scsi_bus_suspend(struct device * dev, pm_message_t state)
 {
struct scsi_device *sdev = to_scsi_device(dev);
@@ -308,6 +320,7 @@ static int scsi_bus_resume(struct device
 struct bus_type scsi_bus_type = {
 .name  = "scsi",
 .match = scsi_bus_match,
+   .uevent = scsi_uevent,
.suspend= scsi_bus_suspend,
.resume = scsi_bus_resume,
 };
@@ -547,6 +560,16 @@ show_sdev_iostat(iorequest_cnt);
 show_sdev_iostat(iodone_cnt);
 show_sdev_iostat(ioerr_cnt);
 
+/* for coldplug support: modprobe $(cat .../modalias) */
+static ssize_t
+show_modalias(struct device *dev, struct device_attribute *attr, char *buf)
+{
+   struct scsi_device *sdev = to_scsi_device(dev);
+
+   return snprintf(buf, 20, "scsi:type-%02x\n", (u8)sdev->type);
+}
+static DEVICE_ATTR(modalias, S_IRUGO, show_modalias, NULL);
+
 
 /* Default template for device attributes.  May NOT be modified */
 static struct device_attribute *scsi_sysfs_sdev_attrs[] = {
@@ -566,6 +589,7 @@ static struct device_attribute *scsi_sys
&dev_attr_iorequest_cnt,
&dev_attr_iodone_cnt,
&dev_attr_ioerr_cnt,
+   &dev_attr_modalias,
NULL
 };
 
--- g26.orig/drivers/scsi/sd.c  2007-02-19 13:43:00.0 -0800
+++ g26/drivers/scsi/sd.c   2007-03-20 17:27:07.0 -0700
@@ -89,6 +89,10 @@ MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK13_
 MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK14_MAJOR);
 MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK15_MAJOR);
 
+MODULE_ALIAS("scsi:type-00");  /* TYPE_DISK */
+MODULE_ALIAS("scsi:type-07");  /* TYPE_MOD */
+MODULE_ALIAS("scsi:type-0e");  /* TYPE_RBC */
+
 /*
  * This is limited by the naming scheme enforced in sd_probe,
  * add another character to it if you really need more disks.
--- g26.orig/drivers/scsi/sr.c  2007-02-15 18:17:21.0 -0800
+++ g26/drivers/scsi/sr.c   2007-03-20 17:27:07.0 -0700
@@ -62,6 +62,8 @@
 MODULE_DESCRIPTION("SCSI cdrom (sr) driver");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_CDROM_MAJOR);
+MODULE_ALIAS("scsi:type-04");  /* TYPE_WORM */
+MODULE_ALIAS("scsi:type-05");  /* TYPE_ROM */
 
 #define SR_DISKS   256
 
--- g26.orig/drivers/scsi/st.c  2007-02-19 22:14:16.0 -0800
+++ g26/drivers/scsi/st.c   2007-03-20 17:27:07.0 -0700
@@ -89,6 +89,7 @@ MODULE_AUTHOR("Kai Makisara");
 MODULE_DESCRIPTION("SCSI tape (st) driver");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS_CHARDEV_MAJOR(SCSI_TAPE_MAJOR);
+MODULE_ALIAS("scsi:type-01");  /* TYPE_TAPE */
 
 /* Set 'perm' (4th argument) to 0 to disable module_param's definition
  * of sysfs parameters (which module_param doesn't yet support).
--- g26.orig/drivers/scsi/ch.c  2007-02-15 18:17:21.0 -0800
+++ g26/drivers/scsi/ch.c   2007-03-20 17:27:07.0 -0700
@@ -38,6 +38,7 @@ MODULE_DESCRIPTION("device driver for sc
 MODULE_AUTHOR("Gerd Knorr <[EMAIL PROTECTED]>");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS_CHARDEV_MAJOR(SCSI_CHANGER_MAJOR);
+MODULE_ALIAS("scsi:type-08");  /* TYPE_MEDIUM_CHANGER */
 
 static int init = 1;
 module_param(init, int, 0444);
-
To unsubscribe from this list: 

Re: [PATCH] correct SCSI_WAIT_SCAN selection for non-modular SCSI_SCAN_ASYNC builds.

2007-03-20 Thread Andrew Vasquez
On Tue, 20 Mar 2007, James Bottomley wrote:

> On Tue, 2007-03-20 at 14:32 -0500, James Bottomley wrote:
> > Is MODULE set to 'n'?  It looks like the symbol export is guarded by
> > #ifdef MODULE for some reason ... other than that, I can't explain this.
> 
> In fact, that's the bug ... the modular config is MODULES not MODULE.
> Can you try this:

Ahh, that makes sense.  Your patch fixes the mis-compilation.

Thanks,
Andrew Vasquez
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] correct SCSI_WAIT_SCAN selection for non-modular SCSI_SCAN_ASYNC builds.

2007-03-20 Thread James Bottomley
On Tue, 2007-03-20 at 14:32 -0500, James Bottomley wrote:
> Is MODULE set to 'n'?  It looks like the symbol export is guarded by
> #ifdef MODULE for some reason ... other than that, I can't explain this.

In fact, that's the bug ... the modular config is MODULES not MODULE.
Can you try this:

James

---
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 0949145..a67f315 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -181,10 +181,8 @@ int scsi_complete_async_scans(void)
return 0;
 }
 
-#ifdef MODULE
 /* Only exported for the benefit of scsi_wait_scan */
 EXPORT_SYMBOL_GPL(scsi_complete_async_scans);
-#endif
 
 /**
  * scsi_unlock_floptical - unlock device via a special MODE SENSE command


-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] correct SCSI_WAIT_SCAN selection for non-modular SCSI_SCAN_ASYNC builds.

2007-03-20 Thread Andrew Vasquez
On Tue, 20 Mar 2007, James Bottomley wrote:

> On Tue, 2007-03-20 at 12:19 -0700, Andrew Vasquez wrote:
> > SCSI_SCAN_ASYNC was compiled non-modularly before merging the latest
> > scsi-misc-2.6.git tree.  After the merge, and a rebuild of the kernel,
> > was getting 'unknown symbol' failures during link as SCSI_WAIT_SCAN
> > was now forced to be built as a module.  'select'ion of SCSI_WAIT_SCAN
> > based on SCSI_SCAN_SYNC (a consumer) appeared to be the most natural
> > way to address the problem.
> 
> There's something else going on here.  The only piece of code in the
> entire tree that depends on SCSI_SCAN_ASYNC is this one (in
> scsi_scan.c):
> 
> #ifdef CONFIG_SCSI_SCAN_ASYNC
> #define SCSI_SCAN_TYPE_DEFAULT "async"
> #else
> #define SCSI_SCAN_TYPE_DEFAULT "sync"
> #endif
> 
> There should be no way that setting this parameter to Y or N can have
> the effects you describe ... could you debug a bit further?
> 
> Is MODULE set to 'n'?  It looks like the symbol export is guarded by
> #ifdef MODULE for some reason ... other than that, I can't explain this.

Here's a snippet of the build process with the attached .config:

...
WARNING: "scsi_complete_async_scans" [drivers/scsi/scsi_wait_scan.ko] 
undefined!
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2

Perhaps I'm papering over-something with the explicit 'select'.

...
CONFIG_SCSI_MULTI_LUN=y
CONFIG_SCSI_CONSTANTS=y
CONFIG_SCSI_LOGGING=y
CONFIG_SCSI_SCAN_ASYNC=y
CONFIG_SCSI_WAIT_SCAN=m
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.21-rc4
# Tue Mar 20 11:31:34 2007
#
CONFIG_X86_64=y
CONFIG_64BIT=y
CONFIG_X86=y
CONFIG_GENERIC_TIME=y
CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_ZONE_DMA32=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_SEMAPHORE_SLEEPERS=y
CONFIG_MMU=y
CONFIG_ZONE_DMA=y
CONFIG_RWSEM_GENERIC_SPINLOCK=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_X86_CMPXCHG=y
CONFIG_EARLY_PRINTK=y
CONFIG_GENERIC_ISA_DMA=y
CONFIG_GENERIC_IOMAP=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_ARCH_POPULATES_NODE_MAP=y
CONFIG_DMI=y
CONFIG_AUDIT_ARCH=y
CONFIG_GENERIC_BUG=y
# CONFIG_ARCH_HAS_ILOG2_U32 is not set
# CONFIG_ARCH_HAS_ILOG2_U64 is not set
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"

#
# Code maturity level options
#
CONFIG_EXPERIMENTAL=y
CONFIG_LOCK_KERNEL=y
CONFIG_INIT_ENV_ARG_LIMIT=32

#
# General setup
#
CONFIG_LOCALVERSION=""
# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
# CONFIG_IPC_NS is not set
CONFIG_SYSVIPC_SYSCTL=y
# CONFIG_POSIX_MQUEUE is not set
# CONFIG_BSD_PROCESS_ACCT is not set
# CONFIG_TASKSTATS is not set
# CONFIG_UTS_NS is not set
# CONFIG_AUDIT is not set
# CONFIG_IKCONFIG is not set
# CONFIG_CPUSETS is not set
CONFIG_SYSFS_DEPRECATED=y
# CONFIG_RELAY is not set
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
CONFIG_SYSCTL=y
# CONFIG_EMBEDDED is not set
CONFIG_SYSCTL_SYSCALL=y
CONFIG_KALLSYMS=y
# CONFIG_KALLSYMS_ALL is not set
# CONFIG_KALLSYMS_EXTRA_PASS is not set
CONFIG_HOTPLUG=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_ELF_CORE=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
CONFIG_EPOLL=y
CONFIG_SHMEM=y
CONFIG_SLAB=y
CONFIG_VM_EVENT_COUNTERS=y
CONFIG_RT_MUTEXES=y
# CONFIG_TINY_SHMEM is not set
CONFIG_BASE_SMALL=0
# CONFIG_SLOB is not set

#
# Loadable module support
#
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_FORCE_UNLOAD=y
CONFIG_MODVERSIONS=y
# CONFIG_MODULE_SRCVERSION_ALL is not set
# CONFIG_KMOD is not set
CONFIG_STOP_MACHINE=y

#
# Block layer
#
CONFIG_BLOCK=y
# CONFIG_BLK_DEV_IO_TRACE is not set

#
# IO Schedulers
#
CONFIG_IOSCHED_NOOP=y
CONFIG_IOSCHED_AS=y
CONFIG_IOSCHED_DEADLINE=y
CONFIG_IOSCHED_CFQ=y
CONFIG_DEFAULT_AS=y
# CONFIG_DEFAULT_DEADLINE is not set
# CONFIG_DEFAULT_CFQ is not set
# CONFIG_DEFAULT_NOOP is not set
CONFIG_DEFAULT_IOSCHED="anticipatory"

#
# Processor type and features
#
CONFIG_X86_PC=y
# CONFIG_X86_VSMP is not set
CONFIG_MK8=y
# CONFIG_MPSC is not set
# CONFIG_MCORE2 is not set
# CONFIG_GENERIC_CPU is not set
CONFIG_X86_L1_CACHE_BYTES=64
CONFIG_X86_L1_CACHE_SHIFT=6
CONFIG_X86_INTERNODE_CACHE_BYTES=64
CONFIG_X86_TSC=y
CONFIG_X86_GOOD_APIC=y
# CONFIG_MICROCODE is not set
# CONFIG_X86_MSR is not set
# CONFIG_X86_CPUID is not set
CONFIG_X86_IO_APIC=y
CONFIG_X86_LOCAL_APIC=y
CONFIG_MTRR=y
CONFIG_SMP=y
# CONFIG_SCHED_SMT is not set
# CONFIG_SCHED_MC is not set
CONFIG_PREEMPT_NONE=y
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT is not set
CONFIG_PREEMPT_BKL=y
# CONFIG_NUMA is not set
CONFIG_ARCH_SPARSEMEM_ENABLE=y
CONFIG_ARCH_FLATMEM_ENABLE=y
CONFIG_SELECT_MEMORY_MODEL=y
CONFIG_FLATMEM_MANUAL=y
# CONFIG_DISCONTIGMEM_MANUAL is not set
# CONFIG_SPARSEMEM_MANUAL is not set
CONFIG_FLATMEM=y
CONFIG_FLAT_NODE_MEM_MAP=y
# CONFIG_SPARSEMEM_STATIC is not set
CONFIG_SPLIT_PTLOCK_CPUS=4
CONFIG_RESOURCES_64BIT=y
CONFIG_ZONE_DMA_FLAG=1
CONFIG_NR_CPUS=4
# CONFIG_HOTPLUG_CPU is not set
C

Re: [PATCH] correct SCSI_WAIT_SCAN selection for non-modular SCSI_SCAN_ASYNC builds.

2007-03-20 Thread James Bottomley
On Tue, 2007-03-20 at 12:19 -0700, Andrew Vasquez wrote:
> SCSI_SCAN_ASYNC was compiled non-modularly before merging the latest
> scsi-misc-2.6.git tree.  After the merge, and a rebuild of the kernel,
> was getting 'unknown symbol' failures during link as SCSI_WAIT_SCAN
> was now forced to be built as a module.  'select'ion of SCSI_WAIT_SCAN
> based on SCSI_SCAN_SYNC (a consumer) appeared to be the most natural
> way to address the problem.

There's something else going on here.  The only piece of code in the
entire tree that depends on SCSI_SCAN_ASYNC is this one (in
scsi_scan.c):

#ifdef CONFIG_SCSI_SCAN_ASYNC
#define SCSI_SCAN_TYPE_DEFAULT "async"
#else
#define SCSI_SCAN_TYPE_DEFAULT "sync"
#endif

There should be no way that setting this parameter to Y or N can have
the effects you describe ... could you debug a bit further?

Is MODULE set to 'n'?  It looks like the symbol export is guarded by
#ifdef MODULE for some reason ... other than that, I can't explain this.

Thanks,

James


-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] correct SCSI_WAIT_SCAN selection for non-modular SCSI_SCAN_ASYNC builds.

2007-03-20 Thread Andrew Vasquez
On Tue, 20 Mar 2007, James Bottomley wrote:

> On Tue, 2007-03-20 at 11:56 -0700, Andrew Vasquez wrote:
> > Commit 840c2835a1c867281d27158378a9d34f593a7664 ([SCSI] make
> > scsi_wait_scan always modular) broke configurations where
> > SCSI_SCAN_ASYNC is selected for non-modular builds.
> > 
> > Signed-off-by: Andrew Vasquez <[EMAIL PROTECTED]>
> > ---
> > 
> > diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
> > index f3bc0f4..eb25abe 100644
> > --- a/drivers/scsi/Kconfig
> > +++ b/drivers/scsi/Kconfig
> > @@ -226,6 +226,7 @@ config SCSI_LOGGING
> >  config SCSI_SCAN_ASYNC
> > bool "Asynchronous SCSI scanning"
> > depends on SCSI
> > +   select SCSI_WAIT_SCAN
> 
> This can't really be right.  Async scan is always compiled in, so the
> module is always required ... this parameter just determines what the
> boot time default is, but it can be overridden by the kernel command
> line.
> 
> What's the actual problem you're trying to fix?

SCSI_SCAN_ASYNC was compiled non-modularly before merging the latest
scsi-misc-2.6.git tree.  After the merge, and a rebuild of the kernel,
was getting 'unknown symbol' failures during link as SCSI_WAIT_SCAN
was now forced to be built as a module.  'select'ion of SCSI_WAIT_SCAN
based on SCSI_SCAN_SYNC (a consumer) appeared to be the most natural
way to address the problem.
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] correct SCSI_WAIT_SCAN selection for non-modular SCSI_SCAN_ASYNC builds.

2007-03-20 Thread James Bottomley
On Tue, 2007-03-20 at 11:56 -0700, Andrew Vasquez wrote:
> Commit 840c2835a1c867281d27158378a9d34f593a7664 ([SCSI] make
> scsi_wait_scan always modular) broke configurations where
> SCSI_SCAN_ASYNC is selected for non-modular builds.
> 
> Signed-off-by: Andrew Vasquez <[EMAIL PROTECTED]>
> ---
> 
> diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
> index f3bc0f4..eb25abe 100644
> --- a/drivers/scsi/Kconfig
> +++ b/drivers/scsi/Kconfig
> @@ -226,6 +226,7 @@ config SCSI_LOGGING
>  config SCSI_SCAN_ASYNC
>   bool "Asynchronous SCSI scanning"
>   depends on SCSI
> + select SCSI_WAIT_SCAN

This can't really be right.  Async scan is always compiled in, so the
module is always required ... this parameter just determines what the
boot time default is, but it can be overridden by the kernel command
line.

What's the actual problem you're trying to fix?

James


-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] correct SCSI_WAIT_SCAN selection for non-modular SCSI_SCAN_ASYNC builds.

2007-03-20 Thread Andrew Vasquez
Commit 840c2835a1c867281d27158378a9d34f593a7664 ([SCSI] make
scsi_wait_scan always modular) broke configurations where
SCSI_SCAN_ASYNC is selected for non-modular builds.

Signed-off-by: Andrew Vasquez <[EMAIL PROTECTED]>
---

diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index f3bc0f4..eb25abe 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -226,6 +226,7 @@ config SCSI_LOGGING
 config SCSI_SCAN_ASYNC
bool "Asynchronous SCSI scanning"
depends on SCSI
+   select SCSI_WAIT_SCAN
help
  The SCSI subsystem can probe for devices while the rest of the
  system continues booting, and even probe devices on different

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] sd: implement START/STOP management

2007-03-20 Thread James Bottomley
On Tue, 2007-03-20 at 13:58 -0400, Douglas Gilbert wrote:
> I note at this point that the IMMED bit in the
> START STOP UNIT cdb is clear. [The code might
> note that as well.] All SCSI disks that I have
> seen, implement the IMMED bit and according to
> the SAT standard, so should SAT layers like the
> one in libata.
> 
> With the IMMED bit clear:
>   - on spin up, it will wait until disk is ready.
> Okay unless there are a lot of disks, in
> which case we could ask Matthew Wilcox for help
>   - on spin down, will wait until media is
> stopped. That could be 20 seconds, and if there
> were multiple disks 
> 
> I guess the question is do we need to wait until a
> disk is spun down before dropping power to it
> and suspending.

Realistically, if you're thinking of doing a bank spin up / spin down
with IMMED=1 I suspect we can wait and see if anyone has sufficient need
for it to be implemented before trying.  The majority of the
suspend/resume cases are laptops with a single disc ... and there immed
is irrelevant to them.

I think we need assurance that the head is parked before full suspend,
yes, so IMMED=0 seems the easiest way to do this.

James


-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] sd: implement START/STOP management

2007-03-20 Thread Douglas Gilbert
Tejun Heo wrote:
> Implement SBC START/STOP management.  sdev->mange_start_stop is added.
> When it's set to one, sd STOPs the device on suspend and shutdown and
> STARTs it on resume.  sdev->manage_start_stop defaults is in sdev
> instead of scsi_disk cdev to allow ->slave_config() override the
> default configuration but is exported under scsi_disk sysfs node as
> sdev->allow_restart is.
> 
> When manage_start_stop is zero (the default value), this patch doesn't
> introduce any behavior change.
> 
> Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>
> ---
>  drivers/scsi/scsi_sysfs.c  |   31 +++--
>  drivers/scsi/sd.c  |  102 
> +
>  include/scsi/scsi_device.h |1 
>  3 files changed, 130 insertions(+), 4 deletions(-)
> 
> Index: work/drivers/scsi/sd.c
> ===
> --- work.orig/drivers/scsi/sd.c
> +++ work/drivers/scsi/sd.c
> @@ -142,6 +142,8 @@ static void sd_rw_intr(struct scsi_cmnd 
>  static int sd_probe(struct device *);
>  static int sd_remove(struct device *);
>  static void sd_shutdown(struct device *dev);
> +static int sd_suspend(struct device *dev, pm_message_t state);
> +static int sd_resume(struct device *dev);
>  static void sd_rescan(struct device *);
>  static int sd_init_command(struct scsi_cmnd *);
>  static int sd_issue_flush(struct device *, sector_t *);
> @@ -206,6 +208,20 @@ static ssize_t sd_store_cache_type(struc
>   return count;
>  }
>  
> +static ssize_t sd_store_manage_start_stop(struct class_device *cdev,
> +   const char *buf, size_t count)
> +{
> + struct scsi_disk *sdkp = to_scsi_disk(cdev);
> + struct scsi_device *sdp = sdkp->device;
> +
> + if (!capable(CAP_SYS_ADMIN))
> + return -EACCES;
> +
> + sdp->manage_start_stop = simple_strtoul(buf, NULL, 10);
> +
> + return count;
> +}
> +
>  static ssize_t sd_store_allow_restart(struct class_device *cdev, const char 
> *buf,
> size_t count)
>  {
> @@ -238,6 +254,14 @@ static ssize_t sd_show_fua(struct class_
>   return snprintf(buf, 20, "%u\n", sdkp->DPOFUA);
>  }
>  
> +static ssize_t sd_show_manage_start_stop(struct class_device *cdev, char 
> *buf)
> +{
> + struct scsi_disk *sdkp = to_scsi_disk(cdev);
> + struct scsi_device *sdp = sdkp->device;
> +
> + return snprintf(buf, 20, "%u\n", sdp->manage_start_stop);
> +}
> +
>  static ssize_t sd_show_allow_restart(struct class_device *cdev, char *buf)
>  {
>   struct scsi_disk *sdkp = to_scsi_disk(cdev);
> @@ -251,6 +275,8 @@ static struct class_device_attribute sd_
>   __ATTR(FUA, S_IRUGO, sd_show_fua, NULL),
>   __ATTR(allow_restart, S_IRUGO|S_IWUSR, sd_show_allow_restart,
>  sd_store_allow_restart),
> + __ATTR(manage_start_stop, S_IRUGO|S_IWUSR, sd_show_manage_start_stop,
> +sd_store_manage_start_stop),
>   __ATTR_NULL,
>  };
>  
> @@ -267,6 +293,8 @@ static struct scsi_driver sd_template = 
>   .name   = "sd",
>   .probe  = sd_probe,
>   .remove = sd_remove,
> + .suspend= sd_suspend,
> + .resume = sd_resume,
>   .shutdown   = sd_shutdown,
>   },
>   .rescan = sd_rescan,
> @@ -1776,6 +1804,32 @@ static void scsi_disk_release(struct cla
>   kfree(sdkp);
>  }
>  
> +static int sd_start_stop_device(struct scsi_device *sdp, int start)
> +{
> + unsigned char cmd[6] = { START_STOP };  /* START_VALID */
> + struct scsi_sense_hdr sshdr;
> + int res;
> +
> + if (start)
> + cmd[4] |= 1;/* START */
> +
> + if (!scsi_device_online(sdp))
> + return -ENODEV;
> +
> + res = scsi_execute_req(sdp, cmd, DMA_NONE, NULL, 0, &sshdr,
> +SD_TIMEOUT, SD_MAX_RETRIES);

Tejun,
I note at this point that the IMMED bit in the
START STOP UNIT cdb is clear. [The code might
note that as well.] All SCSI disks that I have
seen, implement the IMMED bit and according to
the SAT standard, so should SAT layers like the
one in libata.

With the IMMED bit clear:
  - on spin up, it will wait until disk is ready.
Okay unless there are a lot of disks, in
which case we could ask Matthew Wilcox for help
  - on spin down, will wait until media is
stopped. That could be 20 seconds, and if there
were multiple disks 

I guess the question is do we need to wait until a
disk is spun down before dropping power to it
and suspending.

Doug Gilbert
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] sd: implement START/STOP management

2007-03-20 Thread James Bottomley
On Wed, 2007-03-21 at 02:08 +0900, Tejun Heo wrote:
> I got too comfortable with libata-dev#upstream and forgot to verify
> patches against scsi-misc-2.6.  Sorry about that.  If you don't have
> objection against the content, I'll resubmit the SCSI part against
> scsi-misc-2.6.  Once it's in scsi-misc-2.6, we can pull it into
> libata-dev#upstream and do the libata part there.  As the SCSI change
> doesn't break libata, they can be done separately.

I should already have it in scsi-misc-2.6 ... you could verify I got the
merge right ...

There'll be an additional piece to put the new sd_printk helpers into
the routines, which I attach below.

James

---
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 49a94ae..b044dcf 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1733,10 +1733,11 @@ static void scsi_disk_release(struct class_device *cdev)
kfree(sdkp);
 }
 
-static int sd_start_stop_device(struct scsi_device *sdp, int start)
+static int sd_start_stop_device(struct scsi_disk *sdkp, int start)
 {
unsigned char cmd[6] = { START_STOP };  /* START_VALID */
struct scsi_sense_hdr sshdr;
+   struct scsi_device *sdp = sdkp->device;
int res;
 
if (start)
@@ -1748,12 +1749,10 @@ static int sd_start_stop_device(struct scsi_device 
*sdp, int start)
res = scsi_execute_req(sdp, cmd, DMA_NONE, NULL, 0, &sshdr,
   SD_TIMEOUT, SD_MAX_RETRIES);
if (res) {
-   printk(KERN_WARNING "FAILED\n  status = %x, message = %02x, "
-  "host = %d, driver = %02x\n  ",
-  status_byte(res), msg_byte(res),
-  host_byte(res), driver_byte(res));
+   sd_printk(KERN_WARNING, sdkp, "START_STOP FAILED\n");
+   sd_print_result(sdkp, res);
if (driver_byte(res) & DRIVER_SENSE)
-   scsi_print_sense_hdr("sd", &sshdr);
+   sd_print_sense_hdr(sdkp, &sshdr);
}
 
return res;
@@ -1766,7 +1765,6 @@ static int sd_start_stop_device(struct scsi_device *sdp, 
int start)
  */
 static void sd_shutdown(struct device *dev)
 {
-   struct scsi_device *sdp = to_scsi_device(dev);
struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev);
 
if (!sdkp)
@@ -1777,10 +1775,9 @@ static void sd_shutdown(struct device *dev)
sd_sync_cache(sdkp);
}
 
-   if (system_state != SYSTEM_RESTART && sdp->manage_start_stop) {
-   printk(KERN_NOTICE "Stopping disk %s: \n",
-  sdkp->disk->disk_name);
-   sd_start_stop_device(sdp, 0);
+   if (system_state != SYSTEM_RESTART && sdkp->device->manage_start_stop) {
+   sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n");
+   sd_start_stop_device(sdkp, 0);
}
 
scsi_disk_put(sdkp);
@@ -1788,7 +1785,6 @@ static void sd_shutdown(struct device *dev)
 
 static int sd_suspend(struct device *dev, pm_message_t mesg)
 {
-   struct scsi_device *sdp = to_scsi_device(dev);
struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev);
int ret;
 
@@ -1796,17 +1792,16 @@ static int sd_suspend(struct device *dev, pm_message_t 
mesg)
return 0;   /* this can happen */
 
if (sdkp->WCE) {
-   printk(KERN_NOTICE "Synchronizing SCSI cache for disk %s: \n",
-   sdkp->disk->disk_name);
+   sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n");
ret = sd_sync_cache(sdkp);
if (ret)
return ret;
}
 
-   if (mesg.event == PM_EVENT_SUSPEND && sdp->manage_start_stop) {
-   printk(KERN_NOTICE "Stopping disk %s: \n",
-  sdkp->disk->disk_name);
-   ret = sd_start_stop_device(sdp, 0);
+   if (mesg.event == PM_EVENT_SUSPEND &&
+   sdkp->device->manage_start_stop) {
+   sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n");
+   ret = sd_start_stop_device(sdkp, 0);
if (ret)
return ret;
}
@@ -1816,15 +1811,14 @@ static int sd_suspend(struct device *dev, pm_message_t 
mesg)
 
 static int sd_resume(struct device *dev)
 {
-   struct scsi_device *sdp = to_scsi_device(dev);
struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev);
 
-   if (!sdp->manage_start_stop)
+   if (!sdkp->device->manage_start_stop)
return 0;
 
-   printk(KERN_NOTICE "Starting disk %s: \n", sdkp->disk->disk_name);
+   sd_printk(KERN_NOTICE, sdkp, "Starting disk\n");
 
-   return sd_start_stop_device(sdp, 1);
+   return sd_start_stop_device(sdkp, 1);
 }
 
 /**


-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] sd: implement START/STOP management

2007-03-20 Thread Tejun Heo
James Bottomley wrote:
> On Wed, 2007-03-21 at 00:13 +0900, Tejun Heo wrote:
>> Implement SBC START/STOP management.  sdev->mange_start_stop is added.
>> When it's set to one, sd STOPs the device on suspend and shutdown and
>> STARTs it on resume.  sdev->manage_start_stop defaults is in sdev
>> instead of scsi_disk cdev to allow ->slave_config() override the
>> default configuration but is exported under scsi_disk sysfs node as
>> sdev->allow_restart is.
>>
>> When manage_start_stop is zero (the default value), this patch doesn't
>> introduce any behavior change.
> 
> I have this in scsi-misc-2.6.  There was a minor space before tab no-no
> which git complained about (and I fixed).  Unfortunately, there's a
> pretty major merge conflict with prior sd.c patches in scsi-misc-2.6.
> I've merged and fixed this but it's going to create a bit of a
> difficulty for applying the libata pieces.

I got too comfortable with libata-dev#upstream and forgot to verify
patches against scsi-misc-2.6.  Sorry about that.  If you don't have
objection against the content, I'll resubmit the SCSI part against
scsi-misc-2.6.  Once it's in scsi-misc-2.6, we can pull it into
libata-dev#upstream and do the libata part there.  As the SCSI change
doesn't break libata, they can be done separately.

Thanks.

-- 
tejun
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] sd: implement START/STOP management

2007-03-20 Thread James Bottomley
On Wed, 2007-03-21 at 00:13 +0900, Tejun Heo wrote:
> Implement SBC START/STOP management.  sdev->mange_start_stop is added.
> When it's set to one, sd STOPs the device on suspend and shutdown and
> STARTs it on resume.  sdev->manage_start_stop defaults is in sdev
> instead of scsi_disk cdev to allow ->slave_config() override the
> default configuration but is exported under scsi_disk sysfs node as
> sdev->allow_restart is.
> 
> When manage_start_stop is zero (the default value), this patch doesn't
> introduce any behavior change.

I have this in scsi-misc-2.6.  There was a minor space before tab no-no
which git complained about (and I fixed).  Unfortunately, there's a
pretty major merge conflict with prior sd.c patches in scsi-misc-2.6.
I've merged and fixed this but it's going to create a bit of a
difficulty for applying the libata pieces.

James


-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/4] libata: reimplement suspend/resume support using sdev->manage_start_stop

2007-03-20 Thread Oliver Neukum
Am Dienstag, 20. März 2007 17:39 schrieb Alan Cox:
> > * sdev->manage_start_stop is set to 1 in ata_scsi_slave_config().
> >   This fixes spindown on shutdown and suspend-to-disk.
> 
> Yay

Which kernel version is this?

Regards
Oliver
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Kernel 2.6.20 does not work anymore with SCSI or SATA on old Opteron / Xeon servers

2007-03-20 Thread Chuck Ebbert
Stefan Priebe wrote:
> Hello!
> 
> With the sysrq i've found the function with is the problem:
> inode.c => nfs_getattr => nfs_sync_mapping_range
> 
> I've also found the attached patch - which is not included in any stable
> release nor in 2.6.21.X but is public since 20.02.07
> 
> I think this is very important.
> 

It is queued for 2.6.20.4.

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] libata: implement libata.spindown_compat

2007-03-20 Thread Tejun Heo
Now that libata uses sd->manage_start_stop, libata spins down disk on
shutdown.  In an attempt to compensate libata's previous shortcoming,
shutdown(8) syncs and spins down disks attached via libata.  Some
disks spin back up just to spin down again on STANDBYNOW1 if the
command is issued when the disk is spun down, so this double spinning
down causes problem.

This patch implements module parameter libata.spindown_compat which,
when set to one (default value), prevents libata from spinning down
disks on shutdown thus avoiding double spinning down.  Note that
libata spins down disks for suspend to mem and disk, so with
libata.spindown_compat set to one, disks should be properly spun down
in all cases without modifying shutdown(8).

shutdown(8) should be fixed eventually tho.  Some drive do spin up on
SYNCHRONZE_CACHE even when their cache is clean.  Those disks
currently spin up briefly when sd tries to shutdown the device and
then the machine powers off immediately, which can't be good for the
head.  We can't skip SYNCHRONIZE_CACHE during shudown as it can be
dangerous data integrity-wise.

So, this spindown_compat parameter is already scheduled for removal by
the end of the next year and here's what shutdown(8) should do.

  1. Check whether /sys/modules/libata/parameters/spindown_compat
 exists.  If it does, write 0 to it.

  For each libata harddisk {

2. Check whether /sys/class/scsi_disk/h:c:i:l/manage_start_stop
   exists.  If so, write 1 to it and continue; otherwise, fall
   through to #3.

3. Synchronize cache and spin down as before.

  }

Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>
---
Henrique, does it look good enough?  How do we coordinate this with
distributions?  I can take care of suse and I guess Alan/Jeff can do
so for redhat.  So, that leaves us with Debian, Ubuntu, Gentoo...

 Documentation/feature-removal-schedule.txt |   19 +++
 drivers/ata/libata-core.c  |6 ++
 drivers/ata/libata-scsi.c  |   14 +-
 drivers/ata/libata.h   |1 +
 4 files changed, 39 insertions(+), 1 deletion(-)

Index: work/Documentation/feature-removal-schedule.txt
===
--- work.orig/Documentation/feature-removal-schedule.txt
+++ work/Documentation/feature-removal-schedule.txt
@@ -324,3 +324,22 @@ Why:   the i8xx_tco watchdog driver has be
 Who:   Wim Van Sebroeck <[EMAIL PROTECTED]>
 
 ---
+
+What:  libata.spindown_compat module parameter
+When:  Dec 2008
+Why:   halt(8) synchronizes caches for and spins down libata disks
+   because libata didn't use to spin down disk on system halt
+   (only synchronized caches).
+   Spin down on system halt is now implemented and can be tested
+   using sysfs node /sys/class/scsi_disk/h:c:i:l/manage_start_stop.
+   Because issuing spin down command to an already spun down disk
+   makes some disks spin up just to spin down again, the old
+   behavior needs to be maintained till userspace tool is updated
+   to check the sysfs node and not to spin down disks with the
+   node set to one.
+   This module parameter is to give userspace tool the time to
+   get updated and should be removed after userspace is
+   reasonably updated.
+Who:   Tejun Heo <[EMAIL PROTECTED]>
+
+---
Index: work/drivers/ata/libata-core.c
===
--- work.orig/drivers/ata/libata-core.c
+++ work/drivers/ata/libata-core.c
@@ -97,6 +97,12 @@ int noacpi;
 module_param(noacpi, int, 0444);
 MODULE_PARM_DESC(noacpi, "Disables the use of ACPI in suspend/resume when 
set");
 
+int ata_spindown_compat = 1;
+module_param_named(spindown_compat, ata_spindown_compat, int, 0644);
+MODULE_PARM_DESC(spindown_compat, "Enable backward compatible spindown "
+"behavior.  Will be removed.  More info can be found in "
+"Documentation/feature-removal-schedule.txt\n");
+
 MODULE_AUTHOR("Jeff Garzik");
 MODULE_DESCRIPTION("Library module for ATA devices");
 MODULE_LICENSE("GPL");
Index: work/drivers/ata/libata-scsi.c
===
--- work.orig/drivers/ata/libata-scsi.c
+++ work/drivers/ata/libata-scsi.c
@@ -944,9 +944,21 @@ static unsigned int ata_scsi_start_stop_
}
 
tf->command = ATA_CMD_VERIFY;   /* READ VERIFY */
-   } else
+   } else {
+   /* XXX: This is for backward compatibility, will be
+* removed.  Read Documentation/feature-removal-schedule.txt
+* for more info.
+*/
+   if (ata_spindown_compat &&
+   (system_state == SYSTEM_HALT ||
+system_state == SYSTEM_POWER_OFF)) {
+   scmd->result = SAM_STAT_GOOD;
+   return 1;
+   

Re: [PATCH 3/4] libata: reimplement suspend/resume support using sdev->manage_start_stop

2007-03-20 Thread Alan Cox
> * DPM is dropped.  This also simplifies code a lot.  Suspend/resume
>   status is port-wide now.

Makes sense

> * sdev->manage_start_stop is set to 1 in ata_scsi_slave_config().
>   This fixes spindown on shutdown and suspend-to-disk.

Yay
 
> Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>

Acked-by: Alan Cox <[EMAIL PROTECTED]>

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/4] libata: reimplement suspend/resume support using sdev->manage_start_stop

2007-03-20 Thread Christoph Hellwig
On Wed, Mar 21, 2007 at 12:25:33AM +0900, Tejun Heo wrote:
> Reimplement suspend/resume support using sdev->manage_start_stop.
> 
> * Device suspend/resume is now SCSI layer's responsibility and the
>   code is simplified a lot.

Finally.  I've been telling people to do it this way forever.

Can you please also kill the braindead suspend and resume scsi_host_template
methods now?

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] libata: reimplement suspend/resume support using sdev->manage_start_stop

2007-03-20 Thread Tejun Heo
Reimplement suspend/resume support using sdev->manage_start_stop.

* Device suspend/resume is now SCSI layer's responsibility and the
  code is simplified a lot.

* DPM is dropped.  This also simplifies code a lot.  Suspend/resume
  status is port-wide now.

* ata_scsi_device_suspend/resume() and ata_dev_ready() removed.

* Resume now has to wait for disk to spin up before proceeding.  I
  couldn't find easy way out as libata is in EH waiting for the
  disk to be ready and sd is waiting for EH to complete to issue
  START_STOP.

* sdev->manage_start_stop is set to 1 in ata_scsi_slave_config().
  This fixes spindown on shutdown and suspend-to-disk.

Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>
---
 drivers/ata/ahci.c  |4 
 drivers/ata/ata_generic.c   |6 -
 drivers/ata/ata_piix.c  |4 
 drivers/ata/libata-core.c   |   39 --
 drivers/ata/libata-eh.c |  237 
 drivers/ata/libata-scsi.c   |  129 -
 drivers/ata/pata_ali.c  |4 
 drivers/ata/pata_amd.c  |4 
 drivers/ata/pata_atiixp.c   |4 
 drivers/ata/pata_cmd640.c   |2 
 drivers/ata/pata_cmd64x.c   |4 
 drivers/ata/pata_cs5520.c   |4 
 drivers/ata/pata_cs5530.c   |4 
 drivers/ata/pata_cs5535.c   |4 
 drivers/ata/pata_cypress.c  |4 
 drivers/ata/pata_efar.c |4 
 drivers/ata/pata_hpt366.c   |4 
 drivers/ata/pata_hpt3x3.c   |4 
 drivers/ata/pata_it8213.c   |4 
 drivers/ata/pata_it821x.c   |4 
 drivers/ata/pata_ixp4xx_cf.c|2 
 drivers/ata/pata_jmicron.c  |4 
 drivers/ata/pata_marvell.c  |4 
 drivers/ata/pata_mpc52xx.c  |4 
 drivers/ata/pata_mpiix.c|4 
 drivers/ata/pata_netcell.c  |4 
 drivers/ata/pata_ns87410.c  |4 
 drivers/ata/pata_oldpiix.c  |4 
 drivers/ata/pata_opti.c |4 
 drivers/ata/pata_optidma.c  |4 
 drivers/ata/pata_pdc202xx_old.c |4 
 drivers/ata/pata_radisys.c  |4 
 drivers/ata/pata_rz1000.c   |6 -
 drivers/ata/pata_sc1200.c   |4 
 drivers/ata/pata_scc.c  |4 
 drivers/ata/pata_serverworks.c  |4 
 drivers/ata/pata_sil680.c   |4 
 drivers/ata/pata_sis.c  |4 
 drivers/ata/pata_triflex.c  |4 
 drivers/ata/pata_via.c  |4 
 drivers/ata/sata_inic162x.c |4 
 drivers/ata/sata_nv.c   |8 -
 drivers/ata/sata_sil.c  |4 
 drivers/ata/sata_sil24.c|4 
 include/linux/libata.h  |   14 --
 45 files changed, 14 insertions(+), 573 deletions(-)

Index: work/drivers/ata/ahci.c
===
--- work.orig/drivers/ata/ahci.c
+++ work/drivers/ata/ahci.c
@@ -243,10 +243,6 @@ static struct scsi_host_template ahci_sh
.slave_configure= ata_scsi_slave_config,
.slave_destroy  = ata_scsi_slave_destroy,
.bios_param = ata_std_bios_param,
-#ifdef CONFIG_PM
-   .suspend= ata_scsi_device_suspend,
-   .resume = ata_scsi_device_resume,
-#endif
 };
 
 static const struct ata_port_operations ahci_ops = {
Index: work/drivers/ata/ata_generic.c
===
--- work.orig/drivers/ata/ata_generic.c
+++ work/drivers/ata/ata_generic.c
@@ -83,7 +83,7 @@ static int generic_set_mode(struct ata_p
 
for (i = 0; i < ATA_MAX_DEVICES; i++) {
struct ata_device *dev = &ap->device[i];
-   if (ata_dev_ready(dev)) {
+   if (ata_dev_enabled(dev)) {
/* We don't really care */
dev->pio_mode = XFER_PIO_0;
dev->dma_mode = XFER_MW_DMA_0;
@@ -119,10 +119,6 @@ static struct scsi_host_template generic
.slave_configure= ata_scsi_slave_config,
.slave_destroy  = ata_scsi_slave_destroy,
.bios_param = ata_std_bios_param,
-#ifdef CONFIG_PM
-   .resume = ata_scsi_device_resume,
-   .suspend= ata_scsi_device_suspend,
-#endif
 };
 
 static struct ata_port_operations generic_port_ops = {
Index: work/drivers/ata/ata_piix.c
===
--- work.orig/drivers/ata/ata_piix.c
+++ work/drivers/ata/ata_piix.c
@@ -275,10 +275,6 @@ static struct scsi_host_template piix_sh
.slave_configure= ata_scsi_slave_config,
.slave_destroy  = ata_scsi_slave_destroy,
.bios_param = ata_std_bios_param,
-#ifdef CONFIG_PM
-   .resume = ata_scsi_device_resume,
-   .suspend= ata_scsi_device_suspend,
-#endif
 };
 
 static const struct ata_port_operations piix_pata_ops = {
Index: work/drivers/ata/libata-core.c
===

[PATCH 2/3] sd: implement START/STOP management

2007-03-20 Thread Tejun Heo
Implement SBC START/STOP management.  sdev->mange_start_stop is added.
When it's set to one, sd STOPs the device on suspend and shutdown and
STARTs it on resume.  sdev->manage_start_stop defaults is in sdev
instead of scsi_disk cdev to allow ->slave_config() override the
default configuration but is exported under scsi_disk sysfs node as
sdev->allow_restart is.

When manage_start_stop is zero (the default value), this patch doesn't
introduce any behavior change.

Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>
---
 drivers/scsi/scsi_sysfs.c  |   31 +++--
 drivers/scsi/sd.c  |  102 +
 include/scsi/scsi_device.h |1 
 3 files changed, 130 insertions(+), 4 deletions(-)

Index: work/drivers/scsi/sd.c
===
--- work.orig/drivers/scsi/sd.c
+++ work/drivers/scsi/sd.c
@@ -142,6 +142,8 @@ static void sd_rw_intr(struct scsi_cmnd 
 static int sd_probe(struct device *);
 static int sd_remove(struct device *);
 static void sd_shutdown(struct device *dev);
+static int sd_suspend(struct device *dev, pm_message_t state);
+static int sd_resume(struct device *dev);
 static void sd_rescan(struct device *);
 static int sd_init_command(struct scsi_cmnd *);
 static int sd_issue_flush(struct device *, sector_t *);
@@ -206,6 +208,20 @@ static ssize_t sd_store_cache_type(struc
return count;
 }
 
+static ssize_t sd_store_manage_start_stop(struct class_device *cdev,
+ const char *buf, size_t count)
+{
+   struct scsi_disk *sdkp = to_scsi_disk(cdev);
+   struct scsi_device *sdp = sdkp->device;
+
+   if (!capable(CAP_SYS_ADMIN))
+   return -EACCES;
+
+   sdp->manage_start_stop = simple_strtoul(buf, NULL, 10);
+
+   return count;
+}
+
 static ssize_t sd_store_allow_restart(struct class_device *cdev, const char 
*buf,
  size_t count)
 {
@@ -238,6 +254,14 @@ static ssize_t sd_show_fua(struct class_
return snprintf(buf, 20, "%u\n", sdkp->DPOFUA);
 }
 
+static ssize_t sd_show_manage_start_stop(struct class_device *cdev, char *buf)
+{
+   struct scsi_disk *sdkp = to_scsi_disk(cdev);
+   struct scsi_device *sdp = sdkp->device;
+
+   return snprintf(buf, 20, "%u\n", sdp->manage_start_stop);
+}
+
 static ssize_t sd_show_allow_restart(struct class_device *cdev, char *buf)
 {
struct scsi_disk *sdkp = to_scsi_disk(cdev);
@@ -251,6 +275,8 @@ static struct class_device_attribute sd_
__ATTR(FUA, S_IRUGO, sd_show_fua, NULL),
__ATTR(allow_restart, S_IRUGO|S_IWUSR, sd_show_allow_restart,
   sd_store_allow_restart),
+   __ATTR(manage_start_stop, S_IRUGO|S_IWUSR, sd_show_manage_start_stop,
+  sd_store_manage_start_stop),
__ATTR_NULL,
 };
 
@@ -267,6 +293,8 @@ static struct scsi_driver sd_template = 
.name   = "sd",
.probe  = sd_probe,
.remove = sd_remove,
+   .suspend= sd_suspend,
+   .resume = sd_resume,
.shutdown   = sd_shutdown,
},
.rescan = sd_rescan,
@@ -1776,6 +1804,32 @@ static void scsi_disk_release(struct cla
kfree(sdkp);
 }
 
+static int sd_start_stop_device(struct scsi_device *sdp, int start)
+{
+   unsigned char cmd[6] = { START_STOP };  /* START_VALID */
+   struct scsi_sense_hdr sshdr;
+   int res;
+
+   if (start)
+   cmd[4] |= 1;/* START */
+
+   if (!scsi_device_online(sdp))
+   return -ENODEV;
+
+   res = scsi_execute_req(sdp, cmd, DMA_NONE, NULL, 0, &sshdr,
+  SD_TIMEOUT, SD_MAX_RETRIES);
+   if (res) {
+   printk(KERN_WARNING "FAILED\n  status = %x, message = %02x, "
+  "host = %d, driver = %02x\n  ",
+  status_byte(res), msg_byte(res),
+  host_byte(res), driver_byte(res));
+   if (driver_byte(res) & DRIVER_SENSE)
+   scsi_print_sense_hdr("sd", &sshdr);
+   }
+
+   return res;
+}
+
 /*
  * Send a SYNCHRONIZE CACHE instruction down to the device through
  * the normal SCSI command structure.  Wait for the command to
@@ -1794,9 +1848,57 @@ static void sd_shutdown(struct device *d
sdkp->disk->disk_name);
sd_sync_cache(sdp);
}
+
+   if (system_state != SYSTEM_RESTART && sdp->manage_start_stop) {
+   printk(KERN_NOTICE "Stopping disk %s: \n",
+  sdkp->disk->disk_name);
+   sd_start_stop_device(sdp, 0);
+   }
+
scsi_disk_put(sdkp);
 }
 
+static int sd_suspend(struct device *dev, pm_message_t mesg)
+{
+   struct scsi_device *sdp = to_scsi_device(dev);
+   struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev);
+   int ret;
+
+   if (!sdkp)
+

[PATCH 1/3] sd: fix return value of sd_sync_cache()

2007-03-20 Thread Tejun Heo
sd_sync_cache() should return -errno on error, fix it.

Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>
---
 drivers/scsi/sd.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: work/drivers/scsi/sd.c
===
--- work.orig/drivers/scsi/sd.c
+++ work/drivers/scsi/sd.c
@@ -817,7 +817,9 @@ static int sd_sync_cache(struct scsi_dev
scsi_print_sense_hdr("sd", &sshdr);
}
 
-   return res;
+   if (res)
+   return -EIO;
+   return 0;
 }
 
 static int sd_issue_flush(struct device *dev, sector_t *error_sector)
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3] bind bsg to request_queue instead of gendisk

2007-03-20 Thread FUJITA Tomonori
This patch binds bsg devices to request_queue instead of gendisk. Any
objects (like transport entities) can define own request_handler and
create own bsg device.

Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]>
---
 block/bsg.c|   37 +
 block/ll_rw_blk.c  |4 ++--
 include/linux/blkdev.h |5 +
 include/linux/bsg.h|   10 +-
 include/linux/genhd.h  |2 --
 5 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/block/bsg.c b/block/bsg.c
index 0427ece..4ea4bed 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -34,7 +34,6 @@ #include 
 static char bsg_version[] = "block layer sg (bsg) 0.4";
 
 struct bsg_device {
-   struct gendisk *disk;
request_queue_t *queue;
spinlock_t lock;
struct list_head busy_list;
@@ -46,7 +45,7 @@ struct bsg_device {
int done_cmds;
wait_queue_head_t wq_done;
wait_queue_head_t wq_free;
-   char name[BDEVNAME_SIZE];
+   char name[BUS_ID_SIZE];
int max_queue;
unsigned long flags;
 };
@@ -375,7 +374,7 @@ static void bsg_add_command(struct bsg_d
dprintk("%s: queueing rq %p, bc %p\n", bd->name, rq, bc);
 
rq->end_io_data = bc;
-   blk_execute_rq_nowait(q, bd->disk, rq, 1, bsg_rq_end_io);
+   blk_execute_rq_nowait(q, NULL, rq, 1, bsg_rq_end_io);
 }
 
 static inline struct bsg_command *bsg_next_done_cmd(struct bsg_device *bd)
@@ -741,7 +740,7 @@ out:
 }
 
 static struct bsg_device *bsg_add_device(struct inode *inode,
-struct gendisk *disk,
+struct request_queue *rq,
 struct file *file)
 {
struct bsg_device *bd = NULL;
@@ -753,17 +752,16 @@ #endif
if (!bd)
return ERR_PTR(-ENOMEM);
 
-   bd->disk = disk;
-   bd->queue = disk->queue;
-   kobject_get(&disk->queue->kobj);
+   bd->queue = rq;
+   kobject_get(&rq->kobj);
bsg_set_block(bd, file);
 
atomic_set(&bd->ref_count, 1);
bd->minor = iminor(inode);
mutex_lock(&bsg_mutex);
-   hlist_add_head(&bd->dev_list,&bsg_device_list[bsg_list_idx(bd->minor)]);
+   hlist_add_head(&bd->dev_list, 
&bsg_device_list[bsg_list_idx(bd->minor)]);
 
-   strncpy(bd->name, disk->disk_name, sizeof(bd->name) - 1);
+   strncpy(bd->name, rq->bsg_dev.class_dev->class_id, sizeof(bd->name) - 
1);
dprintk("bound to <%s>, max queue %d\n",
format_dev_t(buf, inode->i_rdev), bd->max_queue);
 
@@ -817,7 +815,7 @@ static struct bsg_device *bsg_get_device
if (!bcd)
return ERR_PTR(-ENODEV);
 
-   return bsg_add_device(inode, bcd->disk, file);
+   return bsg_add_device(inode, bcd->queue, file);
 }
 
 static int bsg_open(struct inode *inode, struct file *file)
@@ -900,7 +898,7 @@ bsg_ioctl(struct inode *inode, struct fi
case SG_EMULATED_HOST:
case SCSI_IOCTL_SEND_COMMAND: {
void __user *uarg = (void __user *) arg;
-   return scsi_cmd_ioctl(file, bd->queue, bd->disk, cmd, uarg);
+   return scsi_cmd_ioctl(file, bd->queue, NULL, cmd, uarg);
}
case SG_IO: {
struct request *rq;
@@ -915,7 +913,7 @@ bsg_ioctl(struct inode *inode, struct fi
return PTR_ERR(rq);
 
bio = rq->bio;
-   blk_execute_rq(bd->queue, bd->disk, rq, 0);
+   blk_execute_rq(bd->queue, NULL, rq, 0);
blk_complete_sgv4_hdr_rq(rq, &hdr, bio);
 
if (copy_to_user(uarg, &hdr, sizeof(hdr)))
@@ -945,24 +943,23 @@ static struct file_operations bsg_fops =
.owner  =   THIS_MODULE,
 };
 
-void bsg_unregister_disk(struct gendisk *disk)
+void bsg_unregister_queue(struct request_queue *q)
 {
-   struct bsg_class_device *bcd = &disk->bsg_dev;
+   struct bsg_class_device *bcd = &q->bsg_dev;
 
if (!bcd->class_dev)
return;
 
mutex_lock(&bsg_mutex);
-   sysfs_remove_link(&bcd->disk->queue->kobj, "bsg");
+   sysfs_remove_link(&q->kobj, "bsg");
class_device_destroy(bsg_class, MKDEV(BSG_MAJOR, bcd->minor));
bcd->class_dev = NULL;
list_del_init(&bcd->list);
mutex_unlock(&bsg_mutex);
 }
 
-int bsg_register_disk(struct gendisk *disk)
+int bsg_register_queue(struct request_queue *q, char *name)
 {
-   request_queue_t *q = disk->queue;
struct bsg_class_device *bcd;
dev_t dev;
 
@@ -972,7 +969,7 @@ int bsg_register_disk(struct gendisk *di
if (!q->request_fn)
return 0;
 
-   bcd = &disk->bsg_dev;
+   bcd = &q->bsg_dev;
memset(bcd, 0, sizeof(*bcd));
INIT_LIST_HEAD(&bcd->list);
 
@@ -980,8 +977,8 @@ int bsg_register_disk(struct gendisk *di
dev = MKDEV(BSG_MAJOR, bsg_device_nr);
bcd->minor = bsg_device_nr;
bsg_device_nr++;
-   bcd->

[PATCH 1/3] add a request_queue argument to scsi_cmd_ioctl()

2007-03-20 Thread FUJITA Tomonori
bsg uses scsi_cmd_ioctl() for some SCSI/sg ioctl
commands. scsi_cmd_ioctl() gets a request queue from a gendisk
arguement. This prevents bsg being bound to SCSI devices that don't
have a gendisk (like OSD). This adds a request_queue argument to
scsi_cmd_ioctl(). The SCSI/sg ioctl commands doesn't use a gendisk so
it's safe for any SCSI devices to use scsi_cmd_ioctl().

Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]>
---
 block/bsg.c|2 +-
 block/scsi_ioctl.c |   10 +++---
 drivers/block/ub.c |2 +-
 drivers/cdrom/cdrom.c  |3 ++-
 drivers/ide/ide.c  |2 +-
 drivers/scsi/sd.c  |2 +-
 drivers/scsi/st.c  |3 ++-
 include/linux/blkdev.h |3 ++-
 8 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/block/bsg.c b/block/bsg.c
index c85d961..0427ece 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -900,7 +900,7 @@ bsg_ioctl(struct inode *inode, struct fi
case SG_EMULATED_HOST:
case SCSI_IOCTL_SEND_COMMAND: {
void __user *uarg = (void __user *) arg;
-   return scsi_cmd_ioctl(file, bd->disk, cmd, uarg);
+   return scsi_cmd_ioctl(file, bd->queue, bd->disk, cmd, uarg);
}
case SG_IO: {
struct request *rq;
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index 18e935f..314 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -546,16 +546,12 @@ static inline int blk_send_start_stop(re
return __blk_send_generic(q, bd_disk, GPCMD_START_STOP_UNIT, data);
 }
 
-int scsi_cmd_ioctl(struct file *file, struct gendisk *bd_disk, unsigned int 
cmd, void __user *arg)
+int scsi_cmd_ioctl(struct file *file, struct request_queue *q,
+  struct gendisk *bd_disk, unsigned int cmd, void __user *arg)
 {
-   request_queue_t *q;
int err;
 
-   q = bd_disk->queue;
-   if (!q)
-   return -ENXIO;
-
-   if (blk_get_queue(q))
+   if (!q || blk_get_queue(q))
return -ENXIO;
 
switch (cmd) {
diff --git a/drivers/block/ub.c b/drivers/block/ub.c
index 2098eff..20bdbbf 100644
--- a/drivers/block/ub.c
+++ b/drivers/block/ub.c
@@ -1713,7 +1713,7 @@ static int ub_bd_ioctl(struct inode *ino
struct gendisk *disk = inode->i_bdev->bd_disk;
void __user *usermem = (void __user *) arg;
 
-   return scsi_cmd_ioctl(filp, disk, cmd, usermem);
+   return scsi_cmd_ioctl(filp, disk->queue, disk, cmd, usermem);
 }
 
 /*
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index 3105ddd..ef51aac 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -2695,11 +2695,12 @@ int cdrom_ioctl(struct file * file, stru
 {
void __user *argp = (void __user *)arg;
int ret;
+   struct gendisk *disk = ip->i_bdev->bd_disk;
 
/*
 * Try the generic SCSI command ioctl's first.
 */
-   ret = scsi_cmd_ioctl(file, ip->i_bdev->bd_disk, cmd, argp);
+   ret = scsi_cmd_ioctl(file, disk->queue, disk, cmd, argp);
if (ret != -ENOTTY)
return ret;
 
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index e260259..d51212c 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -1277,7 +1277,7 @@ int generic_ide_ioctl(ide_drive_t *drive
void __user *p = (void __user *)arg;
int err;
 
-   err = scsi_cmd_ioctl(file, bdev->bd_disk, cmd, p);
+   err = scsi_cmd_ioctl(file, bdev->bd_disk->queue, bdev->bd_disk, cmd, p);
if (err != -ENOTTY)
return err;
 
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index b781a90..63d6eef 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -705,7 +705,7 @@ static int sd_ioctl(struct inode * inode
case SCSI_IOCTL_GET_BUS_NUMBER:
return scsi_ioctl(sdp, cmd, p);
default:
-   error = scsi_cmd_ioctl(filp, disk, cmd, p);
+   error = scsi_cmd_ioctl(filp, disk->queue, disk, cmd, p);
if (error != -ENOTTY)
return error;
}
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 3d2e023..d92384f 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -3548,7 +3548,8 @@ static int st_ioctl(struct inode *inode,
!capable(CAP_SYS_RAWIO))
i = -EPERM;
else
-   i = scsi_cmd_ioctl(file, STp->disk, cmd_in, p);
+   i = scsi_cmd_ioctl(file, STp->disk->queue,
+  STp->disk, cmd_in, p);
if (i != -ENOTTY)
return i;
break;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index aa000d2..6370d44 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -643,7 +643,8 @@ extern void blk_requeue_request(request_
 extern void blk_plug

[PATCH 3/3] bind bsg to all SCSI devices

2007-03-20 Thread FUJITA Tomonori
This patch binds bsg to all SCSI devices (their request queues) like
the current sg driver does. We can send SCSI commands to non disk and
cdrom scsi devices like OSD via bsg.

This patch removes bsg_register_queue from blk_register_queue so bsg
devices aren't bound to non SCSI block devices. If they want bsg, I'll
send a patch to do that.

Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]>
---
 block/bsg.c   |   59 ++--
 block/ll_rw_blk.c |8 ---
 2 files changed, 52 insertions(+), 15 deletions(-)

diff --git a/block/bsg.c b/block/bsg.c
index 4ea4bed..cd0221c 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -29,6 +29,8 @@ #include 
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 
 static char bsg_version[] = "block layer sg (bsg) 0.4";
@@ -962,6 +964,8 @@ int bsg_register_queue(struct request_qu
 {
struct bsg_class_device *bcd;
dev_t dev;
+   int ret;
+   struct class_device *class_dev = NULL;
 
/*
 * we need a proper transport to send commands, not a stacked device
@@ -978,22 +982,54 @@ int bsg_register_queue(struct request_qu
bcd->minor = bsg_device_nr;
bsg_device_nr++;
bcd->queue = q;
-   bcd->class_dev = class_device_create(bsg_class, NULL, dev, bcd->dev, 
"%s", name);
-   if (!bcd->class_dev)
+   class_dev = class_device_create(bsg_class, NULL, dev, bcd->dev, "%s", 
name);
+   if (IS_ERR(class_dev)) {
+   ret = PTR_ERR(class_dev);
goto err;
+   }
+   bcd->class_dev = class_dev;
+
+   if (q->kobj.dentry) {
+   ret = sysfs_create_link(&q->kobj, &bcd->class_dev->kobj, "bsg");
+   if (ret)
+   goto err;
+   }
+
list_add_tail(&bcd->list, &bsg_class_list);
-   if (sysfs_create_link(&q->kobj, &bcd->class_dev->kobj, "bsg"))
-   goto err;
+
mutex_unlock(&bsg_mutex);
return 0;
 err:
bsg_device_nr--;
-   if (bcd->class_dev)
+   if (class_dev)
class_device_destroy(bsg_class, MKDEV(BSG_MAJOR, bcd->minor));
mutex_unlock(&bsg_mutex);
-   return -ENOMEM;
+   return ret;
+}
+
+static int bsg_add(struct class_device *cl_dev, struct class_interface 
*cl_intf)
+{
+   int ret;
+   struct scsi_device *sdp = to_scsi_device(cl_dev->dev);
+   struct request_queue *rq = sdp->request_queue;
+
+   if (rq->kobj.parent)
+   ret = bsg_register_queue(rq, kobject_name(rq->kobj.parent));
+   else
+   ret = bsg_register_queue(rq, 
kobject_name(&sdp->sdev_gendev.kobj));
+   return ret;
 }
 
+static void bsg_remove(struct class_device *cl_dev, struct class_interface 
*cl_intf)
+{
+   bsg_unregister_queue(to_scsi_device(cl_dev->dev)->request_queue);
+}
+
+static struct class_interface bsg_intf = {
+   .add= bsg_add,
+   .remove = bsg_remove,
+};
+
 static int __init bsg_init(void)
 {
int ret, i;
@@ -1021,6 +1057,15 @@ static int __init bsg_init(void)
return ret;
}
 
+   ret = scsi_register_interface(&bsg_intf);
+   if (ret) {
+   printk(KERN_ERR "bsg: failed register scsi interface %d\n", 
ret);
+   kmem_cache_destroy(bsg_cmd_cachep);
+   class_destroy(bsg_class);
+   unregister_chrdev(BSG_MAJOR, "bsg");
+   return ret;
+   }
+
printk(KERN_INFO "%s loaded\n", bsg_version);
return 0;
 }
@@ -1029,4 +1074,4 @@ MODULE_AUTHOR("Jens Axboe");
 MODULE_DESCRIPTION("Block layer SGSI generic (sg) driver");
 MODULE_LICENSE("GPL");
 
-subsys_initcall(bsg_init);
+device_initcall(bsg_init);
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index fccc3a1..38c293b 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -4038,13 +4038,6 @@ int blk_register_queue(struct gendisk *d
return ret;
}
 
-   ret = bsg_register_queue(q, disk->disk_name);
-   if (ret) {
-   elv_unregister_queue(q);
-   kobject_unregister(&q->kobj);
-   return ret;
-   }
-
return 0;
 }
 
@@ -4053,7 +4046,6 @@ void blk_unregister_queue(struct gendisk
request_queue_t *q = disk->queue;
 
if (q && q->request_fn) {
-   bsg_unregister_queue(q);
elv_unregister_queue(q);
 
kobject_uevent(&q->kobj, KOBJ_REMOVE);
-- 
1.4.3.2

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Kernel 2.6.20 does not work anymore with SCSI or SATA on old Opteron / Xeon servers

2007-03-20 Thread Stefan Priebe

Hello!

With the sysrq i've found the function with is the problem:
inode.c => nfs_getattr => nfs_sync_mapping_range

I've also found the attached patch - which is not included in any stable 
release nor in 2.6.21.X but is public since 20.02.07


I think this is very important.

Stefan Priebe
commit 090ad38f8ceea3cc048981e9fe9cc62ed43fee58
Author: Trond Myklebust <[EMAIL PROTECTED]>
Date:   Tue Feb 20 19:28:07 2007 -0500

NFS: nfs_getattr() can't call nfs_sync_mapping_range() for non-regular files

Signed-off-by: Trond Myklebust <[EMAIL PROTECTED]>

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index af53c02..93d046c 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -429,7 +429,8 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry 
*dentry, struct kstat *stat)
int err;
 
/* Flush out writes to the server in order to update c/mtime */
-   nfs_sync_mapping_range(inode->i_mapping, 0, 0, FLUSH_NOCOMMIT);
+   if (S_ISREG(inode->i_mode))
+   nfs_sync_mapping_range(inode->i_mapping, 0, 0, FLUSH_NOCOMMIT);
 
/*
 * We may force a getattr if the user cares about atime.


Re: Kernel 2.6.20 does not work anymore with SCSI or SATA on old Opteron / Xeon servers

2007-03-20 Thread Stefan Priebe

>  - on a 2.6.20 system, try "dd if=/dev/sdb of=/dev/null bs=4k count=1" or
>something like this (with NFS root) - does this crash, too?
no it does not crash it is also no problem to set the count= to 1 or 
so or change the bs to 16k ...


>  - do you have ACLs on files in /dev?
no

>  - enable the sysrq key, make sure kernel messages go to the console
>by using "dmesg -n7", and when the kernel hangs, try sysrq-p, and
>sysrq-t
>(sysrq is documented in Documation/sysrq.txt in the kernel source)
>  - try to capture the oops message - there must be one.

OK i've done the following:
1.) I've set up netconsole
2.) dmesg -n7
3.) fdisk /dev/sda
4.) sysrq-t / sysrq-p

So here is the output of -p and -t it hangs at nfs_sync_mapping_wait:
SysRq : Show Regs

Pid: 1598, comm:fdisk
EIP: 0060:[] CPU: 0
EIP is at _spin_lock+0x7/0xf
 EFLAGS: 0286Not tainted  (2.6.20.3 #6)
EAX: c3117afc EBX: c3117a2c ECX: 0020 EDX: 
ESI: f7b63ed4 EDI: f7b63f04 EBP: f7b63edc DS: 007b ES: 007b GS: 00d8
CR0: 8005003b CR2: b7f00f90 CR3: 033ea000 CR4: 06d0
 [] nfs_sync_mapping_wait+0x83/0x1aa
 [] cache_alloc_refill+0xc8/0x196
 [] nfs_sync_mapping_range+0x97/0xb6
 [] nfs_getattr+0x3a/0x96
 [] nfs_getattr+0x0/0x96
 [] vfs_getattr+0x21/0x30
 [] vfs_fstat+0x22/0x31
 [] sys_fstat64+0xf/0x23
 [] sys_ioctl+0x33/0x4b
 [] do_page_fault+0x0/0x549
 [] syscall_call+0x7/0xb
 [] call_verify+0x182/0x36f
 ===




SysRq : Show State

 freesibling
  task PCstack   pid father child younger older
init  S C0117721 0 1  0 2   (NOTLB)
   c313fc48 0082 c312fa90 c0117721 00100100 00200200 f7da9600 
f7941e40
   0010 c313fc04 0008 0002 c3022700 c312fa90 c312fb9c 
08dd
   64bf803e 0029 c312f030 c313fc90  c30013c0 c03b3515 
c03b352f

Call Trace:
 [] default_wake_function+0x0/0xc
 [] rpc_wait_bit_interruptible+0x0/0x1f
 [] rpc_wait_bit_interruptible+0x1a/0x1f
 [] __wait_on_bit+0x2c/0x51
 [] rpc_wait_bit_interruptible+0x0/0x1f
 [] out_of_line_wait_on_bit+0x73/0x7b
 [] wake_bit_function+0x0/0x3c
 [] wake_bit_function+0x0/0x3c
 [] __rpc_execute+0xdb/0x18b
 [] rpc_set_active+0x19/0x57
 [] rpc_call_sync+0x71/0x98
 [] nfs_proc_getattr+0x5b/0x7f
 [] __nfs_revalidate_inode+0xe7/0x21a
 [] nfs_permission+0x0/0x133
 [] nfs_permission+0x0/0x133
 [] nfs_permission+0x112/0x133
 [] nfs_permission+0x0/0x133
 [] permission+0x94/0xa2
 [] __link_path_walk+0x6c/0xa59
 [] __alloc_pages+0x4a/0x2a3
 [] link_path_walk+0x3f/0xa4
 [] do_path_lookup+0x170/0x18b
 [] __user_walk_fd+0x2d/0x43
 [] vfs_stat_fd+0x19/0x40
 [] sys_stat64+0xf/0x23
 [] copy_to_user+0x2f/0x37
 [] do_gettimeofday+0x35/0x119
 [] sys_time+0x1e/0x2e
 [] syscall_call+0x7/0xb
 ===
ksoftirqd/0   S C33442C0 0 3  1 4 2 (L-TLB)
   c3149fb8 0046 c013cd73 c33442c0  c30131e0 0003 
f7931900
   c301321c  c33f5030  c3012700 c3136030 c313613c 
01d9
   a733fbbd 0004 c04a8cc0 c0539380 c0539380 c0120494 fffc 
c01204d6

Call Trace:
 [] mempool_free+0x65/0x6a
 [] ksoftirqd+0x0/0xa7
 [] ksoftirqd+0x42/0xa7
 [] kthread+0x72/0x96
 [] kthread+0x0/0x96
 [] kernel_thread_helper+0x7/0x10
 ===
migration/1   S F745BF24 0 4  1 5 3 (L-TLB)
   c314bfb0 0046 0092 f745bf24 0001 f745bf70 c314bf94 
f7ab03c0
    0001 f745bf74 0001 c301a700 c3139a90 c3139b9c 
23c5
   b7d09ccb 0004 c312f560 c301b054 c301a700 0001 c314bfc4 
c0118643

Call Trace:
 [] migration_thread+0x7a/0xd2
 [] migration_thread+0x0/0xd2
 [] kthread+0x72/0x96
 [] kthread+0x0/0x96
 [] kernel_thread_helper+0x7/0x10
 ===
ksoftirqd/1   S C301B1A0 0 5  1 6 4 (L-TLB)
   c316ffb8 0046  c301b1a0 0008 c012a884 c301b1e0 
f7f39040
   c012aa25 c301b21c  0001 c301a700 c3139560 c313966c 
0c4f
   48c808e9 0004 c312f560 c0539380 c0539380 c0120494 fffc 
c01204d6

Call Trace:
 [] rcu_do_batch+0x1a/0x7f
 [] __rcu_process_callbacks+0x8f/0xa1
 [] ksoftirqd+0x0/0xa7
 [] ksoftirqd+0x42/0xa7
 [] kthread+0x72/0x96
 [] kthread+0x0/0x96
 [] kernel_thread_helper+0x7/0x10
 ===
migration/2   S F7B63F24 0 6  1 7 5 (L-TLB)
   c3171fb0 0046 0092 f7b63f24 0001 f7b63f70 c3171f94 
f79703c0
    0001 f7b63f74 0002 c3022700 c3139030 c313913c 
11f0
   482d3411 0022 c312f030 c3023054 c3022700 0002 c3171fc4 
c0118643

Call Trace:
 [] migration_thread+0x7a/0xd2
 [] migration_thread+0x0/0xd2
 [] kthread+0x72/0x96
 [] kthread+0x0/0x96
 [] kernel_thread_helper+0x7/0x10
 ===
ksoftirqd/2   S C324D780 0 7  1 8 6 (L-TLB)
   c3175fb8 0046 c013cd73 c324d780  c30231e0 0

Re: Kernel 2.6.20 does not work anymore with SCSI or SATA on old Opteron / Xeon servers

2007-03-20 Thread Stefan Priebe

Hello!

Here a some more information:
- sometimes the whole systems crash - sometimes they are still alive
- if they are alive fdisk consumes 99% CPU
- fdisk cannot be killed also not with kill -9
- the same happens with a cat on /dev/sdX
- no problem when trying to access /dev/hdX

Stefan

Olaf Kirch schrieb:

On Tuesday 20 March 2007 11:33, Stefan Priebe wrote:

1.) I've bootet these systems through NFS and would like to access
/dev/sda or /dev/sdb then. For example via fdisk and this does not work.


What do you mean by "booted through NFS"? Do you mean the machine
runs with the root file system mounted via NFS? Or does it mean you
booted, and started the NFS server?

Olaf


-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Kernel 2.6.20 does not work anymore with SCSI or SATA on old Opteron / Xeon servers

2007-03-20 Thread Stefan Priebe

Hello!

It runs with nfsroot

# mount
192.168.0.100:/PXE/debian on / type nfs (rw)

Kernel command line: nfs root=/dev/nfs nfsroot=192.168.0.100:/PXE/debian 
ip=dhcp


Stefan

Olaf Kirch schrieb:

On Tuesday 20 March 2007 11:33, Stefan Priebe wrote:

1.) I've bootet these systems through NFS and would like to access
/dev/sda or /dev/sdb then. For example via fdisk and this does not work.


What do you mean by "booted through NFS"? Do you mean the machine
runs with the root file system mounted via NFS? Or does it mean you
booted, and started the NFS server?

Olaf


-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Kernel 2.6.20 does not work anymore with SCSI or SATA on old Opteron / Xeon servers

2007-03-20 Thread Olaf Kirch
On Tuesday 20 March 2007 11:33, Stefan Priebe wrote:
> 1.) I've bootet these systems through NFS and would like to access
> /dev/sda or /dev/sdb then. For example via fdisk and this does not work.

What do you mean by "booted through NFS"? Do you mean the machine
runs with the root file system mounted via NFS? Or does it mean you
booted, and started the NFS server?

Olaf
-- 
Olaf Kirch  |  --- o --- Nous sommes du soleil we love when we play
[EMAIL PROTECTED] |/ | \   sol.dhoop.naytheet.ah kin.ir.samse.qurax
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Kernel 2.6.20 does not work anymore with SCSI or SATA on old Opteron / Xeon servers

2007-03-20 Thread Stefan Priebe

Hello!

Here are more informations... the problem seems to be a little bit more 
special.


1.) I've bootet these systems through NFS and would like to access 
/dev/sda or /dev/sdb then. For example via fdisk and this does not work.


2.) I've now tested the following kernels -
2.6.18.8 - works
2.6.19.7 - works
2.6.20 - does not work
2.6.21-rc4 - does not work

3.) The funny thing is, i can boot the whole system via 2.6.18.8 for 
example - fdisk the harddisk and format it + plus copying the whole 
image with a 2.6.20.3 kernel - and then the Server installied works 
perfectly i also can fdisk /dev/sdb or so. It only does not work if the 
system itself is bootet via NFS...


Stefan

Andrew Morton schrieb:

On Sun, 18 Mar 2007 21:50:46 +0100 Stefan Priebe <[EMAIL PROTECTED]> wrote:


Hello!

We've a very strange Problem with Kernel 2.6.20.x

If i try to access a SCSI or SATA Disk (tested with Adaptec U320 
ASC-29320, ICP Vortex 9024, Promise TX300) the whole server hangs - no 
output - no error on the screen - but it hangs completely. But it does 
not happen on all our systems affected are only old 604pin xeons and 
socket 940 Opterons. Socket F Opteron or 771 Xeons does work fine.


I've also testet apci=off pci=routeirq but both does not help. The 
systems work fine with 2.6.19.x and before.


Well that's a bit sad.

Could you please set up netconsole
(Documentation/networking/netconsole.txt) and add initcall_debug to the
kernel boot command line and then send us the full bootup logs?

(Even better: serial console with earlyprintk).

If that doesn't shed any light, we might have to ask you to perform a
git-bisect search to find the buggy commit, I'm afraid.


-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html