Bug 20375

Summary: APM doesn't work properly! Suspend/resume/suspend/hang
Product: Base System Reporter: Josef Karthauser <joe>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 5.0-CURRENT   
Hardware: Any   
OS: Any   

Description Josef Karthauser 2000-08-03 10:00:01 UTC
	Something has recently broken APM support for me.

	If I suspend, I can resume, but the machine freezes upon
	a further suspend.

	I've tried cutting the kernel config down to remove the
	possiblity that it's a pccard or pcm problem.

Fix: 

Don't know - I'm going to go back in time and see if I can
	work out when it broke.  It's been broken for a couple of
	weeks I believe.
How-To-Repeat: 
	Compile the supplied kernel config on a laptop and
	try suspend/resume/suspend/resume and see whether you
	get a hang or not.
Comment 1 Sheldon Hearn freebsd_committer freebsd_triage 2000-08-03 10:52:25 UTC
State Changed
From-To: open->feedback

Recently broken looks like something you might be able to track 
down by rolling back apm.c revision by revision. :-)
Comment 2 Sheldon Hearn 2000-08-07 14:52:59 UTC
On Mon, 07 Aug 2000 14:37:39 +0100, Josef Karthauser wrote:

> It would help if I could get some feedback as to whether this
> is a local problem or is affecting others as well.

That's really not what the GNATS database is for.  There are mailing
lists for that purpose.  Perhaps you could close the PR and submit a new
one once you're more certain that this is not a local problem?  That's
what I'd do, at any rate.

I'll leave the PR in feedback state until you close it, ask me to close
it, or send more feedback. :-)

Ciao,
Sheldon.
Comment 3 Sheldon Hearn freebsd_committer freebsd_triage 2000-08-11 11:43:08 UTC
State Changed
From-To: feedback->open

We've got feedback.  Joe, you want to ask Soren to take 
a look, or are you now convinced that this isn't an ata-specific 
problem?
Comment 4 Brian Somers 2000-08-11 11:51:58 UTC
What happens if you change the tsleep to DELAY() ?  It should sort 
out the panic, but do you still die in the second suspend ?

The bit I'm *really* interested in is why this hasn't happened for 
you 'till now ?  It's been happening to me since FreeBSDCon (well, 
for the entire life of this laptop) !!!

Index: ata-all.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/ata-all.c,v
retrieving revision 1.62
diff -u -r1.62 ata-all.c
--- ata-all.c	2000/08/08 14:57:36	1.62
+++ ata-all.c	2000/08/11 10:49:54
@@ -1281,10 +1281,7 @@
 	if (*mask == 0x03)      /* wait for both master & slave */
 	    if (!(status0 & ATA_S_BUSY) && !(status1 & ATA_S_BUSY))
 		break;
-	if (ata_delayed_attach)
-	    DELAY(100);
-	else
-	    tsleep(&ata_delayed_attach, PRIBIO, "atarst", 1);
+	DELAY(100);
     }	
     DELAY(1);
     outb(scp->altioaddr, ATA_A_4BIT);


> On Thu, Aug 10, 2000 at 12:22:15PM +0100, Josef Karthauser wrote:
> > On Thu, Aug 10, 2000 at 12:12:17PM +0100, Brian Somers wrote:
> > > 
> > > With the dodgy call to tsleep (passing a NULL as the first arg) I was 
> > > getting a panic in the KASSERT in tsleep(), but once that was fixed 
> > > I'm back where I can suspend, resume then lock up when I try to suspend 
> > > again.
> > > 
> > > It'd be worth looking at a crash trace if you can get one.
> > 
> > Mine was working once _until_ the tsleep fix!  I'll recompile the
> > kernel again afresh and check again.  My guess is that this tsleep
> > is independant to my original report.
> 
> To repeat - even though it looks like the KASSERT in tsleep fixed the
> ata code for you, it's still broken for me on the head branch.  Upon
> a resume the debugger kicks in at tsleep within atareset.
>  
> > My original problem is the same as what you report above.  I've
> > tried with a cutdown kernel, to remove the possibility that it's
> > pcm, etc, but it does appear to be more fundamental than that.  I
> > don't get a crash, just a hang, so no coredump or back trace is
> > available. :(
> 
> I've gone back to 1/Aug/2000 for the ata code to get around that local
> problem which isn't necessarily the direct cause of the suspend/resume
> hang that you mention, and which appears to be the same as the one that
> I opened this PR under.
> 
> My suspicion is that something isn't resuming properly and when asked
> to suspend a second time it's hanging the system.  I wish that I could
> find our where the hang is occuring.
> 
> Joe
> 

-- 
Brian <brian@Awfulhak.org>                        <brian@[uk.]FreeBSD.org>
      <http://www.Awfulhak.org>                   <brian@[uk.]OpenBSD.org>
Don't _EVER_ lose your sense of humour !
Comment 5 Sheldon Hearn 2000-08-11 13:21:11 UTC
On Fri, 11 Aug 2000 12:29:37 +0100, Josef Karthauser wrote:

> Yes I'm convinced.  The ATA problem was a red herring.  Suspend/Resume
> has worked fine for me since the beginning of the year under 5.0.
> Something has changed and now it's broken.

Something changed and brok after February this year?  Perhaps we could
ask Nick Hibma and Doug Rabson to take a look at this, given their
involvement in rev 1.114 of apm.c?

Ciao,
Sheldon.
Comment 6 joe 2000-08-11 13:25:39 UTC
On Fri, Aug 11, 2000 at 02:21:11PM +0200, Sheldon Hearn wrote:
> 
> 
> On Fri, 11 Aug 2000 12:29:37 +0100, Josef Karthauser wrote:
> 
> > Yes I'm convinced.  The ATA problem was a red herring.  Suspend/Resume
> > has worked fine for me since the beginning of the year under 5.0.
> > Something has changed and now it's broken.
> 
> Something changed and brok after February this year?  Perhaps we could
> ask Nick Hibma and Doug Rabson to take a look at this, given their
> involvement in rev 1.114 of apm.c?

That'd good.

I believe that it broke sometime in the last couple of months.

If I could get a trace that'd find the culprit, but unfortunately
the machine hangs hard - power reset required.  Maybe some debug
output to stderr would catch the problem.  Is there somewhere in
the bus code that I can add some debug that'll show each device
being suspended?

Joe
Comment 7 joe 2000-08-12 17:47:28 UTC
On Fri, Aug 11, 2000 at 05:30:09AM -0700, Josef Karthauser wrote:
>  
>  I believe that it broke sometime in the last couple of months.
>  
>  If I could get a trace that'd find the culprit, but unfortunately
>  the machine hangs hard - power reset required.  Maybe some debug
>  output to stderr would catch the problem.  Is there somewhere in
>  the bus code that I can add some debug that'll show each device
>  being suspended?
>  

Ok, more updates.

There _is_ a sysctl (debug.apm_debug) recently added for debugging.

Using the kernel debugger I've determined that the freeze is almost
definitely in the bios32 call:

	apm_do_suspend
	    apm_suspend_system
	        apm_bioscall
		    bios32
			HANG

This happens on the second suspend only, the first time through it
succeeds, and returns after a resume event (keypress, etc.).

Who's our APM wizard?  I've no idea what the bios interaction should
be.

Joe


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Comment 8 joe 2000-08-15 11:06:31 UTC
On Tue, Aug 15, 2000 at 10:04:23AM +0100, Nick Hibma wrote:
> > Right, my problems were unrelated. After a pretty long goose chase, my
> > laptop crashing was my own fault.
> > 
> > And after that I can get it to crash when suspending or resuming.
> 
> Argh. can -> can't as in cannot.

So your suspend/resume/suspend/resume is hang free?

My guess is that on Brian's and my Vaio something isn't being registered
in the bios as being resumed properly and so when the second suspend
is called it hangs.

Joe


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Comment 9 iedowse freebsd_committer freebsd_triage 2001-08-26 00:18:43 UTC
State Changed
From-To: open->feedback


Nothing has been added to the audit trail in over a year - does this 
problem still exist?
Comment 10 iedowse 2001-08-29 00:30:07 UTC
Adding to the audit trail:

------------------
Date:    Tue, 28 Aug 2001 14:56:06 BST
From:    Josef Karthauser <joe@tao.org.uk>

Joe> I don't know whether the problem still exists as I don't have a Sony any
Joe> more.  I would imagine that it does.  Brian Somers is the one to ask
Joe> (brian@freebsd.org), as he's also got a Sony that had trouble.
Joe> 
Joe> Joe
------------------

------------------
Date: Tue, 28 Aug 2001 15:50:45 +0100
From: Brian Somers <brian@Awfulhak.org>

Brian> Hi,
Brian> 
Brian> It's kind of difficult to tell if the problem is still there right 
Brian> now.  When I suspend & resume, I seem to lose all interrupt routing 
Brian> at the moment (the keyboard doesn't respond, but if I drop into ddb 
Brian> and back out again, I get to see what I've typed).
Brian> 
Brian> The problem was certainly there about a month ago when I last tried 
Brian> it though, so let's assume nothing's changed :*)
------------------
Comment 11 iedowse freebsd_committer freebsd_triage 2001-08-29 00:56:32 UTC
State Changed
From-To: feedback->open


This problem still exists.
Comment 12 Hiten Pandya 2002-03-29 02:09:10 UTC
Does this problem still exist?  If not, we can clost this 
PR I think.  Joe is a committer, so he can probably change the state to
something like suspended.

-- 
Hiten Pandya
http://jfs4bsd.sf.net - JFS for FreeBSD (JFS4BSD)
http://www.FreeBSD.org - The Power to Serve

Public Key: http://www.pittgoth.com/~hiten/pubkey.asc
--- 4FB9 C4A9 4925 CF97 9BF3  ADDA 861D 5DBD E4E3 03C3 ---
Comment 13 Josef Karthauser 2002-03-29 10:23:46 UTC
On Fri, Mar 29, 2002 at 02:09:10AM +0000, Hiten Pandya wrote:
> Does this problem still exist?  If not, we can clost this 
> PR I think.  Joe is a committer, so he can probably change the state to
> something like suspended.


I've no idea whether the problem still exists.  I've not had the afore
mentioned sony for 18 months.

Joe
Comment 14 hiten pandya 2002-05-11 22:19:21 UTC
--- Josef Karthauser <joe@tao.org.uk> wrote:
> I've no idea whether the problem still exists.  I've not had the afore
> mentioned sony for 18 months.

Could you possibly close the PR, as I don't think there has been another PR
which mentions this problem as far as I am aware.

Thanks.

  -- Hiten


__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com
Comment 15 joe freebsd_committer freebsd_triage 2002-05-12 22:56:05 UTC
State Changed
From-To: open->closed

I've not had this laptop for a couple of years, and no-one else has 
reported the problem.