* cciss update for 2.4.24-pre1, 2 of 2
@ 2003-12-16 23:57 mikem
2003-12-17 22:50 ` Jens Axboe
0 siblings, 1 reply; 6+ messages in thread
From: mikem @ 2003-12-16 23:57 UTC (permalink / raw)
To: axboe, marcelo.tosatti; +Cc: linux-kernel, mike.miller, scott.benesh
Some older cciss controllers may take a long time to become ready after
hot replacing the controller. This patch addresses that problem by adding
a check of the scratchpad register. This patch is intended to supplement
the monitor thread when cciss is used in an md environment. In the event
of a controller failure the failed board can now be more reliably
replaced. This is patch #2 of 2.
Please consider this patch for inclusion in the 2.4.24 kernel.
Thanks,
mikem
mike.miller@hp.com
------------------------------------------------------------------------------
diff -burN lx2424pre1-p01/drivers/block/cciss.c lx2424pre1/drivers/block/cciss.c
--- lx2424pre1-p01/drivers/block/cciss.c 2003-12-16 17:25:50.000000000 -0600
+++ lx2424pre1/drivers/block/cciss.c 2003-12-16 17:30:41.000000000 -0600
@@ -2537,8 +2537,8 @@
static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev)
{
ushort subsystem_vendor_id, subsystem_device_id, command;
- unchar irq = pdev->irq;
- __u32 board_id;
+ unchar irq = pdev->irq, revision, ready = 0;
+ __u32 board_id, scratchpad;
__u64 cfg_offset;
__u32 cfg_base_addr;
__u64 cfg_base_addr_index;
@@ -2609,6 +2609,21 @@
printk("address 0 = %x\n", c->paddr);
#endif /* CCISS_DEBUG */
c->vaddr = remap_pci_mem(c->paddr, 200);
+ /* Wait for the board to become ready. (PCI hotplug needs this.)
+ * We poll for up to 120 secs, once per 100ms. */
+ for (i=0; i < 1200; i++) {
+ scratchpad = readl(c->vaddr + SA5_SCRATCHPAD_OFFSET);
+ if (scratchpad == 0xffff0000) {
+ ready = 1;
+ break;
+ }
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(HZ / 10); /* wait 100ms */
+ }
+ if (!ready) {
+ printk(KERN_WARNING "cciss: Board not ready. Timed out.\n");
+ return -1;
+ }
/* get the address index number */
cfg_base_addr = readl(c->vaddr + SA5_CTCFG_OFFSET);
diff -burN lx2424pre1-p01/drivers/block/cciss.h lx2424pre1/drivers/block/cciss.h
--- lx2424pre1-p01/drivers/block/cciss.h 2003-11-28 12:26:19.000000000 -0600
+++ lx2424pre1/drivers/block/cciss.h 2003-12-16 17:30:41.000000000 -0600
@@ -137,6 +137,7 @@
#define SA5_REPLY_INTR_MASK_OFFSET 0x34
#define SA5_REPLY_PORT_OFFSET 0x44
#define SA5_INTR_STATUS 0x30
+#define SA5_SCRATCHPAD_OFFSET 0xB0
#define SA5_CTCFG_OFFSET 0xB4
#define SA5_CTMEM_OFFSET 0xB8
------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: cciss update for 2.4.24-pre1, 2 of 2
2003-12-16 23:57 cciss update for 2.4.24-pre1, 2 of 2 mikem
@ 2003-12-17 22:50 ` Jens Axboe
2003-12-17 23:49 ` Andrew Morton
0 siblings, 1 reply; 6+ messages in thread
From: Jens Axboe @ 2003-12-17 22:50 UTC (permalink / raw)
To: mikem; +Cc: marcelo.tosatti, linux-kernel, mike.miller, scott.benesh
On Tue, Dec 16 2003, mikem@beardog.cca.cpqcorp.net wrote:
> Some older cciss controllers may take a long time to become ready after
> hot replacing the controller. This patch addresses that problem by adding
> a check of the scratchpad register. This patch is intended to supplement
> the monitor thread when cciss is used in an md environment. In the event
> of a controller failure the failed board can now be more reliably
> replaced. This is patch #2 of 2.
> Please consider this patch for inclusion in the 2.4.24 kernel.
>
> Thanks,
> mikem
> mike.miller@hp.com
> ------------------------------------------------------------------------------
> diff -burN lx2424pre1-p01/drivers/block/cciss.c lx2424pre1/drivers/block/cciss.c
> --- lx2424pre1-p01/drivers/block/cciss.c 2003-12-16 17:25:50.000000000 -0600
> +++ lx2424pre1/drivers/block/cciss.c 2003-12-16 17:30:41.000000000 -0600
> @@ -2537,8 +2537,8 @@
> static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev)
> {
> ushort subsystem_vendor_id, subsystem_device_id, command;
> - unchar irq = pdev->irq;
> - __u32 board_id;
> + unchar irq = pdev->irq, revision, ready = 0;
> + __u32 board_id, scratchpad;
> __u64 cfg_offset;
> __u32 cfg_base_addr;
> __u64 cfg_base_addr_index;
> @@ -2609,6 +2609,21 @@
> printk("address 0 = %x\n", c->paddr);
> #endif /* CCISS_DEBUG */
> c->vaddr = remap_pci_mem(c->paddr, 200);
> + /* Wait for the board to become ready. (PCI hotplug needs this.)
> + * We poll for up to 120 secs, once per 100ms. */
> + for (i=0; i < 1200; i++) {
> + scratchpad = readl(c->vaddr + SA5_SCRATCHPAD_OFFSET);
> + if (scratchpad == 0xffff0000) {
> + ready = 1;
> + break;
> + }
> + set_current_state(TASK_INTERRUPTIBLE);
> + schedule_timeout(HZ / 10); /* wait 100ms */
> + }
> + if (!ready) {
> + printk(KERN_WARNING "cciss: Board not ready. Timed out.\n");
> + return -1;
> + }
Fine as well, aren't you happy you changed this to schedule_timeout()
instead of busy looping? :)
--
Jens Axboe
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: cciss update for 2.4.24-pre1, 2 of 2
2003-12-17 22:50 ` Jens Axboe
@ 2003-12-17 23:49 ` Andrew Morton
2003-12-18 0:57 ` Jeff Garzik
2003-12-18 7:47 ` Jens Axboe
0 siblings, 2 replies; 6+ messages in thread
From: Andrew Morton @ 2003-12-17 23:49 UTC (permalink / raw)
To: Jens Axboe
Cc: mikem, marcelo.tosatti, linux-kernel, mike.miller, scott.benesh
Jens Axboe <axboe@suse.de> wrote:
>
> > + for (i=0; i < 1200; i++) {
> > + scratchpad = readl(c->vaddr + SA5_SCRATCHPAD_OFFSET);
> > + if (scratchpad == 0xffff0000) {
> > + ready = 1;
> > + break;
> > + }
> > + set_current_state(TASK_INTERRUPTIBLE);
> > + schedule_timeout(HZ / 10); /* wait 100ms */
> > + }
> > + if (!ready) {
> > + printk(KERN_WARNING "cciss: Board not ready. Timed out.\n");
> > + return -1;
> > + }
>
> Fine as well, aren't you happy you changed this to schedule_timeout()
> instead of busy looping? :)
It will still be a busy loop if this task has a signal pending.
TASK_UNINTERRUPTIBLE may be more appropriate...
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: cciss update for 2.4.24-pre1, 2 of 2
2003-12-17 23:49 ` Andrew Morton
@ 2003-12-18 0:57 ` Jeff Garzik
2003-12-18 7:47 ` Jens Axboe
1 sibling, 0 replies; 6+ messages in thread
From: Jeff Garzik @ 2003-12-18 0:57 UTC (permalink / raw)
To: Andrew Morton
Cc: Jens Axboe, mikem, marcelo.tosatti, linux-kernel, mike.miller,
scott.benesh
Andrew Morton wrote:
> It will still be a busy loop if this task has a signal pending.
> TASK_UNINTERRUPTIBLE may be more appropriate...
Agreed. Same reason you want to use down() instead of
down_interruptible(), when using a semaphore to wait on some hardware
condition.
Jeff
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: cciss update for 2.4.24-pre1, 2 of 2
2003-12-17 23:49 ` Andrew Morton
2003-12-18 0:57 ` Jeff Garzik
@ 2003-12-18 7:47 ` Jens Axboe
2003-12-18 15:05 ` mikem
1 sibling, 1 reply; 6+ messages in thread
From: Jens Axboe @ 2003-12-18 7:47 UTC (permalink / raw)
To: Andrew Morton
Cc: mikem, marcelo.tosatti, linux-kernel, mike.miller, scott.benesh
On Wed, Dec 17 2003, Andrew Morton wrote:
> Jens Axboe <axboe@suse.de> wrote:
> >
> > > + for (i=0; i < 1200; i++) {
> > > + scratchpad = readl(c->vaddr + SA5_SCRATCHPAD_OFFSET);
> > > + if (scratchpad == 0xffff0000) {
> > > + ready = 1;
> > > + break;
> > > + }
> > > + set_current_state(TASK_INTERRUPTIBLE);
> > > + schedule_timeout(HZ / 10); /* wait 100ms */
> > > + }
> > > + if (!ready) {
> > > + printk(KERN_WARNING "cciss: Board not ready. Timed out.\n");
> > > + return -1;
> > > + }
> >
> > Fine as well, aren't you happy you changed this to schedule_timeout()
> > instead of busy looping? :)
>
> It will still be a busy loop if this task has a signal pending.
> TASK_UNINTERRUPTIBLE may be more appropriate...
Agreed, that would be better.
--
Jens Axboe
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: cciss update for 2.4.24-pre1, 2 of 2
2003-12-18 7:47 ` Jens Axboe
@ 2003-12-18 15:05 ` mikem
0 siblings, 0 replies; 6+ messages in thread
From: mikem @ 2003-12-18 15:05 UTC (permalink / raw)
To: Jens Axboe
Cc: Andrew Morton, marcelo.tosatti, linux-kernel, mike.miller,
scott.benesh, jgarzik
Here's a version of the patch with the flag changed to
TASK_UNINTERRUPTIBLE. Thanks for the input.
Thanks,
mikem
mike.miller@hp.com
-------------------------------------------------------------------------------
diff -burN lx2424pre1-p01/drivers/block/cciss.c lx2424pre1/drivers/block/cciss.c
--- lx2424pre1-p01/drivers/block/cciss.c 2003-12-16 17:25:50.000000000 -0600
+++ lx2424pre1/drivers/block/cciss.c 2003-12-16 17:30:41.000000000 -0600
@@ -2537,8 +2537,8 @@
static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev)
{
ushort subsystem_vendor_id, subsystem_device_id, command;
- unchar irq = pdev->irq;
- __u32 board_id;
+ unchar irq = pdev->irq, ready = 0;
+ __u32 board_id, scratchpad;
__u64 cfg_offset;
__u32 cfg_base_addr;
__u64 cfg_base_addr_index;
@@ -2609,6 +2609,21 @@
printk("address 0 = %x\n", c->paddr);
#endif /* CCISS_DEBUG */
c->vaddr = remap_pci_mem(c->paddr, 200);
+ /* Wait for the board to become ready. (PCI hotplug needs this.)
+ * We poll for up to 120 secs, once per 100ms. */
+ for (i=0; i < 1200; i++) {
+ scratchpad = readl(c->vaddr + SA5_SCRATCHPAD_OFFSET);
+ if (scratchpad == 0xffff0000) {
+ ready = 1;
+ break;
+ }
+ set_current_state(TASK_UNINTERRUPTIBLE);
+ schedule_timeout(HZ / 10); /* wait 100ms */
+ }
+ if (!ready) {
+ printk(KERN_WARNING "cciss: Board not ready. Timed out.\n");
+ return -1;
+ }
/* get the address index number */
cfg_base_addr = readl(c->vaddr + SA5_CTCFG_OFFSET);
diff -burN lx2424pre1-p01/drivers/block/cciss.h lx2424pre1/drivers/block/cciss.h
--- lx2424pre1-p01/drivers/block/cciss.h 2003-11-28 12:26:19.000000000 -0600
+++ lx2424pre1/drivers/block/cciss.h 2003-12-16 17:30:41.000000000 -0600
@@ -137,6 +137,7 @@
#define SA5_REPLY_INTR_MASK_OFFSET 0x34
#define SA5_REPLY_PORT_OFFSET 0x44
#define SA5_INTR_STATUS 0x30
+#define SA5_SCRATCHPAD_OFFSET 0xB0
#define SA5_CTCFG_OFFSET 0xB4
#define SA5_CTMEM_OFFSET 0xB8
-------------------------------------------------------------------------------
On Thu, 18 Dec 2003, Jens Axboe wrote:
> On Wed, Dec 17 2003, Andrew Morton wrote:
> > Jens Axboe <axboe@suse.de> wrote:
> > >
> > > > + for (i=0; i < 1200; i++) {
> > > > + scratchpad = readl(c->vaddr + SA5_SCRATCHPAD_OFFSET);
> > > > + if (scratchpad == 0xffff0000) {
> > > > + ready = 1;
> > > > + break;
> > > > + }
> > > > + set_current_state(TASK_INTERRUPTIBLE);
> > > > + schedule_timeout(HZ / 10); /* wait 100ms */
> > > > + }
> > > > + if (!ready) {
> > > > + printk(KERN_WARNING "cciss: Board not ready. Timed out.\n");
> > > > + return -1;
> > > > + }
> > >
> > > Fine as well, aren't you happy you changed this to schedule_timeout()
> > > instead of busy looping? :)
> >
> > It will still be a busy loop if this task has a signal pending.
> > TASK_UNINTERRUPTIBLE may be more appropriate...
>
> Agreed, that would be better.
>
> --
> Jens Axboe
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2003-12-18 15:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-16 23:57 cciss update for 2.4.24-pre1, 2 of 2 mikem
2003-12-17 22:50 ` Jens Axboe
2003-12-17 23:49 ` Andrew Morton
2003-12-18 0:57 ` Jeff Garzik
2003-12-18 7:47 ` Jens Axboe
2003-12-18 15:05 ` mikem
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).