diff options
author | Jayamohan Kallickal <jayamohan.kallickal@emulex.com> | 2011-08-24 19:05:30 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-08-29 03:16:17 -0400 |
commit | 8fcfb21073ea4f4261c8ee3ccd2fde8e281a4f28 (patch) | |
tree | de2eaebef137a95dcef0dc153531a53f6d0d53c0 /drivers/scsi/be2iscsi | |
parent | e5fdae5583e30bbc730e2035d0b6da33e7d8e4ee (diff) |
[SCSI] be2iscsi: Fixing the /proc/interrupts problem V3
Fix be2iscsi driver to use a separate pointer for each irq action->name
field and avoid display corruption in /proc/interrupts. The be2iscsi driver
was using a single static array in a function for the irq action->name field.
This results in garbage output from /proc/interrupts
The pointer for action->name is garbage and scribbles the output on the screen.
This patch fixes the problem:
156: 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 PCI-MSI-X beiscsi_msix_0017
This patch is based on Prarit's patch here:
http://www.spinics.net/lists/linux-scsi/msg52325.html
but I have fixed up the failure paths and removed
redundant check for !i suggested by Eike.
Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/be2iscsi')
-rw-r--r-- | drivers/scsi/be2iscsi/be_main.c | 34 | ||||
-rw-r--r-- | drivers/scsi/be2iscsi/be_main.h | 3 |
2 files changed, 29 insertions, 8 deletions
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 72ac64bbceaf..04970eb1975f 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c | |||
@@ -822,33 +822,47 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba) | |||
822 | struct hwi_controller *phwi_ctrlr; | 822 | struct hwi_controller *phwi_ctrlr; |
823 | struct hwi_context_memory *phwi_context; | 823 | struct hwi_context_memory *phwi_context; |
824 | int ret, msix_vec, i, j; | 824 | int ret, msix_vec, i, j; |
825 | char desc[32]; | ||
826 | 825 | ||
827 | phwi_ctrlr = phba->phwi_ctrlr; | 826 | phwi_ctrlr = phba->phwi_ctrlr; |
828 | phwi_context = phwi_ctrlr->phwi_ctxt; | 827 | phwi_context = phwi_ctrlr->phwi_ctxt; |
829 | 828 | ||
830 | if (phba->msix_enabled) { | 829 | if (phba->msix_enabled) { |
831 | for (i = 0; i < phba->num_cpus; i++) { | 830 | for (i = 0; i < phba->num_cpus; i++) { |
832 | sprintf(desc, "beiscsi_msix_%04x", i); | 831 | phba->msi_name[i] = kzalloc(BEISCSI_MSI_NAME, |
832 | GFP_KERNEL); | ||
833 | if (!phba->msi_name[i]) { | ||
834 | ret = -ENOMEM; | ||
835 | goto free_msix_irqs; | ||
836 | } | ||
837 | |||
838 | sprintf(phba->msi_name[i], "beiscsi_%02x_%02x", | ||
839 | phba->shost->host_no, i); | ||
833 | msix_vec = phba->msix_entries[i].vector; | 840 | msix_vec = phba->msix_entries[i].vector; |
834 | ret = request_irq(msix_vec, be_isr_msix, 0, desc, | 841 | ret = request_irq(msix_vec, be_isr_msix, 0, |
842 | phba->msi_name[i], | ||
835 | &phwi_context->be_eq[i]); | 843 | &phwi_context->be_eq[i]); |
836 | if (ret) { | 844 | if (ret) { |
837 | shost_printk(KERN_ERR, phba->shost, | 845 | shost_printk(KERN_ERR, phba->shost, |
838 | "beiscsi_init_irqs-Failed to" | 846 | "beiscsi_init_irqs-Failed to" |
839 | "register msix for i = %d\n", i); | 847 | "register msix for i = %d\n", i); |
840 | if (!i) | 848 | kfree(phba->msi_name[i]); |
841 | return ret; | ||
842 | goto free_msix_irqs; | 849 | goto free_msix_irqs; |
843 | } | 850 | } |
844 | } | 851 | } |
852 | phba->msi_name[i] = kzalloc(BEISCSI_MSI_NAME, GFP_KERNEL); | ||
853 | if (!phba->msi_name[i]) { | ||
854 | ret = -ENOMEM; | ||
855 | goto free_msix_irqs; | ||
856 | } | ||
857 | sprintf(phba->msi_name[i], "beiscsi_mcc_%02x", | ||
858 | phba->shost->host_no); | ||
845 | msix_vec = phba->msix_entries[i].vector; | 859 | msix_vec = phba->msix_entries[i].vector; |
846 | ret = request_irq(msix_vec, be_isr_mcc, 0, "beiscsi_msix_mcc", | 860 | ret = request_irq(msix_vec, be_isr_mcc, 0, phba->msi_name[i], |
847 | &phwi_context->be_eq[i]); | 861 | &phwi_context->be_eq[i]); |
848 | if (ret) { | 862 | if (ret) { |
849 | shost_printk(KERN_ERR, phba->shost, "beiscsi_init_irqs-" | 863 | shost_printk(KERN_ERR, phba->shost, "beiscsi_init_irqs-" |
850 | "Failed to register beiscsi_msix_mcc\n"); | 864 | "Failed to register beiscsi_msix_mcc\n"); |
851 | i++; | 865 | kfree(phba->msi_name[i]); |
852 | goto free_msix_irqs; | 866 | goto free_msix_irqs; |
853 | } | 867 | } |
854 | 868 | ||
@@ -863,8 +877,11 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba) | |||
863 | } | 877 | } |
864 | return 0; | 878 | return 0; |
865 | free_msix_irqs: | 879 | free_msix_irqs: |
866 | for (j = i - 1; j == 0; j++) | 880 | for (j = i - 1; j >= 0; j--) { |
881 | kfree(phba->msi_name[j]); | ||
882 | msix_vec = phba->msix_entries[j].vector; | ||
867 | free_irq(msix_vec, &phwi_context->be_eq[j]); | 883 | free_irq(msix_vec, &phwi_context->be_eq[j]); |
884 | } | ||
868 | return ret; | 885 | return ret; |
869 | } | 886 | } |
870 | 887 | ||
@@ -4125,6 +4142,7 @@ static void beiscsi_remove(struct pci_dev *pcidev) | |||
4125 | for (i = 0; i <= phba->num_cpus; i++) { | 4142 | for (i = 0; i <= phba->num_cpus; i++) { |
4126 | msix_vec = phba->msix_entries[i].vector; | 4143 | msix_vec = phba->msix_entries[i].vector; |
4127 | free_irq(msix_vec, &phwi_context->be_eq[i]); | 4144 | free_irq(msix_vec, &phwi_context->be_eq[i]); |
4145 | kfree(phba->msi_name[i]); | ||
4128 | } | 4146 | } |
4129 | } else | 4147 | } else |
4130 | if (phba->pcidev->irq) | 4148 | if (phba->pcidev->irq) |
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h index 5ce5170254ca..be0e0bd6f0ed 100644 --- a/drivers/scsi/be2iscsi/be_main.h +++ b/drivers/scsi/be2iscsi/be_main.h | |||
@@ -162,6 +162,8 @@ do { \ | |||
162 | #define PAGES_REQUIRED(x) \ | 162 | #define PAGES_REQUIRED(x) \ |
163 | ((x < PAGE_SIZE) ? 1 : ((x + PAGE_SIZE - 1) / PAGE_SIZE)) | 163 | ((x < PAGE_SIZE) ? 1 : ((x + PAGE_SIZE - 1) / PAGE_SIZE)) |
164 | 164 | ||
165 | #define BEISCSI_MSI_NAME 20 /* size of msi_name string */ | ||
166 | |||
165 | enum be_mem_enum { | 167 | enum be_mem_enum { |
166 | HWI_MEM_ADDN_CONTEXT, | 168 | HWI_MEM_ADDN_CONTEXT, |
167 | HWI_MEM_WRB, | 169 | HWI_MEM_WRB, |
@@ -287,6 +289,7 @@ struct beiscsi_hba { | |||
287 | unsigned int num_cpus; | 289 | unsigned int num_cpus; |
288 | unsigned int nxt_cqid; | 290 | unsigned int nxt_cqid; |
289 | struct msix_entry msix_entries[MAX_CPUS + 1]; | 291 | struct msix_entry msix_entries[MAX_CPUS + 1]; |
292 | char *msi_name[MAX_CPUS + 1]; | ||
290 | bool msix_enabled; | 293 | bool msix_enabled; |
291 | struct be_mem_descriptor *init_mem; | 294 | struct be_mem_descriptor *init_mem; |
292 | 295 | ||