All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC/RFT] ssb: Avoid system hang when SPROM read fails
@ 2010-04-25 22:30 ` Larry Finger
  0 siblings, 0 replies; 8+ messages in thread
From: Larry Finger @ 2010-04-25 22:30 UTC (permalink / raw)
  To: John W Linville, Michael Buesch; +Cc: b43-dev, linux-wireless

In kernel Bugzilla #15825, the OP reports a case of intermittent reading
of the SPROM. If such reads fail, the box hangs. Thanks to careful testing
by bugzillakernelorg@lez.ath.cx has shown that the first read of the
SPROM returns 0xFFFF with the hang happening on the next read.

The source of the read failure is still under investigation; however,
this patch does avoid the system hang.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---

John,

Does this patch avoid the system hang on your box?

Larry
---

===================================================================
--- wireless-testing.orig/drivers/ssb/pci.c
+++ wireless-testing/drivers/ssb/pci.c
@@ -253,6 +253,11 @@ static int sprom_do_read(struct ssb_bus
 {
 	int i;
 
+	/* Check if SPROM can be read */
+	if (ioread16(bus->mmio + SSB_SPROM_BASE) == 0xFFFF) {
+		ssb_printk(KERN_ERR PFX "Unable to read SPROM\n");
+		return -ENODEV;
+	}
 	for (i = 0; i < bus->sprom_size; i++)
 		sprom[i] = ioread16(bus->mmio + SSB_SPROM_BASE + (i * 2));
 
@@ -625,17 +630,23 @@ static int ssb_pci_sprom_get(struct ssb_
 	if (!buf)
 		goto out;
 	bus->sprom_size = SSB_SPROMSIZE_WORDS_R123;
-	sprom_do_read(bus, buf);
+	err = sprom_do_read(bus, buf);
+	if (err)
+		goto out_free;
 	err = sprom_check_crc(buf, bus->sprom_size);
 	if (err) {
 		/* try for a 440 byte SPROM - revision 4 and higher */
 		kfree(buf);
 		buf = kcalloc(SSB_SPROMSIZE_WORDS_R4, sizeof(u16),
 			      GFP_KERNEL);
-		if (!buf)
+		if (!buf) {
+			err = -ENOMEM;
 			goto out;
+		}
 		bus->sprom_size = SSB_SPROMSIZE_WORDS_R4;
-		sprom_do_read(bus, buf);
+		err = sprom_do_read(bus, buf);
+		if (err)
+			goto out_free;
 		err = sprom_check_crc(buf, bus->sprom_size);
 		if (err) {
 			/* All CRC attempts failed.

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

* [RFC/RFT] ssb: Avoid system hang when SPROM read fails
@ 2010-04-25 22:30 ` Larry Finger
  0 siblings, 0 replies; 8+ messages in thread
From: Larry Finger @ 2010-04-25 22:30 UTC (permalink / raw)
  To: John W Linville, Michael Buesch; +Cc: b43-dev, linux-wireless

In kernel Bugzilla #15825, the OP reports a case of intermittent reading
of the SPROM. If such reads fail, the box hangs. Thanks to careful testing
by bugzillakernelorg at lez.ath.cx has shown that the first read of the
SPROM returns 0xFFFF with the hang happening on the next read.

The source of the read failure is still under investigation; however,
this patch does avoid the system hang.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---

John,

Does this patch avoid the system hang on your box?

Larry
---

===================================================================
--- wireless-testing.orig/drivers/ssb/pci.c
+++ wireless-testing/drivers/ssb/pci.c
@@ -253,6 +253,11 @@ static int sprom_do_read(struct ssb_bus
 {
 	int i;
 
+	/* Check if SPROM can be read */
+	if (ioread16(bus->mmio + SSB_SPROM_BASE) == 0xFFFF) {
+		ssb_printk(KERN_ERR PFX "Unable to read SPROM\n");
+		return -ENODEV;
+	}
 	for (i = 0; i < bus->sprom_size; i++)
 		sprom[i] = ioread16(bus->mmio + SSB_SPROM_BASE + (i * 2));
 
@@ -625,17 +630,23 @@ static int ssb_pci_sprom_get(struct ssb_
 	if (!buf)
 		goto out;
 	bus->sprom_size = SSB_SPROMSIZE_WORDS_R123;
-	sprom_do_read(bus, buf);
+	err = sprom_do_read(bus, buf);
+	if (err)
+		goto out_free;
 	err = sprom_check_crc(buf, bus->sprom_size);
 	if (err) {
 		/* try for a 440 byte SPROM - revision 4 and higher */
 		kfree(buf);
 		buf = kcalloc(SSB_SPROMSIZE_WORDS_R4, sizeof(u16),
 			      GFP_KERNEL);
-		if (!buf)
+		if (!buf) {
+			err = -ENOMEM;
 			goto out;
+		}
 		bus->sprom_size = SSB_SPROMSIZE_WORDS_R4;
-		sprom_do_read(bus, buf);
+		err = sprom_do_read(bus, buf);
+		if (err)
+			goto out_free;
 		err = sprom_check_crc(buf, bus->sprom_size);
 		if (err) {
 			/* All CRC attempts failed.

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

* Re: [RFC/RFT] ssb: Avoid system hang when SPROM read fails
  2010-04-25 22:30 ` Larry Finger
@ 2010-04-26 17:15   ` John W. Linville
  -1 siblings, 0 replies; 8+ messages in thread
From: John W. Linville @ 2010-04-26 17:15 UTC (permalink / raw)
  To: Larry Finger; +Cc: Michael Buesch, b43-dev, linux-wireless

On Sun, Apr 25, 2010 at 05:30:28PM -0500, Larry Finger wrote:
> In kernel Bugzilla #15825, the OP reports a case of intermittent reading
> of the SPROM. If such reads fail, the box hangs. Thanks to careful testing
> by bugzillakernelorg@lez.ath.cx has shown that the first read of the
> SPROM returns 0xFFFF with the hang happening on the next read.
> 
> The source of the read failure is still under investigation; however,
> this patch does avoid the system hang.
> 
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> ---
> 
> John,
> 
> Does this patch avoid the system hang on your box?
> 
> Larry
> ---
> 
> ===================================================================
> --- wireless-testing.orig/drivers/ssb/pci.c
> +++ wireless-testing/drivers/ssb/pci.c
> @@ -253,6 +253,11 @@ static int sprom_do_read(struct ssb_bus
>  {
>  	int i;
>  
> +	/* Check if SPROM can be read */
> +	if (ioread16(bus->mmio + SSB_SPROM_BASE) == 0xFFFF) {
> +		ssb_printk(KERN_ERR PFX "Unable to read SPROM\n");
> +		return -ENODEV;
> +	}
>  	for (i = 0; i < bus->sprom_size; i++)
>  		sprom[i] = ioread16(bus->mmio + SSB_SPROM_BASE + (i * 2));
>  

Well, the "good" news is that I hit the "Unable to read SPROM" case.
The bad news is that the box still hangs after the -ENODEV.  I have
not yet tracked-down the exact location of the current hang.

John

P.S.  Sorry about the 'radio silence' -- I've been distracted with
some other things.  Also, the box in question originally belonged
to someone else who had configured it in a way that was less than
friendly to kernel development.  I finally reinstalled it...
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

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

* [RFC/RFT] ssb: Avoid system hang when SPROM read fails
@ 2010-04-26 17:15   ` John W. Linville
  0 siblings, 0 replies; 8+ messages in thread
From: John W. Linville @ 2010-04-26 17:15 UTC (permalink / raw)
  To: Larry Finger; +Cc: Michael Buesch, b43-dev, linux-wireless

On Sun, Apr 25, 2010 at 05:30:28PM -0500, Larry Finger wrote:
> In kernel Bugzilla #15825, the OP reports a case of intermittent reading
> of the SPROM. If such reads fail, the box hangs. Thanks to careful testing
> by bugzillakernelorg at lez.ath.cx has shown that the first read of the
> SPROM returns 0xFFFF with the hang happening on the next read.
> 
> The source of the read failure is still under investigation; however,
> this patch does avoid the system hang.
> 
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> ---
> 
> John,
> 
> Does this patch avoid the system hang on your box?
> 
> Larry
> ---
> 
> ===================================================================
> --- wireless-testing.orig/drivers/ssb/pci.c
> +++ wireless-testing/drivers/ssb/pci.c
> @@ -253,6 +253,11 @@ static int sprom_do_read(struct ssb_bus
>  {
>  	int i;
>  
> +	/* Check if SPROM can be read */
> +	if (ioread16(bus->mmio + SSB_SPROM_BASE) == 0xFFFF) {
> +		ssb_printk(KERN_ERR PFX "Unable to read SPROM\n");
> +		return -ENODEV;
> +	}
>  	for (i = 0; i < bus->sprom_size; i++)
>  		sprom[i] = ioread16(bus->mmio + SSB_SPROM_BASE + (i * 2));
>  

Well, the "good" news is that I hit the "Unable to read SPROM" case.
The bad news is that the box still hangs after the -ENODEV.  I have
not yet tracked-down the exact location of the current hang.

John

P.S.  Sorry about the 'radio silence' -- I've been distracted with
some other things.  Also, the box in question originally belonged
to someone else who had configured it in a way that was less than
friendly to kernel development.  I finally reinstalled it...
-- 
John W. Linville		Someday the world will need a hero, and you
linville at tuxdriver.com			might be all we have.  Be ready.

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

* Re: [RFC/RFT] ssb: Avoid system hang when SPROM read fails
  2010-04-26 17:15   ` John W. Linville
@ 2010-04-26 18:04     ` Larry Finger
  -1 siblings, 0 replies; 8+ messages in thread
From: Larry Finger @ 2010-04-26 18:04 UTC (permalink / raw)
  To: John W. Linville; +Cc: Michael Buesch, b43-dev, linux-wireless

On 04/26/2010 12:15 PM, John W. Linville wrote:
> 
> Well, the "good" news is that I hit the "Unable to read SPROM" case.
> The bad news is that the box still hangs after the -ENODEV.  I have
> not yet tracked-down the exact location of the current hang.
> 
> John
> 
> P.S.  Sorry about the 'radio silence' -- I've been distracted with
> some other things.  Also, the box in question originally belonged
> to someone else who had configured it in a way that was less than
> friendly to kernel development.  I finally reinstalled it...

That box is certainly resistant!

I certainly understand your distractions. That has to be a major
understatement.

As the patch makes some improvement in both your system and the one in
Bug #15825, I'll push it as a real patch.

Would your box be available to me as a loaner? I have considered buying
a netbook for debugging purposes, but I cannot quite justify the cost.
In addition, Murphy's law would make whatever one I bought work without
any problems.

Larry

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

* [RFC/RFT] ssb: Avoid system hang when SPROM read fails
@ 2010-04-26 18:04     ` Larry Finger
  0 siblings, 0 replies; 8+ messages in thread
From: Larry Finger @ 2010-04-26 18:04 UTC (permalink / raw)
  To: John W. Linville; +Cc: Michael Buesch, b43-dev, linux-wireless

On 04/26/2010 12:15 PM, John W. Linville wrote:
> 
> Well, the "good" news is that I hit the "Unable to read SPROM" case.
> The bad news is that the box still hangs after the -ENODEV.  I have
> not yet tracked-down the exact location of the current hang.
> 
> John
> 
> P.S.  Sorry about the 'radio silence' -- I've been distracted with
> some other things.  Also, the box in question originally belonged
> to someone else who had configured it in a way that was less than
> friendly to kernel development.  I finally reinstalled it...

That box is certainly resistant!

I certainly understand your distractions. That has to be a major
understatement.

As the patch makes some improvement in both your system and the one in
Bug #15825, I'll push it as a real patch.

Would your box be available to me as a loaner? I have considered buying
a netbook for debugging purposes, but I cannot quite justify the cost.
In addition, Murphy's law would make whatever one I bought work without
any problems.

Larry

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

* Re: [RFC/RFT] ssb: Avoid system hang when SPROM read fails
  2010-04-26 18:04     ` Larry Finger
@ 2010-04-26 18:32       ` John W. Linville
  -1 siblings, 0 replies; 8+ messages in thread
From: John W. Linville @ 2010-04-26 18:32 UTC (permalink / raw)
  To: Larry Finger; +Cc: Michael Buesch, b43-dev, linux-wireless

On Mon, Apr 26, 2010 at 01:04:33PM -0500, Larry Finger wrote:
> On 04/26/2010 12:15 PM, John W. Linville wrote:
> > 
> > Well, the "good" news is that I hit the "Unable to read SPROM" case.
> > The bad news is that the box still hangs after the -ENODEV.  I have
> > not yet tracked-down the exact location of the current hang.
> > 
> > John
> > 
> > P.S.  Sorry about the 'radio silence' -- I've been distracted with
> > some other things.  Also, the box in question originally belonged
> > to someone else who had configured it in a way that was less than
> > friendly to kernel development.  I finally reinstalled it...
> 
> That box is certainly resistant!
> 
> I certainly understand your distractions. That has to be a major
> understatement.
> 
> As the patch makes some improvement in both your system and the one in
> Bug #15825, I'll push it as a real patch.
> 
> Would your box be available to me as a loaner? I have considered buying
> a netbook for debugging purposes, but I cannot quite justify the cost.
> In addition, Murphy's law would make whatever one I bought work without
> any problems.

I think that can be arranged...

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

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

* [RFC/RFT] ssb: Avoid system hang when SPROM read fails
@ 2010-04-26 18:32       ` John W. Linville
  0 siblings, 0 replies; 8+ messages in thread
From: John W. Linville @ 2010-04-26 18:32 UTC (permalink / raw)
  To: Larry Finger; +Cc: Michael Buesch, b43-dev, linux-wireless

On Mon, Apr 26, 2010 at 01:04:33PM -0500, Larry Finger wrote:
> On 04/26/2010 12:15 PM, John W. Linville wrote:
> > 
> > Well, the "good" news is that I hit the "Unable to read SPROM" case.
> > The bad news is that the box still hangs after the -ENODEV.  I have
> > not yet tracked-down the exact location of the current hang.
> > 
> > John
> > 
> > P.S.  Sorry about the 'radio silence' -- I've been distracted with
> > some other things.  Also, the box in question originally belonged
> > to someone else who had configured it in a way that was less than
> > friendly to kernel development.  I finally reinstalled it...
> 
> That box is certainly resistant!
> 
> I certainly understand your distractions. That has to be a major
> understatement.
> 
> As the patch makes some improvement in both your system and the one in
> Bug #15825, I'll push it as a real patch.
> 
> Would your box be available to me as a loaner? I have considered buying
> a netbook for debugging purposes, but I cannot quite justify the cost.
> In addition, Murphy's law would make whatever one I bought work without
> any problems.

I think that can be arranged...

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville at tuxdriver.com			might be all we have.  Be ready.

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

end of thread, other threads:[~2010-04-26 18:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-25 22:30 [RFC/RFT] ssb: Avoid system hang when SPROM read fails Larry Finger
2010-04-25 22:30 ` Larry Finger
2010-04-26 17:15 ` John W. Linville
2010-04-26 17:15   ` John W. Linville
2010-04-26 18:04   ` Larry Finger
2010-04-26 18:04     ` Larry Finger
2010-04-26 18:32     ` John W. Linville
2010-04-26 18:32       ` John W. Linville

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.