snd-nm256: hard lockup on every second module load after powerup
Hi folks,
I have this really old Dell Latitude CPiA here containing the dreaded neomagic combined audio/video chipset, and observe some hard lockup sometimes, which is not supposed to be anything special wrt. other people with similar laptops having the same trouble. The only regularity I noticed was that after completely removing power to the machine, the sound driver can be loaded without locking the thing hard. Any further attempt, eg. rmmod and insmod or reboot with alsasound startup script, will result in a dead machine. Every time. Cut the power, and next time it will survive - exactly once.
Now this chip is a NM2200 / 256AV, and I already did some reading in the alsa driver source code, but adding printk()s all over the place just showed that it does not lock up during init_chip() or poking at the registers during ac97_reset(), but shortly after the latter, approx. half a second or so - it might still be a consequence thereof.
My basic idea is, with the device being entirely undocumented (to hell with all hardware vendors who don't even release specs after the devices are not even sold anymore, by the way), that the code is missing a proper device reset, and trying to re-init some parts just kill the machine. Cutting the power really is not that nice as a workaround. I'd love to try something along the lines of saving the device's state as a whole, and before reloading the module, restore that state again. The difference between before and after should somehow give a clue about the proper reset procedure - or so I hope.
Unfortunately I failed with my previous attempts to modify the driver appropriately. Now that it's basically back to formula, I wanted to ask whether there is a possibility to read and write back whole parts of memory directly from/to the device, or if I should rather store each and every register somewhere I can later restore it from, one by one. I'd even prefer userspace, and am currently experimenting with pcidump.
Any hints would be greatly appreciated! Thanks a bunch,
Chris
Quoted 1 line · Christian Trefzer
... currently experimenting with pcidump.
First of all, that is pcitweak. Reading all the register space sequentially 32bit word-wise revealed the following:
If word #7 (counting from 0) is 0x22a0c0c0 the driver locks up while loading, while with 0xa2a0c0c0 it will load. I'll try and reproduce the case where I get the lockup-prone value, and then try to write the working value there...
Later,
Chris
OK, apparently the importance of this issue is quite modest, so I won't expect too much attention - not that I'd have presumed any in the first place ; )
Here's what I found so far, anyway:
Writing the following to the device one word at a time prior to loading snd-nm256 saved my laptop from hanging. It was dumped in a shell loop after successful driver loading:
0x719180860x0220011f0x060400030x000120000x000000000x000000000x200101000xa2a0c0c00xfef0fd000xf9f0f8000x000000000x000000000x000000000x000000000x000000000x008c00000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x00000000
The following I get when reading stuff right before a crash:
0x719180860x0220011f0x060400030x000120000x000000000x000000000x200101000x22a0c0c00xfef0fd000xf9f0f8000x000000000x000000000x000000000x000000000x000000000x008c00000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x000000000x00000000
The funny part is that only writing word #7 won't save the suicidal fsck from going over the edge, I only succeeded when writing all the stuff back to the device. By the way, here's a diff:
nm256-device-driverloaded renamed from nm256-device-beforedriver +1 -1
@@ -5,7 +5,7 @@ 0x00000000 0x00000000 0x20010100 -0x22a0c0c0 +0xa2a0c0c0 0xfef0fd00 0xf9f0f800 0x00000000
It came out of suspend2 just the way it was supposed to crash, I flushed the registers and it is now happily playing music for me. Strange thing... For now, I'll add the register paint job to an install directive in modprobe.conf, let's see what this can do.
Kind regards,
Chris
At Sun, 26 Mar 2006 07:45:42 +0200,
Quoted 37 lines · Christian Trefzer
Hi folks,
I have this really old Dell Latitude CPiA here containing the dreaded neomagic combined audio/video chipset, and observe some hard lockup sometimes, which is not supposed to be anything special wrt. other people with similar laptops having the same trouble. The only regularity I noticed was that after completely removing power to the machine, the sound driver can be loaded without locking the thing hard. Any further attempt, eg. rmmod and insmod or reboot with alsasound startup script, will result in a dead machine. Every time. Cut the power, and next time it will survive - exactly once.
Now this chip is a NM2200 / 256AV, and I already did some reading in the alsa driver source code, but adding printk()s all over the place just showed that it does not lock up during
init_chip()or poking at the registers duringac97_reset(), but shortly after the latter, approx. half a second or so - it might still be a consequence thereof.My basic idea is, with the device being entirely undocumented (to hell with all hardware vendors who don't even release specs after the devices are not even sold anymore, by the way), that the code is missing a proper device reset, and trying to re-init some parts just kill the machine. Cutting the power really is not that nice as a workaround. I'd love to try something along the lines of saving the device's state as a whole, and before reloading the module, restore that state again. The difference between before and after should somehow give a clue about the proper reset procedure - or so I hope.
Unfortunately I failed with my previous attempts to modify the driver appropriately. Now that it's basically back to formula, I wanted to ask whether there is a possibility to read and write back whole parts of memory directly from/to the device, or if I should rather store each and every register somewhere I can later restore it from, one by one. I'd even prefer userspace, and am currently experimenting with pcidump.
Quoted 1 line
Any hints would be greatly appreciated! Thanks a bunch,
Try 2.6.16-git tree. Some patches for this problem are there.
Takashi
Quoted 3 lines · Takashi Iwai
Quoted 1 line
Any hints would be greatly appreciated! Thanks a bunch,
Try 2.6.16-git tree. Some patches for this problem are there.
If this does not fix the problem then alsa-devel (cc'ed) is the best list to discuss the issue.
Lee
Hi Takashi, Lee,
Quoted 6 lines · Lee Revell
Quoted 2 lines · Takashi Iwai
Try 2.6.16-git tree. Some patches for this problem are there.
If this does not fix the problem then alsa-devel (cc'ed) is the best list to discuss the issue.
Actually, the changes in Linus' current git have fixed the hang for me. Good job - thanks a lot, guys!
Kind regards,
Chris
Quoted 8 lines · Christian Trefzer
Hi Takashi, Lee,
Quoted 4 lines · Lee Revell
Quoted 2 lines · Takashi Iwai
Try 2.6.16-git tree. Some patches for this problem are there.
Quoted 8 lines
Quoted 2 lines
If this does not fix the problem then alsa-devel (cc'ed) is the best list to discuss the issue.
Actually, the changes in Linus' current git have fixed the hang for me. Good job - thanks a lot, guys!
Kind regards,
Chris
Takashi, would it be possible getting the fixes for this hard lookup into 2.6.16.2?
cu
Adrian
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon SeedQuoted 10 lines · Adrian Bunk
Quoted 1 line
Actually, the changes in Linus' current git have fixed the hang for
me.
Quoted 4 lines
Good job - thanks a lot, guys!
Kind regards,
ChrisTakashi, would it be possible getting the fixes for this hard lookup into 2.6.16.2?
Is a 225 line patch to fix a driver that's never worked appropriate for -stable?
Lee
Quoted 8 lines · Lee Revell
Quoted 7 lines · Adrian Bunk
Quoted 1 line
Actually, the changes in Linus' current git have fixed the hang for
me.
Quoted 4 lines
Good job - thanks a lot, guys!
Kind regards,
Chris
Quoted 6 lines
Quoted 3 lines
Takashi, would it be possible getting the fixes for this hard lookup into 2.6.16.2?
Is a 225 line patch to fix a driver that's never worked appropriate for -stable?
If it was only "not working" it wasn't that bad, but "hard lockup" is really bad.
Quoted 1 line
Lee
cu
Adrian
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon SeedAt Fri, 31 Mar 2006 16:53:13 -0500,
Quoted 9 lines · Lee Revell
Quoted 7 lines · Adrian Bunk
Quoted 1 line
Actually, the changes in Linus' current git have fixed the hang for
me.
Quoted 4 lines
Good job - thanks a lot, guys!
Kind regards,
Chris
Quoted 6 lines
Quoted 3 lines
Takashi, would it be possible getting the fixes for this hard lookup into 2.6.16.2?
Is a 225 line patch to fix a driver that's never worked appropriate for -stable?
In addition to more 200 lines of patches to ac97 for putting every piece into its place...
I think it's too big for -stable tree.
Takashi