aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorAsai Thambi S P <asamymuthupa@micron.com>2012-04-09 02:35:39 -0400
committerJens Axboe <axboe@kernel.dk>2012-04-09 02:35:39 -0400
commit95fea2f1d90626498e2495a81fe5aab7fba9fb3f (patch)
treefd3fe50db4390110c0e028cf81b4529fd2e60afb /drivers/block
parentc74b0f586fa3cbc92ca451836fd75ae7a3fa85ac (diff)
mtip32xx: dump tagmap on failure
Dump tagmap on failure, instead of individual tags. Signed-off-by: Asai Thambi S P <asamymuthupa@micron.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/mtip32xx/mtip32xx.c62
1 files changed, 33 insertions, 29 deletions
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 47404ef5749f..00f9fc992090 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -526,6 +526,25 @@ static void mtip_restart_port(struct mtip_port *port)
526} 526}
527 527
528/* 528/*
529 * Helper function for tag logging
530 */
531static void print_tags(struct driver_data *dd,
532 char *msg,
533 unsigned long *tagbits,
534 int cnt)
535{
536 unsigned char tagmap[128];
537 int group, tagmap_len = 0;
538
539 memset(tagmap, 0, sizeof(tagmap));
540 for (group = SLOTBITS_IN_LONGS; group > 0; group--)
541 tagmap_len = sprintf(tagmap + tagmap_len, "%016lX ",
542 tagbits[group-1]);
543 dev_warn(&dd->pdev->dev,
544 "%d command(s) %s: tagmap [%s]", cnt, msg, tagmap);
545}
546
547/*
529 * Called periodically to see if any read/write commands are 548 * Called periodically to see if any read/write commands are
530 * taking too long to complete. 549 * taking too long to complete.
531 * 550 *
@@ -542,7 +561,7 @@ static void mtip_timeout_function(unsigned long int data)
542 int tag, cmdto_cnt = 0; 561 int tag, cmdto_cnt = 0;
543 unsigned int bit, group; 562 unsigned int bit, group;
544 unsigned int num_command_slots = port->dd->slot_groups * 32; 563 unsigned int num_command_slots = port->dd->slot_groups * 32;
545 unsigned long to; 564 unsigned long to, tagaccum[SLOTBITS_IN_LONGS];
546 565
547 if (unlikely(!port)) 566 if (unlikely(!port))
548 return; 567 return;
@@ -552,6 +571,8 @@ static void mtip_timeout_function(unsigned long int data)
552 jiffies + msecs_to_jiffies(30000)); 571 jiffies + msecs_to_jiffies(30000));
553 return; 572 return;
554 } 573 }
574 /* clear the tag accumulator */
575 memset(tagaccum, 0, SLOTBITS_IN_LONGS * sizeof(long));
555 576
556 for (tag = 0; tag < num_command_slots; tag++) { 577 for (tag = 0; tag < num_command_slots; tag++) {
557 /* 578 /*
@@ -569,9 +590,7 @@ static void mtip_timeout_function(unsigned long int data)
569 command = &port->commands[tag]; 590 command = &port->commands[tag];
570 fis = (struct host_to_dev_fis *) command->command; 591 fis = (struct host_to_dev_fis *) command->command;
571 592
572 dev_warn(&port->dd->pdev->dev, 593 set_bit(tag, tagaccum);
573 "Timeout for command tag %d\n", tag);
574
575 cmdto_cnt++; 594 cmdto_cnt++;
576 if (cmdto_cnt == 1) 595 if (cmdto_cnt == 1)
577 set_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags); 596 set_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags);
@@ -608,9 +627,8 @@ static void mtip_timeout_function(unsigned long int data)
608 } 627 }
609 628
610 if (cmdto_cnt && !test_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags)) { 629 if (cmdto_cnt && !test_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags)) {
611 dev_warn(&port->dd->pdev->dev, 630 print_tags(port->dd, "timed out", tagaccum, cmdto_cnt);
612 "%d commands timed out: restarting port", 631
613 cmdto_cnt);
614 mtip_restart_port(port); 632 mtip_restart_port(port);
615 clear_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags); 633 clear_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags);
616 wake_up_interruptible(&port->svc_wait); 634 wake_up_interruptible(&port->svc_wait);
@@ -733,23 +751,6 @@ static void mtip_null_completion(struct mtip_port *port,
733 return; 751 return;
734} 752}
735 753
736/*
737 * Helper function for tag logging
738 */
739static void print_tags(struct driver_data *dd,
740 char *msg,
741 unsigned long *tagbits)
742{
743 unsigned int tag, count = 0;
744
745 for (tag = 0; tag < (dd->slot_groups) * 32; tag++) {
746 if (test_bit(tag, tagbits))
747 count++;
748 }
749 if (count)
750 dev_info(&dd->pdev->dev, "%s [%i tags]\n", msg, count);
751}
752
753static int mtip_read_log_page(struct mtip_port *port, u8 page, u16 *buffer, 754static int mtip_read_log_page(struct mtip_port *port, u8 page, u16 *buffer,
754 dma_addr_t buffer_dma, unsigned int sectors); 755 dma_addr_t buffer_dma, unsigned int sectors);
755static int mtip_get_smart_attr(struct mtip_port *port, unsigned int id, 756static int mtip_get_smart_attr(struct mtip_port *port, unsigned int id,
@@ -770,6 +771,7 @@ static void mtip_handle_tfe(struct driver_data *dd)
770 u32 completed; 771 u32 completed;
771 struct host_to_dev_fis *fis; 772 struct host_to_dev_fis *fis;
772 unsigned long tagaccum[SLOTBITS_IN_LONGS]; 773 unsigned long tagaccum[SLOTBITS_IN_LONGS];
774 unsigned int cmd_cnt = 0;
773 unsigned char *buf; 775 unsigned char *buf;
774 char *fail_reason = NULL; 776 char *fail_reason = NULL;
775 int fail_all_ncq_write = 0, fail_all_ncq_cmds = 0; 777 int fail_all_ncq_write = 0, fail_all_ncq_cmds = 0;
@@ -781,6 +783,9 @@ static void mtip_handle_tfe(struct driver_data *dd)
781 /* Stop the timer to prevent command timeouts. */ 783 /* Stop the timer to prevent command timeouts. */
782 del_timer(&port->cmd_timer); 784 del_timer(&port->cmd_timer);
783 785
786 /* clear the tag accumulator */
787 memset(tagaccum, 0, SLOTBITS_IN_LONGS * sizeof(long));
788
784 /* Set eh_active */ 789 /* Set eh_active */
785 set_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags); 790 set_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags);
786 791
@@ -791,9 +796,6 @@ static void mtip_handle_tfe(struct driver_data *dd)
791 /* clear completed status register in the hardware.*/ 796 /* clear completed status register in the hardware.*/
792 writel(completed, port->completed[group]); 797 writel(completed, port->completed[group]);
793 798
794 /* clear the tag accumulator */
795 memset(tagaccum, 0, SLOTBITS_IN_LONGS * sizeof(long));
796
797 /* Process successfully completed commands */ 799 /* Process successfully completed commands */
798 for (bit = 0; bit < 32 && completed; bit++) { 800 for (bit = 0; bit < 32 && completed; bit++) {
799 if (!(completed & (1<<bit))) 801 if (!(completed & (1<<bit)))
@@ -807,6 +809,7 @@ static void mtip_handle_tfe(struct driver_data *dd)
807 cmd = &port->commands[tag]; 809 cmd = &port->commands[tag];
808 if (likely(cmd->comp_func)) { 810 if (likely(cmd->comp_func)) {
809 set_bit(tag, tagaccum); 811 set_bit(tag, tagaccum);
812 cmd_cnt++;
810 atomic_set(&cmd->active, 0); 813 atomic_set(&cmd->active, 0);
811 cmd->comp_func(port, 814 cmd->comp_func(port,
812 tag, 815 tag,
@@ -824,7 +827,8 @@ static void mtip_handle_tfe(struct driver_data *dd)
824 } 827 }
825 } 828 }
826 } 829 }
827 print_tags(dd, "TFE tags completed:", tagaccum); 830
831 print_tags(dd, "completed (TFE)", tagaccum, cmd_cnt);
828 832
829 /* Restart the port */ 833 /* Restart the port */
830 mdelay(20); 834 mdelay(20);
@@ -934,7 +938,7 @@ static void mtip_handle_tfe(struct driver_data *dd)
934 tag); 938 tag);
935 } 939 }
936 } 940 }
937 print_tags(dd, "TFE tags reissued:", tagaccum); 941 print_tags(dd, "reissued (TFE)", tagaccum, cmd_cnt);
938 942
939 /* clear eh_active */ 943 /* clear eh_active */
940 clear_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags); 944 clear_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags);