Re: slow after upgrade to CentOS 5 (RHEL5)

2007-10-28 Thread James Bottomley
On Sat, 2007-10-27 at 13:21 -0700, Anthony Ewell wrote:
 James Bottomley wrote:
  On Wed, 2007-10-24 at 18:04 -0700, Anthony Ewell wrote:
  Hi All,
 
  If you all would not mind a post from the general
  public Linux user, after doing a complete disk wipe
  of CentOS 4 and installing CentOS5, my system is preceived
  to be 3 times slower.
 
   To troubleshooting this, I made a post on CentOS's
  bugzilla:  http://bugs.centos.org/view.php?id=2382
 
   Would some of the experts on this group mind
  looking at the bug to evaluate the possibility
  that it is being caused by the underlying scsi
  driver?   The post contains a dmesg from Computer C.
  (Yes, I am getting a bit desperate.)
  
  There's still too little information in the bug report to tell much of
  anything.  The dmesg doesn't indicate any anomaly with the megaraid
  (although the LSI people might be able to tell better).  However, it
  also doesn't contain a trace of the tape drive.
  
  Best guess would be a slow down in the megaraid driver.  Can you try
  doing a speed test on it?  (hdparm -t should suffice).
  
  James
 
 
 Hi James,
 
 The other guy reporting the problem
  
 http://www.centos.org/modules/newbb/viewtopic.php?topic_id=10659start=0#forumpost34209
 is not using a MegaRAID card.  He is using 3ware9508 Raid Controllers.
 He is also using a different processor (amd vs xeon) and a different
 chipset (Intel Greenwood vs nVidia)
 
 I also spoke to Neela Kolli (Mega RAID maintainer) and he said he'd
 never heard of the problem.  Here are some tests (including dhparm)
 that I sent to Neela (he never wrote back).
 
 I have also checked with Stellen over at the dump
 list and he has not seen the problem (yet).
 
 The problem occurs when backing up to a two different types
 of tape drives and to an eSata drive.
 
 When I am running a dump on computer C, gnome-system-monitor
 shows my two cores running at only about 10 to 20% and
 switching back and forth (one at 0% the other at 20% for
 about 5 seconds, then switching positions)
 
 On Computer C (Cent OS 5), when typing in Word Pro (a windows word 
 processor) in Parallels, I can watch myself type.  Computer B
 (CentOS 4.4, now 4.5) has the same version of Parallels
 installed on it (Parallels-2.2.2112-lin.i386) that computer C
 (CentOS 5) has. The perceived speed difference is about a factor
 of three (you can not watch yourself type).
 
 All the Low Level test I run seem to come out the same between
 Cent OS 4.4 and 5.  Very frustrating!  It is almost like some
 system monitor component is looking at everything and
 slowing things down.  If this was Windows, I'd go straight
 to the Anti Virus as the culprit.  (Does SE Linux do such
 things?)
 
 Are there any performance tests I can run for you?
 
 Thank you for letting me ramble, this problem is
 really frustrating.  I am afraid to any additional CentOS5
 server out there and CentOS 4.x is so terribly out of
 date.
 
 -T
 
 ~~
 Tests I sent to Neela:
 
 CentOS 5 (2.6.18-8.1.8.el5, Sata150-4):
 
 #grep -i bogomips /var/log/dmesg
 Calibrating delay using timer specific routine.. 4001.91 BogoMIPS 
 (lpj=2000959)
 Calibrating delay using timer specific routine.. 3999.58 BogoMIPS 
 (lpj=1999791)
 Total of 2 processors activated (8001.50 BogoMIPS).
 
 
 #/sbin/hdparm -t /dev/sda
 /dev/sda:
   Timing buffered disk reads:  236 MB in  3.01 seconds =  78.53 MB/sec
 
 
 #/sbin/hdparm -t /dev/sdb
 /dev/sdb:
   Timing buffered disk reads:  182 MB in  3.01 seconds =  60.37 MB/sec
 
 
 ~~
 CentOS 4.4 (linux rescue 2.6.9-42.EL, IDE):
 
 #cat /proc/cpuinfo
 bogomips  : 4002.92
 
 #/sbin/hdparm -t /dev/sda
 /dev/sda:
   Timing buffered disk reads:  216 MB in  3.01 seconds =  71.87 MB/sec
 
 #/sbin/hdparm -t /dev/sdb
 /dev/sdb:
   Timing buffered disk reads:  184 MB in  3.01 seconds =  61.18 MB/sec

That pretty much shows, if anything, that transfer speed improved
from .9 to .18.

 ~~
 CentOS 5 (2.6.18-8.1.3.el5, Sata300-4):
 #grep -i bogomips /var/log/dmesg
 Calibrating delay using timer specific routine.. 4001.92 BogoMIPS 
 (lpj=2000960)
 Calibrating delay using timer specific routine.. 3999.58 BogoMIPS 
 (lpj=1999794)
 Total of 2 processors activated (8001.50 BogoMIPS).
 
 #/sbin/hdparm -t /dev/sda
 /dev/sda:
   Timing buffered disk reads:  214 MB in  3.02 seconds =  70.86 MB/sec
 
 
 ~~
 CentOS 5  (2.6.18-10.1.3.el5, Sata300-4):
 
 eSata:  dump -0a -z -f /dev/nul winxp.hdd
DUMP: Volume 1 took 0:04:04
DUMP: Volume 1 transfer rate: 4247 kB/s
DUMP: Volume 1 1567020kB uncompressed, 1036385kB compressed, 1.513:1
 
 eSata:  dump -0a -f /dev/nul winxp.hdd  (no compression)
DUMP: Volume 1 1036420 blocks (1012.13MB)
DUMP: Volume 1 took 0:02:09
DUMP: Volume 1 transfer rate: 8034 kB/s
 
 
 150-4:  dump -0a -z -f 

[PATCH] sym53c8xx_2: compilation warning fix

2007-10-28 Thread Krzysztof Helt
From: Krzysztof Helt [EMAIL PROTECTED]

Small code rearrangement to kill this compilation warning:

drivers/scsi/sym53c8xx_2/sym_glue.c:612: warning: io_reset
may be used uninitialized in this function

Signed-off-by: Krzysztof Helt [EMAIL PROTECTED]

---

diff -urp linux-ref/drivers/scsi/sym53c8xx_2/sym_glue.c 
linux-new/drivers/scsi/sym53c8xx_2/sym_glue.c
--- linux-ref/drivers/scsi/sym53c8xx_2/sym_glue.c   2007-10-28 
11:11:02.0 +0100
+++ linux-new/drivers/scsi/sym53c8xx_2/sym_glue.c   2007-10-28 
14:25:08.0 +0100
@@ -609,8 +609,7 @@ static int sym_eh_handler(int op, char *
 */
 #define WAIT_FOR_PCI_RECOVERY  35
if (pci_channel_offline(pdev)) {
-   struct completion *io_reset;
-   int finished_reset = 0;
+   struct completion *io_reset = NULL;
init_completion(eh_done);
spin_lock_irq(shost-host_lock);
/* Make sure we didn't race */
@@ -618,15 +617,12 @@ static int sym_eh_handler(int op, char *
if (!sym_data-io_reset)
sym_data-io_reset = eh_done;
io_reset = sym_data-io_reset;
-   } else {
-   finished_reset = 1;
}
spin_unlock_irq(shost-host_lock);
-   if (!finished_reset)
-   finished_reset = wait_for_completion_timeout(io_reset,
-   WAIT_FOR_PCI_RECOVERY*HZ);
-   if (!finished_reset)
-   return SCSI_FAILED;
+   if (io_reset 
+   !wait_for_completion_timeout(io_reset,
+WAIT_FOR_PCI_RECOVERY * HZ))
+   return SCSI_FAILED;
}
 
spin_lock_irq(shost-host_lock);
-
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


[2.6 patch] scsi/seagate.c: remove dead code

2007-10-28 Thread Adrian Bunk
This patch removes obviously dead code.

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]

---

 drivers/scsi/seagate.c |2 --
 1 file changed, 2 deletions(-)

c0807bbefb65ef679b7d2ec13d14c35f2e927404 
diff --git a/drivers/scsi/seagate.c b/drivers/scsi/seagate.c
index b113244..2d31ed4 100644
--- a/drivers/scsi/seagate.c
+++ b/drivers/scsi/seagate.c
@@ -1437,17 +1437,15 @@ connect_loop:
break;
 #ifdef LINKED
case LINKED_WRONG:
WRITE_DATA (ABORT);
linked_connected = 0;
reselect = CAN_RECONNECT;
goto connect_loop;
-   DPRINTK (PHASE_MSGOUT | DEBUG_LINKED, 
scsi%d : sent ABORT message to cancel incorrect I_T_L nexus.\n, hostno);
 #endif /* LINKED */
-   DPRINTK (DEBUG_LINKED, correct\n);
default:
WRITE_DATA (NOP);
printk(scsi%d : target %d requested 
MSGOUT, sent NOP message.\n, hostno, target);
}
break;
 
case REQ_MSGIN:

-
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 patch] scsi/seagate.c: remove dead code

2007-10-28 Thread Matthew Wilcox
On Sun, Oct 28, 2007 at 04:51:42PM +0100, Adrian Bunk wrote:
 This patch removes obviously dead code.
   case LINKED_WRONG:
   WRITE_DATA (ABORT);
   linked_connected = 0;
   reselect = CAN_RECONNECT;
   goto connect_loop;
 - DPRINTK (PHASE_MSGOUT | DEBUG_LINKED, 
 scsi%d : sent ABORT message to cancel incorrect I_T_L nexus.\n, hostno);
  #endif   /* LINKED */
 - DPRINTK (DEBUG_LINKED, correct\n);
   default:

Surely the 'goto' should just be moved two lines down?

-- 
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] scsi_aen: fix event locking problems

2007-10-28 Thread James Bottomley
There was a fundamental flaw in the initial code, in that it had no
locking around scsi_device_event_notify().  This is a problem because
execute_in_process_context() also has no locking (it expects the caller
to do the work).  This means that two events firing simultaneously could
potentially corrupt each other.  This might be unlikely for media change
events, but it will become more likely as we use this call as the engine
for other SCSI AENs.

The best fix looks to be simply not to use sdev-ew for the source of
the execute_work queue.  Further, since kzalloc() always has to give us
at least 32 bytes and we're doing an allocation anyway, it's free to
shove the execute_work structure into scsi_device_event_info and
eliminate all of the other locking and the work queue list.

I also separated the aen headers out into scsi_aen.h and cleaned up the
uevent processing (there's no real need to define the strings anywhere
other than in scsi_aen_uevent_notifier() ... especially as I envisage
there will be more complex strings for some SCSI events.

Finally, I exported and made available scsi_aen_chain for the things
that will attach to it.

James

Index: BUILD-2.6/include/scsi/scsi_device.h
===
--- BUILD-2.6.orig/include/scsi/scsi_device.h   2007-10-28 13:45:42.0 
-0500
+++ BUILD-2.6/include/scsi/scsi_device.h2007-10-28 13:51:06.0 
-0500
@@ -46,16 +46,6 @@ enum scsi_device_state {
 * to the scsi lld. */
 };
 
-/* must match scsi_device_event_strings in scsi_lib.c */
-enum scsi_device_event {
-   SDEV_MEDIA_CHANGE = 1,  /* media has changed */
-};
-
-struct scsi_device_event_info {
-   enum scsi_device_event event;
-   struct list_head link;
-};
-
 struct scsi_device {
struct Scsi_Host *host;
struct request_queue *request_queue;
@@ -154,7 +144,6 @@ struct scsi_device {
struct execute_work ew; /* used to get process context on put */
 
enum scsi_device_state sdev_state;
-   struct list_headsdev_event_list;
unsigned long   sdev_data[0];
 } __attribute__((aligned(sizeof(unsigned long;
 #defineto_scsi_device(d)   \
@@ -286,8 +275,6 @@ extern int scsi_test_unit_ready(struct s
int retries);
 extern int scsi_device_set_state(struct scsi_device *sdev,
 enum scsi_device_state state);
-extern int scsi_device_event_notify(struct scsi_device *sdev,
-   enum scsi_device_event event);
 extern int scsi_device_quiesce(struct scsi_device *sdev);
 extern void scsi_device_resume(struct scsi_device *sdev);
 extern void scsi_target_quiesce(struct scsi_target *);
Index: BUILD-2.6/drivers/scsi/scsi_aen.c
===
--- BUILD-2.6.orig/drivers/scsi/scsi_aen.c  2007-10-28 13:51:27.0 
-0500
+++ BUILD-2.6/drivers/scsi/scsi_aen.c   2007-10-28 14:34:27.0 -0500
@@ -28,21 +28,18 @@
 #include scsi/scsi_driver.h
 #include scsi/scsi_eh.h
 #include scsi/scsi_host.h
+#include scsi/scsi_aen.h
 
 static int scsi_aen_uevent_notifier(struct notifier_block *nb,
unsigned long action, void *sdev);
 
 BLOCKING_NOTIFIER_HEAD(scsi_aen_chain);
+EXPORT_SYMBOL_GPL(scsi_aen_chain);
 
 static struct notifier_block scsi_aen_nb = {
.notifier_call = scsi_aen_uevent_notifier,
 };
 
-/* must match scsi_device_event enum in scsi_device.h */
-static char * scsi_device_event_strings[] = {
-   MEDIA_CHANGE=1,
-};
-
 /**scsi_aen_notifier_register - register to receive aen events
  * @nb: callers notifier_block
  *
@@ -66,33 +63,6 @@ int scsi_aen_notifier_unregister(struct 
 EXPORT_SYMBOL_GPL(scsi_aen_notifier_unregister);
 
 /**
- * scsi_device_set_event - Add a new Async event to the event list
- * @sdev: scsi_device event occurred on
- * @event: the scsi device event
- *
- * Add a new scsi_device_event_info struct to the scsi_device_event_list
- * queue.  This may be called from interrupt context.
- *
- * Returns 0 if successful, -ENOMEM otherwise.
- */
-static int
-scsi_device_set_event(struct scsi_device *sdev, enum scsi_device_event event)
-{
-   struct scsi_device_event_info *scsi_event;
-   unsigned long flags;
-
-   scsi_event = kzalloc(sizeof(*scsi_event), GFP_ATOMIC);
-   if (!scsi_event)
-   return -ENOMEM;
-   INIT_LIST_HEAD(scsi_event-link);
-   scsi_event-event = event;
-   spin_lock_irqsave(sdev-list_lock, flags);
-   list_add_tail(scsi_event-link, sdev-sdev_event_list);
-   spin_unlock_irqrestore(sdev-list_lock, flags);
-   return 0;
-}
-
-/**
  * scsi_device_event_notify_thread - send a uevent for each scsi event
  * @work: work struct for scsi_device
  *
@@ -101,24 +71,15 @@ scsi_device_set_event(struct scsi_device
  */
 static void 

Re: [PATCH] scsi_aen: fix event locking problems

2007-10-28 Thread Jeff Garzik

James Bottomley wrote:

There was a fundamental flaw in the initial code, in that it had no
locking around scsi_device_event_notify().  This is a problem because
execute_in_process_context() also has no locking (it expects the caller
to do the work).  This means that two events firing simultaneously could
potentially corrupt each other.  This might be unlikely for media change
events, but it will become more likely as we use this call as the engine
for other SCSI AENs.

The best fix looks to be simply not to use sdev-ew for the source of
the execute_work queue.  Further, since kzalloc() always has to give us
at least 32 bytes and we're doing an allocation anyway, it's free to
shove the execute_work structure into scsi_device_event_info and
eliminate all of the other locking and the work queue list.

I also separated the aen headers out into scsi_aen.h and cleaned up the
uevent processing (there's no real need to define the strings anywhere
other than in scsi_aen_uevent_notifier() ... especially as I envisage
there will be more complex strings for some SCSI events.

Finally, I exported and made available scsi_aen_chain for the things
that will attach to it.


You missed an updated version (which was CC'd to you).

Jeff



-
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_aen: fix event locking problems

2007-10-28 Thread James Bottomley
On Sun, 2007-10-28 at 16:52 -0400, Jeff Garzik wrote:
 You missed an updated version (which was CC'd to you).

No ... I was coming to yours next.

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


trivial annotations in arcmsr

2007-10-28 Thread Al Viro

driver still has serious portability problems

Signed-off-by: Al Viro [EMAIL PROTECTED]
---
 drivers/scsi/arcmsr/arcmsr.h  |   32 ---
 drivers/scsi/arcmsr/arcmsr_attr.c |6 +-
 drivers/scsi/arcmsr/arcmsr_hba.c  |  170 ++---
 3 files changed, 103 insertions(+), 105 deletions(-)

diff --git a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h
index ace7a15..3c38cd8 100644
--- a/drivers/scsi/arcmsr/arcmsr.h
+++ b/drivers/scsi/arcmsr/arcmsr.h
@@ -141,14 +141,14 @@ struct CMD_MESSAGE_FIELD
 #define IS_SG64_ADDR0x0100 /* bit24 */
 struct  SG32ENTRY
 {
-   uint32_tlength;
-   uint32_taddress;
+   __le32  length;
+   __le32  address;
 };
 struct  SG64ENTRY
 {
-   uint32_tlength;
-   uint32_taddress;
-   uint32_taddresshigh;
+   __le32  length;
+   __le32  address;
+   __le32  addresshigh;
 };
 struct SGENTRY_UNION
 {
@@ -339,13 +339,13 @@ struct MessageUnit_B
uint32_tdone_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];
uint32_tpostq_index;
uint32_tdoneq_index;
-   uint32_t*drv2iop_doorbell_reg;
-   uint32_t*drv2iop_doorbell_mask_reg;
-   uint32_t*iop2drv_doorbell_reg;
-   uint32_t*iop2drv_doorbell_mask_reg;
-   uint32_t*msgcode_rwbuffer_reg;
-   uint32_t*ioctl_wbuffer_reg;
-   uint32_t*ioctl_rbuffer_reg;
+   uint32_t__iomem *drv2iop_doorbell_reg;
+   uint32_t__iomem *drv2iop_doorbell_mask_reg;
+   uint32_t__iomem *iop2drv_doorbell_reg;
+   uint32_t__iomem *iop2drv_doorbell_mask_reg;
+   uint32_t__iomem *msgcode_rwbuffer_reg;
+   uint32_t__iomem *ioctl_wbuffer_reg;
+   uint32_t__iomem *ioctl_rbuffer_reg;
 };
 
 struct MessageUnit
@@ -374,7 +374,11 @@ struct AdapterControlBlock
/* Offset is used in making arc cdb physical to virtual calculations */
uint32_toutbound_int_enable;
 
-   struct MessageUnit *pmu;
+   union {
+   struct MessageUnit *pmu;
+   struct MessageUnit_A __iomem *  pmuA;
+   struct MessageUnit_B *  pmuB;
+   };
/* message unit ATU inbound base address0 */
 
uint32_tacb_flags;
@@ -558,7 +562,7 @@ struct SENSE_DATA
 
 extern void arcmsr_post_ioctldata2iop(struct AdapterControlBlock *);
 extern void arcmsr_iop_message_read(struct AdapterControlBlock *);
-extern struct QBUFFER *arcmsr_get_iop_rqbuffer(struct AdapterControlBlock *);
+extern struct QBUFFER __iomem *arcmsr_get_iop_rqbuffer(struct 
AdapterControlBlock *);
 extern struct class_device_attribute *arcmsr_host_attrs[];
 extern int arcmsr_alloc_sysfs_attr(struct AdapterControlBlock *);
 void arcmsr_free_sysfs_attr(struct AdapterControlBlock *acb);
diff --git a/drivers/scsi/arcmsr/arcmsr_attr.c 
b/drivers/scsi/arcmsr/arcmsr_attr.c
index d04d1aa..7d7b0a5 100644
--- a/drivers/scsi/arcmsr/arcmsr_attr.c
+++ b/drivers/scsi/arcmsr/arcmsr_attr.c
@@ -85,13 +85,13 @@ static ssize_t arcmsr_sysfs_iop_message_read(struct kobject 
*kobj,
allxfer_len++;
}
if (acb-acb_flags  ACB_F_IOPDATA_OVERFLOW) {
-   struct QBUFFER *prbuffer;
-   uint8_t *iop_data;
+   struct QBUFFER __iomem *prbuffer;
+   uint8_t __iomem *iop_data;
int32_t iop_len;
 
acb-acb_flags = ~ACB_F_IOPDATA_OVERFLOW;
prbuffer = arcmsr_get_iop_rqbuffer(acb);
-   iop_data = (uint8_t *)prbuffer-data;
+   iop_data = prbuffer-data;
iop_len = readl(prbuffer-data_len);
while (iop_len  0) {
acb-rqbuffer[acb-rqbuf_lastindex] = readb(iop_data);
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index f7a2528..aaee028 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -236,8 +236,8 @@ static int arcmsr_alloc_ccb_pool(struct AdapterControlBlock 
*acb)
uint32_t intmask_org;
int i, j;
 
-   acb-pmu = ioremap(pci_resource_start(pdev, 0), 
pci_resource_len(pdev, 0));
-   if (!acb-pmu) {
+   acb-pmuA = ioremap(pci_resource_start(pdev, 0), 
pci_resource_len(pdev, 0));
+   if (!acb-pmuA) {
printk(KERN_NOTICE arcmsr%d: memory mapping region 
fail \n,

deal with resource allocation bugs in arcmsr

2007-10-28 Thread Al Viro

a) for type B we should _not_ iounmap() acb-pmu; it's not ioremapped.
b) for type B we should iounmap() two regions we _do_ ioremap.
c) if ioremap() fails, we need to bail out (and clean up).

Signed-off-by: Al Viro [EMAIL PROTECTED]
---
 drivers/scsi/arcmsr/arcmsr.h |9 -
 drivers/scsi/arcmsr/arcmsr_hba.c |   33 ++---
 2 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h
index 3c38cd8..a67e29f 100644
--- a/drivers/scsi/arcmsr/arcmsr.h
+++ b/drivers/scsi/arcmsr/arcmsr.h
@@ -348,14 +348,6 @@ struct MessageUnit_B
uint32_t__iomem *ioctl_rbuffer_reg;
 };
 
-struct MessageUnit
-{
-   union
-   {
-   struct MessageUnit_Apmu_A;
-   struct MessageUnit_Bpmu_B;
-   } u;
-};
 /*
 ***
 ** Adapter Control Block
@@ -375,7 +367,6 @@ struct AdapterControlBlock
uint32_toutbound_int_enable;
 
union {
-   struct MessageUnit *pmu;
struct MessageUnit_A __iomem *  pmuA;
struct MessageUnit_B *  pmuB;
};
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index aaee028..152af46 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -240,14 +240,18 @@ static int arcmsr_alloc_ccb_pool(struct 
AdapterControlBlock *acb)
if (!acb-pmuA) {
printk(KERN_NOTICE arcmsr%d: memory mapping region 
fail \n,
acb-host-host_no);
+   return -ENOMEM;
}
 
dma_coherent = dma_alloc_coherent(pdev-dev,
ARCMSR_MAX_FREECCB_NUM *
sizeof (struct CommandControlBlock) + 0x20,
dma_coherent_handle, GFP_KERNEL);
-   if (!dma_coherent)
+
+   if (!dma_coherent) {
+   iounmap(acb-pmuA);
return -ENOMEM;
+   }
 
acb-dma_coherent = dma_coherent;
acb-dma_coherent_handle = dma_coherent_handle;
@@ -331,8 +335,16 @@ static int arcmsr_alloc_ccb_pool(struct 
AdapterControlBlock *acb)
acb-pmuB = reg;
mem_base0 = ioremap(pci_resource_start(pdev, 0),
pci_resource_len(pdev, 0));
+   if (!mem_base0)
+   goto out;
+
mem_base1 = ioremap(pci_resource_start(pdev, 2),
pci_resource_len(pdev, 2));
+   if (!mem_base1) {
+   iounmap(mem_base0);
+   goto out;
+   }
+
reg-drv2iop_doorbell_reg = mem_base0 + ARCMSR_DRV2IOP_DOORBELL;
reg-drv2iop_doorbell_mask_reg = mem_base0 +
ARCMSR_DRV2IOP_DOORBELL_MASK;
@@ -357,6 +369,12 @@ static int arcmsr_alloc_ccb_pool(struct 
AdapterControlBlock *acb)
break;
}
return 0;
+
+out:
+   dma_free_coherent(acb-pdev-dev,
+   ARCMSR_MAX_FREECCB_NUM * sizeof(struct CommandControlBlock) + 
0x20,
+   acb-dma_coherent, acb-dma_coherent_handle);
+   return -ENOMEM;
 }
 
 static int arcmsr_probe(struct pci_dev *pdev,
@@ -449,7 +467,6 @@ static int arcmsr_probe(struct pci_dev *pdev,
free_irq(pdev-irq, acb);
  out_free_ccb_pool:
arcmsr_free_ccb_pool(acb);
-   iounmap(acb-pmu);
  out_release_regions:
pci_release_regions(pdev);
  out_host_put:
@@ -810,7 +827,6 @@ static void arcmsr_remove(struct pci_dev *pdev)
}
 
free_irq(pdev-irq, acb);
-   iounmap(acb-pmu);
arcmsr_free_ccb_pool(acb);
pci_release_regions(pdev);
 
@@ -1018,6 +1034,17 @@ static void arcmsr_stop_adapter_bgrb(struct 
AdapterControlBlock *acb)
 
 static void arcmsr_free_ccb_pool(struct AdapterControlBlock *acb)
 {
+   switch (acb-adapter_type) {
+   case ACB_ADAPTER_TYPE_A: {
+   iounmap(acb-pmuA);
+   break;
+   }
+   case ACB_ADAPTER_TYPE_B: {
+   struct MessageUnit_B *reg = acb-pmuB;
+   iounmap(reg-drv2iop_doorbell_reg - ARCMSR_DRV2IOP_DOORBELL);
+   iounmap(reg-ioctl_wbuffer_reg - ARCMSR_IOCTL_WBUFFER);
+   }
+   }
dma_free_coherent(acb-pdev-dev,
ARCMSR_MAX_FREECCB_NUM * sizeof (struct CommandControlBlock) + 
0x20,
acb-dma_coherent,
-- 
1.5.3.GIT


-
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


arcmsr: endianness bug

2007-10-28 Thread Al Viro

initializing a field in data shared with the card with
cpu_to_le32(something) | 0x10 is broken - the field
is, indeed, little-endian and we need cpu_to_le32() on
both parts.

Signed-off-by: Al Viro [EMAIL PROTECTED]
---
 drivers/scsi/arcmsr/arcmsr_hba.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index 152af46..acbc50f 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -932,7 +932,7 @@ static void arcmsr_build_ccb(struct AdapterControlBlock 
*acb,
 
pdma_sg-addresshigh = address_hi;
pdma_sg-address = address_lo;
-   pdma_sg-length = length|IS_SG64_ADDR;
+   pdma_sg-length = 
length|cpu_to_le32(IS_SG64_ADDR);
psge += sizeof (struct SG64ENTRY);
arccdbsize += sizeof (struct SG64ENTRY);
}
-- 
1.5.3.GIT


-
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


fix reentrancy bug in arcmsr_get_iop_{r,w}qbuffer()

2007-10-28 Thread Al Viro

doh...

Signed-off-by: Al Viro [EMAIL PROTECTED]
---
 drivers/scsi/arcmsr/arcmsr_hba.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index acbc50f..d466a2d 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -1095,7 +1095,7 @@ static void arcmsr_iop_message_wrote(struct 
AdapterControlBlock *acb)
 
 struct QBUFFER __iomem *arcmsr_get_iop_rqbuffer(struct AdapterControlBlock 
*acb)
 {
-   static struct QBUFFER __iomem *qbuffer;
+   struct QBUFFER __iomem *qbuffer = NULL;
 
switch (acb-adapter_type) {
 
@@ -1116,7 +1116,7 @@ struct QBUFFER __iomem *arcmsr_get_iop_rqbuffer(struct 
AdapterControlBlock *acb)
 
 static struct QBUFFER __iomem *arcmsr_get_iop_wqbuffer(struct 
AdapterControlBlock *acb)
 {
-   static struct QBUFFER __iomem *pqbuffer;
+   struct QBUFFER __iomem *pqbuffer = NULL;
 
switch (acb-adapter_type) {
 
-- 
1.5.3.GIT

-
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