All of lore.kernel.org
 help / color / mirror / Atom feed
From: Prarit Bhargava <prarit@redhat.com>
To: linux-scsi@vger.kernel.org
Cc: jayamohank@serverengines.com, mchristi@redhat.com
Subject: [PATCH]: be2iscsi: Fix MSIX interrupt names
Date: Fri, 20 May 2011 14:12:57 -0400	[thread overview]
Message-ID: <4DD6AF29.8090903@redhat.com> (raw)
In-Reply-To: <4DD6AEB7.2090900@redhat.com>


The be2iscsi driver uses a single static array in a function for the
irq action->name field.

This results in /proc/interrupts output like

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 
W�9�_޲J������t��kfbY��~}����(p���%���'loCm�������n`!�v��%�4����b\"P�����/"�t���(b��I��ԫ��1/"��Rm�u~�������

                                                           
�8r�)�N�>\aj*��+�е��ۻ�wB䝟�Bl��

In the line above, everything up to PCI-MSI-X is correct.  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

P.

---->8----

Fix be2iscsi driver to use a separate pointer for each irq action->name field
and avoid display corruption in /proc/interrupts.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 24e20ba..8d71e47 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -874,16 +874,20 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba)
 	struct hwi_controller *phwi_ctrlr;
 	struct hwi_context_memory *phwi_context;
 	int ret, msix_vec, i, j;
-	char desc[32];
 
 	phwi_ctrlr = phba->phwi_ctrlr;
 	phwi_context = phwi_ctrlr->phwi_ctxt;
 
 	if (phba->msix_enabled) {
 		for (i = 0; i < phba->num_cpus; i++) {
-			sprintf(desc, "beiscsi_msix_%04x", i);
+			phba->msi_name[i] = kzalloc(BEISCSI_MSI_NAME,
+						    GFP_KERNEL);
+			if (!phba->msi_name[i])
+				goto free_msix_irqs;
+			sprintf(phba->msi_name[i], "beiscsi_msix_%04x", i);
 			msix_vec = phba->msix_entries[i].vector;
-			ret = request_irq(msix_vec, be_isr_msix, 0, desc,
+			ret = request_irq(msix_vec, be_isr_msix, 0,
+					  phba->msi_name[i],
 					  &phwi_context->be_eq[i]);
 			if (ret) {
 				shost_printk(KERN_ERR, phba->shost,
@@ -915,8 +919,10 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba)
 	}
 	return 0;
 free_msix_irqs:
-	for (j = i - 1; j == 0; j++)
+	for (j = i - 1; j == 0; j++) {
 		free_irq(msix_vec, &phwi_context->be_eq[j]);
+		kfree(phba->msi_name[i]);
+	}
 	return ret;
 }
 
@@ -4117,10 +4123,13 @@ static void beiscsi_remove(struct pci_dev *pcidev)
 		for (i = 0; i <= phba->num_cpus; i++) {
 			msix_vec = phba->msix_entries[i].vector;
 			free_irq(msix_vec, &phwi_context->be_eq[i]);
+			kfree(phba->msi_name[i]);
 		}
 	} else
-		if (phba->pcidev->irq)
+		if (phba->pcidev->irq) {
 			free_irq(phba->pcidev->irq, phba);
+			kfree(phba->msi_name[i]);
+		}
 	pci_disable_msix(phba->pcidev);
 	destroy_workqueue(phba->wq);
 	if (blk_iopoll_enabled)
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 90eb74f..0c97e5a 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -163,6 +163,8 @@ do {							\
 #define PAGES_REQUIRED(x) \
 	((x < PAGE_SIZE) ? 1 :  ((x + PAGE_SIZE - 1) / PAGE_SIZE))
 
+#define BEISCSI_MSI_NAME 20 /* size of msi_name string */
+
 enum be_mem_enum {
 	HWI_MEM_ADDN_CONTEXT,
 	HWI_MEM_WRB,
@@ -288,6 +290,7 @@ struct beiscsi_hba {
 	unsigned int num_cpus;
 	unsigned int nxt_cqid;
 	struct msix_entry msix_entries[MAX_CPUS + 1];
+	char * msi_name[MAX_CPUS + 1];
 	bool msix_enabled;
 	struct be_mem_descriptor *init_mem;
 
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

       reply	other threads:[~2011-05-20 18:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4DD6AEB7.2090900@redhat.com>
2011-05-20 18:12 ` Prarit Bhargava [this message]
2011-05-20 18:33   ` [PATCH]: be2iscsi: Fix MSIX interrupt names Jayamohan.Kallickal
2011-05-20 18:51     ` Prarit Bhargava
2011-05-20 20:17       ` Rolf Eike Beer
2011-05-24 14:48         ` Prarit Bhargava
2011-05-24 15:09           ` Rolf Eike Beer
2011-06-01 18:55       ` Jayamohan.Kallickal
2011-06-01 19:41         ` Rolf Eike Beer
2011-06-01 23:50           ` Jayamohan.Kallickal
2011-06-02  9:35             ` Rolf Eike Beer
2011-05-20 19:13     ` Prarit Bhargava
2011-05-20 22:07       ` Jayamohan.Kallickal
2011-05-20 23:45         ` Prarit Bhargava
2011-05-23 17:22           ` Jayamohan.Kallickal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DD6AF29.8090903@redhat.com \
    --to=prarit@redhat.com \
    --cc=jayamohank@serverengines.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mchristi@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.