G1-ATA driver broken
- SWAT
- Insane DCEmu
- Posts: 191
- https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
- Joined: Sat Jan 31, 2004 2:34 pm
- Location: Russia/Novosibirsk
- Has thanked: 1 time
- Been thanked: 0
- Contact:
G1-ATA driver broken
Hello everyone!
Approximately after commit http://sourceforge.net/p/cadcdev/kallis ... ded37e9e1/ (I tested all CD-ROM changes from http://sourceforge.net/p/cadcdev/kallis ... a4ba0ca76/) G1-ATA driver works unstable.
Seems the recursive mutex is locked and freezes all code after several readings from HDD/CF.
If I use this revision http://sourceforge.net/p/cadcdev/kallis ... db411efe2/ the G1-ATA driver works fine.
Approximately after commit http://sourceforge.net/p/cadcdev/kallis ... ded37e9e1/ (I tested all CD-ROM changes from http://sourceforge.net/p/cadcdev/kallis ... a4ba0ca76/) G1-ATA driver works unstable.
Seems the recursive mutex is locked and freezes all code after several readings from HDD/CF.
If I use this revision http://sourceforge.net/p/cadcdev/kallis ... db411efe2/ the G1-ATA driver works fine.
Last edited by SWAT on Mon Mar 02, 2015 1:00 am, edited 1 time in total.
- BlueCrab
- The Crabby Overlord
- Posts: 5663
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: G1-ATA driver broken. Quzar it's for you =)
I'm pretty sure that Quzar doesn't have a G1 ATA device, so I'll take a look at it.
That said, what exactly is happening? It sounds like (from what you've described) it works fine for several read operations and then just locks up later waiting on the mutex? Is this all from the same thread, or separate threads?
That said, what exactly is happening? It sounds like (from what you've described) it works fine for several read operations and then just locks up later waiting on the mutex? Is this all from the same thread, or separate threads?
- SWAT
- Insane DCEmu
- Posts: 191
- Joined: Sat Jan 31, 2004 2:34 pm
- Location: Russia/Novosibirsk
- Has thanked: 1 time
- Been thanked: 0
- Contact:
Re: G1-ATA driver broken. Quzar it's for you =)
BlueCrab wrote:...it works fine for several read operations and then just locks up later waiting on the mutex? Is this all from the same thread, or separate threads?
Yep. From the same thread.
- BlueCrab
- The Crabby Overlord
- Posts: 5663
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: G1-ATA driver broken. Quzar it's for you =)
Are you doing any operations to the GD-ROM drive in the mean time, or just to the ATA device?
- BlueCrab
- The Crabby Overlord
- Posts: 5663
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: G1-ATA driver broken. Quzar it's for you =)
If you could provide me with a minimal piece of code that demonstrates the way to freeze things up, it'd help me immensely in debugging. If you can do it with just the g1_ata_* and cdrom_* functions (ie, no filesystem-related stuff), that'd be best.
My suspicion (which I can't back up at all, at the moment) is that it is something going screwy between the mutex being locked in the fs_iso9660 code during vblank interrupts and whatever you're doing in the foreground with the ATA device...
EDIT: Actually, let's see if my suspicion is correct before you try to write an example to show the bug. I've attached a patch that might fix any potential issues with interrupts and recursive mutexes... Try applying that patch ("patch -p1 < mutex.diff" from the $KOS_BASE directory, assuming you put the file attached there too), and see if it fixes the issue. I'd also suggest a full "make clean && make" on both KOS and whatever you're using to test with, just in case there are other funny things that have been changed in the meantime...
My suspicion (which I can't back up at all, at the moment) is that it is something going screwy between the mutex being locked in the fs_iso9660 code during vblank interrupts and whatever you're doing in the foreground with the ATA device...
EDIT: Actually, let's see if my suspicion is correct before you try to write an example to show the bug. I've attached a patch that might fix any potential issues with interrupts and recursive mutexes... Try applying that patch ("patch -p1 < mutex.diff" from the $KOS_BASE directory, assuming you put the file attached there too), and see if it fixes the issue. I'd also suggest a full "make clean && make" on both KOS and whatever you're using to test with, just in case there are other funny things that have been changed in the meantime...
- Attachments
-
- mutex.diff
- (2.64 KiB) Downloaded 101 times
- SWAT
- Insane DCEmu
- Posts: 191
- Joined: Sat Jan 31, 2004 2:34 pm
- Location: Russia/Novosibirsk
- Has thanked: 1 time
- Been thanked: 0
- Contact:
Re: G1-ATA driver broken. Quzar it's for you =)
Hmm my application now crashes at new place:
Video rendering I have in separate thread. And it's uses normal mutex.
Code: Select all
*** ASSERTION FAILURE ***
Assertion "0" failed at pvr_prim.c:98 in `pvr_poly_compile': Invalid texture U size
- BlueCrab
- The Crabby Overlord
- Posts: 5663
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: G1-ATA driver broken. Quzar it's for you =)
That message is entirely unrelated to the g1ata stuff, quite obviously. That error means that you've put in an invalid size for the width of a texture somewhere...
Other than that, it could, of course, be caused by memory corruption elsewhere (outside of your rendering code).
Other than that, it could, of course, be caused by memory corruption elsewhere (outside of your rendering code).
Re: G1-ATA driver broken. Quzar it's for you =)
I saw that kind of error message before on these forums when somebody only partially recompiled KOS
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
- BlueCrab
- The Crabby Overlord
- Posts: 5663
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: G1-ATA driver broken. Quzar it's for you =)
That's also entirely possible (and that's also why I suggested doing a full "make clean && make" pass).bogglez wrote:I saw that kind of error message before on these forums when somebody only partially recompiled KOS
@SWAT: Did you do a full "make clean && make" pass on both KOS and your program? Do you use anything from kos-ports (or other external libraries)? If so, you should probably do a "make clean && make" on those too. Basically, clean and remake everything in this order: KOS, any external libraries (in order of any dependencies they have on each other, of course), and then your program that is failing.
Re: G1-ATA driver broken. Quzar it's for you =)
Bluecrab: Out of curiosity, do you know why this error message always occurs in the PVR code? Is it because there was an ABI change in that code recently or something? Funny error that one.
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
- BlueCrab
- The Crabby Overlord
- Posts: 5663
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: G1-ATA driver broken. Quzar it's for you =)
Relatively recently, the pvr_poly_cxt_t was changed, which is what causes it. So, yes, that would be an ABI change.bogglez wrote:Bluecrab: Out of curiosity, do you know why this error message always occurs in the PVR code? Is it because there was an ABI change in that code recently or something? Funny error that one.
Since KOS is statically linked, we've never worried about ABI changes. It has always been recommended practice to do a full clean/rebuild pass every time you update. I'll try to be more explicit about it in the commit messages in the future when things like that happen, but yeah, please do a full clean/rebuild pass every time you update.
- SWAT
- Insane DCEmu
- Posts: 191
- Joined: Sat Jan 31, 2004 2:34 pm
- Location: Russia/Novosibirsk
- Has thanked: 1 time
- Been thanked: 0
- Contact:
Re: G1-ATA driver broken. Quzar it's for you =)
Sorry I forget rebuild parallax library, now it's ok. Soon I'll check your patch on HDD.
Update: Your patch did not help Still freezing at ATA access. Now even slightly worse, freezes earlier than before the patch.
Update: Your patch did not help Still freezing at ATA access. Now even slightly worse, freezes earlier than before the patch.
- BlueCrab
- The Crabby Overlord
- Posts: 5663
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: G1-ATA driver broken. Quzar it's for you =)
I doubt that the patch itself made matters worse (I'd guess it's something random happening, at this point).
I'm going to need some sort of example code that demonstrates the issue, since I don't seem to be having this problem...
I'm going to need some sort of example code that demonstrates the issue, since I don't seem to be having this problem...
- SWAT
- Insane DCEmu
- Posts: 191
- Joined: Sat Jan 31, 2004 2:34 pm
- Location: Russia/Novosibirsk
- Has thanked: 1 time
- Been thanked: 0
- Contact:
Re: G1-ATA driver broken. Quzar it's for you =)
It's not easy to make example with this problem. I really don't know why this happen, but if I use cdrom driver before this changes, it's works fine...
Ok, I'll try get more info about this at free time.
Ok, I'll try get more info about this at free time.
- BlueCrab
- The Crabby Overlord
- Posts: 5663
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: G1-ATA driver broken. Quzar it's for you =)
So, the only thing you have to revert is the cdrom changes? No other code has to be changed in order to make your code work -- that is to say, if you save the cdrom.[ch] files from when it works and otherwise update everything else to the current version, does it work?
- BlueCrab
- The Crabby Overlord
- Posts: 5663
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: G1-ATA driver broken. Quzar it's for you =)
Also, when you say it's difficult to make an example, does that imply that you don't run into the same issue outside of whatever you're normally using to test it? That actually makes it sound like the problem is elsewhere in your code (or in some other unrelated part of KOS to the g1ata code).
Remember, KOS doesn't give you any memory protection or kernel/userspace separation, so a simple buffer overflow pretty much anywhere can break things in very strange ways.
Remember, KOS doesn't give you any memory protection or kernel/userspace separation, so a simple buffer overflow pretty much anywhere can break things in very strange ways.
- SWAT
- Insane DCEmu
- Posts: 191
- Joined: Sat Jan 31, 2004 2:34 pm
- Location: Russia/Novosibirsk
- Has thanked: 1 time
- Been thanked: 0
- Contact:
Re: G1-ATA driver broken. Quzar it's for you =)
Not easy because need time I have not time for any code example
But I have some testers, they are help me with debugging.
So, I can say yes for:
But I have some testers, they are help me with debugging.
So, I can say yes for:
I just replace cdrom.c and cdrom.h in current KOS rev to 2014-05-01 and it's works.BlueCrab wrote:So, the only thing you have to revert is the cdrom changes? No other code has to be changed in order to make your code work -- that is to say, if you save the cdrom.[ch] files from when it works and otherwise update everything else to the current version, does it work?
Not sure what it is my case. I did not touch the code before have this problem, everything worked well with old cdrom driver.BlueCrab wrote:Also, when you say it's difficult to make an example, does that imply that you don't run into the same issue outside of whatever you're normally using to test it? That actually makes it sound like the problem is elsewhere in your code (or in some other unrelated part of KOS to the g1ata code).
Remember, KOS doesn't give you any memory protection or kernel/userspace separation, so a simple buffer overflow pretty much anywhere can break things in very strange ways.
- Quzar
- Dream Coder
- Posts: 7499
- Joined: Wed Jul 31, 2002 12:14 am
- Location: Miami, FL
- Has thanked: 4 times
- Been thanked: 10 times
- Contact:
Re: G1-ATA driver broken. Quzar it's for you =)
Sorry, I'd been away from internet access for a few weeks. Like bluecrab said, I don't have a g1-ata device to test with. I'll take a look through the driver again, but I don't know what would cause it.
"When you post fewer lines of text than your signature, consider not posting at all." - A Wise Man