Re: 2.6.24-rc3-mm1

2007-12-14 Thread Hannes Reinecke
James Bottomley wrote:
 On Mon, 2007-11-26 at 22:15 -0800, Andrew Morton wrote:
 OK, thanks.  I'll assume that James and Hannes have this in hand (or will
 have, by mid-week) and I won't do anything here.
 
 Just to confirm what I think I'm going to be doing:  rebasing the
 scsi-misc tree to remove this commit:
 
 commit 8655a546c83fc43f0a73416bbd126d02de7ad6c0
 Author: Hannes Reinecke [EMAIL PROTECTED]
 Date:   Tue Nov 6 09:23:40 2007 +0100
 
 [SCSI] Do not requeue requests if REQ_FAILFAST is set
 
 And its allied fix ups:
 
 commit 983289045faa96fba8841d3c51b98bb8623d9504
 Author: James Bottomley [EMAIL PROTECTED]
 Date:   Sat Nov 24 19:47:25 2007 +0200
 
 [SCSI] fix up REQ_FASTFAIL not to fail when state is QUIESCE
 
 commit 9dd15a13b332e9f5c8ee752b1ccd9b84cb5bdf17
 Author: James Bottomley [EMAIL PROTECTED]
 Date:   Sat Nov 24 19:55:53 2007 +0200
 
 [SCSI] fix domain validation to work again
 
 James
 
 
Or just apply my latest patch (cf Undo __scsi_kill_request).
The main point is that we shouldn't retry requests
with FAILFAST set when the queue is blocked. AFAICS
only FC and iSCSI transports set the queue to blocked,
and use this to indicate a loss of connection. So any
retry with queue blocked is futile.

Cheers,

Hannes

-- 
Dr. Hannes Reinecke   zSeries  Storage
[EMAIL PROTECTED] +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)
-
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 18/30] scsi/qla2xxx/: possible cleanups

2007-12-14 Thread Andrew Morton
On Fri, 14 Dec 2007 07:37:24 -0800 Andrew Vasquez [EMAIL PROTECTED] wrote:

 On Thu, 13 Dec 2007, [EMAIL PROTECTED] wrote:
 
  From: Adrian Bunk [EMAIL PROTECTED]
  
  - make the following needlessly global code static:
- qla_attr.c: qla24xx_vport_delete()
- qla_attr.c: qla24xx_vport_disable()
- qla_mid.c: qla24xx_allocate_vp_id()
- qla_mid.c: qla24xx_find_vhost_by_name()
- qla_mid.c: qla2x00_do_dpc_vp()
- qla_os.c: struct qla2x00_driver_template
- qla_os.c: qla2x00_stop_timer()
- qla_os.c: qla2x00_mem_alloc()
- qla_os.c: qla2x00_mem_free()
- qla_sup.c: qla2x00_lock_nvram_access()
- qla_sup.c: qla2x00_unlock_nvram_access()
- qla_sup.c: qla2x00_get_nvram_word()
- qla_sup.c: qla2x00_write_nvram_word()
  - #if 0 the following unused global functions:
- qla_dbg.c: qla2x00_dump_pkt()
- qla_mbx.c: qla2x00_system_error()
- qla_mbx.c: qla2x00_get_serdes_params()
- qla_mbx.c: qla2x00_get_idma_speed()
- qla_mbx.c: qla24xx_get_vp_database()
- qla_mbx.c: qla24xx_get_vp_entry()
  - qla_os.c: remove some unneeded function prototypes
  
  Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
  Cc: Andrew Vasquez [EMAIL PROTECTED]
  Signed-off-by: Andrew Morton [EMAIL PROTECTED]
 
 Andrew,
 
 Could you drop this patch from your queue.  I'll carry it in my tree
 (along with additional code removals) for 2.6.25 submission.
 

I'll normally carry patches until they turn up in a subsystem tree or
mainline and will drop them then.  To minimise potential of lossage..

Is your tree publically accessible?
-
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] fix page_alloc for larger I/O segments (improved)

2007-12-14 Thread Mel Gorman
On (13/12/07 19:46), Mark Lord didst pronounce:
 
 Improved version, more similar to the 2.6.23 code:
 
 Fix page allocator to give better chance of larger contiguous segments 
 (again).
 
 Signed-off-by: Mark Lord [EMAIL PROTECTED]

Regrettably this interferes with anti-fragmentation because the next page
on the list on return from rmqueue_bulk is not guaranteed to be of the right
mobility type. I fixed it as an additional patch but it adds additional cost
that should not be necessary and it's visible in microbenchmark results on
at least one machine.

The following patch should fix the page ordering problem without incurring an
additional cost or interfering with anti-fragmentation. However, I haven't
anything in place yet to verify that the physical page ordering is correct
but it makes sense. Can you verify it fixes the problem please?

It'll still be some time before I have a full set of performance results
but initially at least, this fix seems to avoid any impact.

==
Subject: Fix page allocation for larger I/O segments

In some cases the IO subsystem is able to merge requests if the pages are
adjacent in physical memory. This was achieved in the allocator by having
expand() return pages in physically contiguous order in situations were
a large buddy was split. However, list-based anti-fragmentation changed
the order pages were returned in to avoid searching in buffered_rmqueue()
for a page of the appropriate migrate type.

This patch restores behaviour of rmqueue_bulk() preserving the physical order
of pages returned by the allocator without incurring increased search costs for
anti-fragmentation.

Signed-off-by: Mel Gorman [EMAIL PROTECTED]
--- 
 page_alloc.c |   11 +++
 1 file changed, 11 insertions(+)

diff -rup -X /usr/src/patchset-0.6/bin//dontdiff 
linux-2.6.24-rc5-clean/mm/page_alloc.c 
linux-2.6.24-rc5-giveback-physorder-listmove/mm/page_alloc.c
--- linux-2.6.24-rc5-clean/mm/page_alloc.c  2007-12-14 11:55:13.0 
+
+++ linux-2.6.24-rc5-giveback-physorder-listmove/mm/page_alloc.c
2007-12-14 15:33:12.0 +
@@ -847,8 +847,19 @@ static int rmqueue_bulk(struct zone *zon
struct page *page = __rmqueue(zone, order, migratetype);
if (unlikely(page == NULL))
break;
+
+   /*
+* Split buddy pages returned by expand() are received here
+* in physical page order. The page is added to the callers and
+* list and the list head then moves forward. From the callers
+* perspective, the linked list is ordered by page number in
+* some conditions. This is useful for IO devices that can
+* merge IO requests if the physical pages are ordered
+* properly.
+*/
list_add(page-lru, list);
set_page_private(page, migratetype);
+   list = page-lru;
}
spin_unlock(zone-lock);
return i;
-
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] sym53c8xx: fix irq X: nobody cared regression in 2.6.24

2007-12-14 Thread Tony Battersby
The patch described by the following excerpt from ChangeLog-2.6.24-rc1
eventually causes a irq X: nobody cared error after a while:

commit 99c9e0a1d6cfe1ba1169a7a81435ee85bc00e4a1
Author: Matthew Wilcox [EMAIL PROTECTED]
Date:   Fri Oct 5 15:55:12 2007 -0400

[SCSI] sym53c8xx: Make interrupt handler capable of returning IRQ_NONE

After this happens, the kernel disables the IRQ, causing the SCSI card
to stop working until the next reboot.  The problem is caused by the
interrupt handler returning IRQ_NONE instead of IRQ_HANDLED after
handling an interrupt-on-the-fly (INTF) condition.  The following patch
fixes the problem.

Signed-off-by: Tony Battersby [EMAIL PROTECTED]
---

James, please queue for scsi-rc-fixes-2.6.  Thanks!

--- linux-2.6.24-rc5-git3/drivers/scsi/sym53c8xx_2/sym_hipd.c.orig  
2007-12-14 15:07:09.0 -0500
+++ linux-2.6.24-rc5-git3/drivers/scsi/sym53c8xx_2/sym_hipd.c   2007-12-14 
15:07:31.0 -0500
@@ -2791,7 +2791,7 @@ irqreturn_t sym_interrupt(struct Scsi_Ho
istat = INB(np, nc_istat);
if (istat  INTF) {
OUTB(np, nc_istat, (istat  SIGP) | INTF | np-istat_sem);
-   istat = INB(np, nc_istat);  /* DUMMY READ */
+   istat |= INB(np, nc_istat); /* DUMMY READ */
if (DEBUG_FLAGS  DEBUG_TINY) printf (F );
sym_wakeup_done(np);
}


-
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] [SCSI] sym53c8xx: fix irq X: nobody cared regression in 2.6.24

2007-12-14 Thread Matthew Wilcox
On Fri, Dec 14, 2007 at 03:45:16PM -0500, Tony Battersby wrote:
 After this happens, the kernel disables the IRQ, causing the SCSI card
 to stop working until the next reboot.  The problem is caused by the
 interrupt handler returning IRQ_NONE instead of IRQ_HANDLED after
 handling an interrupt-on-the-fly (INTF) condition.  The following patch
 fixes the problem.
 
 Signed-off-by: Tony Battersby [EMAIL PROTECTED]

Acked-by: Matthew Wilcox [EMAIL PROTECTED]

-- 
Intel are signing my paycheques ... these opinions are still mine
Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step.
-
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/3] cciss: version change to 3.6.18

2007-12-14 Thread Mike Miller
Patch 3 of 3

This patch bumps the driver version to 3.6.18 to reflect support for the
P700m. This matches the HP released driver version for hardware support.
Please consider this for inclusion.

Signed-off-by: Mike Miller [EMAIL PROTECTED]

diff --git a/Documentation/cciss.txt b/Documentation/cciss.txt
index e65736c..0467639 100644
--- a/Documentation/cciss.txt
+++ b/Documentation/cciss.txt
@@ -21,6 +21,7 @@ This driver is known to work with the following cards:
* SA E200
* SA E200i
* SA E500
+   * SA P700m
 
 Detecting drive failures:
 -
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index cd5ef4a..7a0b28b 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -51,15 +51,15 @@
 #include linux/cdrom.h
 
 #define CCISS_DRIVER_VERSION(maj,min,submin) ((maj16)|(min8)|(submin))
-#define DRIVER_NAME HP CISS Driver (v 3.6.14)
-#define DRIVER_VERSION CCISS_DRIVER_VERSION(3,6,14)
+#define DRIVER_NAME HP CISS Driver (v 3.6.18)
+#define DRIVER_VERSION CCISS_DRIVER_VERSION(3,6,18)
 
 /* Embedded module documentation macros - see modules.h */
 MODULE_AUTHOR(Hewlett-Packard Company);
-MODULE_DESCRIPTION(Driver for HP Controller SA5xxx SA6xxx version 3.6.14);
+MODULE_DESCRIPTION(Driver for HP Controller SA5xxx SA6xxx version 3.6.18);
 MODULE_SUPPORTED_DEVICE(HP SA5i SA5i+ SA532 SA5300 SA5312 SA641 SA642 SA6400
-SA6i P600 P800 P400 P400i E200 E200i E500);
-MODULE_VERSION(3.6.14);
+SA6i P600 P800 P400 P400i E200 E200i E500 P700m);
+MODULE_VERSION(3.6.18);
 MODULE_LICENSE(GPL);
 
 #include cciss_cmd.h
-
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] cciss: change information displayed in /proc/drivers/cciss

2007-12-14 Thread Mike Miller
Patch 2 of 3

This patch modifies our /proc entries to display information about only
the first logical volume on each controller. Primary reason is for hardware
that can support many LUNs (128 or more). In this case we can step on memory
and crash the system trying to display so much information. Users will have
to find information about other LUNs in /sys/block rather than /proc/drivers.
Also took the liberty of making some formatting changes to eliminate a bunch
of white spaces while I was in that part of the code.
Hardware to support this many LUNs should be available in March 2008.
Please consider this for inclusion.

Signed-off-by: Mike Miller [EMAIL PROTECTED]

diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 54080e6..cd5ef4a 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -716,7 +716,7 @@ static int cciss_proc_get_info(char *buffer, char **start, 
off_t offset,
 {
off_t pos = 0;
off_t len = 0;
-   int size, i, ctlr;
+   int size, ctlr;
ctlr_info_t *h = (ctlr_info_t *) data;
drive_info_struct *drv;
unsigned long flags;
@@ -736,50 +736,47 @@ static int cciss_proc_get_info(char *buffer, char 
**start, off_t offset,
spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags);
 
size = sprintf(buffer, %s: HP %s Controller\n
-  Board ID: 0x%08lx\n
-  Firmware Version: %c%c%c%c\n
-  IRQ: %d\n
-  Logical drives: %d\n
-  Max sectors: %d\n
-  Current Q depth: %d\n
-  Current # commands on controller: %d\n
-  Max Q depth since init: %d\n
-  Max # commands on controller since init: %d\n
-  Max SG entries since init: %d\n\n,
-  h-devname,
-  h-product_name,
-  (unsigned long)h-board_id,
-  h-firm_ver[0], h-firm_ver[1], h-firm_ver[2],
-  h-firm_ver[3], (unsigned int)h-intr[SIMPLE_MODE_INT],
-  h-num_luns,
-  h-cciss_max_sectors,
-  h-Qdepth, h-commands_outstanding,
-  h-maxQsinceinit, h-max_outstanding, h-maxSG);
-
-   pos += size;
-   len += size;
+   Board ID: 0x%08lx\n
+   Firmware Version: %c%c%c%c\n
+   IRQ: %d\n
+   Max sectors: %d\n
+   Current Q depth: %d\n
+   Current # commands on controller: %d\n
+   Max Q depth since init: %d\n
+   Max # commands on controller since init: %d\n
+   Max SG entries since init: %d\n
+   Logical drives: %d\n\n,
+   h-devname,
+   h-product_name,
+   (unsigned long)h-board_id,
+   h-firm_ver[0], h-firm_ver[1], h-firm_ver[2],
+   h-firm_ver[3], (unsigned int)h-intr[SIMPLE_MODE_INT],
+   h-cciss_max_sectors,
+   h-Qdepth, h-commands_outstanding,
+   h-maxQsinceinit, h-max_outstanding,
+   h-maxSG, h-num_luns);
+
+   pos += size; len += size;
cciss_proc_tape_report(ctlr, buffer, pos, len);
-   for (i = 0; i = h-highest_lun; i++) {
-
-   drv = h-drv[i];
-   if (drv-heads == 0)
-   continue;
-
-   vol_sz = drv-nr_blocks;
-   vol_sz_frac = sector_div(vol_sz, ENG_GIG_FACTOR);
-   vol_sz_frac *= 100;
-   sector_div(vol_sz_frac, ENG_GIG_FACTOR);
+   drv = h-drv[0];
+   vol_sz = drv-nr_blocks;
+   vol_sz_frac = sector_div(vol_sz, ENG_GIG_FACTOR);
+   vol_sz_frac *= 100;
+   sector_div(vol_sz_frac, ENG_GIG_FACTOR);
 
-   if (drv-raid_level  5)
-   drv-raid_level = RAID_UNKNOWN;
-   size = sprintf(buffer + len, cciss/c%dd%d:
+   if (drv-raid_level  5)
+   drv-raid_level = RAID_UNKNOWN;
+   if (drv-heads) {
+   size = sprintf(buffer + len, cciss/c%dd0:
   \t%4u.%02uGB\tRAID %s\n,
-  ctlr, i, (int)vol_sz, (int)vol_sz_frac,
+  ctlr, (int)vol_sz, (int)vol_sz_frac,
   raid_label[drv-raid_level]);
-   pos += size;
-   len += size;
+   pos += size; len += size;
}
+   size = sprintf(buffer + len, For information about other logical
+volumes see /sys/block/cciss!c%dd*\n, ctlr);
 
+   pos += size; len += size;
*eof = 1;
*start = buffer + offset;
len -= offset;
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a 

[PATCH 1/3] cciss: export more attributes to sysfs (repost)

2007-12-14 Thread Mike Miller
Patch 1 of 3

Sorry to take so long to repost.

This patch exports more attributes to /sys so we can work work better with
udev. Some distros use unique_id among other attributes. This patch attempts
to provide that and other attributes to reveal more information about cciss
devices in /sys. It's also an effort to be more sysfs friendly.
Please consider this for inclusion.

Signed-off-by: Mike Miller

diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 7d70496..54080e6 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -229,20 +229,485 @@ static inline CommandList_struct 
*removeQ(CommandList_struct **Qptr,
return c;
 }
 
+static inline int find_drv_index(int ctlr, drive_info_struct *drv){
+int i;
+for (i=0; i  CISS_MAX_LUN; i++) {
+if (hba[ctlr]-drv[i].LunID == drv-LunID)
+return i;
+}
+return i;
+}
+
 #include cciss_scsi.c/* For SCSI tape support */
 
+#define ENG_GIG 10
+#define ENG_GIG_FACTOR (ENG_GIG/512)
 #define RAID_UNKNOWN 6
+static const char *raid_label[] = { 0, 4, 1(1+0), 5, 5+1, ADG,
+   UNKNOWN};
+
+
+static spinlock_t sysfs_lock = SPIN_LOCK_UNLOCKED;
+
+static void cciss_sysfs_stat_inquiry(int ctlr, int logvol,
+   int withirq, drive_info_struct *drv)
+{
+   int return_code;
+   InquiryData_struct *inq_buff;
+
+   /* If there are no heads then this is the controller disk and
+* not a valid logical drive so don't query it.
+*/
+   if (!drv-heads)
+   return;
+
+   inq_buff = kzalloc(sizeof(InquiryData_struct), GFP_KERNEL);
+   if (!inq_buff) {
+   printk(KERN_ERR cciss: out of memory\n);
+   goto err;
+   }
+
+   if (withirq)
+   return_code = sendcmd_withirq(CISS_INQUIRY, ctlr,
+   inq_buff, sizeof(*inq_buff), 1, logvol ,0, TYPE_CMD);
+   else
+   return_code = sendcmd(CISS_INQUIRY, ctlr, inq_buff,
+   sizeof(*inq_buff), 1, logvol , 0, NULL, TYPE_CMD);
+   if (return_code == IO_OK) {
+   memcpy(drv-vendor, inq_buff-data_byte[8], 8);
+   drv-vendor[8]='\0';
+   memcpy(drv-model, inq_buff-data_byte[16], 16);
+   drv-model[16] = '\0';
+   memcpy(drv-rev, inq_buff-data_byte[32], 4);
+   drv-rev[4] = '\0';
+   } else { /* Get geometry failed */
+   printk(KERN_WARNING cciss: inquiry for VPD page 0 failed\n);
+   }
+
+   if (withirq)
+   return_code = sendcmd_withirq(CISS_INQUIRY, ctlr,
+   inq_buff, sizeof(*inq_buff), 1, logvol ,0x83, TYPE_CMD);
+   else
+   return_code = sendcmd(CISS_INQUIRY, ctlr, inq_buff,
+   sizeof(*inq_buff), 1, logvol , 0x83, NULL, TYPE_CMD);
+
+   if (return_code == IO_OK) {
+   memcpy(drv-uid, inq_buff-data_byte[8], 16);
+   } else { /* Get geometry failed */
+   printk(KERN_WARNING cciss: inquiry for VPD page 83 failed\n);
+   }
+
+   kfree(inq_buff);
+err:
+   drv-vendor[8] = '\0';
+   drv-model[16] = '\0';
+   drv-rev[4] = '\0';
+
+}
+
+static ssize_t cciss_show_raid_level(struct device *dev,
+struct device_attribute *attr, char *buf)
+{
+   struct drv_dynamic *d;
+   drive_info_struct *drv;
+   ctlr_info_t *h;
+   unsigned long flags;
+   int raid;
+
+   d = container_of(dev, struct drv_dynamic, dev);
+   spin_lock(sysfs_lock);
+   if (!d-disk) {
+   spin_unlock(sysfs_lock);
+   return -ENOENT;
+   }
+
+   h = get_host(d-disk);
+
+   spin_lock_irqsave(CCISS_LOCK(h-ctlr), flags);
+   if (h-busy_configuring) {
+   spin_unlock_irqrestore(CCISS_LOCK(h-ctlr), flags);
+   spin_unlock(sysfs_lock);
+   return snprintf(buf, 30, Device busy configuring\n);
+   }
+
+   drv = d-disk-private_data;
+   if ((drv-raid_level  0) || (drv-raid_level)  5)
+   raid = RAID_UNKNOWN;
+   else
+   raid = drv-raid_level;
+
+   spin_unlock_irqrestore(CCISS_LOCK(h-ctlr), flags);
+   spin_unlock(sysfs_lock);
+   return snprintf(buf, 20, RAID %s\n, raid_label[raid]);
+}
+
+static ssize_t cciss_show_disk_size(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   struct drv_dynamic *d;
+   drive_info_struct *drv;
+   ctlr_info_t *h;
+   unsigned long flags;
+   sector_t vol_sz, vol_sz_frac;
+
+   d = container_of(dev, struct drv_dynamic, dev);
+   spin_lock(sysfs_lock);
+   if (!d-disk) {
+   spin_unlock(sysfs_lock);
+   return -ENOENT;
+   }
+   h = get_host(d-disk);
+
+   spin_lock_irqsave(CCISS_LOCK(h-ctlr), flags);
+   if (h-busy_configuring) {
+   

2.6.24-rc5-mm1: kernel BUG at include/linux/scatterlist.h:59!

2007-12-14 Thread John Stoffel

Hi,

Just fired up 2.6.24-rc5-mm1 on a Dual CPU PIII 550mhz system with 2gb
of RAM.  Got the following error.  Let me know if you need more
details or want me to run tests or make changes.  Looks like something
in the SCSI st driver, which makes sense since I have a pair of DLT 7k
drives hooked upto this system via a Symbios PCI card.  I've also got
a P1000 jukebox on there as well.

  [  354.338667] kernel BUG at include/linux/scatterlist.h:59!
  [  354.403311] invalid opcode:  [#1] SMP 
  [  354.452774] last sysfs file:
  /sys/devices/pci:00/:00:0d.1/host3/target3:0:3/3:0:3:0/vendor
  [  354.560099] Modules linked in:
  [  354.596859] 
  [  354.614753] Pid: 1795, comm: stinit Not tainted (2.6.24-rc5-mm1 #3)
  [  354.689825] EIP: 0060:[c0356bd0] EFLAGS: 00010213 CPU: 0
  [  354.755538] EIP is at st_do_scsi+0x2e0/0x340
  [  354.806668] EAX:  EBX:  ECX: c16e1f80 EDX: f7f87050
  [  354.881731] ESI: f7f877d0 EDI: 1000 EBP: f7f87000 ESP: f7167db0
  [  354.956788]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
  [  355.021452] Process stinit (pid: 1795, ti=f7167000 task=f74d7030
  task.ti=f7167000)
  [  355.110028] Stack: 0003 f7f87050   00d59f80
   f75cf9e0 c0359840 
  [  355.211879]00d0 f7167e54 f7d2bc00 f75cf9e0 f7d2bc18
   0006 f7167e54 
  [  355.313757]f7d2bc00 f7167e64 f7f87000 c0358730 0006
  0002 000dbba0  
  [  355.415639] Call Trace:
  [  355.447258]  [c0359840] st_sleep_done+0x0/0x70
  [  355.502773]  [c0358730] check_tape+0x510/0x640
  [  355.558284]  [c0359c9b] st_open+0x18b/0x220
  [  355.610677]  [c0171850] exact_match+0x0/0x10
  [  355.664113]  [c0359b10] st_open+0x0/0x220
  [  355.714429]  [c0171f2f] chrdev_open+0x9f/0x190
  [  355.769945]  [c0171e90] chrdev_open+0x0/0x190
  [  355.824418]  [c016d685] __dentry_open+0xb5/0x2a0
  [  355.882013]  [c01762cb] permission+0xdb/0x100
  [  355.936486]  [c016d937] nameidata_to_filp+0x47/0x60
  [  355.997200]  [c017985d] open_pathname+0x17d/0x740
  [  356.055831]  [c011fa10] update_curr+0x80/0x110
  [  356.111345]  [c0123792] scheduler_tick+0xe2/0x130
  [  356.169979]  [c0177765] getname+0xa5/0xc0
  [  356.220294]  [c016d4bc] do_sys_open+0x4c/0xe0
  [  356.274770]  [c016d58c] sys_open+0x1c/0x20
  [  356.326123]  [c0103f6e] syscall_call+0x7/0xb
  [  356.379559]  ===
  [  356.422393] Code: 32 8b 54 24 28 89 44 24 2c 89 50 74 e9 ba fd ff ff 0f 0b 
eb fe 8d b6 00 00 00 00 0f 0b eb fe 0f 0b eb fe 0f 0b eb fe 8d 74 26 00 0f 0b 
eb fe 0f 0b eb fe 64 a1 00 50 6e c0 8b 40 04 8b 40 08 a8 
  [  356.661693] EIP: [c0356bd0] st_do_scsi+0x2e0/0x340 SS:ESP
  0068:f7167db0


My system is pretty loaded with the following stuff in lspci:

  00:00.0 Host bridge: Intel Corporation 440GX - 82443GX Host bridge
  00:01.0 PCI bridge: Intel Corporation 440GX - 82443GX AGP bridge
  00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 02)
  00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)
  00:07.2 USB Controller: Intel Corporation 82371AB/EB/MB PIIX4 USB (rev 01)
  00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 02)
  00:0d.0 SCSI storage controller: LSI Logic / Symbios Logic 53c875 (rev 14)
  00:0d.1 SCSI storage controller: LSI Logic / Symbios Logic 53c875 (rev 14)
  00:0e.0 RAID bus controller: Silicon Image, Inc. SiI 3114 [SATALink/SATARaid] 
Serial ATA Controller (rev 02)
  00:10.0 PCI bridge: Hint Corp HB6 Universal PCI-PCI bridge (non-transparent 
mode) (rev 13)
  00:11.0 Ethernet controller: 3Com Corporation 3c905B 100BaseTX [Cyclone] (rev 
24)
  00:13.0 PCI bridge: Digital Equipment Corporation DECchip 21152 (rev 03)
  01:00.0 VGA compatible controller: Matrox Graphics, Inc. MGA G400/G450 (rev 
82)
  02:08.0 USB Controller: NEC Corporation USB (rev 41)
  02:08.1 USB Controller: NEC Corporation USB (rev 41)
  02:08.2 USB Controller: NEC Corporation USB 2.0 (rev 02)
  02:0b.0 FireWire (IEEE 1394): Texas Instruments TSB12LV26 IEEE-1394 
Controller (Link)
  03:06.0 RAID bus controller: Triones Technologies, Inc. HPT302/302N (rev 01)
  03:09.0 Communication controller: Cyclades Corporation Cyclom-8Y above first 
megabyte (rev 01)
  03:0a.0 SCSI storage controller: Adaptec AHA-2940U2/U2W / 7890/7891
  03:0e.0 SCSI storage controller: Adaptec AIC-7880U (rev 01)
-
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: QUEUE_FLAG_CLUSTER: not working in 2.6.24 ?

2007-12-14 Thread Andrew Morton
On Sat, 15 Dec 2007 01:09:41 + Mel Gorman [EMAIL PROTECTED] wrote:

 On (13/12/07 14:29), Andrew Morton didst pronounce:
   The simple way seems to be to malloc a large area, touch every page and
   then look at the physical pages assigned ... they now mostly seem to be
   descending in physical address.
   
  
  OIC.  -mm's /proc/pid/pagemap can be used to get the pfn's...
  
 
 I tried using pagemap to verify the patch but it triggered BUG_ON
 checks. Perhaps I am using the interface wrong but I would still not
 expect it to break in this fashion. I tried 2.6.24-rc4-mm1, 2.6.24-rc5-mm1,
 2.6.24-rc5 with just the maps4 patches applied and 2.6.23 with maps4 patches
 applied. Each time I get errors like this;
 
 [   90.108315] BUG: sleeping function called from invalid context at 
 include/asm/uaccess_32.h:457
 [   90.211227] in_atomic():1, irqs_disabled():0
 [   90.262251] no locks held by showcontiguous/2814.
 [   90.318475] Pid: 2814, comm: showcontiguous Not tainted 2.6.24-rc5 #1
 [   90.395344]  [c010522a] show_trace_log_lvl+0x1a/0x30
 [   90.456948]  [c0105bb2] show_trace+0x12/0x20
 [   90.510173]  [c0105eee] dump_stack+0x6e/0x80
 [   90.563409]  [c01205b3] __might_sleep+0xc3/0xe0
 [   90.619765]  [c02264fd] copy_to_user+0x3d/0x60
 [   90.675153]  [c01b3e9c] add_to_pagemap+0x5c/0x80
 [   90.732513]  [c01b43e8] pagemap_pte_range+0x68/0xb0
 [   90.793010]  [c0175ed2] walk_page_range+0x112/0x210
 [   90.853482]  [c01b47c6] pagemap_read+0x176/0x220
 [   90.910863]  [c0182dc4] vfs_read+0x94/0x150
 [   90.963058]  [c01832fd] sys_read+0x3d/0x70
 [   91.014219]  [c0104262] syscall_call+0x7/0xb
 
 ...

 Just using cp to read the file is enough to cause problems but I included
 a very basic program below that produces the BUG_ON checks. Is this a known
 issue or am I using the interface incorrectly?

I'd say you're using it correctly but you've found a hitherto unknown bug. 
On i386 highmem machines with CONFIG_HIGHPTE (at least) pte_offset_map()
takes kmap_atomic(), so pagemap_pte_range() can't do copy_to_user() as it
presently does.

Drat.

Still, that shouldn't really disrupt the testing which you're doing.  You
could disable CONFIG_HIGHPTE to shut it up.
-
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


[rfc][patch 1/3] block: non-atomic queue_flags prep

2007-12-14 Thread Nick Piggin
Hi,

This is just an idea I had, which might make request processing a little
bit cheaper depending on queue behaviour. For example if it is getting plugged
unplugged frequently (as I think is the case for some database workloads),
then we might save one or two atomic operations per request.

Anyway, I'm not completely sure if I have ensured all queue_flags users are
safe (I think md may need a bit of help). But overall it seems quite doable.

Comments?
---
Prep queue_flags to be non-atomic and taking protection from queue_lock.
Do this by ensuring the queue_lock is held everywhere that queue_flags
are changed. Locking additions are confined to slowpaths.

Index: linux-2.6/block/elevator.c
===
--- linux-2.6.orig/block/elevator.c
+++ linux-2.6/block/elevator.c
@@ -1066,7 +1066,10 @@ static int elevator_switch(struct reques
 * finally exit old elevator and turn off BYPASS.
 */
elevator_exit(old_elevator);
+   spin_lock_irq(q-queue_lock);
clear_bit(QUEUE_FLAG_ELVSWITCH, q-queue_flags);
+   spin_unlock_irq(q-queue_lock);
+
return 1;
 
 fail_register:
@@ -1077,7 +1080,11 @@ fail_register:
elevator_exit(e);
q-elevator = old_elevator;
elv_register_queue(q);
+
+   spin_lock_irq(q-queue_lock);
clear_bit(QUEUE_FLAG_ELVSWITCH, q-queue_flags);
+   spin_unlock_irq(q-queue_lock);
+
return 0;
 }
 
Index: linux-2.6/block/ll_rw_blk.c
===
--- linux-2.6.orig/block/ll_rw_blk.c
+++ linux-2.6/block/ll_rw_blk.c
@@ -1732,14 +1732,11 @@ void blk_sync_queue(struct request_queue
 EXPORT_SYMBOL(blk_sync_queue);
 
 /**
- * blk_run_queue - run a single device queue
+ * __blk_run_queue - run a single device queue. queue_lock must be held.
  * @q: The queue to run
  */
-void blk_run_queue(struct request_queue *q)
+void __blk_run_queue(struct request_queue *q)
 {
-   unsigned long flags;
-
-   spin_lock_irqsave(q-queue_lock, flags);
blk_remove_plug(q);
 
/*
@@ -1755,7 +1752,19 @@ void blk_run_queue(struct request_queue 
kblockd_schedule_work(q-unplug_work);
}
}
+}
+EXPORT_SYMBOL(__blk_run_queue);
 
+/**
+ * blk_run_queue - run a single device queue
+ * @q: The queue to run
+ */
+void blk_run_queue(struct request_queue *q)
+{
+   unsigned long flags;
+
+   spin_lock_irqsave(q-queue_lock, flags);
+   __blk_run_queue(q);
spin_unlock_irqrestore(q-queue_lock, flags);
 }
 EXPORT_SYMBOL(blk_run_queue);
@@ -1804,7 +1813,9 @@ EXPORT_SYMBOL(blk_put_queue);
 void blk_cleanup_queue(struct request_queue * q)
 {
mutex_lock(q-sysfs_lock);
+   spin_lock_irq(q-queue_lock);
set_bit(QUEUE_FLAG_DEAD, q-queue_flags);
+   spin_unlock_irq(q-queue_lock);
mutex_unlock(q-sysfs_lock);
 
if (q-elevator)
Index: linux-2.6/drivers/scsi/scsi_lib.c
===
--- linux-2.6.orig/drivers/scsi/scsi_lib.c
+++ linux-2.6/drivers/scsi/scsi_lib.c
@@ -532,6 +532,9 @@ static void scsi_run_queue(struct reques
   !shost-host_blocked  !shost-host_self_blocked 
!((shost-can_queue  0) 
  (shost-host_busy = shost-can_queue))) {
+
+   int flagset;
+
/*
 * As long as shost is accepting commands and we have
 * starved queues, call blk_run_queue. scsi_request_fn
@@ -547,17 +550,17 @@ static void scsi_run_queue(struct reques
list_del_init(sdev-starved_entry);
spin_unlock_irqrestore(shost-host_lock, flags);
 
-
-   if (test_bit(QUEUE_FLAG_REENTER, q-queue_flags) 
-   !test_and_set_bit(QUEUE_FLAG_REENTER,
- sdev-request_queue-queue_flags)) {
-   blk_run_queue(sdev-request_queue);
+   spin_lock(sdev-request_queue-queue_lock);
+   flagset = test_bit(QUEUE_FLAG_REENTER, q-queue_flags) 
+   !test_and_set_bit(QUEUE_FLAG_REENTER,
+   sdev-request_queue-queue_flags);
+   __blk_run_queue(sdev-request_queue);
+   if (flagset)
clear_bit(QUEUE_FLAG_REENTER,
- sdev-request_queue-queue_flags);
-   } else
-   blk_run_queue(sdev-request_queue);
+   sdev-request_queue-queue_flags);
+   spin_unlock(sdev-request_queue-queue_lock);
 
-   spin_lock_irqsave(shost-host_lock, flags);
+   spin_lock(shost-host_lock);
if (unlikely(!list_empty(sdev-starved_entry)))
/*
 * sdev lost a race, and was put back on the
Index: linux-2.6/drivers/block/loop.c

[rfc][patch 2/3] block: non-atomic queue_flags

2007-12-14 Thread Nick Piggin

All queue_flag manipulations are performed under queue_lock (or eg. during
allocation-time where parallelism isn't a problem). So we can use non-atomic
bitops for these.

Index: linux-2.6/block/elevator.c
===
--- linux-2.6.orig/block/elevator.c
+++ linux-2.6/block/elevator.c
@@ -1032,7 +1032,7 @@ static int elevator_switch(struct reques
 */
spin_lock_irq(q-queue_lock);
 
-   set_bit(QUEUE_FLAG_ELVSWITCH, q-queue_flags);
+   __set_bit(QUEUE_FLAG_ELVSWITCH, q-queue_flags);
 
elv_drain_elevator(q);
 
@@ -1067,7 +1067,7 @@ static int elevator_switch(struct reques
 */
elevator_exit(old_elevator);
spin_lock_irq(q-queue_lock);
-   clear_bit(QUEUE_FLAG_ELVSWITCH, q-queue_flags);
+   __clear_bit(QUEUE_FLAG_ELVSWITCH, q-queue_flags);
spin_unlock_irq(q-queue_lock);
 
return 1;
@@ -1082,7 +1082,7 @@ fail_register:
elv_register_queue(q);
 
spin_lock_irq(q-queue_lock);
-   clear_bit(QUEUE_FLAG_ELVSWITCH, q-queue_flags);
+   __clear_bit(QUEUE_FLAG_ELVSWITCH, q-queue_flags);
spin_unlock_irq(q-queue_lock);
 
return 0;
Index: linux-2.6/block/ll_rw_blk.c
===
--- linux-2.6.orig/block/ll_rw_blk.c
+++ linux-2.6/block/ll_rw_blk.c
@@ -720,7 +720,7 @@ void blk_queue_stack_limits(struct reque
t-max_segment_size = min(t-max_segment_size,b-max_segment_size);
t-hardsect_size = max(t-hardsect_size,b-hardsect_size);
if (!test_bit(QUEUE_FLAG_CLUSTER, b-queue_flags))
-   clear_bit(QUEUE_FLAG_CLUSTER, t-queue_flags);
+   __clear_bit(QUEUE_FLAG_CLUSTER, t-queue_flags);
 }
 
 EXPORT_SYMBOL(blk_queue_stack_limits);
@@ -823,7 +823,7 @@ static void __blk_queue_free_tags(struct
__blk_free_tags(bqt);
 
q-queue_tags = NULL;
-   q-queue_flags = ~(1  QUEUE_FLAG_QUEUED);
+   __clear_bit(QUEUE_FLAG_QUEUED, q-queue_flags);
 }
 
 
@@ -852,7 +852,7 @@ EXPORT_SYMBOL(blk_free_tags);
  **/
 void blk_queue_free_tags(struct request_queue *q)
 {
-   clear_bit(QUEUE_FLAG_QUEUED, q-queue_flags);
+   __clear_bit(QUEUE_FLAG_QUEUED, q-queue_flags);
 }
 
 EXPORT_SYMBOL(blk_queue_free_tags);
@@ -942,7 +942,7 @@ int blk_queue_init_tags(struct request_q
} else if (q-queue_tags) {
if ((rc = blk_queue_resize_tags(q, depth)))
return rc;
-   set_bit(QUEUE_FLAG_QUEUED, q-queue_flags);
+   __set_bit(QUEUE_FLAG_QUEUED, q-queue_flags);
return 0;
} else
atomic_inc(tags-refcnt);
@@ -951,7 +951,7 @@ int blk_queue_init_tags(struct request_q
 * assign it, all done
 */
q-queue_tags = tags;
-   q-queue_flags |= (1  QUEUE_FLAG_QUEUED);
+   __set_bit(QUEUE_FLAG_QUEUED, q-queue_flags);
INIT_LIST_HEAD(q-tag_busy_list);
return 0;
 fail:
@@ -1205,7 +1205,7 @@ static void blk_recalc_rq_segments(struc
if (!rq-bio)
return;
 
-   cluster = q-queue_flags  (1  QUEUE_FLAG_CLUSTER);
+   cluster = test_bit(QUEUE_FLAG_CLUSTER, q-queue_flags);
hw_seg_size = seg_size = 0;
phys_size = hw_size = nr_phys_segs = nr_hw_segs = 0;
rq_for_each_segment(bv, rq, iter) {
@@ -1263,7 +1263,7 @@ new_hw_segment:
 static int blk_phys_contig_segment(struct request_queue *q, struct bio *bio,
   struct bio *nxt)
 {
-   if (!(q-queue_flags  (1  QUEUE_FLAG_CLUSTER)))
+   if (!test_bit(QUEUE_FLAG_CLUSTER, q-queue_flags))
return 0;
 
if (!BIOVEC_PHYS_MERGEABLE(__BVEC_END(bio), __BVEC_START(nxt)))
@@ -1310,7 +1310,7 @@ int blk_rq_map_sg(struct request_queue *
int nsegs, cluster;
 
nsegs = 0;
-   cluster = q-queue_flags  (1  QUEUE_FLAG_CLUSTER);
+   cluster = test_bit(QUEUE_FLAG_CLUSTER, q-queue_flags);
 
/*
 * for each bio in rq
@@ -1557,7 +1557,8 @@ void blk_plug_device(struct request_queu
if (blk_queue_stopped(q))
return;
 
-   if (!test_and_set_bit(QUEUE_FLAG_PLUGGED, q-queue_flags)) {
+   if (!test_bit(QUEUE_FLAG_PLUGGED, q-queue_flags)) {
+   __set_bit(QUEUE_FLAG_PLUGGED, q-queue_flags);
mod_timer(q-unplug_timer, jiffies + q-unplug_delay);
blk_add_trace_generic(q, NULL, 0, BLK_TA_PLUG);
}
@@ -1573,8 +1574,9 @@ int blk_remove_plug(struct request_queue
 {
WARN_ON(!irqs_disabled());
 
-   if (!test_and_clear_bit(QUEUE_FLAG_PLUGGED, q-queue_flags))
+   if (!test_bit(QUEUE_FLAG_PLUGGED, q-queue_flags))
return 0;
+   __clear_bit(QUEUE_FLAG_PLUGGED, q-queue_flags);
 
del_timer(q-unplug_timer);
return 1;
@@ -1672,15 +1674,16 @@ void blk_start_queue(struct request_queu
 {
WARN_ON(!irqs_disabled());
 
-   clear_bit(QUEUE_FLAG_STOPPED, 

[rfc][patch 3/3] block: non-atomic queue_flags accessors

2007-12-14 Thread Nick Piggin

Introduce queue_ accessors to set and clear queue_flags, which include debug
checks to ensure queue_lock is held. Non-checking versions are provided where
it is known that there can be no parallelism on queue_flags.

Index: linux-2.6/block/elevator.c
===
--- linux-2.6.orig/block/elevator.c
+++ linux-2.6/block/elevator.c
@@ -1032,7 +1032,7 @@ static int elevator_switch(struct reques
 */
spin_lock_irq(q-queue_lock);
 
-   __set_bit(QUEUE_FLAG_ELVSWITCH, q-queue_flags);
+   queue_flag_set(QUEUE_FLAG_ELVSWITCH, q);
 
elv_drain_elevator(q);
 
@@ -1067,7 +1067,7 @@ static int elevator_switch(struct reques
 */
elevator_exit(old_elevator);
spin_lock_irq(q-queue_lock);
-   __clear_bit(QUEUE_FLAG_ELVSWITCH, q-queue_flags);
+   queue_flag_clear(QUEUE_FLAG_ELVSWITCH, q);
spin_unlock_irq(q-queue_lock);
 
return 1;
@@ -1082,7 +1082,7 @@ fail_register:
elv_register_queue(q);
 
spin_lock_irq(q-queue_lock);
-   __clear_bit(QUEUE_FLAG_ELVSWITCH, q-queue_flags);
+   queue_flag_clear(QUEUE_FLAG_ELVSWITCH, q);
spin_unlock_irq(q-queue_lock);
 
return 0;
Index: linux-2.6/block/ll_rw_blk.c
===
--- linux-2.6.orig/block/ll_rw_blk.c
+++ linux-2.6/block/ll_rw_blk.c
@@ -720,7 +720,7 @@ void blk_queue_stack_limits(struct reque
t-max_segment_size = min(t-max_segment_size,b-max_segment_size);
t-hardsect_size = max(t-hardsect_size,b-hardsect_size);
if (!test_bit(QUEUE_FLAG_CLUSTER, b-queue_flags))
-   __clear_bit(QUEUE_FLAG_CLUSTER, t-queue_flags);
+   queue_flag_clear(QUEUE_FLAG_CLUSTER, t);
 }
 
 EXPORT_SYMBOL(blk_queue_stack_limits);
@@ -823,7 +823,7 @@ static void __blk_queue_free_tags(struct
__blk_free_tags(bqt);
 
q-queue_tags = NULL;
-   __clear_bit(QUEUE_FLAG_QUEUED, q-queue_flags);
+   queue_flag_clear(QUEUE_FLAG_QUEUED, q);
 }
 
 
@@ -852,7 +852,7 @@ EXPORT_SYMBOL(blk_free_tags);
  **/
 void blk_queue_free_tags(struct request_queue *q)
 {
-   __clear_bit(QUEUE_FLAG_QUEUED, q-queue_flags);
+   queue_flag_clear(QUEUE_FLAG_QUEUED, q);
 }
 
 EXPORT_SYMBOL(blk_queue_free_tags);
@@ -942,7 +942,7 @@ int blk_queue_init_tags(struct request_q
} else if (q-queue_tags) {
if ((rc = blk_queue_resize_tags(q, depth)))
return rc;
-   __set_bit(QUEUE_FLAG_QUEUED, q-queue_flags);
+   queue_flag_set(QUEUE_FLAG_QUEUED, q);
return 0;
} else
atomic_inc(tags-refcnt);
@@ -951,7 +951,7 @@ int blk_queue_init_tags(struct request_q
 * assign it, all done
 */
q-queue_tags = tags;
-   __set_bit(QUEUE_FLAG_QUEUED, q-queue_flags);
+   queue_flag_set(QUEUE_FLAG_QUEUED, q);
INIT_LIST_HEAD(q-tag_busy_list);
return 0;
 fail:
@@ -1558,7 +1558,7 @@ void blk_plug_device(struct request_queu
return;
 
if (!test_bit(QUEUE_FLAG_PLUGGED, q-queue_flags)) {
-   __set_bit(QUEUE_FLAG_PLUGGED, q-queue_flags);
+   queue_flag_set(QUEUE_FLAG_PLUGGED, q);
mod_timer(q-unplug_timer, jiffies + q-unplug_delay);
blk_add_trace_generic(q, NULL, 0, BLK_TA_PLUG);
}
@@ -1576,7 +1576,7 @@ int blk_remove_plug(struct request_queue
 
if (!test_bit(QUEUE_FLAG_PLUGGED, q-queue_flags))
return 0;
-   __clear_bit(QUEUE_FLAG_PLUGGED, q-queue_flags);
+   queue_flag_clear(QUEUE_FLAG_PLUGGED, q);
 
del_timer(q-unplug_timer);
return 1;
@@ -1674,16 +1674,16 @@ void blk_start_queue(struct request_queu
 {
WARN_ON(!irqs_disabled());
 
-   __clear_bit(QUEUE_FLAG_STOPPED, q-queue_flags);
+   queue_flag_clear(QUEUE_FLAG_STOPPED, q);
 
/*
 * one level of recursion is ok and is much faster than kicking
 * the unplug handling
 */
if (!test_bit(QUEUE_FLAG_REENTER, q-queue_flags)) {
-   __set_bit(QUEUE_FLAG_REENTER, q-queue_flags);
+   queue_flag_set(QUEUE_FLAG_REENTER, q);
q-request_fn(q);
-   __clear_bit(QUEUE_FLAG_REENTER, q-queue_flags);
+   queue_flag_clear(QUEUE_FLAG_REENTER, q);
} else {
blk_plug_device(q);
kblockd_schedule_work(q-unplug_work);
@@ -1709,7 +1709,7 @@ EXPORT_SYMBOL(blk_start_queue);
 void blk_stop_queue(struct request_queue *q)
 {
blk_remove_plug(q);
-   __set_bit(QUEUE_FLAG_STOPPED, q-queue_flags);
+   queue_flag_set(QUEUE_FLAG_STOPPED, q);
 }
 EXPORT_SYMBOL(blk_stop_queue);
 
@@ -1748,9 +1748,9 @@ void __blk_run_queue(struct request_queu
 */
if (!elv_queue_empty(q)) {
if (!test_bit(QUEUE_FLAG_REENTER, q-queue_flags)) {
-   __set_bit(QUEUE_FLAG_REENTER, 

[PATCH] bsg: fix SG_IO error path

2007-12-14 Thread FUJITA Tomonori
bsg SG_IO needs to return -EFAULT for the response field in struct
sg_io_v4.

Signed-off-by: FUJITA Tomonori [EMAIL PROTECTED]
---
 block/bsg.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/block/bsg.c b/block/bsg.c
index 8e181ab..7781e63 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -877,6 +877,7 @@ static long bsg_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
struct request *rq;
struct bio *bio, *bidi_bio = NULL;
struct sg_io_v4 hdr;
+   int ret;
 
if (copy_from_user(hdr, uarg, sizeof(hdr)))
return -EFAULT;
@@ -889,12 +890,12 @@ static long bsg_ioctl(struct file *file, unsigned int 
cmd, unsigned long arg)
if (rq-next_rq)
bidi_bio = rq-next_rq-bio;
blk_execute_rq(bd-queue, NULL, rq, 0);
-   blk_complete_sgv4_hdr_rq(rq, hdr, bio, bidi_bio);
+   ret = blk_complete_sgv4_hdr_rq(rq, hdr, bio, bidi_bio);
 
if (copy_to_user(uarg, hdr, sizeof(hdr)))
return -EFAULT;
 
-   return 0;
+   return ret;
}
/*
 * block device ioctls
-- 
1.5.3.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


Re: QUEUE_FLAG_CLUSTER: not working in 2.6.24 ?

2007-12-14 Thread Matt Mackall
On Fri, Dec 14, 2007 at 06:02:06PM -0800, Andrew Morton wrote:
 On Sat, 15 Dec 2007 01:09:41 + Mel Gorman [EMAIL PROTECTED] wrote:
 
  On (13/12/07 14:29), Andrew Morton didst pronounce:
The simple way seems to be to malloc a large area, touch every page and
then look at the physical pages assigned ... they now mostly seem to be
descending in physical address.

   
   OIC.  -mm's /proc/pid/pagemap can be used to get the pfn's...
   
  
  I tried using pagemap to verify the patch but it triggered BUG_ON
  checks. Perhaps I am using the interface wrong but I would still not
  expect it to break in this fashion. I tried 2.6.24-rc4-mm1, 2.6.24-rc5-mm1,
  2.6.24-rc5 with just the maps4 patches applied and 2.6.23 with maps4 patches
  applied. Each time I get errors like this;
  
  [   90.108315] BUG: sleeping function called from invalid context at 
  include/asm/uaccess_32.h:457
  [   90.211227] in_atomic():1, irqs_disabled():0
  [   90.262251] no locks held by showcontiguous/2814.
  [   90.318475] Pid: 2814, comm: showcontiguous Not tainted 2.6.24-rc5 #1
  [   90.395344]  [c010522a] show_trace_log_lvl+0x1a/0x30
  [   90.456948]  [c0105bb2] show_trace+0x12/0x20
  [   90.510173]  [c0105eee] dump_stack+0x6e/0x80
  [   90.563409]  [c01205b3] __might_sleep+0xc3/0xe0
  [   90.619765]  [c02264fd] copy_to_user+0x3d/0x60
  [   90.675153]  [c01b3e9c] add_to_pagemap+0x5c/0x80
  [   90.732513]  [c01b43e8] pagemap_pte_range+0x68/0xb0
  [   90.793010]  [c0175ed2] walk_page_range+0x112/0x210
  [   90.853482]  [c01b47c6] pagemap_read+0x176/0x220
  [   90.910863]  [c0182dc4] vfs_read+0x94/0x150
  [   90.963058]  [c01832fd] sys_read+0x3d/0x70
  [   91.014219]  [c0104262] syscall_call+0x7/0xb
  
  ...
 
  Just using cp to read the file is enough to cause problems but I included
  a very basic program below that produces the BUG_ON checks. Is this a known
  issue or am I using the interface incorrectly?
 
 I'd say you're using it correctly but you've found a hitherto unknown bug. 
 On i386 highmem machines with CONFIG_HIGHPTE (at least) pte_offset_map()
 takes kmap_atomic(), so pagemap_pte_range() can't do copy_to_user() as it
 presently does.

Damn, I coulda sworn I fixed that.

-- 
Mathematics is the supreme nostalgia of our time.
-
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: 2.6.24-rc5-mm1: kernel BUG at include/linux/scatterlist.h:59!

2007-12-14 Thread FUJITA Tomonori
On Fri, 14 Dec 2007 18:05:56 -0500
John Stoffel [EMAIL PROTECTED] wrote:

 
 Hi,
 
 Just fired up 2.6.24-rc5-mm1 on a Dual CPU PIII 550mhz system with 2gb
 of RAM.  Got the following error.  Let me know if you need more
 details or want me to run tests or make changes.  Looks like something
 in the SCSI st driver, which makes sense since I have a pair of DLT 7k
 drives hooked upto this system via a Symbios PCI card.  I've also got
 a P1000 jukebox on there as well.

Can you try the following patch?

diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 98dfd6e..328c47c 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -3611,6 +3611,7 @@ static struct st_buffer *
 
tb-dma = need_dma;
tb-buffer_size = got;
+   sg_init_table(tb-sg, max_sg);
 
return tb;
 }
-- 
1.5.3.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