linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [50/75] mpt2sas crashes on shutdown
       [not found] <20120103223332.GA4112@kroah.com>
@ 2012-01-03 22:33 ` Greg KH
  2012-01-04  8:53   ` Nandigama, Nagalakshmi
  0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2012-01-03 22:33 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: torvalds, akpm, alan, linux-scsi, nagalakshmi.nandigama,
	David S. Miller, Eric Moore

3.1-stable review patch.  If anyone has any objections, please let me know.

------------------

From: David Miller <davem@davemloft.net>

[Fixed differently in 3.2]

The mpt2sas driver accesses I/O space as virtual addresses when
saving and restoring the MSIX table, this only works by luck on x86.

One needs to use the appropriate {read,write}{b,w,l}() APIs.

This is fixed in v3.2.x because all of this code got rewritten for
NUMA I/O support.

But both 3.0.x and 3.1.x still have this bug, and my Niagara sparc
machines crash on shutdown every single time due to this bug making my
-stable work more difficult than it needs to be.


Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Eric Moore <Eric.Moore@lsi.com>
Cc: Nagalakshmi Nandigama <nagalakshmi.nandigama@lsi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/scsi/mpt2sas/mpt2sas_base.c |    6 +++---
 drivers/scsi/mpt2sas/mpt2sas_base.h |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -1096,7 +1096,7 @@ _base_save_msix_table(struct MPT2SAS_ADA
 		return;
 
 	for (i = 0; i < ioc->msix_vector_count; i++)
-		ioc->msix_table_backup[i] = ioc->msix_table[i];
+		ioc->msix_table_backup[i] = readl(&ioc->msix_table[i]);
 }
 
 /**
@@ -1113,7 +1113,7 @@ _base_restore_msix_table(struct MPT2SAS_
 		return;
 
 	for (i = 0; i < ioc->msix_vector_count; i++)
-		ioc->msix_table[i] = ioc->msix_table_backup[i];
+		writel(ioc->msix_table_backup[i], &ioc->msix_table[i]);
 }
 
 /**
@@ -1144,7 +1144,7 @@ _base_check_enable_msix(struct MPT2SAS_A
 	/* get msix table  */
 	pci_read_config_dword(ioc->pdev, base + 4, &msix_table_offset);
 	msix_table_offset &= 0xFFFFFFF8;
-	ioc->msix_table = (u32 *)((void *)ioc->chip + msix_table_offset);
+	ioc->msix_table = ((void __iomem *)ioc->chip + msix_table_offset);
 
 	dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "msix is supported, "
 	    "vector_count(%d), table_offset(0x%08x), table(%p)\n", ioc->name,
--- a/drivers/scsi/mpt2sas/mpt2sas_base.h
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.h
@@ -779,7 +779,7 @@ struct MPT2SAS_ADAPTER {
 
 	u8		msix_enable;
 	u16		msix_vector_count;
-	u32		*msix_table;
+	u32 __iomem	*msix_table;
 	u32		*msix_table_backup;
 	u32		ioc_reset_count;
 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [50/75] mpt2sas crashes on shutdown
  2012-01-03 22:33 ` [50/75] mpt2sas crashes on shutdown Greg KH
@ 2012-01-04  8:53   ` Nandigama, Nagalakshmi
  2012-01-04 15:18     ` Greg KH
  2012-01-04 15:19     ` James Bottomley
  0 siblings, 2 replies; 9+ messages in thread
From: Nandigama, Nagalakshmi @ 2012-01-04  8:53 UTC (permalink / raw)
  To: Greg KH, linux-kernel@vger.kernel.org, stable@vger.kernel.org
  Cc: torvalds@linux-foundation.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk, linux-scsi@vger.kernel.org,
	David S. Miller, Moore, Eric

Greg,
As a fix to this issue, I posted the patch "[PATCH] mpt2sas: Remove msix_table_backup which is required only for preproduction boards". The patch in this mail will not address the complete issue. 

Please revert back this patch and add the patch "[PATCH] mpt2sas: Remove msix_table_backup which is required only for preproduction boards" to the stable kernels 3.0 and 3.1.

Regards,
Nagalakshmi


-----Original Message-----
From: Greg KH [mailto:gregkh@suse.de] 
Sent: Wednesday, January 04, 2012 4:03 AM
To: linux-kernel@vger.kernel.org; stable@vger.kernel.org
Cc: torvalds@linux-foundation.org; akpm@linux-foundation.org; alan@lxorguk.ukuu.org.uk; linux-scsi@vger.kernel.org; Nandigama, Nagalakshmi; David S. Miller; Moore, Eric
Subject: [50/75] mpt2sas crashes on shutdown

3.1-stable review patch.  If anyone has any objections, please let me know.

------------------

From: David Miller <davem@davemloft.net>

[Fixed differently in 3.2]

The mpt2sas driver accesses I/O space as virtual addresses when
saving and restoring the MSIX table, this only works by luck on x86.

One needs to use the appropriate {read,write}{b,w,l}() APIs.

This is fixed in v3.2.x because all of this code got rewritten for
NUMA I/O support.

But both 3.0.x and 3.1.x still have this bug, and my Niagara sparc
machines crash on shutdown every single time due to this bug making my
-stable work more difficult than it needs to be.


Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Eric Moore <Eric.Moore@lsi.com>
Cc: Nagalakshmi Nandigama <nagalakshmi.nandigama@lsi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/scsi/mpt2sas/mpt2sas_base.c |    6 +++---
 drivers/scsi/mpt2sas/mpt2sas_base.h |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -1096,7 +1096,7 @@ _base_save_msix_table(struct MPT2SAS_ADA
 		return;
 
 	for (i = 0; i < ioc->msix_vector_count; i++)
-		ioc->msix_table_backup[i] = ioc->msix_table[i];
+		ioc->msix_table_backup[i] = readl(&ioc->msix_table[i]);
 }
 
 /**
@@ -1113,7 +1113,7 @@ _base_restore_msix_table(struct MPT2SAS_
 		return;
 
 	for (i = 0; i < ioc->msix_vector_count; i++)
-		ioc->msix_table[i] = ioc->msix_table_backup[i];
+		writel(ioc->msix_table_backup[i], &ioc->msix_table[i]);
 }
 
 /**
@@ -1144,7 +1144,7 @@ _base_check_enable_msix(struct MPT2SAS_A
 	/* get msix table  */
 	pci_read_config_dword(ioc->pdev, base + 4, &msix_table_offset);
 	msix_table_offset &= 0xFFFFFFF8;
-	ioc->msix_table = (u32 *)((void *)ioc->chip + msix_table_offset);
+	ioc->msix_table = ((void __iomem *)ioc->chip + msix_table_offset);
 
 	dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "msix is supported, "
 	    "vector_count(%d), table_offset(0x%08x), table(%p)\n", ioc->name,
--- a/drivers/scsi/mpt2sas/mpt2sas_base.h
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.h
@@ -779,7 +779,7 @@ struct MPT2SAS_ADAPTER {
 
 	u8		msix_enable;
 	u16		msix_vector_count;
-	u32		*msix_table;
+	u32 __iomem	*msix_table;
 	u32		*msix_table_backup;
 	u32		ioc_reset_count;
 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [50/75] mpt2sas crashes on shutdown
  2012-01-04  8:53   ` Nandigama, Nagalakshmi
@ 2012-01-04 15:18     ` Greg KH
  2012-01-04 15:19     ` James Bottomley
  1 sibling, 0 replies; 9+ messages in thread
From: Greg KH @ 2012-01-04 15:18 UTC (permalink / raw)
  To: Nandigama, Nagalakshmi
  Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	torvalds@linux-foundation.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk, linux-scsi@vger.kernel.org,
	David S. Miller, Moore, Eric


A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

On Wed, Jan 04, 2012 at 02:23:27PM +0530, Nandigama, Nagalakshmi wrote:
> Greg,
> As a fix to this issue, I posted the patch "[PATCH] mpt2sas: Remove
> msix_table_backup which is required only for preproduction boards".
> The patch in this mail will not address the complete issue. 
> 
> Please revert back this patch and add the patch "[PATCH] mpt2sas:
> Remove msix_table_backup which is required only for preproduction
> boards" to the stable kernels 3.0 and 3.1.

As I stated in the thread of that patch, I can't accept that patch
as-is.  Please resend it according to the instructions I gave you, which
for some reason, you ignored.  Because you didn't respond, I took
David's patch, which did follow the stable kernel rules.  So I'll keep
this patch in, until I get something that properly supersedes it.

greg k-h

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [50/75] mpt2sas crashes on shutdown
  2012-01-04  8:53   ` Nandigama, Nagalakshmi
  2012-01-04 15:18     ` Greg KH
@ 2012-01-04 15:19     ` James Bottomley
  2012-01-04 15:25       ` [PATCH] mpt2sas: fix non-x86 crash " James Bottomley
  1 sibling, 1 reply; 9+ messages in thread
From: James Bottomley @ 2012-01-04 15:19 UTC (permalink / raw)
  To: Nandigama, Nagalakshmi
  Cc: Greg KH, linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	torvalds@linux-foundation.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk, linux-scsi@vger.kernel.org,
	David S. Miller, Moore, Eric

On Wed, 2012-01-04 at 14:23 +0530, Nandigama, Nagalakshmi wrote:
> Greg,
> As a fix to this issue, I posted the patch "[PATCH] mpt2sas: Remove
> msix_table_backup which is required only for preproduction boards".
> The patch in this mail will not address the complete issue. 
> 
> Please revert back this patch and add the patch "[PATCH] mpt2sas:
> Remove msix_table_backup which is required only for preproduction
> boards" to the stable kernels 3.0 and 3.1.

So the problem is that you still haven't actually manage to produce a
patch for the problem in the form required by the stable tree as listed
in 

Documentation/stable_kernel_rules.txt

If you can't follow the guide, perhaps an example would work, so as a
one time thing, I'll show you what such a patch should look like
according to the rules of the stable kernel in reply to this email

James

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] mpt2sas: fix non-x86 crash on shutdown
  2012-01-04 15:19     ` James Bottomley
@ 2012-01-04 15:25       ` James Bottomley
  2012-01-04 19:21         ` Greg KH
                           ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: James Bottomley @ 2012-01-04 15:25 UTC (permalink / raw)
  To: Nandigama, Nagalakshmi, stable@vger.kernel.org
  Cc: Greg KH, linux-kernel@vger.kernel.org,
	torvalds@linux-foundation.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk, linux-scsi@vger.kernel.org,
	David S. Miller, Moore, Eric

From: "nagalakshmi.nandigama@lsi.com" <nagalakshmi.nandigama@lsi.com>

Upstrem commit: 911ae9434f83e7355d343f6c2be3ef5b00ea7aed

There's a bug in the MSIX backup and restore routines that cause a crash on
non-x86 (direct access to PCI space not via read/write).  These routines are
unnecessary and were removed by the above commit, so also remove them from
stable to fix the crash.

Signed-off-by: Nagalakshmi Nandigama <nagalakshmi.nandigama@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>

diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
index 83035bd..39e81cd 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -1082,41 +1082,6 @@ _base_config_dma_addressing(struct MPT2SAS_ADAPTER *ioc, struct pci_dev *pdev)
 }
 
 /**
- * _base_save_msix_table - backup msix vector table
- * @ioc: per adapter object
- *
- * This address an errata where diag reset clears out the table
- */
-static void
-_base_save_msix_table(struct MPT2SAS_ADAPTER *ioc)
-{
-	int i;
-
-	if (!ioc->msix_enable || ioc->msix_table_backup == NULL)
-		return;
-
-	for (i = 0; i < ioc->msix_vector_count; i++)
-		ioc->msix_table_backup[i] = ioc->msix_table[i];
-}
-
-/**
- * _base_restore_msix_table - this restores the msix vector table
- * @ioc: per adapter object
- *
- */
-static void
-_base_restore_msix_table(struct MPT2SAS_ADAPTER *ioc)
-{
-	int i;
-
-	if (!ioc->msix_enable || ioc->msix_table_backup == NULL)
-		return;
-
-	for (i = 0; i < ioc->msix_vector_count; i++)
-		ioc->msix_table[i] = ioc->msix_table_backup[i];
-}
-
-/**
  * _base_check_enable_msix - checks MSIX capabable.
  * @ioc: per adapter object
  *
@@ -1128,7 +1093,7 @@ _base_check_enable_msix(struct MPT2SAS_ADAPTER *ioc)
 {
 	int base;
 	u16 message_control;
-	u32 msix_table_offset;
+
 
 	base = pci_find_capability(ioc->pdev, PCI_CAP_ID_MSIX);
 	if (!base) {
@@ -1141,14 +1106,8 @@ _base_check_enable_msix(struct MPT2SAS_ADAPTER *ioc)
 	pci_read_config_word(ioc->pdev, base + 2, &message_control);
 	ioc->msix_vector_count = (message_control & 0x3FF) + 1;
 
-	/* get msix table  */
-	pci_read_config_dword(ioc->pdev, base + 4, &msix_table_offset);
-	msix_table_offset &= 0xFFFFFFF8;
-	ioc->msix_table = (u32 *)((void *)ioc->chip + msix_table_offset);
-
 	dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "msix is supported, "
-	    "vector_count(%d), table_offset(0x%08x), table(%p)\n", ioc->name,
-	    ioc->msix_vector_count, msix_table_offset, ioc->msix_table));
+	    "vector_count(%d)\n", ioc->name, ioc->msix_vector_count));
 	return 0;
 }
 
@@ -1162,8 +1121,6 @@ _base_disable_msix(struct MPT2SAS_ADAPTER *ioc)
 {
 	if (ioc->msix_enable) {
 		pci_disable_msix(ioc->pdev);
-		kfree(ioc->msix_table_backup);
-		ioc->msix_table_backup = NULL;
 		ioc->msix_enable = 0;
 	}
 }
@@ -1189,14 +1146,6 @@ _base_enable_msix(struct MPT2SAS_ADAPTER *ioc)
 	if (_base_check_enable_msix(ioc) != 0)
 		goto try_ioapic;
 
-	ioc->msix_table_backup = kcalloc(ioc->msix_vector_count,
-	    sizeof(u32), GFP_KERNEL);
-	if (!ioc->msix_table_backup) {
-		dfailprintk(ioc, printk(MPT2SAS_INFO_FMT "allocation for "
-		    "msix_table_backup failed!!!\n", ioc->name));
-		goto try_ioapic;
-	}
-
 	memset(&entries, 0, sizeof(struct msix_entry));
 	r = pci_enable_msix(ioc->pdev, &entries, 1);
 	if (r) {
@@ -3513,9 +3462,6 @@ _base_diag_reset(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
 	u32 hcb_size;
 
 	printk(MPT2SAS_INFO_FMT "sending diag reset !!\n", ioc->name);
-
-	_base_save_msix_table(ioc);
-
 	drsprintk(ioc, printk(MPT2SAS_INFO_FMT "clear interrupts\n",
 	    ioc->name));
 
@@ -3611,7 +3557,6 @@ _base_diag_reset(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
 		goto out;
 	}
 
-	_base_restore_msix_table(ioc);
 	printk(MPT2SAS_INFO_FMT "diag reset: SUCCESS\n", ioc->name);
 	return 0;
 
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h
index 8d5be21..7df640f 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.h
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.h
@@ -636,8 +636,6 @@ enum mutex_type {
  * @wait_for_port_enable_to_complete:
  * @msix_enable: flag indicating msix is enabled
  * @msix_vector_count: number msix vectors
- * @msix_table: virt address to the msix table
- * @msix_table_backup: backup msix table
  * @scsi_io_cb_idx: shost generated commands
  * @tm_cb_idx: task management commands
  * @scsih_cb_idx: scsih internal commands
@@ -779,8 +777,6 @@ struct MPT2SAS_ADAPTER {
 
 	u8		msix_enable;
 	u16		msix_vector_count;
-	u32		*msix_table;
-	u32		*msix_table_backup;
 	u32		ioc_reset_count;
 
 	/* internal commands, callback index */



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] mpt2sas: fix non-x86 crash on shutdown
  2012-01-04 15:25       ` [PATCH] mpt2sas: fix non-x86 crash " James Bottomley
@ 2012-01-04 19:21         ` Greg KH
  2012-01-04 19:39           ` David Miller
  2012-01-05 19:10         ` Patch "mpt2sas: fix non-x86 crash on shutdown" has been added to the 3.0-stable tree gregkh
  2012-01-05 19:25         ` Patch "mpt2sas: fix non-x86 crash on shutdown" has been added to the 3.1-stable tree gregkh
  2 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2012-01-04 19:21 UTC (permalink / raw)
  To: James Bottomley, David S. Miller
  Cc: Nandigama, Nagalakshmi, stable@vger.kernel.org, Greg KH,
	linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
	akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
	linux-scsi@vger.kernel.org, Moore, Eric

On Wed, Jan 04, 2012 at 09:25:13AM -0600, James Bottomley wrote:
> From: "nagalakshmi.nandigama@lsi.com" <nagalakshmi.nandigama@lsi.com>

That's not a correct "from" line, sorry.  That would create a mess of
the log.  Oh, I see Linus's tree is already a mess here, ugh.  Please be
more careful when accepting patches, otherwise stuff like this causes me
to have to hand-edit the kernel git logs when I run the "who does what"
statistic reports...

David, any objection for me taking this patch (left below) instead of
your original one for the stable tree?

thanks,

greg k-h

> Upstrem commit: 911ae9434f83e7355d343f6c2be3ef5b00ea7aed
> 
> There's a bug in the MSIX backup and restore routines that cause a crash on
> non-x86 (direct access to PCI space not via read/write).  These routines are
> unnecessary and were removed by the above commit, so also remove them from
> stable to fix the crash.
> 
> Signed-off-by: Nagalakshmi Nandigama <nagalakshmi.nandigama@lsi.com>
> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
> 
> diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
> index 83035bd..39e81cd 100644
> --- a/drivers/scsi/mpt2sas/mpt2sas_base.c
> +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
> @@ -1082,41 +1082,6 @@ _base_config_dma_addressing(struct MPT2SAS_ADAPTER *ioc, struct pci_dev *pdev)
>  }
>  
>  /**
> - * _base_save_msix_table - backup msix vector table
> - * @ioc: per adapter object
> - *
> - * This address an errata where diag reset clears out the table
> - */
> -static void
> -_base_save_msix_table(struct MPT2SAS_ADAPTER *ioc)
> -{
> -	int i;
> -
> -	if (!ioc->msix_enable || ioc->msix_table_backup == NULL)
> -		return;
> -
> -	for (i = 0; i < ioc->msix_vector_count; i++)
> -		ioc->msix_table_backup[i] = ioc->msix_table[i];
> -}
> -
> -/**
> - * _base_restore_msix_table - this restores the msix vector table
> - * @ioc: per adapter object
> - *
> - */
> -static void
> -_base_restore_msix_table(struct MPT2SAS_ADAPTER *ioc)
> -{
> -	int i;
> -
> -	if (!ioc->msix_enable || ioc->msix_table_backup == NULL)
> -		return;
> -
> -	for (i = 0; i < ioc->msix_vector_count; i++)
> -		ioc->msix_table[i] = ioc->msix_table_backup[i];
> -}
> -
> -/**
>   * _base_check_enable_msix - checks MSIX capabable.
>   * @ioc: per adapter object
>   *
> @@ -1128,7 +1093,7 @@ _base_check_enable_msix(struct MPT2SAS_ADAPTER *ioc)
>  {
>  	int base;
>  	u16 message_control;
> -	u32 msix_table_offset;
> +
>  
>  	base = pci_find_capability(ioc->pdev, PCI_CAP_ID_MSIX);
>  	if (!base) {
> @@ -1141,14 +1106,8 @@ _base_check_enable_msix(struct MPT2SAS_ADAPTER *ioc)
>  	pci_read_config_word(ioc->pdev, base + 2, &message_control);
>  	ioc->msix_vector_count = (message_control & 0x3FF) + 1;
>  
> -	/* get msix table  */
> -	pci_read_config_dword(ioc->pdev, base + 4, &msix_table_offset);
> -	msix_table_offset &= 0xFFFFFFF8;
> -	ioc->msix_table = (u32 *)((void *)ioc->chip + msix_table_offset);
> -
>  	dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "msix is supported, "
> -	    "vector_count(%d), table_offset(0x%08x), table(%p)\n", ioc->name,
> -	    ioc->msix_vector_count, msix_table_offset, ioc->msix_table));
> +	    "vector_count(%d)\n", ioc->name, ioc->msix_vector_count));
>  	return 0;
>  }
>  
> @@ -1162,8 +1121,6 @@ _base_disable_msix(struct MPT2SAS_ADAPTER *ioc)
>  {
>  	if (ioc->msix_enable) {
>  		pci_disable_msix(ioc->pdev);
> -		kfree(ioc->msix_table_backup);
> -		ioc->msix_table_backup = NULL;
>  		ioc->msix_enable = 0;
>  	}
>  }
> @@ -1189,14 +1146,6 @@ _base_enable_msix(struct MPT2SAS_ADAPTER *ioc)
>  	if (_base_check_enable_msix(ioc) != 0)
>  		goto try_ioapic;
>  
> -	ioc->msix_table_backup = kcalloc(ioc->msix_vector_count,
> -	    sizeof(u32), GFP_KERNEL);
> -	if (!ioc->msix_table_backup) {
> -		dfailprintk(ioc, printk(MPT2SAS_INFO_FMT "allocation for "
> -		    "msix_table_backup failed!!!\n", ioc->name));
> -		goto try_ioapic;
> -	}
> -
>  	memset(&entries, 0, sizeof(struct msix_entry));
>  	r = pci_enable_msix(ioc->pdev, &entries, 1);
>  	if (r) {
> @@ -3513,9 +3462,6 @@ _base_diag_reset(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
>  	u32 hcb_size;
>  
>  	printk(MPT2SAS_INFO_FMT "sending diag reset !!\n", ioc->name);
> -
> -	_base_save_msix_table(ioc);
> -
>  	drsprintk(ioc, printk(MPT2SAS_INFO_FMT "clear interrupts\n",
>  	    ioc->name));
>  
> @@ -3611,7 +3557,6 @@ _base_diag_reset(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
>  		goto out;
>  	}
>  
> -	_base_restore_msix_table(ioc);
>  	printk(MPT2SAS_INFO_FMT "diag reset: SUCCESS\n", ioc->name);
>  	return 0;
>  
> diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h
> index 8d5be21..7df640f 100644
> --- a/drivers/scsi/mpt2sas/mpt2sas_base.h
> +++ b/drivers/scsi/mpt2sas/mpt2sas_base.h
> @@ -636,8 +636,6 @@ enum mutex_type {
>   * @wait_for_port_enable_to_complete:
>   * @msix_enable: flag indicating msix is enabled
>   * @msix_vector_count: number msix vectors
> - * @msix_table: virt address to the msix table
> - * @msix_table_backup: backup msix table
>   * @scsi_io_cb_idx: shost generated commands
>   * @tm_cb_idx: task management commands
>   * @scsih_cb_idx: scsih internal commands
> @@ -779,8 +777,6 @@ struct MPT2SAS_ADAPTER {
>  
>  	u8		msix_enable;
>  	u16		msix_vector_count;
> -	u32		*msix_table;
> -	u32		*msix_table_backup;
>  	u32		ioc_reset_count;
>  
>  	/* internal commands, callback index */
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe stable" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] mpt2sas: fix non-x86 crash on shutdown
  2012-01-04 19:21         ` Greg KH
@ 2012-01-04 19:39           ` David Miller
  0 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2012-01-04 19:39 UTC (permalink / raw)
  To: greg
  Cc: James.Bottomley, Nagalakshmi.Nandigama, stable, gregkh,
	linux-kernel, torvalds, akpm, alan, linux-scsi, Eric.Moore

From: Greg KH <greg@kroah.com>
Date: Wed, 4 Jan 2012 11:21:02 -0800

> On Wed, Jan 04, 2012 at 09:25:13AM -0600, James Bottomley wrote:
>> From: "nagalakshmi.nandigama@lsi.com" <nagalakshmi.nandigama@lsi.com>
> 
> That's not a correct "from" line, sorry.  That would create a mess of
> the log.  Oh, I see Linus's tree is already a mess here, ugh.  Please be
> more careful when accepting patches, otherwise stuff like this causes me
> to have to hand-edit the kernel git logs when I run the "who does what"
> statistic reports...
> 
> David, any objection for me taking this patch (left below) instead of
> your original one for the stable tree?

No objection.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Patch "mpt2sas: fix non-x86 crash on shutdown" has been added to the 3.0-stable tree
  2012-01-04 15:25       ` [PATCH] mpt2sas: fix non-x86 crash " James Bottomley
  2012-01-04 19:21         ` Greg KH
@ 2012-01-05 19:10         ` gregkh
  2012-01-05 19:25         ` Patch "mpt2sas: fix non-x86 crash on shutdown" has been added to the 3.1-stable tree gregkh
  2 siblings, 0 replies; 9+ messages in thread
From: gregkh @ 2012-01-05 19:10 UTC (permalink / raw)
  To: James.Bottomley, akpm, alan, davem, Eric.Moore, gregkh,
	JBottomley, linux-kernel, linux-scsi, nagalakshmi.nandigama,
	Nagalakshmi.Nandigama, torvalds
  Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    mpt2sas: fix non-x86 crash on shutdown

to the 3.0-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mpt2sas-fix-non-x86-crash-on-shutdown.patch
and it can be found in the queue-3.0 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From James.Bottomley@HansenPartnership.com  Thu Jan  5 10:58:15 2012
From: James Bottomley <James.Bottomley@HansenPartnership.com>
Date: Wed, 04 Jan 2012 09:25:13 -0600
Subject: mpt2sas: fix non-x86 crash on shutdown
To: "Nandigama, Nagalakshmi" <Nagalakshmi.Nandigama@lsi.com>, "stable@vger.kernel.org" <stable@vger.kernel.org>
Cc: Greg KH <gregkh@suse.de>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "torvalds@linux-foundation.org" <torvalds@linux-foundation.org>, "akpm@linux-foundation.org" <akpm@linux-foundation.org>, "alan@lxorguk.ukuu.org.uk" <alan@lxorguk.ukuu.org.uk>, "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>, "David S. Miller" <davem@davemloft.net>, "Moore, Eric" <Eric.Moore@lsi.com>
Message-ID: <1325690713.2758.13.camel@dabdike.int.hansenpartnership.com>


From: Nagalakshmi Nandigama <nagalakshmi.nandigama@lsi.com>

Upstrem commit: 911ae9434f83e7355d343f6c2be3ef5b00ea7aed

There's a bug in the MSIX backup and restore routines that cause a crash on
non-x86 (direct access to PCI space not via read/write).  These routines are
unnecessary and were removed by the above commit, so also remove them from
stable to fix the crash.

Signed-off-by: Nagalakshmi Nandigama <nagalakshmi.nandigama@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/scsi/mpt2sas/mpt2sas_base.c |   59 +-----------------------------------
 drivers/scsi/mpt2sas/mpt2sas_base.h |    4 --
 2 files changed, 2 insertions(+), 61 deletions(-)

--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -1082,41 +1082,6 @@ _base_config_dma_addressing(struct MPT2S
 }
 
 /**
- * _base_save_msix_table - backup msix vector table
- * @ioc: per adapter object
- *
- * This address an errata where diag reset clears out the table
- */
-static void
-_base_save_msix_table(struct MPT2SAS_ADAPTER *ioc)
-{
-	int i;
-
-	if (!ioc->msix_enable || ioc->msix_table_backup == NULL)
-		return;
-
-	for (i = 0; i < ioc->msix_vector_count; i++)
-		ioc->msix_table_backup[i] = ioc->msix_table[i];
-}
-
-/**
- * _base_restore_msix_table - this restores the msix vector table
- * @ioc: per adapter object
- *
- */
-static void
-_base_restore_msix_table(struct MPT2SAS_ADAPTER *ioc)
-{
-	int i;
-
-	if (!ioc->msix_enable || ioc->msix_table_backup == NULL)
-		return;
-
-	for (i = 0; i < ioc->msix_vector_count; i++)
-		ioc->msix_table[i] = ioc->msix_table_backup[i];
-}
-
-/**
  * _base_check_enable_msix - checks MSIX capabable.
  * @ioc: per adapter object
  *
@@ -1128,7 +1093,7 @@ _base_check_enable_msix(struct MPT2SAS_A
 {
 	int base;
 	u16 message_control;
-	u32 msix_table_offset;
+
 
 	base = pci_find_capability(ioc->pdev, PCI_CAP_ID_MSIX);
 	if (!base) {
@@ -1141,14 +1106,8 @@ _base_check_enable_msix(struct MPT2SAS_A
 	pci_read_config_word(ioc->pdev, base + 2, &message_control);
 	ioc->msix_vector_count = (message_control & 0x3FF) + 1;
 
-	/* get msix table  */
-	pci_read_config_dword(ioc->pdev, base + 4, &msix_table_offset);
-	msix_table_offset &= 0xFFFFFFF8;
-	ioc->msix_table = (u32 *)((void *)ioc->chip + msix_table_offset);
-
 	dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "msix is supported, "
-	    "vector_count(%d), table_offset(0x%08x), table(%p)\n", ioc->name,
-	    ioc->msix_vector_count, msix_table_offset, ioc->msix_table));
+	    "vector_count(%d)\n", ioc->name, ioc->msix_vector_count));
 	return 0;
 }
 
@@ -1162,8 +1121,6 @@ _base_disable_msix(struct MPT2SAS_ADAPTE
 {
 	if (ioc->msix_enable) {
 		pci_disable_msix(ioc->pdev);
-		kfree(ioc->msix_table_backup);
-		ioc->msix_table_backup = NULL;
 		ioc->msix_enable = 0;
 	}
 }
@@ -1189,14 +1146,6 @@ _base_enable_msix(struct MPT2SAS_ADAPTER
 	if (_base_check_enable_msix(ioc) != 0)
 		goto try_ioapic;
 
-	ioc->msix_table_backup = kcalloc(ioc->msix_vector_count,
-	    sizeof(u32), GFP_KERNEL);
-	if (!ioc->msix_table_backup) {
-		dfailprintk(ioc, printk(MPT2SAS_INFO_FMT "allocation for "
-		    "msix_table_backup failed!!!\n", ioc->name));
-		goto try_ioapic;
-	}
-
 	memset(&entries, 0, sizeof(struct msix_entry));
 	r = pci_enable_msix(ioc->pdev, &entries, 1);
 	if (r) {
@@ -3513,9 +3462,6 @@ _base_diag_reset(struct MPT2SAS_ADAPTER
 	u32 hcb_size;
 
 	printk(MPT2SAS_INFO_FMT "sending diag reset !!\n", ioc->name);
-
-	_base_save_msix_table(ioc);
-
 	drsprintk(ioc, printk(MPT2SAS_INFO_FMT "clear interrupts\n",
 	    ioc->name));
 
@@ -3611,7 +3557,6 @@ _base_diag_reset(struct MPT2SAS_ADAPTER
 		goto out;
 	}
 
-	_base_restore_msix_table(ioc);
 	printk(MPT2SAS_INFO_FMT "diag reset: SUCCESS\n", ioc->name);
 	return 0;
 
--- a/drivers/scsi/mpt2sas/mpt2sas_base.h
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.h
@@ -626,8 +626,6 @@ struct mpt2sas_port_facts {
  * @wait_for_port_enable_to_complete:
  * @msix_enable: flag indicating msix is enabled
  * @msix_vector_count: number msix vectors
- * @msix_table: virt address to the msix table
- * @msix_table_backup: backup msix table
  * @scsi_io_cb_idx: shost generated commands
  * @tm_cb_idx: task management commands
  * @scsih_cb_idx: scsih internal commands
@@ -768,8 +766,6 @@ struct MPT2SAS_ADAPTER {
 
 	u8		msix_enable;
 	u16		msix_vector_count;
-	u32		*msix_table;
-	u32		*msix_table_backup;
 	u32		ioc_reset_count;
 
 	/* internal commands, callback index */


Patches currently in stable-queue which might be from James.Bottomley@HansenPartnership.com are

queue-3.0/mpt2sas-fix-non-x86-crash-on-shutdown.patch

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Patch "mpt2sas: fix non-x86 crash on shutdown" has been added to the 3.1-stable tree
  2012-01-04 15:25       ` [PATCH] mpt2sas: fix non-x86 crash " James Bottomley
  2012-01-04 19:21         ` Greg KH
  2012-01-05 19:10         ` Patch "mpt2sas: fix non-x86 crash on shutdown" has been added to the 3.0-stable tree gregkh
@ 2012-01-05 19:25         ` gregkh
  2 siblings, 0 replies; 9+ messages in thread
From: gregkh @ 2012-01-05 19:25 UTC (permalink / raw)
  To: James.Bottomley, akpm, alan, davem, Eric.Moore, gregkh,
	JBottomley, linux-kernel, linux-scsi, nagalakshmi.nandigama,
	Nagalakshmi.Nandigama, torvalds
  Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    mpt2sas: fix non-x86 crash on shutdown

to the 3.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mpt2sas-fix-non-x86-crash-on-shutdown.patch
and it can be found in the queue-3.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From James.Bottomley@HansenPartnership.com  Thu Jan  5 10:58:15 2012
From: James Bottomley <James.Bottomley@HansenPartnership.com>
Date: Wed, 04 Jan 2012 09:25:13 -0600
Subject: mpt2sas: fix non-x86 crash on shutdown
To: "Nandigama, Nagalakshmi" <Nagalakshmi.Nandigama@lsi.com>, "stable@vger.kernel.org" <stable@vger.kernel.org>
Cc: Greg KH <gregkh@suse.de>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "torvalds@linux-foundation.org" <torvalds@linux-foundation.org>, "akpm@linux-foundation.org" <akpm@linux-foundation.org>, "alan@lxorguk.ukuu.org.uk" <alan@lxorguk.ukuu.org.uk>, "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>, "David S. Miller" <davem@davemloft.net>, "Moore, Eric" <Eric.Moore@lsi.com>
Message-ID: <1325690713.2758.13.camel@dabdike.int.hansenpartnership.com>


From: Nagalakshmi Nandigama <nagalakshmi.nandigama@lsi.com>

Upstrem commit: 911ae9434f83e7355d343f6c2be3ef5b00ea7aed

There's a bug in the MSIX backup and restore routines that cause a crash on
non-x86 (direct access to PCI space not via read/write).  These routines are
unnecessary and were removed by the above commit, so also remove them from
stable to fix the crash.

Signed-off-by: Nagalakshmi Nandigama <nagalakshmi.nandigama@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/scsi/mpt2sas/mpt2sas_base.c |   59 +-----------------------------------
 drivers/scsi/mpt2sas/mpt2sas_base.h |    4 --
 2 files changed, 2 insertions(+), 61 deletions(-)

--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -1082,41 +1082,6 @@ _base_config_dma_addressing(struct MPT2S
 }
 
 /**
- * _base_save_msix_table - backup msix vector table
- * @ioc: per adapter object
- *
- * This address an errata where diag reset clears out the table
- */
-static void
-_base_save_msix_table(struct MPT2SAS_ADAPTER *ioc)
-{
-	int i;
-
-	if (!ioc->msix_enable || ioc->msix_table_backup == NULL)
-		return;
-
-	for (i = 0; i < ioc->msix_vector_count; i++)
-		ioc->msix_table_backup[i] = ioc->msix_table[i];
-}
-
-/**
- * _base_restore_msix_table - this restores the msix vector table
- * @ioc: per adapter object
- *
- */
-static void
-_base_restore_msix_table(struct MPT2SAS_ADAPTER *ioc)
-{
-	int i;
-
-	if (!ioc->msix_enable || ioc->msix_table_backup == NULL)
-		return;
-
-	for (i = 0; i < ioc->msix_vector_count; i++)
-		ioc->msix_table[i] = ioc->msix_table_backup[i];
-}
-
-/**
  * _base_check_enable_msix - checks MSIX capabable.
  * @ioc: per adapter object
  *
@@ -1128,7 +1093,7 @@ _base_check_enable_msix(struct MPT2SAS_A
 {
 	int base;
 	u16 message_control;
-	u32 msix_table_offset;
+
 
 	base = pci_find_capability(ioc->pdev, PCI_CAP_ID_MSIX);
 	if (!base) {
@@ -1141,14 +1106,8 @@ _base_check_enable_msix(struct MPT2SAS_A
 	pci_read_config_word(ioc->pdev, base + 2, &message_control);
 	ioc->msix_vector_count = (message_control & 0x3FF) + 1;
 
-	/* get msix table  */
-	pci_read_config_dword(ioc->pdev, base + 4, &msix_table_offset);
-	msix_table_offset &= 0xFFFFFFF8;
-	ioc->msix_table = (u32 *)((void *)ioc->chip + msix_table_offset);
-
 	dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "msix is supported, "
-	    "vector_count(%d), table_offset(0x%08x), table(%p)\n", ioc->name,
-	    ioc->msix_vector_count, msix_table_offset, ioc->msix_table));
+	    "vector_count(%d)\n", ioc->name, ioc->msix_vector_count));
 	return 0;
 }
 
@@ -1162,8 +1121,6 @@ _base_disable_msix(struct MPT2SAS_ADAPTE
 {
 	if (ioc->msix_enable) {
 		pci_disable_msix(ioc->pdev);
-		kfree(ioc->msix_table_backup);
-		ioc->msix_table_backup = NULL;
 		ioc->msix_enable = 0;
 	}
 }
@@ -1189,14 +1146,6 @@ _base_enable_msix(struct MPT2SAS_ADAPTER
 	if (_base_check_enable_msix(ioc) != 0)
 		goto try_ioapic;
 
-	ioc->msix_table_backup = kcalloc(ioc->msix_vector_count,
-	    sizeof(u32), GFP_KERNEL);
-	if (!ioc->msix_table_backup) {
-		dfailprintk(ioc, printk(MPT2SAS_INFO_FMT "allocation for "
-		    "msix_table_backup failed!!!\n", ioc->name));
-		goto try_ioapic;
-	}
-
 	memset(&entries, 0, sizeof(struct msix_entry));
 	r = pci_enable_msix(ioc->pdev, &entries, 1);
 	if (r) {
@@ -3513,9 +3462,6 @@ _base_diag_reset(struct MPT2SAS_ADAPTER
 	u32 hcb_size;
 
 	printk(MPT2SAS_INFO_FMT "sending diag reset !!\n", ioc->name);
-
-	_base_save_msix_table(ioc);
-
 	drsprintk(ioc, printk(MPT2SAS_INFO_FMT "clear interrupts\n",
 	    ioc->name));
 
@@ -3611,7 +3557,6 @@ _base_diag_reset(struct MPT2SAS_ADAPTER
 		goto out;
 	}
 
-	_base_restore_msix_table(ioc);
 	printk(MPT2SAS_INFO_FMT "diag reset: SUCCESS\n", ioc->name);
 	return 0;
 
--- a/drivers/scsi/mpt2sas/mpt2sas_base.h
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.h
@@ -636,8 +636,6 @@ enum mutex_type {
  * @wait_for_port_enable_to_complete:
  * @msix_enable: flag indicating msix is enabled
  * @msix_vector_count: number msix vectors
- * @msix_table: virt address to the msix table
- * @msix_table_backup: backup msix table
  * @scsi_io_cb_idx: shost generated commands
  * @tm_cb_idx: task management commands
  * @scsih_cb_idx: scsih internal commands
@@ -779,8 +777,6 @@ struct MPT2SAS_ADAPTER {
 
 	u8		msix_enable;
 	u16		msix_vector_count;
-	u32		*msix_table;
-	u32		*msix_table_backup;
 	u32		ioc_reset_count;
 
 	/* internal commands, callback index */


Patches currently in stable-queue which might be from James.Bottomley@HansenPartnership.com are

queue-3.1/mpt2sas-fix-non-x86-crash-on-shutdown.patch

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-01-05 19:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20120103223332.GA4112@kroah.com>
2012-01-03 22:33 ` [50/75] mpt2sas crashes on shutdown Greg KH
2012-01-04  8:53   ` Nandigama, Nagalakshmi
2012-01-04 15:18     ` Greg KH
2012-01-04 15:19     ` James Bottomley
2012-01-04 15:25       ` [PATCH] mpt2sas: fix non-x86 crash " James Bottomley
2012-01-04 19:21         ` Greg KH
2012-01-04 19:39           ` David Miller
2012-01-05 19:10         ` Patch "mpt2sas: fix non-x86 crash on shutdown" has been added to the 3.0-stable tree gregkh
2012-01-05 19:25         ` Patch "mpt2sas: fix non-x86 crash on shutdown" has been added to the 3.1-stable tree gregkh

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).