Linux-2.5.14..
Subsystems (2)
There's a lot of stuff that has happened in the 2.5.x series lately, and you can see the gory details in the ChangeLog files that accompany releases these days, but I thought I'd point out 2.5.14, since it has some interesting fundamental changes to how dirty state is maintained in the VM.
(The big changes were actually in 2.5.12, but 2.5.13 contained various minor fixes and tweaks, and 2.5.14 contains a number of fixes especially wrt truncate, so hopefully it's fairly _stable_ as of 2.5.14.)
Credit goes to Andrew Morton, and not only does it clean up the code a lot, it also seems to perform a lot better in many circumstances.
There's a lot of other stuff in the 2.5.x tree too, but few things are so fundamental. Please test (but also, please be careful - backups are always a good idea).
Linus
Quoted 6 lines · Linus Torvalds
There's a lot of stuff that has happened in the 2.5.x series lately, and you can see the gory details in the ChangeLog files that accompany releases these days, but I thought I'd point out 2.5.14, since it has some interesting fundamental changes to how dirty state is maintained in the VM.
Quoted 6 lines
(The big changes were actually in 2.5.12, but 2.5.13 contained various minor fixes and tweaks, and 2.5.14 contains a number of fixes especially wrt truncate, so hopefully it's fairly _stable_ as of 2.5.14.)
From the look of the changelog at least a few of the file corruption
bugs with ext3, 2k block file systems and 2.5 have been fixed. Should I expect this release to address the problems I was seeing?
Daniel
Signature · 3 lines
I keep my head above the surface, trying to breath, looking for land.
I keep an eye at the distant horizon waiting for help, clutching the sky.
-- Covenant, _Phoenix_Quoted 4 lines · Daniel Pittman
From the look of the changelog at least a few of the file corruption bugs with ext3, 2k block file systems and 2.5 have been fixed. Should I expect this release to address the problems I was seeing?
"Expect" is too strong a word. I'd say "hope" - a number of truncate bugs were fixed, but whether that was what bit you, nobody knows.
I suspect the real answer is that we'd love for you to test things out, but that if it ends up being too painful to recover if the problems happen again, you probably shouldn't..
Linus
Quoted 8 lines · Linus Torvalds
Quoted 4 lines · Daniel Pittman
From the look of the changelog at least a few of the file corruption bugs with ext3, 2k block file systems and 2.5 have been fixed. Should I expect this release to address the problems I was seeing?
"Expect" is too strong a word. I'd say "hope" - a number of truncate bugs were fixed, but whether that was what bit you, nobody knows.
Well, hope seems justified...
Quoted 3 lines
I suspect the real answer is that we'd love for you to test things out, but that if it ends up being too painful to recover if the problems happen again, you probably shouldn't..
I did, and I failed to reproduce it working on a scratch disk. This was a period of playing and I /hope/ that it's conclusive. I couldn't get .12 to reliably fail, though, which is less inspiring.
I should be able to find some time in the next day or so to test it a bit more on the scratch disk and then, if that works, I will update my backups. :)
Still, it seems good so far.
Daniel
Signature · 3 lines
Television is the ideal propaganda medium, a mendacious monster, not primarily
out of malice but from its amoral nature.
-- Paul JohnsonQuoted 6 lines · Linus Torvalds
Quoted 4 lines · Daniel Pittman
From the look of the changelog at least a few of the file corruption bugs with ext3, 2k block file systems and 2.5 have been fixed. Should I expect this release to address the problems I was seeing?
Quoted 6 lines
"Expect" is too strong a word. I'd say "hope" - a number of truncate bugs were fixed, but whether that was what bit you, nobody knows.
I suspect the real answer is that we'd love for you to test things out, but that if it ends up being too painful to recover if the problems happen again, you probably shouldn't..
Right. I got brave enough to test it on a real, live system after extensive fake testing. It seems to work well, at least so far as running the same workload that cause massive file corruption correctly.
So, I believe that 2.5.14 is working correctly with 2k ext3 filesystems, at least for minimal use. I didn't do any sort of extreme load testing or anything like that, being cautious about it.
On reboot, I got an assertion in ext3, though, and the following BUG trace. So, something still isn't well, but it seems to be getting it much more right. :)
Daniel
ksymoops 2.4.5 on i686 2.5.6. Options used
-V (default)
-k /proc/ksyms (default)
-l /proc/modules (default)
-o /lib/modules/2.5.6/ (default)
-m /boot/System.map-2.5.14 (specified)
Error (regular_file): read_ksyms stat /proc/ksyms failed No modules in ksyms, skipping objects
No ksyms, skipping lsmod
Invalid Operand: 0000
CPU: 0
EIP: 0010:[<c015cf45>] Not Tainted
Using defaults from ksymoops -t elf32-i386 -a i386
EFLAGS: 00010286
EAX: 00000061 EBX: dc883900 ECX: c14ee080 EDX: df954ca0
ESI: dd36d200 EDI: dfd53600 EBP: d0d805c0 ESP: c14f1e6c
DS: 0018 ES: 0018 SS: 0018
Stack: c02c0060 c02c04e1 c02c0040 00000460 c02c0537 d2821380 d0d805c0 00000000
c14f1f04 c01557fd d0d805c0 d2821380 d2821380 00000800 d2821380 00000800
00000800 000000c0 c015555c d0d805c0 d2821380 0005f700 00000000 bfd71c00
Call Trace: [<c01557fd>] [<c015555c0>] [<c0155909>] [<c01557e4>] [<c0126bab>]
[<c01535fa>] [<c0132576>] [<c0106c97>]
Code: 0f 0b 60 04 40 00 2c c0 83 c4 14 6a 03 8b 45 00 50 53 e8 1cQuoted 9 lines
Quoted 9 lines
EIP;
c015cf45<journal_dirty_metadata+13d/174> <=====EBX;
dc883900<END_OF_CODE+1c4d838c/????>
ECX;c14ee080<END_OF_CODE+1142b0c/????>
EDX;df954ca0<END_OF_CODE+1f5a972c/????>
ESI;dd36d200<END_OF_CODE+1cfc1c8c/????>
EDI;dfd53600<END_OF_CODE+1f9a808c/????>
EBP;d0d805c0<END_OF_CODE+109d504c/????>
ESP;c14f1e6c<END_OF_CODE+11468f8/????>
Trace; c01557fd <commit_write_fn+19/5c>
Trace; c015555c0 <END_OF_CODE+b411aa04c/????>
Trace; c0155909 <ext3_commit_write+c9/1e4>
Trace; c01557e4 <commit_write_fn+0/5c>
Trace; c0126bab <generic_file_write+4c3/6e4>
Trace; c01535fa <ext3_file_write+46/4c>
Trace; c0132576 <sys_write+96/f0>
Trace; c0106c97 <syscall_call+7/b>
Code; c015cf45 <journal_dirty_metadata+13d/174>
00000000 <_EIP>:
Code; c015cf45 <journal_dirty_metadata+13d/174> <=====
0: 0f 0b ud2a <=====
Code; c015cf47 <journal_dirty_metadata+13f/174>
2: 60 pusha
Code; c015cf48 <journal_dirty_metadata+140/174>
3: 04 40 add $0x40,%al
Code; c015cf4a <journal_dirty_metadata+142/174>
5: 00 2c c0 add %ch,(%eax,%eax,8)
Code; c015cf4d <journal_dirty_metadata+145/174>
8: 83 c4 14 add $0x14,%esp
Code; c015cf50 <journal_dirty_metadata+148/174>
b: 6a 03 push $0x3
Code; c015cf52 <journal_dirty_metadata+14a/174>
d: 8b 45 00 mov 0x0(%ebp),%eax
Code; c015cf55 <journal_dirty_metadata+14d/174>
10: 50 push %eax
Code; c015cf56 <journal_dirty_metadata+14e/174>
11: 53 push %ebx
Code; c015cf57 <journal_dirty_metadata+14f/174>
12: e8 1c 00 00 00 call 33 <_EIP+0x33> c015cf78 <journal_dirty_metadata+170/174>
1 error issued. Results may not be reliable.
Signature · 2 lines
The artistic temperment is a disease which afflicts amateurs.
-- G. K. Chesterton, _Heretics_, 1905Quoted 11 lines · Daniel Pittman
Quoted 9 lines · Linus Torvalds
Quoted 4 lines · Daniel Pittman
From the look of the changelog at least a few of the file corruption bugs with ext3, 2k block file systems and 2.5 have been fixed. Should I expect this release to address the problems I was seeing?
"Expect" is too strong a word. I'd say "hope" - a number of truncate bugs were fixed, but whether that was what bit you, nobody knows.
Quoted 7 lines
Quoted 3 lines
I suspect the real answer is that we'd love for you to test things out, but that if it ends up being too painful to recover if the problems happen again, you probably shouldn't..
Right. I got brave enough to test it on a real, live system after extensive fake testing. It seems to work well, at least so far as running the same workload that cause massive file corruption correctly.
hmm.
Quoted 3 lines
So, I believe that 2.5.14 is working correctly with 2k ext3 filesystems, at least for minimal use. I didn't do any sort of extreme load testing or anything like that, being cautious about it.
I've been testing 2.5.14 pretty hard for a couple of days.
ext2, ext3-ordered, ext3-writeback (all with small blocks) are solid.
reiserfs and vfat are solid.
JFS deadlocks (see the BUGBUG comment in jfs_txnmgr.c - it happens). I've asked the JFS guys for help on this; possibly the code can just be removed:
the buffer-based writeout which I replaced wouldn't have written the pages anyway...
ext3-journalled is not happy.
There's a locking bug between try_to_free_buffers and buffer_insert_inode_queue which never seems to trigger. I've got that fixed.
There's a known race between unmount and writeback which is probably impossible to trigger. (see the FIXME at __sync_list). Testing the fix for that at present.
The "sync" functions aren't right. Pages which are both dirty and under writeback are not correctly waited upon. This is a minor correctness thing which nobody would notice. Still thinking about the best way to close this.
So unless you're a JFS or ext3-journalled user, 2.5.14 is OK.
Quoted 8 lines
On reboot, I got an assertion in ext3, though, and the following BUG trace. So, something still isn't well, but it seems to be getting it much more right. :)
...
Quoted 1 line
Quoted 1 line
EIP;
c015cf45<journal_dirty_metadata+13d/174> <=====
Quoted 7 lines
...
Code;c015cf45<journal_dirty_metadata+13d/174> <=====
0: 0f 0b ud2a <=====
Code;c015cf47<journal_dirty_metadata+13f/174>
2: 60 pusha
Code;c015cf48<journal_dirty_metadata+140/174>
3: 04 40 add $0x40,%al
04 60 -> line 1120. Yup, I get that one too. I assume you were testing with data=journal.
Thanks again...
-
Quoted 17 lines · Andrew Morton
Quoted 16 lines · Daniel Pittman
Quoted 14 lines · Linus Torvalds
Quoted 5 lines · Daniel Pittman
From the look of the changelog at least a few of the file corruption bugs with ext3, 2k block file systems and 2.5 have been fixed. Should I expect this release to address the problems I was seeing?
"Expect" is too strong a word. I'd say "hope" - a number of truncate bugs were fixed, but whether that was what bit you, nobody knows.
I suspect the real answer is that we'd love for you to test things out, but that if it ends up being too painful to recover if the problems happen again, you probably shouldn't..
Quoted 6 lines
Quoted 4 lines
Right. I got brave enough to test it on a real, live system after extensive fake testing. It seems to work well, at least so far as running the same workload that cause massive file corruption correctly.
hmm.
Not conclusive, I know, but getting a panic after a brief test stopped it at that point. :)
Quoted 5 lines
Quoted 3 lines
So, I believe that 2.5.14 is working correctly with 2k ext3 filesystems, at least for minimal use. I didn't do any sort of extreme load testing or anything like that, being cautious about it.
I've been testing 2.5.14 pretty hard for a couple of days.
[...]
Quoted 1 line
ext3-journalled is not happy.
Which probably explains my error, then, as I have not stepped back from data journaled mode on my system.
[...]
Quoted 3 lines
There's a known race between unmount and writeback which is probably impossible to trigger. (see the FIXME at
__sync_list). Testing the fix for that at present.
Well, unmount wouldn't have happened for quite a long time in the shutdown process, given it was at the initial 'send SIGTERM' stage...
[...]
Quoted 1 line
So unless you're a JFS or ext3-journalled user, 2.5.14 is OK.
The latter. Ah, well, at least you know.
[...]
Quoted 2 lines
04 60 -> line 1120. Yup, I get that one too. I assume you were testing with data=journal.
Confirmed.
Daniel
Signature · 2 lines
No, no, you're not thinking, you're just being logical.
-- Niels BohrQuoted 3 lines · Linus Torvalds
releases these days, but I thought I'd point out 2.5.14, since it has some interesting fundamental changes to how dirty state is maintained in the VM.
I parsed this 'dirty state' sentence all wrong at first :-) Andrew, Linus - where does the current VM lie in between rmap-vm and aa-vm?
Regards,
bert hubert
Signature · 3 lines
http://www.PowerDNS.com Versatile DNS Software & Services http://www.tk the dot in .tk http://lartc.org Linux Advanced Routing & Traffic Control HOWTO
Quoted 8 lines · Daniel Pittman
Quoted 6 lines · Linus Torvalds
There's a lot of stuff that has happened in the 2.5.x series lately, and you can see the gory details in the ChangeLog files that accompany releases these days, but I thought I'd point out 2.5.14, since it has some interesting fundamental changes to how dirty state is maintained in the VM.
Quoted 9 lines
Quoted 6 lines
(The big changes were actually in 2.5.12, but 2.5.13 contained various minor fixes and tweaks, and 2.5.14 contains a number of fixes especially wrt truncate, so hopefully it's fairly _stable_ as of 2.5.14.)
From the look of the changelog at least a few of the file corruption
bugs with ext3, 2k block file systems and 2.5 have been fixed. Should I expect this release to address the problems I was seeing?
I don't have an explanation for the ext3 problem which you saw. It's conceivable that 2.5.13 was leaving dirty buffers around after they were "deleted", and that fsync grabbed them via the i_dirty_buffers back door, and wrote them where they shouldn't have been written.
But they wouldn't have been mapped anywhere...
So I still need to try to reproduce that one. If you could have another shot, it would be appreciated. But if it _does_ work OK, I can't say it's fixed until I know what caused the 2.4.13 failure.
ext3 is very sensitive to what is going on in buffer.c. There's a lot of tension in there between the desire to share code and the desire to not be damaged by changes in the code which we share.
Generally, ext3 with data=journal is not happy at present.
Partly because it contains assertions of things which aren't true any more.
Partly because of a known problem in ext3: assertion failure at transaction.c:606. Stephen has a fix for this which we need to wiggle into 2.4. For some reason, the 2.5 changes are triggering it much more easily.
I'll spend a few hours this week trying to resurrect data=journal, but if that doesn't work out I think I'll just turn it off for the while, make it emit a warning and use data=ordered.
-
Quoted 10 lines · bert hubert
Quoted 3 lines · Linus Torvalds
releases these days, but I thought I'd point out 2.5.14, since it has some interesting fundamental changes to how dirty state is maintained in the VM.
I parsed this 'dirty state' sentence all wrong at first :-) Andrew, Linus - where does the current VM lie in between rmap-vm and aa-vm?
"VM" is a broad term. The memory allocator, page replacement, swap and all that stuff is unaltered - it is the same as 2.4.current. ie: Andrea's VM from when his changes stopped going into the mainline kernel.
I made minimal changes in there to teach the page allocator that all dirty memory is written back via pages and not sometimes-pages, sometimes-buffers. Also to add support for the new `clustering writeback' which address_spaces can perform.
It's probably not as well tuned as it could be at present, but I don't see a lot of point in fiddling with it. As long as the VM doesn't actually impede 2.5 development and evaulation of 2.5 performance, best to leave it alone until a VM developer steps up to do the 2.6 VM.
The change to which Linus refers is:
In 2.4, dirty data from the write(2) system call is encapsulated in buffer_heads and is placed on a global buffer list for writeout. And dirty data from shared mappings is attached to its inode.
In 2.5, the buffer list went away, and dirty data from write(2) is now managed in the same way as dirty data from mmap().
And because the kupdate and bdflush functions used to work against the buffer LRU, replacements were introduced which do the same thing against the inodes, instead of against the buffers.
So it's all page-oriented now.
-
Quoted 11 lines · Andrew Morton
Quoted 2 lines · bert hubert
I parsed this 'dirty state' sentence all wrong at first :-) Andrew, Linus - where does the current VM lie in between rmap-vm and aa-vm?
I made minimal changes in there to teach the page allocator that all dirty memory is written back via pages and not sometimes-pages, sometimes-buffers. Also to add support for the new `clustering writeback' which
address_spacescan perform.So it's all page-oriented now.
Nice, this will make it possible to have much cleaner page replacement code.
regards,
Rik
Signature · 3 lines
Bravely reimplemented by the knights who say "NIH". http://www.surriel.com/ http://distro.conectiva.com/
PATCH 1/1 2.5.14 IDE 55
In reply to Linus TorvaldsSun May 5 16:34:59 CEST 2002 ide-clean-55
Resync with 2.5.14.
- Update HPT374 driver carried over from 2.4.xx series by Andrew Morton. Resync it with the recent host chip driver changes, or better the introduction of an API at all.
- Consolidate the handling of device ID byte order in one place. This was spotted and patched by Bartomiej onierkiewicz.
- Eliminate CONFIG_BLK_DEV_IDEPCI - it's duplicating the functionality of the already present and fine CONFIG_PCI flag and if we are a PCI host, we are indeed very likely to need host chip support anyway.
- Remove some redundant info about the model and channel number from /proc/ide. Remove the binary entries not helpful to the user, and not used by any program and redundant to corresponding ioctls.
- Properly return udma_read and udma_write values in taskfile.
- Only initialize XXX_udma to the default handlers if it has not been initialized by the host chip initialization.
I have enabled spin lock debugging and can see that on device flush the spin locks get wrong counts... no problems elsewher ethus far. I will re check them next time around.
Re: [PATCH] 2.5.14 IDE 55
Quoted 3 lines · Martin Dalecki
- Remove some redundant info about the model and channel number from
/proc/ide. Remove the binary entries not helpful to the user, and not used by any program and redundant to corresponding ioctls.
Martin, how do you know it isn't used by any program?
changing /proc stuff 'becouse it's availabe elsewhere' is not a good idea, people writing shell scripts do not nessasarily have access to ioctls.
you must have missed the proc wars of past kernels, but in general it's not a good idea to tinker with anything in /proc unless it is a significant improvement and 'redundant to corresponding ioctls' is not a significant improvement.
David Lang
Re: [PATCH] 2.5.14 IDE 55
In reply to Martin DaleckiHi,
Quoted 3 lines · Martin Dalecki
- Eliminate
CONFIG_BLK_DEV_IDEPCI- it's duplicating the functionality of the already present and fineCONFIG_PCIflag and if we are a PCI host, we are indeed very likely to need host chip support anyway.
Please don't do this! There are configurations possible with pci enabled but without a pci ide adapter.
Could you please try to compile without CONFIG_BLK_DEV_IDEDMA_PCI enabled?
bye, Roman
Re: [PATCH] 2.5.14 IDE 55
Uz.ytkownik Roman Zippel napisa?:
Quoted 11 lines
Hi,
Quoted 3 lines · Martin Dalecki
- Eliminate
CONFIG_BLK_DEV_IDEPCI- it's duplicating the functionality of the already present and fineCONFIG_PCIflag and if we are a PCI host, we are indeed very likely to need host chip support anyway.Please don't do this! There are configurations possible with pci enabled but without a pci ide adapter.
So please just don't configure any PCI host chip support there.
Re: [PATCH] 2.5.14 IDE 55
Hi,
Quoted 4 lines · Martin Dalecki
Quoted 2 lines
Please don't do this! There are configurations possible with pci enabled but without a pci ide adapter.
So please just don't configure any PCI host chip support there.
Then ide-pci.c is still compiled into the kernel. Why?
bye, Roman
Re: [PATCH] 2.5.14 IDE 55
Uz.ytkownik Roman Zippel napisa?:
Quoted 11 lines
Hi,
Quoted 3 lines · Martin Dalecki
Quoted 1 line
Please don't do this! There are configurations possible with pci enabled but without a pci ide adapter.
So please just don't configure any PCI host chip support there.
Then
ide-pci.cis still compiled into the kernel. Why?
Becouse the big tables there are subject to go.
Re: [PATCH] 2.5.14 IDE 55
In reply to Roman ZippelUz.ytkownik Martin Dalecki napisa?:
Quoted 14 lines
Uz.ytkownik Roman Zippel napisa?:
Quoted 12 lines
Hi,
Quoted 4 lines · Martin Dalecki
Quoted 1 line
Please don't do this! There are configurations possible with pci enabled but without a pci ide adapter.
So please just don't configure any PCI host chip support there.
Quoted 5 lines
Quoted 1 line
Then
ide-pci.cis still compiled into the kernel. Why?Becouse the big tables there are subject to go.
And at some point in time it will check whatever there is request for any host chip support.
Re: [PATCH] 2.5.14 IDE 55
Hi,
Quoted 6 lines · Martin Dalecki
Quoted 3 lines
Quoted 1 line
Then
ide-pci.cis still compiled into the kernel. Why?Becouse the big tables there are subject to go.
And at some point in time it will check whatever there is request for any host chip support.
Could you please then do the above change _after_ you have done this?
bye, Roman
Re: [PATCH] 2.5.14 IDE 55
Uz.ytkownik Roman Zippel napisa?:
Quoted 7 lines
Hi,
Quoted 2 lines · Martin Dalecki
Quoted 2 lines
Quoted 1 line
Then
ide-pci.cis still compiled into the kernel. Why?
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Becouse the big tables there are subject to go.
And at some point in time it will check whatever there is request for any host chip support.
Could you please then do the above change _after_ you have done this?
Well one question renames: Please name me one PCI based architecture which contains IDE support and does not contain any special host chip attached to the very same PCI bus as well.
Re: [PATCH] 2.5.14 IDE 55
Hi,
Quoted 3 lines · Martin Dalecki
Well one question renames: Please name me one PCI based architecture which contains IDE support and does not contain any special host chip attached to the very same PCI bus as well.
Architectures which are not directly PCI based, but which can have have PCI bridges. On the other hand even on PCI based archs you don't necessarily want to compile in ide support automatically, please leave that to Eric's autoconf.
bye, Roman
Re: [PATCH] 2.5.14 IDE 55
In reply to Roman ZippelQuoted 14 lines · Martin Dalecki
Uz.ytkownik Roman Zippel napisa?:
Quoted 13 lines
Hi,
Quoted 6 lines · Martin Dalecki
Quoted 3 lines
Quoted 1 line
Then
ide-pci.cis still compiled into the kernel. Why?Becouse the big tables there are subject to go.
And at some point in time it will check whatever there is request for any host chip support.
Quoted 5 lines
Quoted 1 line
Could you please then do the above change _after_ you have done this?
Well one question renames: Please name me one PCI based architecture which contains IDE support and does not contain any special host chip attached to the very same PCI bus as well.
SiS 496/497 PCI chipset for i486's. It has integrated IDE controller, but this controller is not connected to PCI bus.
Signature · 2 lines
Andrey Panin | Embedded systems software engineer [email protected] | PGP key: wwwkeys.eu.pgp.net
Re: [PATCH] 2.5.14 IDE 55
In reply to Roman ZippelQuoted 9 lines · Użytkownik Andrey Panin
Quoted 3 lines · Martin Dalecki
Well one question renames: Please name me one PCI based architecture which contains IDE support and does not contain any special host chip attached to the very same PCI bus as well.
SiS 496/497 PCI chipset for i486's. It has integrated IDE controller, but this controller is not connected to PCI bus.
OK - That actually is an argument I follow. Thank you I will adjust the code. (Not quite right jet maybe but I will do it.)
Re: [PATCH] 2.5.14 IDE 55
In reply to Roman ZippelQuoted 3 lines · Martin Dalecki
Well one question renames: Please name me one PCI based architecture which contains IDE support and does not contain any special host chip attached to the very same PCI bus as well.
If by 'attached' you mean integrated into chipset, I have several such machines that have no IDE without an extra add-on card.
My quad ppro has two PCI buses, but no IDE controller. My PCI 486 has no onboard IDE.
Signature · 2 lines
| Dave Jones. http://www.codemonkey.org.uk | SuSE Labs
Re: [PATCH] 2.5.14 IDE 55
In reply to Martin DaleckiHi,
Quoted 2 lines · Martin Dalecki
- Consolidate the handling of device ID byte order in one place. This was spotted and patched by Bartomiej onierkiewicz.
Another thing: where is the equivalilent part of this removed code?
-static __inline__ void ide_fix_driveid(struct hd_driveid *id)
-{
-#if defined(CONFIG_AMIGA) || defined (CONFIG_MAC) || defined(M68K_IDE_SWAPW)
- u_char *p = (u_char *)id; - int i, j, cnt; - u_char t;
-
- if (!MACH_IS_AMIGA && !MACH_IS_MAC && !MACH_IS_Q40 && !MACH_IS_ATARI)
- return;
-#ifdef M68K_IDE_SWAPW
- if (M68K_IDE_SWAPW) /* fix bus byteorder first */
- for (i=0; i < 512; i+=2) {
- t = p[i]; p[i] = p[i+1]; p[i+1] = t;
- }
-#endif
bye, Roman
Re: [PATCH] 2.5.14 IDE 55
Uz.ytkownik Roman Zippel napisa?:
Quoted 10 lines
Hi,
Quoted 2 lines · Martin Dalecki
- Consolidate the handling of device ID byte order in one place. This was spotted and patched by Bartomiej onierkiewicz.
Another thing: where is the equivalilent part of this removed code?
Look closer it's there in ide-probe.c.
Quoted 18 lines
(quoted diff) +0
-15-static __inline__ void ide_fix_driveid(struct hd_driveid *id) -{ -#if defined(CONFIG_AMIGA) || defined (CONFIG_MAC) || defined(M68K_IDE_SWAPW) - u_char *p = (u_char *)id; - int i, j, cnt; - u_char t; - - if (!MACH_IS_AMIGA && !MACH_IS_MAC && !MACH_IS_Q40 && !MACH_IS_ATARI) - return; -#ifdef M68K_IDE_SWAPW - if (M68K_IDE_SWAPW) /* fix bus byteorder first */ - for (i=0; i < 512; i+=2) { - t = p[i]; p[i] = p[i+1]; p[i+1] = t; - } -#endifbye, Roman
Re: [PATCH] 2.5.14 IDE 55
Hi,
Quoted 3 lines · Martin Dalecki
Quoted 1 line
Another thing: where is the equivalilent part of this removed code?
Look closer it's there in
ide-probe.c.
Does it still take the correct byte swapping into account? Did you consider using a table for the fixup? It's nothing perfomance critical and this might generate more compact code.
bye, Roman
Re: [PATCH] 2.5.14 IDE 55
Uz.ytkownik Roman Zippel napisa?:
Quoted 5 lines
Hi,
On Tue, 7 May 2002, Martin Dalecki wrote:
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Another thing: where is the equivalilent part of this removed code?
Look closer it's there in
ide-probe.c.Does it still take the correct byte swapping into account? Did you consider using a table for the fixup? It's nothing perfomance critical and this might generate more compact code.
Well right now we have two different reimplementation of get device id code, so this areas is subject to change anyway. BTW.> It should indeed take both in to account as far as I can see.(Despite the fact that I could affort an ATARI I hardly can find one...)
Re: [PATCH] 2.5.14 IDE 55
Hi,
Quoted 3 lines · Martin Dalecki
BTW.> It should indeed take both in to account as far as I can see.(Despite the fact that I could affort an ATARI I hardly can find one...)
That's not necessary, but I'm only afraid that functionality gets lost, which isn't needed on the latest hardware.
bye, Roman
PATCH 1/1 2.5.14 IDE 56
In reply to Linus TorvaldsMon May 6 13:29:44 CEST 2002 ide-clean-56
- Push poll_timeout down from the hwgroup to the channel. We are resetting the channel and not a whole hwgroup. This way using multiple pdc202xxx cards should magically start to work with multiple performance and resets will no longer lock the system.
- Updates for PDC4030 by Peter Denison <[email protected]>.
- Make ide_raw_taskfile don't care about request buffers. They where always NULL.
- Port set multi mode count over from the special setting interface to ide_raw_taskfile. Fix errors in the corresponding interrupt handler in one go as well. It turned out that this is precisely the same code as in task_no_data_intr, so we can nuke it altogether. And finally we have found some problems with the set_pio_mode() command which can fail with -EBUSY - this is in esp. probably *very* common during boot hdparm usage those days! (OK it was masked by reportig too early that it finished... Crap Crap utter crap it was!!!) Right now hdparm should just be extendid to properly
sync and retry on -EBUSY and everything should be fine.
And now the 1 Milion EUR question for everybody who loves to put driver settings in to /proc:
How the hell could echo > /proc/ide/ide0/settings blah blah blah blah handle properly cases like -EIO, -EBUSY and so on??? Having the possibility o do it does not mean that it is a good idea to use it.
OK. After realizing the simple fact that quite a lot of low level hardware manipulating ioctls may require assistance in usage from proper logic which is *very* unlikely to be implemented in a bash (for me preferable still ksh) I have made my mind up.
/proc/ide will be nuked.
- Execute the recalibration for error recovery on precisely the same request as the one which failed.
- Remove set geometry. It's crap by means of standard specification. Because:
1. We relay on the existence of the identify command anyway.
2. This command was obsoleted *before* the identify command existed as far as I can see.
2. I'm able to have a look at what other ATA/ATAPI drivers in the wild do:
They don't do it.
- Just call tuneproc in set_pio_mode() directly - we are already behind the rq queue there.
- After we have uncovered the broken logics behind the whole ioctl handling we now just have made ide_spin_wait_hwgroup() waiting for a proper somehow longer timeout before giving up. This was previously just hiding the broken concept of setting ioctl values through /proc/ide/ideX/settings - now it just really helps hdparm to not to give up too early. (It shouldn't probably play wreck havock on the global driver spin lock as well. I will look in to this later.)
- Scrap the non necessary, to say the least, disabling of interrupts for 3, read it again please, 3 seconds, on the local CPU inside ide_spin_wait_hwgroup(). Spin lock handling needs checking there badly as I see now as well...
Hey apparently any "special" requests are gone. We now have only to deal with REQ_DEVICE_ACB and REQ_DEVICE_CMD. One of them is still too much and will be killed.
drivers/ide/ide.c +84 -97
@@ -193,7 +193,7 @@#ifdef CONFIG_BLK_DEV_HD if (ch->io_ports[IDE_DATA_OFFSET ] ==HD_DATA ) ch->noprobe =1 ;/* may be overridden by ide_setup() */ -#endif /* CONFIG_BLK_DEV_HD */ +#endif ch->major = ide_major[index];sprintf (ch->name,"ide%d" , index); ch->bus_state =BUSSTATE_ON ;
@@ -201,15 +201,14 @@for (unit =0 ; unit <MAX_DRIVES ; ++unit) {struct ata_device *drive = &ch->drives[unit]; - drive->type =ATA_DISK ; - drive->select.all = (unit<<4 )|0xa0 ; - drive->channel = ch; - drive->ctl =0x08 ; - drive->ready_stat =READY_STAT ; - drive->bad_wstat =BAD_W_STAT ; - drive->special_cmd = (ATA_SPECIAL_RECALIBRATE |ATA_SPECIAL_GEOMETRY ); + drive->type =ATA_DISK ; + drive->select.all = (unit<<4 )|0xa0 ; + drive->channel = ch; + drive->ctl =0x08 ; + drive->ready_stat =READY_STAT ; + drive->bad_wstat =BAD_W_STAT ;sprintf (drive->name,"hd%c" ,'a' + (index *MAX_DRIVES ) + unit); - drive->max_failures =IDE_DEFAULT_MAX_FAILURES ; + drive->max_failures =IDE_DEFAULT_MAX_FAILURES ;init_waitqueue_head (&drive->wqueue); }
@@ -354,11 +353,8 @@spin_unlock_irqrestore (&ide_lock, flags); } -static void ata_pre_reset (struct ata_device *drive) +static void check_crc_errors (struct ata_device *drive) { -if (ata_ops (drive) &&ata_ops (drive)->pre_reset) -ata_ops (drive)->pre_reset (drive); -if (!drive->using_dma)return ;
@@ -392,38 +388,6 @@return ~0UL ; } -/* -* This is used to issue WIN_SPECIFY, WIN_RESTORE, and WIN_SETMULT commands to -* a drive. -*/ -static ide_startstop_t ata_special (struct ata_device *drive) -{ -unsigned char special_cmd = drive->special_cmd; - -#ifdef DEBUG -printk ("%s: ata_special: 0x%02x\n" , drive->name, special_cmd); -#endif -if (special_cmd &ATA_SPECIAL_TUNE ) { - drive->special_cmd &= ~ATA_SPECIAL_TUNE ; -if (drive->channel->tuneproc !=NULL ) - drive->channel->tuneproc (drive, drive->tune_req); - }else if (drive->driver !=NULL ) { -if (ata_ops (drive)->special) -return ata_ops (drive)->special (drive); -else { - drive->special_cmd =0 ; - drive->mult_req =0 ; - -return ide_stopped; - } - }else if (special_cmd) { -printk ("%s: bad special flag: 0x%02x\n" , drive->name, special_cmd); - drive->special_cmd =0 ; - } - -return ide_stopped; -} -extern struct block_device_operations ide_fops[];/*
@@ -460,24 +424,24 @@*/ static ide_startstop_t atapi_reset_pollfunc (struct ata_device *drive,struct request *__rq) { -ide_hwgroup_t *hwgroup =HWGROUP (drive); -byte stat; +struct ata_channel *ch = drive->channel; +u8 stat; -SELECT_DRIVE (drive->channel,drive); +SELECT_DRIVE (ch,drive);udelay (10 );if (OK_STAT (stat=GET_STAT (),0 ,BUSY_STAT )) {printk ("%s: ATAPI reset complete\n" , drive->name); }else { -if (time_before (jiffies, hwgroup->poll_timeout)) { +if (time_before (jiffies, ch->poll_timeout)) {ide_set_handler (drive, atapi_reset_pollfunc,HZ /20 ,NULL );return ide_started;/* continue polling */ } - hwgroup->poll_timeout =0 ;/* end of polling */ + ch->poll_timeout =0 ;/* end of polling */ printk ("%s: ATAPI reset timed-out, status=0x%02x\n" , drive->name, stat);return do_reset1 (drive,1 );/* do it the old fashioned way */ } - hwgroup->poll_timeout =0 ;/* done polling */ + ch->poll_timeout =0 ;/* done polling */ return ide_stopped; }
@@ -489,19 +453,18 @@*/ static ide_startstop_t reset_pollfunc (struct ata_device *drive,struct request *__rq) { -ide_hwgroup_t *hwgroup =HWGROUP (drive); -struct ata_channel *hwif = drive->channel; +struct ata_channel *ch = drive->channel;u8 stat;if (!OK_STAT (stat=GET_STAT (),0 ,BUSY_STAT )) { -if (time_before (jiffies, hwgroup->poll_timeout)) { +if (time_before (jiffies, ch->poll_timeout)) {ide_set_handler (drive, reset_pollfunc,HZ /20 ,NULL );return ide_started;/* continue polling */ } -printk ("%s: reset timed-out, status=0x%02x\n" , hwif->name, stat); +printk ("%s: reset timed-out, status=0x%02x\n" , ch->name, stat); drive->failures++; }else { -printk ("%s: reset: " , hwif->name); +printk ("%s: reset: " , ch->name);if ((stat =GET_ERR ()) ==1 ) {printk ("success\n" ); drive->failures =0 ;
@@ -531,7 +494,8 @@ drive->failures++; } } - hwgroup->poll_timeout =0 ;/* done polling */ + ch->poll_timeout =0 ;/* done polling */ +return ide_stopped; }
@@ -555,21 +519,21 @@ {unsigned int unit;unsigned long flags; -struct ata_channel *hwif = drive->channel; -ide_hwgroup_t *hwgroup =HWGROUP (drive); +struct ata_channel *ch = drive->channel;__save_flags (flags);/* local CPU only */ __cli ();/* local CPU only */ /* For an ATAPI device, first try an ATAPI SRST. */ if (drive->type !=ATA_DISK && !do_not_try_atapi) { -ata_pre_reset (drive); -SELECT_DRIVE (hwif,drive); +check_crc_errors (drive); +SELECT_DRIVE (ch, drive);udelay (20 );OUT_BYTE (WIN_SRST ,IDE_COMMAND_REG ); - hwgroup->poll_timeout = jiffies +WAIT_WORSTCASE ; + ch->poll_timeout = jiffies +WAIT_WORSTCASE ;ide_set_handler (drive, atapi_reset_pollfunc,HZ /20 ,NULL );__restore_flags (flags);/* local CPU only */ +return ide_started; }
@@ -578,11 +542,12 @@* for any of the drives on this interface. */ for (unit =0 ; unit <MAX_DRIVES ; ++unit) -ata_pre_reset (&hwif->drives[unit]); +check_crc_errors (&ch->drives[unit]);#if OK_TO_RESET_CONTROLLER if (!IDE_CONTROL_REG ) {__restore_flags (flags); +return ide_stopped; }/*
@@ -601,7 +566,7 @@OUT_BYTE (drive->ctl|2 ,IDE_CONTROL_REG );/* clear SRST, leave nIEN */ }udelay (10 );/* more than enough time */ - hwgroup->poll_timeout = jiffies +WAIT_WORSTCASE ; + ch->poll_timeout = jiffies +WAIT_WORSTCASE ;ide_set_handler (drive, reset_pollfunc,HZ /20 ,NULL );/*
@@ -609,9 +574,10 @@* state when the disks are reset this way. At least, the Winbond * 553 documentation says that */ -if (hwif->resetproc !=NULL ) - hwif->resetproc (drive); +if (ch->resetproc !=NULL ) + ch->resetproc (drive); +/* FIXME: we should handle mulit mode setting here as well ! */ #endif __restore_flags (flags);/* local CPU only */
@@ -789,6 +755,36 @@ } } +#ifdef CONFIG_BLK_DEV_PDC4030 +# define IS_PDC4030_DRIVE (drive->channel->chipset == ide_pdc4030) +#else +# define IS_PDC4030_DRIVE (0)/* auto-NULLs out pdc4030 code */ +#endif + +/* +* We are still on the old request path here so issuing the recalibrate command +* directly should just work. +*/ +static int do_recalibrate (struct ata_device *drive) +{ +printk (KERN_INFO "%s: recalibrating!\n" , drive->name); + +if (drive->type !=ATA_DISK ) +return ide_stopped; + +if (!IS_PDC4030_DRIVE ) { +struct ata_taskfile args; + +memset (&args,0 ,sizeof (args)); + args.taskfile.sector_count = drive->sect; + args.taskfile.command =WIN_RESTORE ; + args.handler = recal_intr; +ata_taskfile (drive, &args,NULL ); + } + +return IS_PDC4030_DRIVE ? ide_stopped : ide_started; +} +/* * Take action based on the error returned by the drive. */
@@ -835,13 +831,11 @@else ide_end_request (drive, rq,0 ); }else { -if ((rq->errors &ERROR_RESET ) ==ERROR_RESET ) { - ++rq->errors; + ++rq->errors; +if ((rq->errors &ERROR_RESET ) ==ERROR_RESET )return do_reset1 (drive,0 ); - }if ((rq->errors &ERROR_RECAL ) ==ERROR_RECAL ) - drive->special_cmd |=ATA_SPECIAL_RECALIBRATE ; - ++rq->errors; +return do_recalibrate (drive); }return ide_stopped; }
@@ -960,7 +954,7 @@ goto kill_rq; } - block = rq->sector; + block = rq->sector;/* Strange disk manager remap. */
@@ -991,14 +985,6 @@ } } -/* FIXME: We can see nicely here that all commands should be submitted -* through the request queue and that the special field in drive should -* go as soon as possible! -*/ - -if (drive->special_cmd) -return ata_special (drive); -/* This issues a special drive command, usually initiated by ioctl() * from the external hdparm program. */
@@ -1011,7 +997,7 @@ata_taskfile (drive, args,NULL );if (((args->command_type ==IDE_DRIVE_TASK_RAW_WRITE ) || - (args->command_type ==IDE_DRIVE_TASK_OUT )) && + (args->command_type ==IDE_DRIVE_TASK_OUT )) && args->prehandler && args->handler)return args->prehandler (drive, rq);
@@ -1053,6 +1039,7 @@return ata_ops (drive)->do_request (drive, rq, block); else {ide_end_request (drive, rq,0 ); +return ide_stopped; } }
@@ -1499,7 +1486,7 @@disable_irq (ch->irq);/* disable_irq_nosync ?? */ #endif __cli ();/* local CPU only, as if we were handling an interrupt */ -if (hwgroup->poll_timeout !=0 ) { +if (ch->poll_timeout !=0 ) { startstop =handler (drive, ch->hwgroup->rq); }else if (drive_is_ready (drive)) {if (drive->waiting_for_dma)
@@ -1598,7 +1585,7 @@if (!ide_ack_intr (ch)) goto out_lock; -if (handler ==NULL || hwgroup->poll_timeout !=0 ) { +if (handler ==NULL || ch->poll_timeout !=0 ) {#if 0 printk (KERN_INFO "ide: unexpected interrupt %d %d\n" , ch->unit, irq);#endif
@@ -2327,23 +2314,24 @@int ide_spin_wait_hwgroup (struct ata_device *drive) {ide_hwgroup_t *hwgroup =HWGROUP (drive); -unsigned long timeout = jiffies + (3 *HZ ); + +/* FIXME: Wait on a proper timer. Instead of playing games on the +* spin_lock(). +*/ + +unsigned long timeout = jiffies + (10 *HZ );spin_lock_irq (&ide_lock);while (test_bit (IDE_BUSY , &hwgroup->flags)) { -unsigned long lflags;spin_unlock_irq (&ide_lock); -__save_flags (lflags);/* local CPU only */ -__sti ();/* local CPU only; needed for jiffies */ -if (0 < (signed long )(jiffies - timeout)) { -__restore_flags (lflags);/* local CPU only */ +if (time_after (jiffies, timeout)) {printk ("%s: channel busy\n" , drive->name);return -EBUSY ; } -__restore_flags (lflags);/* local CPU only */ spin_lock_irq (&ide_lock); } +return 0 ; }
@@ -2411,18 +2399,17 @@static int set_pio_mode (struct ata_device *drive,int arg) { -struct request rq; -if (!drive->channel->tuneproc)return -ENOSYS ; -if (drive->special_cmd &ATA_SPECIAL_TUNE ) +/* FIXME: This is very much the same kind of problem as we have with +* set_mutlmode() see for a edscription there. +*/ +if (HWGROUP (drive)->handler)return -EBUSY ; -ide_init_drive_cmd (&rq); - drive->tune_req = (u8 ) arg; - drive->special_cmd |=ATA_SPECIAL_TUNE ; -ide_do_drive_cmd (drive, &rq, ide_wait); +if (drive->channel->tuneproc !=NULL ) + drive->channel->tuneproc (drive, (u8 ) arg);return 0 ; }
drivers/ide/ide-disk.c +60 -100
293 lines not on this page · raw message
drivers/ide/ide-tape.c +0 -12
@@ -4273,16 +4273,6 @@ }/* -* idetape_pre_reset is called before an ATAPI/ATA software reset. -*/ -static void idetape_pre_reset (ide_drive_t *drive) -{ -idetape_tape_t *tape = drive->driver_data; -if (tape !=NULL ) -set_bit (IDETAPE_IGNORE_DSC , &tape->flags); -} - -/* * Character device interface functions */ static ide_drive_t *get_drive_ptr (kdev_t i_rdev)
@@ -6164,8 +6154,6 @@ release: idetape_blkdev_release, check_media_change: NULL, revalidate: idetape_revalidate, - pre_reset: idetape_pre_reset, - capacity: NULL, proc: idetape_proc };
drivers/ide/ide-taskfile.c +6 -42
98 lines not on this page · raw message
drivers/ide/pdc4030.c +24 -22
139 lines not on this page · raw message
drivers/ide/tcq.c +4 -4
@@ -418,7 +418,7 @@* pass NOP with sub-code 0x01 to device, so the command will not * fail there */ -ide_raw_taskfile (drive, &args,NULL ); +ide_raw_taskfile (drive, &args);if (args.taskfile.feature &ABRT_ERR )return 1 ;
@@ -448,7 +448,7 @@ args.taskfile.command =WIN_SETFEATURES ;ide_cmd_type_parser (&args); -if (ide_raw_taskfile (drive, &args,NULL )) { +if (ide_raw_taskfile (drive, &args)) {printk ("%s: failed to enable write cache\n" , drive->name);return 1 ; }
@@ -462,7 +462,7 @@ args.taskfile.command =WIN_SETFEATURES ;ide_cmd_type_parser (&args); -if (ide_raw_taskfile (drive, &args,NULL )) { +if (ide_raw_taskfile (drive, &args)) {printk ("%s: disabling release interrupt fail\n" , drive->name);return 1 ; }
@@ -476,7 +476,7 @@ args.taskfile.command =WIN_SETFEATURES ;ide_cmd_type_parser (&args); -if (ide_raw_taskfile (drive, &args,NULL )) { +if (ide_raw_taskfile (drive, &args)) {printk ("%s: enabling service interrupt fail\n" , drive->name);return 1 ; }
include/linux/ide.h +11 -20
@@ -47,7 +47,7 @@# define DISK_RECOVERY_TIME 0/* for hardware that needs it */ #endif #ifndef OK_TO_RESET_CONTROLLER /* 1 needed for good error recovery */ -# define OK_TO_RESET_CONTROLLER 1/* 0 for use with AH2372A/B interface */ +# define OK_TO_RESET_CONTROLLER 0/* 0 for use with AH2372A/B interface */ #endif #ifndef FANCY_STATUS_DUMPS /* 1 for human-readable drive errors */ # define FANCY_STATUS_DUMPS 1/* 0 to reduce kernel size */
@@ -327,19 +327,9 @@*/ request_queue_t queue;/* per device request queue */ -unsigned long sleep;/* sleep until this time */ -/* Flags requesting/indicating one of the following special commands -* executed on the request queue. -*/ -#define ATA_SPECIAL_GEOMETRY 0x01 -#define ATA_SPECIAL_RECALIBRATE 0x02 -#define ATA_SPECIAL_MMODE 0x04 -#define ATA_SPECIAL_TUNE 0x08 -unsigned char special_cmd; -u8 mult_req;/* requested multiple sector setting */ -u8 tune_req;/* requested drive tuning setting */ +u8 XXX_tune_req;/* requested drive tuning setting */ byte using_dma;/* disk is using dma for read/write */ byte using_tcq;/* disk is using queueing */
@@ -409,6 +399,7 @@unsigned int failures;/* current failure count */ unsigned int max_failures;/* maximum allowed failure count */ struct device device;/* global device tree handle */ +/* * tcq statistics */
@@ -517,6 +508,8 @@/* driver soft-power interface */ int (*busproc)(struct ata_device *,int );byte bus_state;/* power state of the IDE bus */ + +unsigned long poll_timeout;/* timeout value during polled operations */ };/*
@@ -565,17 +558,19 @@ return 1; }#else -#define ata_pending_commands (drive) (0) -#define ata_can_queue (drive) (1) +# define ata_pending_commands (drive) (0) +# define ata_can_queue (drive) (1)#endif typedef struct hwgroup_s { +/* FIXME: We should look for busy request queues instead of looking at +* the !NULL state of this field. +*/ ide_startstop_t (*handler)(struct ata_device *,struct request *);/* irq handler, if active */ unsigned long flags;/* BUSY, SLEEPING */ struct ata_device *XXX_drive;/* current drive */ struct request *rq;/* current request */ struct timer_list timer;/* failsafe timer */ -unsigned long poll_timeout;/* timeout value during long polls */ int (*expiry)(struct ata_device *,struct request *);/* irq handler, if active */ }ide_hwgroup_t ;
@@ -675,9 +670,7 @@int (*check_media_change)(struct ata_device *);void (*revalidate)(struct ata_device *); -void (*pre_reset)(struct ata_device *);sector_t (*capacity)(struct ata_device *); -ide_startstop_t (*special)(struct ata_device *);ide_proc_entry_t *proc; };
@@ -827,15 +820,13 @@*/ extern ide_startstop_t recal_intr (struct ata_device *,struct request *); -extern ide_startstop_t set_geometry_intr (struct ata_device *,struct request *); -extern ide_startstop_t set_multmode_intr (struct ata_device *,struct request *);extern ide_startstop_t task_no_data_intr (struct ata_device *,struct request *);/* This is setting up all fields in args, which depend upon the command type. */ extern void ide_cmd_type_parser (struct ata_taskfile *args); -extern int ide_raw_taskfile (struct ata_device *drive,struct ata_taskfile *cmd,byte *buf); +extern int ide_raw_taskfile (struct ata_device *,struct ata_taskfile *);extern int ide_cmd_ioctl (struct ata_device *drive,unsigned long arg);void ide_delay_50ms (void );
PATCH 1/1 2.5.14 IDE 57
In reply to Linus TorvaldsTue May 7 02:37:49 CEST 2002 ide-clean-57
Nuke /proc/ide. For explanations why, please see the frustrated comments in the previous change log. If one still don't see why it wasn't a good thing, well please just take a look at the following:
Kernel size before:
/usr/src/linux# size vmlinux
text data bss dec hex filename
1716049 403968 470252 2590269 27863d vmlinux
/usr/src/linux#
Kernel size after:
/usr/src/linux# size vmlinux
text data bss dec hex filename
1680993 403488 470124 2554605 26faed vmlinux
/usr/src/linux#
2% of overall size! And this is not exactly an minimalistic setup. Wow! What a waste of space!!!! Not even counting the runtime size of this crap! And then let's take a look at the following self flattery:
-/*
- * Copyright (C) 1997-1998 Mark Lord
- *
- * This is the /proc/ide/ filesystem implementation.
- *
- * The major reason this exists is to provide sufficient access
- * to driver and config data, such that user-mode programs can
- * be developed to handle chipset tuning for most PCI interfaces.
- * This should provide better utilities, and less kernel bloat.
^^^^^^^^^^^^^^^^^^
Well there could only be an answer to this which would be universally understandable in every Slavic language... but since it's mothers day...
EOD.
drivers/ide/aec62xx.c +2 -2
@@ -26,7 +26,7 @@#include "ata-timing.h" -#define DISPLAY_AEC62XX_TIMINGS +#undef DISPLAY_AEC62XX_TIMINGS#ifndef HIGH_4 #define HIGH_4 (H ) ((H)=(H>>4))
@@ -503,7 +503,7 @@ bmide_dev = dev; aec62xx_display_info = &aec62xx_get_info; } -#endif /* DISPLAY_AEC62XX_TIMINGS && CONFIG_PROC_FS */ +#endif return dev->irq; }
drivers/ide/alim15x3.c +1 -1
@@ -28,7 +28,7 @@#include "ata-timing.h" -#define DISPLAY_ALI_TIMINGS +#undef DISPLAY_ALI_TIMINGS#if defined(DISPLAY_ALI_TIMINGS ) && defined(CONFIG_PROC_FS )#include <linux/stat.h>
drivers/ide/amd74xx.c +2 -2
@@ -94,7 +94,7 @@* AMD /proc entry. */ -#ifdef CONFIG_PROC_FS +#if 0 && defined(CONFIG_PROC_FS )#include <linux/stat.h> #include <linux/proc_fs.h>
@@ -384,7 +384,7 @@* Register /proc/ide/amd74xx entry */ -#ifdef CONFIG_PROC_FS +#if 0 && defined(CONFIG_PROC_FS )if (!amd74xx_proc) { amd_base =pci_resource_start (dev,4 ); bmide_dev = dev;
drivers/ide/cmd64x.c +1 -1
@@ -79,7 +79,7 @@#define UDIDETCR1 0x7B#define DTPR1 0x7C -#define DISPLAY_CMD64X_TIMINGS +#undef DISPLAY_CMD64X_TIMINGS#if defined(DISPLAY_CMD64X_TIMINGS ) && defined(CONFIG_PROC_FS )#include <linux/stat.h>
drivers/ide/cs5530.c +1 -1
@@ -29,7 +29,7 @@#include "ata-timing.h" -#define DISPLAY_CS5530_TIMINGS +#undef DISPLAY_CS5530_TIMINGS#if defined(DISPLAY_CS5530_TIMINGS ) && defined(CONFIG_PROC_FS )#include <linux/stat.h>
drivers/ide/hpt366.c +1 -1
@@ -65,7 +65,7 @@#include "ata-timing.h" -#define DISPLAY_HPT366_TIMINGS +#undef DISPLAY_HPT366_TIMINGS/* various tuning parameters */ #define HPT_RESET_STATE_ENGINE
drivers/ide/ide.c +1 -33
@@ -1921,12 +1921,6 @@return 0 ; } -#ifdef CONFIG_PROC_FS -ide_proc_entry_t generic_subdriver_entries[] = { - {NULL ,0 ,NULL ,NULL } -}; -#endif -void ide_unregister (struct ata_channel *ch) {struct gendisk *gd;
@@ -1983,9 +1977,6 @@ } } } -#ifdef CONFIG_PROC_FS -destroy_proc_ide_drives (ch); -#endif spin_lock_irqsave (&ide_lock, flags);/*
@@ -2208,9 +2199,6 @@if (!initializing) {ideprobe_init ();revalidate_drives (); -#ifdef CONFIG_PROC_FS -create_proc_ide_interfaces (); -#endif /* FIXME: Do we really have to call it second time here?! */ ide_driver_module (); }
@@ -3198,11 +3186,7 @@ } drive->revalidate =1 ; drive->suspend_reset =0 ; -#ifdef CONFIG_PROC_FS -ide_add_proc_entries (drive->proc, generic_subdriver_entries, drive); -if (ata_ops (drive)) -ide_add_proc_entries (drive->proc,ata_ops (drive)->proc, drive); -#endif +return 0 ; }
@@ -3233,11 +3217,6 @@#if defined(CONFIG_BLK_DEV_ISAPNP ) && defined(CONFIG_ISAPNP ) && defined(MODULE )pnpide_init (0 );#endif -#ifdef CONFIG_PROC_FS -if (ata_ops (drive)) -ide_remove_proc_entries (drive->proc,ata_ops (drive)->proc); -ide_remove_proc_entries (drive->proc, generic_subdriver_entries); -#endif auto_remove_settings (drive); drive->driver =NULL ; drive->present =0 ;
@@ -3315,10 +3294,6 @@EXPORT_SYMBOL (ide_cmd);EXPORT_SYMBOL (ide_delay_50ms);EXPORT_SYMBOL (ide_stall_queue); -#ifdef CONFIG_PROC_FS -EXPORT_SYMBOL (ide_add_proc_entries); -EXPORT_SYMBOL (ide_remove_proc_entries); -#endif EXPORT_SYMBOL (ide_add_setting);EXPORT_SYMBOL (ide_remove_setting);
@@ -3484,10 +3459,6 @@# endif #endif -#ifdef CONFIG_PROC_FS -proc_ide_create (); -#endif -/* * Initialize all device type driver modules. */
@@ -3553,9 +3524,6 @@ide_unregister (&ide_hwifs[h]); } -# ifdef CONFIG_PROC_FS -proc_ide_destroy (); -# endif devfs_unregister (ide_devfs_handle); }
drivers/ide/ide-cd.c +0 -1
@@ -2906,7 +2906,6 @@ check_media_change: ide_cdrom_check_media_change, revalidate: ide_cdrom_revalidate, capacity: ide_cdrom_capacity, - proc: NULL };/* options */
drivers/ide/ide-disk.c +0 -67
85 lines not on this page · raw message
drivers/ide/ide-proc.c +0 -477
477 lines not on this page · raw message
drivers/ide/ide-tape.c +0 -26
@@ -6108,31 +6108,6 @@return 0 ; } -#ifdef CONFIG_PROC_FS - -static int proc_idetape_read_name - (char *page,char **start,off_t off,int count,int *eof,void *data) -{ -ide_drive_t *drive = (ide_drive_t *) data; -idetape_tape_t *tape = drive->driver_data; -char *out = page; -int len; - - len =sprintf (out,"%s\n" , tape->name); -PROC_IDE_READ_RETURN (page, start, off, count, eof, len); -} - -static ide_proc_entry_t idetape_proc[] = { - {"name" ,S_IFREG |S_IRUGO , proc_idetape_read_name,NULL }, - {NULL ,0 ,NULL ,NULL } -}; - -#else - -#define idetape_proc NULL - -#endif -static void idetape_revalidate (ide_drive_t *_dummy) {/* We don't have to handle any partition information here, which is the
@@ -6154,7 +6129,6 @@ release: idetape_blkdev_release, check_media_change: NULL, revalidate: idetape_revalidate, - proc: idetape_proc };/*
drivers/ide/Makefile +0 -2
@@ -72,8 +72,6 @@ obj-$(CONFIG_BLK_DEV_ATARAID_PDC) += pdcraid.o obj-$(CONFIG_BLK_DEV_ATARAID_HPT) += hptraid.o -ide-obj-$(CONFIG_PROC_FS) += ide-proc.o - ide-mod-objs := ide-taskfile.o ide.o ide-probe.o ide-geometry.o ide-features.o ata-timing.o $(ide-obj-y) include $(TOPDIR)/Rules.make
drivers/ide/pdc202xx.c +1 -1
@@ -51,7 +51,7 @@#define PDC202XX_DEBUG_DRIVE_INFO 0#define PDC202XX_DECODE_REGISTER_INFO 0 -#define DISPLAY_PDC202XX_TIMINGS +#undef DISPLAY_PDC202XX_TIMINGS#ifndef SPLIT_BYTE #define SPLIT_BYTE (B ,H ,L ) ((H)=(B>>4), (L)=(B-((B>>4)<<4)))
drivers/ide/piix.c +2 -2
@@ -110,7 +110,7 @@* PIIX/ICH /proc entry. */ -#ifdef CONFIG_PROC_FS +#if 0 && defined(CONFIG_PROC_FS )#include <linux/stat.h> #include <linux/proc_fs.h>
@@ -520,7 +520,7 @@* Register /proc/ide/piix entry */ -#ifdef CONFIG_PROC_FS +#if 0 && defined(CONFIG_PROC_FS )if (!piix_proc) { piix_base =pci_resource_start (dev,4 ); bmide_dev = dev;
drivers/ide/serverworks.c +3 -2
@@ -93,15 +93,16 @@#include "ata-timing.h" -#define DISPLAY_SVWKS_TIMINGS 1 +#undef DISPLAY_SVWKS_TIMINGS#undef SVWKS_DEBUG_DRIVE_INFO +static u8 svwks_revision =0 ; +#if defined(DISPLAY_SVWKS_TIMINGS ) && defined(CONFIG_PROC_FS )#include <linux/stat.h> #include <linux/proc_fs.h> static struct pci_dev *bmide_dev; -static byte svwks_revision =0 ;static int svwks_get_info (char *,char **,off_t ,int );extern int (*svwks_display_info)(char *,char **,off_t ,int );/* ide-proc.c */
drivers/ide/sis5513.c +1 -1
@@ -58,7 +58,7 @@/* When BROKEN_LEVEL is defined it limits the DMA mode at boot time to its value */ // #define BROKEN_LEVEL XFER_SW_DMA_0 -#define DISPLAY_SIS_TIMINGS +#undef DISPLAY_SIS_TIMINGS/* Miscellaneaous flags */ #define SIS5513_LATENCY 0x01
drivers/ide/via82cxxx.c +2 -2
@@ -136,7 +136,7 @@* VIA /proc entry. */ -#ifdef CONFIG_PROC_FS +#if 0 && defined(CONFIG_PROC_FS )#include <linux/stat.h> #include <linux/proc_fs.h>
@@ -497,7 +497,7 @@* Setup /proc/ide/via entry. */ -#ifdef CONFIG_PROC_FS +#if 0 && defined(CONFIG_PROC_FS )if (!via_proc) { via_base =pci_resource_start (dev,4 ); bmide_dev = dev;
drivers/scsi/ide-scsi.c +0 -1
@@ -557,7 +557,6 @@ check_media_change: NULL, revalidate: idescsi_revalidate, capacity: NULL, - proc: NULL };/*
include/linux/ide.h +2 -42
68 lines not on this page · raw message
Re: [PATCH] 2.5.14 IDE 57
Quoted 3 lines · Martin Dalecki
Tue May 7 02:37:49 CEST 2002 ide-clean-57
Nuke
/proc/ide. For explanations why, please see the frustrated comments in the previous change log.
This is a big mistake IMO.
Nuking the ability to change settings, fair enough, but only if alternative interface is provided for userspace to tweak everything, otherwise provide the interface before you remove the existing one. (There may be already another interface, I don't know...I am sure someone will tell me if there is!)
Removing the information provided by /proc/ide is very bad! It is very useful to diagnose one's ide setup, to see what the host is configured as, what all settings are set to, etc. This is the first place I look to check whether the interfaces are configured as I expect them to be and in case of problems, this is again the first place I look.
What alternatives are you going to present to give all the information that /proc/ide gives? If the answer is none IMHO your patch is not acceptable...
Best regards,
Anton
Signature · 5 lines
"I've not lost my mind. It's backed up on tape somewhere." - Unknown -- Anton Altaparmakov <aia21 at cantab.net> (replace at with @) Linux NTFS Maintainer / IRC: #ntfs on irc.openprojects.net WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/
Re: [PATCH] 2.5.14 IDE 57
In reply to Linus TorvaldsUz.ytkownik Anton Altaparmakov napisa?:
Quoted 10 lines
Quoted 3 lines · Martin Dalecki
Tue May 7 02:37:49 CEST 2002 ide-clean-57
Nuke
/proc/ide. For explanations why, please see the frustrated comments in the previous change log.This is a big mistake IMO.
Nuking the ability to change settings, fair enough, but only if alternative interface is provided for userspace to tweak everything, otherwise provide the interface before you remove the existing one. (There may be already another interface, I don't know...I am sure someone will tell me if there is!)
Ehmm... There *is* one interface there. hdparm will help you. Note: the upcomming release of hdparm should contain the following patch which incearses it's usability vastly to the average user. Just for convenience I'm attaching it here.
If you don't like hdparm - well please shoot the people who wrote init, ifconfig, eject and so on...
hdparm.8 +6 -4
@@ -368,14 +368,16 @@ Tristate device for hotswap (DANGEROUS). .TP .I -X -Set the IDE transfer mode for newer (E)IDE/ATA2 drives. +Set the IDE transfer mode for newer (E)IDE/ATA-7 drives. This is typically used in combination with .I -d1 when enabling DMA to/from a drive on a supported interface chipset, where -.I -X34 -is used to select multiword DMA mode2 transfers. +.I -X mdma2 +is used to select multiword DMA mode2 transfers and +.I -X sdma1 +is used to select simple mode 1 DMA transfers. With systems which support UltraDMA burst timings, -.I -X66 +.I -X udma2 is used to select UltraDMA mode2 transfers (you'll need to prepare the chipset for UltraDMA beforehand). Apart from that, use of this flag is
hdparm.c +79 -2
108 lines not on this page · raw message
Re: [PATCH] 2.5.14 IDE 57
Quoted 11 lines · Martin Dalecki
Uz.ytkownik Anton Altaparmakov napisa?:
Quoted 10 lines
Quoted 4 lines · Martin Dalecki
Tue May 7 02:37:49 CEST 2002 ide-clean-57
Nuke
/proc/ide. For explanations why, please see the frustrated comments in the previous change log.This is a big mistake IMO.
Quoted 8 lines
Quoted 5 lines
Nuking the ability to change settings, fair enough, but only if alternative interface is provided for userspace to tweak everything, otherwise provide the interface before you remove the existing one. (There may be already another interface, I don't know...I am sure someone will tell me if there is!)
Ehmm... There *is* one interface there. hdparm will help you. Note: the upcomming release of hdparm should contain the
hdparm -i requires root privs. cat /proc/ide/${file} does not. hdparm is NOT an acceptable substitute for /proc/ide/.
/Mikael
Re: [PATCH] 2.5.14 IDE 57
In reply to Martin DaleckiQuoted 6 lines · Martin Dalecki
Uz.ytkownik Anton Altaparmakov napisa?:
Quoted 5 lines
Quoted 3 lines · Martin Dalecki
Tue May 7 02:37:49 CEST 2002 ide-clean-57
Nuke
/proc/ide. For explanations why, please see the frustrated comments in the previous change log.
Quoted 7 lines
Quoted 2 lines
This is a big mistake IMO.
Nuking the ability to change settings, fair enough, but only if alternative interface is provided for userspace to tweak everything, otherwise provide the interface before you remove the existing one. (There may be already another interface, I don't know...I am sure someone will tell me if there is!)Ehmm... There *is* one interface there. hdparm will help you. Note: the upcomming release of hdparm should contain the following patch which incearses it's usability vastly to the average user. Just for convenience I'm attaching it here.
How do I get this information with hdparm please?
[aia21@drop ide]$ cat via
----------VIA BusMastering IDE Configuration----------------
Driver Version: 3.34 South Bridge: VIA vt82c686b Revision: ISA 0x40 IDE 0x6 Highest DMA rate: UDMA100 BM-DMA base: 0xd000 PCI clock: 33.3MHz Master Read Cycle IRDY: 0ws Master Write Cycle IRDY: 0ws BM IDE Status Register Read Retry: yes Max DRDY Pulse Width: No limit -----------------------Primary IDE-------Secondary IDE------ Read DMA FIFO flush: yes yes End Sector FIFO flush: no no Prefetch Buffer: yes no Post Write Buffer: yes no Enabled: yes yes Simplex only: no no Cable Type: 80w 40w -------------------drive0----drive1----drive2----drive3----- Transfer Mode: UDMA PIO DMA UDMA Address Setup: 30ns 120ns 30ns 30ns Cmd Active: 90ns 90ns 90ns 90ns Cmd Recovery: 30ns 30ns 30ns 30ns Data Active: 90ns 330ns 90ns 90ns Data Recovery: 30ns 270ns 30ns 30ns Cycle Time: 20ns 600ns 120ns 60ns Transfer Rate: 99.9MB/s 3.3MB/s 16.6MB/s 33.3MB/s
hdparm is a tool to query a device and how the controller is programmed to talk to the device. But it is not designed nor capable of giving information about the host itself. I just read the man page for hdparm and there are no options in sight to show any of the things I have shown above.
Also the below work as normal user but hdparm requires super user... It is debateable whether a normal user should be allowed access but still you are taking away existing functionality...
[aia21@drop hda]$ cat cache
1916
[aia21@drop hda]$ cat capacity
80418240
[aia21@drop hda]$ cat geometry
physical 79780/16/63
logical 5005/255/63
And hdparm never gives you the physical geometry AFAICS.
Either I am missing something or you are removing a lot of functionality and replacing it with nothingness...
And as I said, I can understand removing the ability to write values into /proc/ide/*, what I disagree with is the removal of the information provided by read-only access to /proc/ide/*. And that is because I am not aware of any other way to get the same information.
Best regards,
Anton
Signature · 5 lines
"I've not lost my mind. It's backed up on tape somewhere." - Unknown -- Anton Altaparmakov <aia21 at cantab.net> (replace at with @) Linux NTFS Maintainer / IRC: #ntfs on irc.openprojects.net WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/
Re: [PATCH] 2.5.14 IDE 57
Uz.ytkownik Anton Altaparmakov napisa?:
Quoted 7 lines
[aia21@drop hda]$ ideinfo
bash: ideinfo: command not foundObviously distros haven't caught up with this development. )-:
Care to give me a URL? A quick google for "ideinfo Linux download" didn't bring up anything looking relevant.
http://www.j2.ru/frozenfido/ru.unix.bsd/1329707b3e3f8.html
Porting it should be fairly tirvial. Basically lspci + the parsing crap.
Quoted 2 lines
I like text parsing... It is not performance critical and makes info human readable... Whether existing text parsers are any good or not, I don't care, write a better one if you don't like the existing one or go beat up the people who wrote the bad ones... That seems to be Martin's standard reply, so I thought I would use it, too. (-;
Feel free to do it yourself - in user space where it belongs.
Re: [PATCH] 2.5.14 IDE 57
Quoted 10 lines · Martin Dalecki
Uz.ytkownik Anton Altaparmakov napisa?:
Quoted 4 lines
[aia21@drop hda]$ ideinfo
bash: ideinfo: command not found
Obviously distros haven't caught up with this development. )-:
Care to give me a URL? A quick google for "ideinfo Linux download" didn't bring up anything looking relevant.http://www.j2.ru/frozenfido/ru.unix.bsd/1329707b3e3f8.html
Porting it should be fairly tirvial. Basically lspci + the parsing crap.
I don't want to port anything. I don't know ide and I don't want to know ide. I want to be able to use it. I am an ide USER. You are the ide DEVELOPER. If you take away functionality YOU have to provide a replacement. NOT tell me, the USER to write it.
Quoted 3 lines
Quoted 1 line
I like text parsing... It is not performance critical and makes info human readable... Whether existing text parsers are any good or not, I don't care, write a better one if you don't like the existing one or go beat up the people who wrote the bad ones... That seems to be Martin's standard reply, so I thought I would use it, too. (-;
Feel free to do it yourself - in user space where it belongs.
I don't want to do it myself. I want YOU to do it because YOU are taking away the functionality that already exists.
Anton
Signature · 5 lines
"I've not lost my mind. It's backed up on tape somewhere." - Unknown -- Anton Altaparmakov <aia21 at cantab.net> (replace at with @) Linux NTFS Maintainer / IRC: #ntfs on irc.openprojects.net WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/
Re: [PATCH] 2.5.14 IDE 57
In reply to Anton AltaparmakovQuoted 5 lines · Anton Altaparmakov
[aia21@drop hda]$ ideinfo
bash: ideinfo: command not found
Obviously distros haven't caught up with this development. )-:
Care to give me a URL? A quick google for "ideinfo Linux download" didn't bring up anything looking relevant.
Can't find where I got it from, and it seems to have fallen off google. I put up the last version I had (which I hacked up a bit) at
http://www.codemonkey.org.uk/cruft/ide-info-0.0.5-dj.tar.gz
Quoted 4 lines
Quoted 2 lines
The parsing gunk we have for
/proc/ideis fugly, and should have been done with sysctls from day one imo.I like text parsing.
must.. resist.. /proc ascii/bin... holywar.. (besides, sysctl interface gives you ascii in /proc/sys/)
Quoted 3 lines
It is not performance critical and makes info human readable... Whether existing text parsers are any good or not, I don't care, write a better one if you don't like the existing one
That's likely exactly the reason we ended up with the dungheap we have now. Rewriting the parser when we already have a usable sysctl interface seems to have no gain over the existing mess to me.
Dave.
Signature · 2 lines
| Dave Jones. http://www.codemonkey.org.uk | SuSE Labs
Re: [PATCH] 2.5.14 IDE 57
Quoted 10 lines · Dave Jones
Quoted 5 lines · Anton Altaparmakov
[aia21@drop hda]$ ideinfo
bash: ideinfo: command not found
Obviously distros haven't caught up with this development. )-:
Care to give me a URL? A quick google for "ideinfo Linux download" didn't bring up anything looking relevant.Can't find where I got it from, and it seems to have fallen off google. I put up the last version I had (which I hacked up a bit) at
http://www.codemonkey.org.uk/cruft/ide-info-0.0.5-dj.tar.gz
Ok, will get that. Someone else emailed me a url and I tried that earlier on (ages ago it seems) it said version 0.0.4 and it displayed a lot of crap on a 2.5.14 running kernel. Certainly it bears no resemblance to what /proc/ide/via has to say and it certainly bears no resemblance to reality... )-: i hope...
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
The parsing gunk we have for
/proc/ideis fugly, and should have been done with sysctls from day one imo.I like text parsing.
must.. resist.. /proc ascii/bin... holywar.. (besides, sysctl interface gives you ascii in
/proc/sys/)
It does indeed (if implemented). Agreed if Martin were to change to sysctl with /proc interface great, it would just mean /proc/ide becomes /proc/sys/ide, nothing against that....
Quoted 7 lines
Quoted 3 lines
It is not performance critical and makes info human readable... Whether existing text parsers are any good or not, I don't care, write a better one if you don't like the existing one
That's likely exactly the reason we ended up with the dungheap we have now. Rewriting the parser when we already have a usable sysctl interface seems to have no gain over the existing mess to me.
Probably... I agree sysctl is great. I use it in ntfs myself. (-: And i think the /proc/sys is very nice... And for people who don't like it or who don;'t compile /proc fs they can use _sysctl...
Cheers,
Anton
Signature · 5 lines
"I've not lost my mind. It's backed up on tape somewhere." - Unknown -- Anton Altaparmakov <aia21 at cantab.net> (replace at with @) Linux NTFS Maintainer / IRC: #ntfs on irc.openprojects.net WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/
Re: [PATCH] 2.5.14 IDE 56
In reply to Linus TorvaldsQuoted 2 lines · Martin Dalecki
Mon May 6 13:29:44 CEST 2002 ide-clean-56
[snip]
Quoted 5 lines
OK. After realizing the simple fact that quite a lot of low level hardware manipulating ioctls may require assistance in usage from proper logic which is *very* unlikely to be implemented in a bash
(for me preferable still ksh) I have made my mind up.
/proc/idewill be nuked.
Please consider this carefully, especially the read only bits. One particular thing I use a lot is: /proc/ide/hda/capacity Will there be another interface easily usable by scripts to get this information?
Am I going to have to parse hdparm output?
....
geometry = 2434/255/63, sectors = 39102336, start = 0
Am I going to need hdparm on my embedded system?
Padraig.
Re: [PATCH] 2.5.14 IDE 57
In reply to Linus TorvaldsQuoted 1 line · Mikael Pettersson
hdparm -i requires root privs.
hdparm itself doesn't, but you must be able to read /dev/hd* Some distros have this owned by group 'disk' for eg. Adding yourself as a member of this group should allow you to use hdparm without becoming root.
Signature · 2 lines
| Dave Jones. http://www.codemonkey.org.uk | SuSE Labs
Re: [PATCH] 2.5.14 IDE 57
In reply to Linus TorvaldsQuoted 3 lines · Anton Altaparmakov
How do I get this information with hdparm please?
[aia21@drop ide]$ cat via
Bartlomiej Zolnierkiewicz moved all this stuff to userspace a long time ago in 'ideinfo'.
Quoted 9 lines
[aia21@drop hda]$ cat cache
1916
[aia21@drop hda]$ cat capacity
80418240
[aia21@drop hda]$ cat geometry
physical 79780/16/63
logical 5005/255/63And hdparm never gives you the physical geometry AFAICS.
Why would a normal user ever need to know this info?
Quoted 4 lines
And as I said, I can understand removing the ability to write values into
/proc/ide/*, what I disagree with is the removal of the information provided by read-only access to/proc/ide/*. And that is because I am not aware of any other way to get the same information.
The parsing gunk we have for /proc/ide is fugly, and should have been done with sysctls from day one imo.
Signature · 2 lines
| Dave Jones. http://www.codemonkey.org.uk | SuSE Labs
Re: [PATCH] 2.5.14 IDE 57
Quoted 7 lines · Dave Jones
Quoted 3 lines · Anton Altaparmakov
How do I get this information with hdparm please?
[aia21@drop ide]$ cat via
Bartlomiej Zolnierkiewicz moved all this stuff to userspace a long time ago in 'ideinfo'.
[aia21@drop hda]$ ideinfo
bash: ideinfo: command not found
Obviously distros haven't caught up with this development. )-:
Care to give me a URL? A quick google for "ideinfo Linux download" didn't bring up anything looking relevant.
Quoted 11 lines
Quoted 9 lines
[aia21@drop hda]$ cat cache
1916
[aia21@drop hda]$ cat capacity
80418240
[aia21@drop hda]$ cat geometry
physical 79780/16/63
logical 5005/255/63And hdparm never gives you the physical geometry AFAICS.
Why would a normal user ever need to know this info?
I want to know this info. (-: Admittedly normal users don't need it... It is useful for diagnosing problems with NTFS and MD setups for example (in conjunction with fdisk -l shown in sectors).
Quoted 7 lines
Quoted 4 lines
And as I said, I can understand removing the ability to write values into
/proc/ide/*, what I disagree with is the removal of the information provided by read-only access to/proc/ide/*. And that is because I am not aware of any other way to get the same information.The parsing gunk we have for
/proc/ideis fugly, and should have been done with sysctls from day one imo.
I like text parsing... It is not performance critical and makes info human readable... Whether existing text parsers are any good or not, I don't care, write a better one if you don't like the existing one or go beat up the people who wrote the bad ones... That seems to be Martin's standard reply, so I thought I would use it, too. (-;
Best regards,
Anton
Signature · 5 lines
"I've not lost my mind. It's backed up on tape somewhere." - Unknown -- Anton Altaparmakov <aia21 at cantab.net> (replace at with @) Linux NTFS Maintainer / IRC: #ntfs on irc.openprojects.net WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/
Re: [PATCH] 2.5.14 IDE 57
Quoted 3 lines · Anton Altaparmakov
Ok, will get that. Someone else emailed me a url and I tried that earlier on (ages ago it seems) it said version 0.0.4
I don't think 0.0.5 actually hit the streets, I just named it that as this one contained something or other I did (can't remember what exactly diff will tell you) that I was intended to send to the author for 0.0.5
Quoted 3 lines
Certainly it bears no resemblance to what
/proc/ide/viahas to say and it certainly bears no resemblance to reality... )-:
Likely it needs an update for the newer VIA chipsets, as this code is ~2 years old. What it does do however, is proove that this doesn't need to be done in kernel space.
Dave.
Signature · 2 lines
| Dave Jones. http://www.codemonkey.org.uk | SuSE Labs
Re: [PATCH] 2.5.14 IDE 57
In reply to Dave Jonesvaio:~ # hdparm -i /dev/hda
/dev/hda:
Model=FUJITSU MHJ2181AT, FwRev=D034, SerialNo=01001697 Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs } RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4 BuffType=unknown, BuffSize=512kB, MaxMultSect=16, MultSect=16 CurCHS=17475/15/63, CurSects=16513875, LBA=yes, LBAsects=35433216 IORDY=yes, tPIO={min:240,w/IORDY:120}, tDMA={min:120,rec:120} PIO modes: pio0 pio1 pio2 pio3 pio4
DMA modes: mdma0 mdma1 mdma2 udma0 udma1 *udma2 udma3 udma4 Drive Supports : ATA-2 ATA-3 ATA-4 ATA-5
Kernel Drive Geometry LogicalCHS=2205/255/63 PhysicalCHS=37495/15/63
BS Dave it does parse the difference nicely
Quoted 20 lines · Dave Jones
Quoted 3 lines · Anton Altaparmakov
How do I get this information with hdparm please?
[aia21@drop ide]$ cat via
Bartlomiej Zolnierkiewicz moved all this stuff to userspace a long time ago in 'ideinfo'.
Quoted 9 lines
[aia21@drop hda]$ cat cache
1916
[aia21@drop hda]$ cat capacity
80418240
[aia21@drop hda]$ cat geometry
physical 79780/16/63
logical 5005/255/63And hdparm never gives you the physical geometry AFAICS.
Why would a normal user ever need to know this info?
Quoted 17 lines
Quoted 4 lines
And as I said, I can understand removing the ability to write values into
/proc/ide/*, what I disagree with is the removal of the information provided by read-only access to/proc/ide/*. And that is because I am not aware of any other way to get the same information.The parsing gunk we have for
/proc/ideis fugly, and should have been done with sysctls from day one imo.Signature · 7 lines
| Dave Jones. http://www.codemonkey.org.uk | SuSE Labs - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Andre Hedrick
LAD Storage Consulting Group
Re: [PATCH] 2.5.14 IDE 57
In reply to Linus TorvaldsUz.ytkownik Dave Jones napisa?:
Quoted 20 lines · Anton Altaparmakov
Quoted 3 lines
How do I get this information with hdparm please?
[aia21@drop ide]$ cat via
Bartlomiej Zolnierkiewicz moved all this stuff to userspace a long time ago in 'ideinfo'.
Quoted 9 lines
[aia21@drop hda]$ cat cache
1916
[aia21@drop hda]$ cat capacity
80418240
[aia21@drop hda]$ cat geometry
physical 79780/16/63
logical 5005/255/63And hdparm never gives you the physical geometry AFAICS.
Why would a normal user ever need to know this info?
Quoted 7 lines
Quoted 4 lines
And as I said, I can understand removing the ability to write values into
/proc/ide/*, what I disagree with is the removal of the information provided by read-only access to/proc/ide/*. And that is because I am not aware of any other way to get the same information.The parsing gunk we have for
/proc/ideis fugly, and should have been done with sysctls from day one imo.
Amen. For where it turn outs to be really really worth it I indeed plan to move to sysctl. For example currently we have on ioctl level still the problem that many of them are attached to the device but act on the channel.
hdparm -xxx /dev/hda & hdparm -xxx /dev/hdc - BANG race condition. (At least on the level of logics).
Re: [PATCH] 2.5.14 IDE 56
In reply to Linus TorvaldsUz.ytkownik Padraig Brady napisa?:
Quoted 5 lines
Am I going to have to parse hdparm output?
....
geometry = 2434/255/63, sectors = 39102336, start = 0Am I going to need hdparm on my embedded system?
Yes. Or just fsck hardcode the defaults.
Re: [PATCH] 2.5.14 IDE 56
Quoted 7 lines · Martin Dalecki
Uz.ytkownik Padraig Brady napisa?:
Quoted 4 lines
Am I going to have to parse hdparm output?
....
geometry = 2434/255/63, sectors = 39102336, start = 0
Am I going to need hdparm on my embedded system?Yes. Or just fsck hardcode the defaults.
This is stupid! And if that isn't obvious to you, you should think a bit more carefully...
Linux's power is exactly that it can be used on anything from a wristwatch to a huge server and that it is flexible about everything. You are breaking this flexibility for no apparent reason. (I don't accept "I can't cope with this so I remove it." as a reason, sorry).
As the new IDE maintainer so far we have only seen you removing one feature after the other in the name of cleanup, without adequate or even any at all(!) replacements, renaming all functions to hell and back, and breaking the ide core here there and everywhere. All critical bug fixes seem to have been contributed by other people looking at your code which doesn't inspire a lot of confidence in you... Even Alan Cox said a while ago that you have his vote of no confidence (probably slightly rephrased here) because of changes you were introducing and I tend to trust bearded kernel hackers from Whales. (-;
Aren't you noticing that something is wrong here???
Best regards,
Anton
Signature · 5 lines
"I've not lost my mind. It's backed up on tape somewhere." - Unknown -- Anton Altaparmakov <aia21 at cantab.net> (replace at with @) Linux NTFS Maintainer / IRC: #ntfs on irc.openprojects.net WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/
Re: [PATCH] 2.5.14 IDE 56
[ First off: any IDE-only thing that doesn't work for SCSI or other disks
doesn't solve a generic problem, so the complaint that some generic tools might use it is totally invalid. ]
Quoted 5 lines · Anton Altaparmakov
Linux's power is exactly that it can be used on anything from a wristwatch to a huge server and that it is flexible about everything. You are breaking this flexibility for no apparent reason. (I don't accept "I can't cope with this so I remove it." as a reason, sorry).
Run the 57 patch, and complain if something doesn't work.
Linux's power is that we FIX stuff. That we make it the best system possible, and that we don't just whine and argue about things.
Quoted 3 lines
As the new IDE maintainer so far we have only seen you removing one feature after the other in the name of cleanup, without adequate or even any at all(!) replacements,
Who cares? Have you found _anything_ that Martin removed that was at all worthwhile? I sure haven't.
Guys, you have to realize that the IDE layer has eight YEARS of absolute crap in it. Seriously. It's _never_ been cleaned up before. It has stuff so distasteful that t's scary.
Take it from me: it's a _lot_ easier to add cruft and crap on top of clean code. You can do it yourself if you want to. You don't need a maintainer to add barnacles.
All the information that /proc/ide gave you is basically available in hdparm, and for your dear embedded system it apparently takes up less space by being in user space. So what is the problem?
My vote is to remove as much as humanly possible.
"Everything should be made as simple as possible, but not
simpler" - Albert Einstein
Think about it, and really _understand_ it.
Linus
Re: [PATCH] 2.5.14 IDE 56
Quoted 30 lines · Linus Torvalds
[ First off: any IDE-only thing that doesn't work for SCSI or other disks
doesn't solve a generic problem, so the complaint that some generic tools might use it is totally invalid. ]Quoted 4 lines · Anton Altaparmakov
Linux's power is exactly that it can be used on anything from a wristwatch to a huge server and that it is flexible about everything. You are breaking this flexibility for no apparent reason. (I don't accept "I can't cope with this so I remove it." as a reason, sorry).
Run the 57 patch, and complain if something doesn't work.
Linux's power is that we FIX stuff. That we make it the best system possible, and that we don't just whine and argue about things.
Quoted 3 lines
As the new IDE maintainer so far we have only seen you removing one feature after the other in the name of cleanup, without adequate or even any at all(!) replacements,
Who cares? Have you found _anything_ that Martin removed that was at all worthwhile? I sure haven't.
Guys, you have to realize that the IDE layer has eight YEARS of absolute crap in it. Seriously. It's _never_ been cleaned up before. It has stuff so distasteful that t's scary.
Quoted 7 lines
Take it from me: it's a _lot_ easier to add cruft and crap on top of clean code. You can do it yourself if you want to. You don't need a maintainer to add barnacles.
All the information that
/proc/idegave you is basically available in hdparm, and for your dear embedded system it apparently takes up less space by being in user space. So what is the problem?
Well my "dear" embedded system doesn't have libc :-(
So 35664 saved in kernel (less on disk), requires 25212 extra for hdparm + more for static linked uclibc (hope it works ;-)). As a side note if this happens hdparm would be a requirement for busybox IMHO, anyway getting back on topic...
All the info I've ever needed is /proc/ide/hdx/capacity which I could get from /proc/partitions with more a bit more effort, so I vote for removing /proc/ide.
I think everyone realises Martin is doing great and much needed work on IDE (btw I'll have those flash support patches soon Martin ;-)), but I did think this change needed debate. In general I know it's a hard decision what to export in proc, especially if there are existing dependencies, a few already mentioned possibles in RH7.1:
/sbin/mkinitrd/sbin/fdisk/sbin/sfdisk/sbin/sndconfig/usr/sbin/mouseconfig/usr/sbin/kudzu/usr/sbin/module_upgrade/usr/sbin/updfstab/usr/sbin/glidelink/usr/sbin/sndconfig/usr/lib/python1.5/site-packages/_kudzumodule.so/usr/bin/X11/Xconfigurator
For e.g. could the same arguments could be made for lspci only interface to pci info rather than /proc/bus/pci? The following references are made to /proc/bus/pci on my system:
/sbin/lspci/sbin/setpci/sbin/sndconfig/usr/sbin/mouseconfig/usr/sbin/kudzu/usr/sbin/module_upgrade/usr/sbin/updfstab/usr/sbin/glidelink/usr/sbin/sndconfig/usr/sbin/adsl-config/usr/sbin/internet-config/usr/sbin/isdn-config/usr/lib/python1.5/site-packages/_kudzumodule.so/usr/bin/X11/XFree86/usr/bin/X11/pcitweak/usr/bin/X11/scanpci/usr/bin/X11/Xconfigurator
cheers,
Padraig.
Re: [PATCH] 2.5.14 IDE 56
Quoted 3 lines
All the info I've ever needed is
/proc/ide/hdx/capacitywhich I could get from/proc/partitionswith more a bit more effort, so I vote for removing/proc/ide.
/proc/ide has useful information in it that you can't get easily by other means at the moment - which controller is driving the disks, what devices are present etc.
Quoted 3 lines
For e.g. could the same arguments could be made for lspci only interface to pci info rather than
/proc/bus/pci? The following references are made to/proc/bus/pcion my system:
lspci relies on /proc/bus/pci - its the only part of the universe that actually knows how to handle PCI and virtualised PCI devices. Unlike the older /proc/pci interface it keeps all the complex gunk out of the kernel
Re: [PATCH] 2.5.14 IDE 56
Quoted 4 lines · Alan Cox
/proc/idehas useful information in it that you can't get easily by other means at the moment - which controller is driving the disks, what devices are present etc.
I'd love for somebody to add the devices to the real device tree, at which point this kind of information would be very much visible..
Right now devicefs isn't even mounted by default, but it's the only _really_ generic way of showing things like this that we have. For people who haven't seen it before, do a
mount -t driverfs /devfs /devfs
and go look in there.. In particular, if you have a PCI system with a USB device tree (or _multiple_ such trees), notice how you can look at things like
/driverfs/root/pci0/00:1f.4/usb_bus/000/
and it wouldn't be impossible (or even necessarily very hard) to make an IDE controller export the "IDE device tree" the same way a USB controller now exports the "USB device tree".
For things like hotplug etc, I think driverfs is eventually the only way to go, simply because it gives you the full (and unambiguous) path to _any_ device, and is completely bus-agnostic.
But there is definitely a potential backwards-compatibility-issue.
Linus
Re: [PATCH] 2.5.14 IDE 56
Quoted 11 lines
/driverfs/root/pci0/00:1f.4/usb_bus/000/and it wouldn't be impossible (or even necessarily very hard) to make an IDE controller export the "IDE device tree" the same way a USB controller now exports the "USB device tree".
For things like hotplug etc, I think driverfs is eventually the only way to go, simply because it gives you the full (and unambiguous) path to _any_ device, and is completely bus-agnostic.
But there is definitely a potential backwards-compatibility-issue.
One interesting thing here would be to have some optional link between the bus-oriented device tree and the function-oriented tree (ie. devfs or simply /dev). For example, an IDE node in driverfs could eventually hold symlinks to the entries it provides in /dev when using devfs (or just provide major/minor when not using devfs).
What do you think ?
One problem I've been faced with on ppc is to be able to match a linux device with what the firmware (Open Firmware) thinks that device is. The firmware view is bus-centered and it would be pretty easy to provide some additional entries in driverfs that give the OF fullpath of a given device. But then, the link between the actual driver in driverfs and the "device" as used by, for example, the filesystem isn't trivial.
Ben.
Re: [PATCH] 2.5.14 IDE 56
Quoted 4 lines · On Tue, 7 May 2002 [email protected] wrote:
One interesting thing here would be to have some optional link between the bus-oriented device tree and the function-oriented tree (ie. devfs or simply /dev).
There isn't any 1:1 thing - the device/bus-oriented one should _not_ show virtual things like partitions etc that have no relevance for a driver, while /dev (and thus devfs) obviously think that that is the important part, much more important than how we actually got to the device.
I think we need to have some way of getting a mapping from /dev -> devicefs, but I don't think that has to be a filesystem thing (it might even be as simple as just one ioctl or new system call: 'get the "path" of this device').
There aren't that many people who actually care, I suspect.
Linus
Re: [PATCH] 2.5.14 IDE 56
Quoted 13 lines · On Tue, 7 May 2002 [email protected] wrote:
Quoted 4 lines
One interesting thing here would be to have some optional link between the bus-oriented device tree and the function-oriented tree (ie. devfs or simply /dev).
There isn't any 1:1 thing - the device/bus-oriented one should _not_ show virtual things like partitions etc that have no relevance for a driver, while /dev (and thus devfs) obviously think that that is the important part, much more important than how we actually got to the device.
Quoted 6 lines
I think we need to have some way of getting a mapping from /dev -> devicefs, but I don't think that has to be a filesystem thing (it might even be as simple as just one ioctl or new system call: 'get the "path" of this device').
There aren't that many people who actually care, I suspect.
Sure, It's obviously not 1:1, what I had in mind was for the controller to show what devices it exports in the sense of raw devices, but I agree the other way makes a lot more sense. My problem was how to be devfs agnostic, but you answered with "ioctl or syscall" and that would indeed be ok. The ioctl things make it appliable to network interfaces as well, which is good.
The need to do this link from a /dev to the driverfs, I suspect, will exist only for case like setting up the firmware, though I can imagine one may want to tweak some IDE settings (available via driverfs in your proposed scheme) knowing only the /dev node.
Ben.
Re: [PATCH] 2.5.14 IDE 56
In reply to Linus TorvaldsQuoted 11 lines · Linus Torvalds
Quoted 4 lines · On Tue, 7 May 2002 [email protected] wrote:
One interesting thing here would be to have some optional link between the bus-oriented device tree and the function-oriented tree (ie. devfs or simply /dev).
There isn't any 1:1 thing - the device/bus-oriented one should _not_ show virtual things like partitions etc that have no relevance for a driver, while /dev (and thus devfs) obviously think that that is the important part, much more important than how we actually got to the device.
Actually, I've always said that I think devfs should care about both views. And that's why I think putting the driver tree (ala driverfs) in devfs, and making the device-oriented part of the tree be symlinks into the bus-oriented tree, is a good idea.
Quoted 4 lines
I think we need to have some way of getting a mapping from /dev -> devicefs, but I don't think that has to be a filesystem thing (it might even be as simple as just one ioctl or new system call: 'get the "path" of this device').
Fugly. What's wrong with readlink(2) as this "magic syscall"?
Regards, Richard.... Permanent: [email protected] Current: [email protected]
Re: [PATCH] 2.5.14 IDE 56
Quoted 3 lines · Richard Gooch
Actually, I've always said that I think devfs should care about both views.
And I think you're completely wrong.
The fact is, they are two completely different and orthogonal things, and they have _nothing_ in common except for a very weak linkage of actual "physical device" (which does not always exist).
The set of people that cares about one view is almost 100% different from the set of people that care about the other view.
Quoted 1 line
Fugly. What's wrong with readlink(2) as this "magic syscall"?
Ehh - like the fact that it doesn't work on device files?
Linus
Re: [PATCH] 2.5.14 IDE 56
Quoted 2 lines
Quoted 1 line
Fugly. What's wrong with readlink(2) as this "magic syscall"?
Ehh - like the fact that it doesn't work on device files?
I can't find anything in Posix/SuS that says it isnt allowed to however 8)
Re: [PATCH] 2.5.14 IDE 56
Quoted 5 lines · Alan Cox
Quoted 3 lines
Quoted 2 lines
Fugly. What's wrong with readlink(2) as this "magic syscall"?
Ehh - like the fact that it doesn't work on device files?
I can't find anything in Posix/SuS that says it isnt allowed to however 8)
We can certainly do it, it just doesn't buy us much of anything, since none of the standard tools (ie "ls") will actually do the readlink() for anything but a symlink.
So at that point it's just another magic syscall, except we've overloaded an old one.
Which may certainly be acceptable, of course.
Linus
Re: [PATCH] 2.5.14 IDE 56
Quoted 9 lines · Linus Torvalds
Quoted 5 lines · Alan Cox
Quoted 3 lines
Quoted 2 lines
Fugly. What's wrong with readlink(2) as this "magic syscall"?
Ehh - like the fact that it doesn't work on device files?
I can't find anything in Posix/SuS that says it isnt allowed to however 8)
Quoted 8 lines
We can certainly do it, it just doesn't buy us much of anything, since none of the standard tools (ie "ls") will actually do the
readlink()for anything but a symlink.So at that point it's just another magic syscall, except we've overloaded an old one.
Which may certainly be acceptable, of course.
I wasn't suggesting a magic readlink(2). I was suggesting a *real* one. Device nodes get stored in the physical tree (what you call driverfs), and the entries in the logical tree are symlinks. Such as:
/dev/scsi/host0 symlink to /dev/bus/pci0/slot1/function2
or something like that. Easy to implement, easy to understand, easy to manage.
Regards, Richard.... Permanent: [email protected] Current: [email protected]
Re: [PATCH] 2.5.14 IDE 56
Quoted 5 lines · Richard Gooch
Quoted 1 line
Which may certainly be acceptable, of course.
I wasn't suggesting a magic readlink(2). I was suggesting a *real* one. Device nodes get stored in the physical tree (what you call driverfs), and the entries in the logical tree are symlinks.
NO.
This is one backwards compatibility thing that I'm _not_ removing.
We have tons of existign /dev trees, and I'm not making them into symlinks.
Also, you obviously haven't thought it through AT ALL. Hint: partitions.
If you have /dev/hda1, that _cannot_ be a symlink to the physical tree, because on a physical level that partition DOES NOT EXIST. It's purely a virtual mapping.
Yet clearly there _is_ a mapping from /dev/hda1 onto the physical device in question, and clearly it _is_ a meaninful operation to operate on the physical device underlying /dev/hda1.
So if you want to have a sane interface, you need to have a way to look up the physical device that underlies /dev/hda1.
Yet it clearly cannot be a symlink.
QED.
So stop mixing up physical devices and /dev. They should NOT be handled by the same mechanism.
Linus
Re: [PATCH] 2.5.14 IDE 56
Hi,
Quoted 10 lines · Linus Torvalds
Also, you obviously haven't thought it through AT ALL. Hint: partitions.
If you have
/dev/hda1, that _cannot_ be a symlink to the physical tree, because on a physical level that partition DOES NOT EXIST. It's purely a virtual mapping.Yet clearly there _is_ a mapping from
/dev/hda1onto the physical device in question, and clearly it _is_ a meaninful operation to operate on the physical device underlying/dev/hda1.
Quoted 6 lines
So if you want to have a sane interface, you need to have a way to look up the physical device that underlies
/dev/hda1.Yet it clearly cannot be a symlink.
QED.
Somehow I expect Al to step in with something like:
mount -t partfs /devfs/bus/... /dev/hda
:-)
bye, Roman
Re: [PATCH] 2.5.14 IDE 56
In reply to Linus Torvalds[email protected] (Linus Torvalds) wrote on 07.05.02 in <[email protected]>:
Quoted 3 lines
If you have
/dev/hda1, that _cannot_ be a symlink to the physical tree, because on a physical level that partition DOES NOT EXIST. It's purely a virtual mapping.
Well ... one *could* argue that there's justification for showing those partitions by the exact same argument that there's reason to show devices on a SCSI or USB bus. It's just going further down the tree.
Say something like
/driverfs/root/pci0/00:1f.4/scsi_bus/003/pc_partition/2
Sure, it's software, not hardware. OTOH, it's one of the things that change with hotplug. (And incidentally, fdisk changing partitions *might* be handled somewhat like a hotplug event ...)
As to linking to /dev, I see no reason why you couldn't have that tree include information (not in the tree *structure*, obviously) of what the relevant device numbers are. That's more expensive than a lookup with a pointer gotten from /dev, but it's certainly possible.
MfG Kai
Re: [PATCH] 2.5.14 IDE 56
Quoted 3 lines · On 08 May 2002 08:57:00 +0200 [email protected] (Kai Henningsen) wrote:
/driverfs/root/pci0/00:1f.4/scsi_bus/003/pc_partition/2Sure, it's software, not hardware.
I agree. I think it'd be great to have something like the above.
Re: [PATCH] 2.5.14 IDE 56
In reply to Richard GoochHi!
Quoted 5 lines
Also, you obviously haven't thought it through AT ALL. Hint: partitions.
If you have
/dev/hda1, that _cannot_ be a symlink to the physical tree, because on a physical level that partition DOES NOT EXIST. It's purely a virtual mapping.
I don't see why partitions in devicefs are bad idea.
Some physical chips show as multiple devices in devicefs, so I'd guess it would be okay for partitions to be there, too.
Pavel
Signature · 2 lines
Philips Velo 1: 1"x4"x8", 300gram, 60, 12MB, 40bogomips, linux, mutt, details at http://atrey.karlin.mff.cuni.cz/~pavel/velo/index.html.
Re: [PATCH] 2.5.14 IDE 56
In reply to Alan CoxQuoted 21 lines · Użytkownik Richard Gooch
Quoted 9 lines · Linus Torvalds
Quoted 5 lines · Alan Cox
Quoted 3 lines
Quoted 1 line
Fugly. What's wrong with readlink(2) as this "magic syscall"?
Ehh - like the fact that it doesn't work on device files?
I can't find anything in Posix/SuS that says it isnt allowed to however 8)
Quoted 8 lines
We can certainly do it, it just doesn't buy us much of anything, since none of the standard tools (ie "ls") will actually do the
readlink()for anything but a symlink.So at that point it's just another magic syscall, except we've overloaded an old one.
Which may certainly be acceptable, of course.
Quoted 8 lines
I wasn't suggesting a magic readlink(2). I was suggesting a *real* one. Device nodes get stored in the physical tree (what you call driverfs), and the entries in the logical tree are symlinks. Such as:
/dev/scsi/host0symlink to/dev/bus/pci0/slot1/function2or something like that. Easy to implement, easy to understand, easy to manage.
Now you take the last step toward solaris and realize why I was always against your solution (no personal offence)
to the device management problem - they do it all in user space by precisely the above symlink system....
Re: [PATCH] 2.5.14 IDE 56
In reply to Linus TorvaldsQuoted 18 lines · On Tue, May 07, 2002 at 07:30:34PM +0200, [email protected] wrote:
Quoted 18 lines · On Tue, 7 May 2002 [email protected] wrote:
Quoted 4 lines
One interesting thing here would be to have some optional link between the bus-oriented device tree and the function-oriented tree (ie. devfs or simply /dev).
There isn't any 1:1 thing - the device/bus-oriented one should _not_ show virtual things like partitions etc that have no relevance for a driver, while /dev (and thus devfs) obviously think that that is the important part, much more important than how we actually got to the device.
I think we need to have some way of getting a mapping from /dev -> devicefs, but I don't think that has to be a filesystem thing (it might even be as simple as just one ioctl or new system call: 'get the "path" of this device').
Quoted 8 lines
Quoted 1 line
There aren't that many people who actually care, I suspect.
Sure, It's obviously not 1:1, what I had in mind was for the controller to show what devices it exports in the sense of raw devices, but I agree the other way makes a lot more sense. My problem was how to be devfs agnostic, but you answered with "ioctl or syscall" and that would indeed be ok. The ioctl things make it appliable to network interfaces as well, which is good.
Yes, when will we get something that associates the physical device with network ethX name?
Re: [PATCH] 2.5.14 IDE 56
In reply to [email protected]Ben, what you are proposing is fairly similar to what Solaris does today. There is a /devices directory that contains the real path while /dev contains the legacy stuff. Seems to work fine and given the proper docs, you can decipher what the /devices path points to fairly easily. So I certainly wouldnt mind seeing this happen for Linux eventually.
--Jauder
Quoted 39 lines · On Tue, 7 May 2002 [email protected] wrote:
Quoted 11 lines
/driverfs/root/pci0/00:1f.4/usb_bus/000/and it wouldn't be impossible (or even necessarily very hard) to make an IDE controller export the "IDE device tree" the same way a USB controller now exports the "USB device tree".
For things like hotplug etc, I think driverfs is eventually the only way to go, simply because it gives you the full (and unambiguous) path to _any_ device, and is completely bus-agnostic.
But there is definitely a potential backwards-compatibility-issue.
One interesting thing here would be to have some optional link between the bus-oriented device tree and the function-oriented tree (ie. devfs or simply /dev). For example, an IDE node in driverfs could eventually hold symlinks to the entries it provides in /dev when using devfs (or just provide major/minor when not using devfs).
What do you think ?
One problem I've been faced with on ppc is to be able to match a linux device with what the firmware (Open Firmware) thinks that device is. The firmware view is bus-centered and it would be pretty easy to provide some additional entries in driverfs that give the OF fullpath of a given device. But then, the link between the actual driver in driverfs and the "device" as used by, for example, the filesystem isn't trivial.
Ben.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] 2.5.14 IDE 56
Uz.ytkownik Jauder Ho napisa?:
Quoted 5 lines
Ben, what you are proposing is fairly similar to what Solaris does today. There is a /devices directory that contains the real path while /dev contains the legacy stuff. Seems to work fine and given the proper docs, you can decipher what the /devices path points to fairly easily. So I certainly wouldnt mind seeing this happen for Linux eventually.
Amen, We would only have to add a device special file to some of the /devices Stuff and /dev/ could be a symlink tree pointing there...
I have *intentionally* named the standard mounting point of the devicefs /devices the time I added the description how to mount it to the driver-model.txt. The following words are from *me*:
This can be done permanently by providing the following entry into the /dev/fstab (under the provision that the mount point does exist, of course):
none /devices driverfs defaults 0 0
Or by hand on the command line:
~: mount -t driverfs none /devices
Quoted 48 lines
--Jauder
Quoted 39 lines · On Tue, 7 May 2002 [email protected] wrote:
Quoted 11 lines
/driverfs/root/pci0/00:1f.4/usb_bus/000/and it wouldn't be impossible (or even necessarily very hard) to make an IDE controller export the "IDE device tree" the same way a USB controller now exports the "USB device tree".
For things like hotplug etc, I think driverfs is eventually the only way to go, simply because it gives you the full (and unambiguous) path to _any_ device, and is completely bus-agnostic.
But there is definitely a potential backwards-compatibility-issue.
One interesting thing here would be to have some optional link between the bus-oriented device tree and the function-oriented tree (ie. devfs or simply /dev). For example, an IDE node in driverfs could eventually hold symlinks to the entries it provides in /dev when using devfs (or just provide major/minor when not using devfs).
What do you think ?
One problem I've been faced with on ppc is to be able to match a linux device with what the firmware (Open Firmware) thinks that device is. The firmware view is bus-centered and it would be pretty easy to provide some additional entries in driverfs that give the OF fullpath of a given device. But then, the link between the actual driver in driverfs and the "device" as used by, for example, the filesystem isn't trivial.
Ben.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 3 lines
- phone: +49 214 8656 283 - job: eVision-Ventures AG, LEV .de (MY OPINIONS ARE MY OWN!) - langs: de_DE.ISO8859-1, en_US, pl_PL.ISO8859-2, last ressort: ru_RU.KOI8-R
Re: [PATCH] 2.5.14 IDE 56
In reply to [email protected]Quoted 10 lines · On Tue, 7 May 2002 [email protected] wrote:
Quoted 10 lines
/driverfs/root/pci0/00:1f.4/usb_bus/000/and it wouldn't be impossible (or even necessarily very hard) to make an IDE controller export the "IDE device tree" the same way a USB controller now exports the "USB device tree".
For things like hotplug etc, I think driverfs is eventually the only way to go, simply because it gives you the full (and unambiguous) path to _any_ device, and is completely bus-agnostic.
Quoted 7 lines
Quoted 1 line
But there is definitely a potential backwards-compatibility-issue.
One interesting thing here would be to have some optional link between the bus-oriented device tree and the function-oriented tree (ie. devfs or simply /dev). For example, an IDE node in driverfs could eventually hold symlinks to the entries it provides in /dev when using devfs (or just provide major/minor when not using devfs).
I agree with such a concept, but as Linus said, it should go the other way, from the functional interface to physical interface. There are many details involved in doing such a thing, but it should work something like this:
The logical subystems (ide disks, networking, etc) would register with the device model core and get a directory in driverfs:
/driverfs/class/ide/
Devices would be discovered and get a driverfs directory representing the physical location of the device:
/driverfs/root/pci0/07.2/
Note that no drivers have been bound to the device. When the driver is bound, it registers the device with the subsystem, passing in a subsystem-specific structure. These can be made to point in some way to the generic struct device of the device (from which the physical path can be inferred).
When this happens, the subsystem creates a directory underneath its driverfs directory, so you get:
/driverfs/class/ide/0/
And, a symlink is created to point to the directory in the physical path. As the driver discovers partitions on the device, it can create special nodes in its class directory.
At this point, userspace can be notified (via /sbin/hotplug). That can create symlinks in /dev to the nodes that were just created, emulating current /dev behavior.
So, what does this do? To an extent, it reengineers the funtionality of devfs. I'll be the first to admit it. However, it centers less around the filesystem, and more on the device model core.
Most devices already register with their subsystems, so having the subsystesm pass device info onto the core is relatively easy.
As partitions are discovered, you get paths like:
/driverfs/class/ide/0/2
Which gives you a default name for the device. With /sbin/hotplug, simple userspace policy, and symlinks in /dev, you can emulate the current device hierarchy. So, you get a device naming solution that gives you only the device names for the devices you have.
This approach also de-emphasizes the dependency on major and minor numbers. If device nodes are created in kernel space initially, userspace doesn't need to know what the major/minor is for a particular device. The symlink to the device node is all that's need to operate on the device.
Without the need to coordinate between kernel and userspace, at least some majors/minors can be dynamically allocated as the subsystems and devices are registered with the core. (These can then be exported via files in driverfs). (This is similar to the dynamic allocation of minor numbers in the USB subsystem that showed up recently...)
Oh, and it's with a modern, clean filesystem, 1/5 the size of devfs.
Thoughts? Comments? Flames?
-pat
Re: [PATCH] 2.5.14 IDE 56
Quoted 1 line · Patrick Mochel
Oh, and it's with a modern, clean filesystem, 1/5 the size of devfs.
The size argument is not an issue. I've already said that devfs will shrink a lot once I move tree management from my own code to the VFS. At that point devfs will mostly be:
- an API
- a way fo supporting the devfsd protocol.
Regards, Richard.... Permanent: [email protected] Current: [email protected]
Re: [PATCH] 2.5.14 IDE 56
Quoted 5 lines · Richard Gooch
Quoted 1 line · Patrick Mochel
Oh, and it's with a modern, clean filesystem, 1/5 the size of devfs.
The size argument is not an issue. I've already said that devfs will shrink a lot once I move tree management from my own code to the VFS.
I agree 100%. However, I think that move will be very painful. I tried to do it a couple of months ago, and there were so many interdependencies and oddities that I gave up after about 6 hours.
Quoted 3 lines
At that point devfs will mostly be:
- an API
- a way fo supporting the devfsd protocol.
I argue that you shouldn't need a separate daemon. We already have the /sbin/hotplug interface. It's simple and sweet. We shouldn't need to rely on an entirely separate daemon.
-pat
Re: [PATCH] 2.5.14 IDE 56
Quoted 4 lines · Patrick Mochel
Quoted 1 line · Richard Gooch
Patrick Mochel writes:
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Oh, and it's with a modern, clean filesystem, 1/5 the size of devfs.
The size argument is not an issue. I've already said that devfs will shrink a lot once I move tree management from my own code to the VFS.
I agree 100%. However, I think that move will be very painful. I tried to do it a couple of months ago, and there were so many interdependencies and oddities that I gave up after about 6 hours.
Oh, it's certainly more that 6 hours of work. But it *will* get done.
Quoted 7 lines
Quoted 3 lines
At that point devfs will mostly be:
- an API
- a way fo supporting the devfsd protocol.I argue that you shouldn't need a separate daemon. We already have the
/sbin/hotpluginterface. It's simple and sweet. We shouldn't need to rely on an entirely separate daemon.
The devfsd protocol is more lightweight. Plus it doesn't require fork(2)+execve(2) overheads. And more importantly, you can capture lookup() events.
Regards, Richard.... Permanent: [email protected] Current: [email protected]
Re: [PATCH] 2.5.14 IDE 56
Quoted 2 lines
Oh, it's certainly more that 6 hours of work. But it *will* get done.
Even the mtrr driver was a good 8 hours to clean up, make readable and more object-oriented. I wish you luck, as well as anyone that has to attempt to decipher it.
Quoted 11 lines
Quoted 7 lines
Quoted 3 lines
At that point devfs will mostly be:
- an API
- a way fo supporting the devfsd protocol.I argue that you shouldn't need a separate daemon. We already have the
/sbin/hotpluginterface. It's simple and sweet. We shouldn't need to rely on an entirely separate daemon.The devfsd protocol is more lightweight. Plus it doesn't require fork(2)+execve(2) overheads. And more importantly, you can capture
lookup()events.
These events are not performance critical, so the overhead is less important. Besides, almost all systems have /sbin/hotplug, since it can be anything - a shell script, a perl script, a tiny C executable.
The hotplug interface doesn't rely on any particular implementation. It only relies on something on the other side implementing a particular interface. The implementation can be replaced, as well as the format of the policy, based on the constratints of the system or the whims of the distro.
It also doesn't rely on a process running to capture events. What happens if the devfsd process is killed?
-pat
Re: [PATCH] 2.5.14 IDE 56
In reply to Patrick MochelHi,
Quoted 5 lines
Quoted 1 line
Quoted 1 line
/driverfs/root/pci0/00:1f.4/usb_bus/000//driverfs/class/ide/
/driverfs/root/pci0/07.2/
/driverfs/class/ide/0/
/driverfs/class/ide/0/2
Why not fixing devfs for that? My root directory is messed up enough. We have dev, proc, tmp, ...
We might have /dev/driver or such, which doesn't make the root directory any fuller. (And also not to disturb the newbies any further. It's hard a lot to explain to a windows user why he can't remove /proc and /dev, and what this is supposed to be.)
This is just my opinion...
Regards,
Thunder
Signature · 2 lines
if (errno == ENOTAVAIL)
fprintf(stderr, "Error: Talking to Microsoft server!\n");Re: [PATCH] 2.5.14 IDE 56
Quoted 10 lines · Thunder from the hill
Hi,
Quoted 5 lines
Quoted 1 line
Quoted 1 line
/driverfs/root/pci0/00:1f.4/usb_bus/000//driverfs/class/ide/
/driverfs/root/pci0/07.2/
/driverfs/class/ide/0/
/driverfs/class/ide/0/2Why not fixing devfs for that? My root directory is messed up enough. We have dev, proc, tmp, ...
For one, I am of the camp that believes devfs is unfixable.
For two, where driverfs is mounted is irrelevant: /driverfs, /sys, /proc/bus are all valid places.
Besides, who cares what's in /? You have /home, which is all that really matters, no?
Quoted 4 lines
We might have
/dev/driveror such, which doesn't make the root directory any fuller. (And also not to disturb the newbies any further. It's hard a lot to explain to a windows user why he can't remove /proc and /dev, and what this is supposed to be.)
So don't give them root access. Or, explain to them that they're magic, like the pagefile.sys file. :)
-pat
Re: [PATCH] 2.5.14 IDE 56
Quoted 11 lines · Patrick Mochel
Quoted 8 lines · Thunder from the hill
Hi,
Quoted 5 lines
Quoted 1 line
Quoted 1 line
/driverfs/root/pci0/00:1f.4/usb_bus/000//driverfs/class/ide/
/driverfs/root/pci0/07.2/
/driverfs/class/ide/0/
/driverfs/class/ide/0/2
Quoted 4 lines
Quoted 2 lines
Why not fixing devfs for that? My root directory is messed up enough. We have dev, proc, tmp, ...
For one, I am of the camp that believes devfs is unfixable.
But it's not actually broken, now that the locking is fixed.
Regards, Richard.... Permanent: [email protected] Current: [email protected]
Re: [PATCH] 2.5.14 IDE 56
In reply to Thunder from the hillQuoted 1 line · Richard Gooch
But it's not actually broken, now that the locking is fixed.
Really? What about the case of the missing BKL for device opens that you haven't really commented on?
Seems like devfs _still_ has locking problems.
Signature · 2 lines
Russell King ([email protected]) The developer of ARM Linux http://www.arm.linux.org.uk/personal/aboutme.html
Re: [PATCH] 2.5.14 IDE 56
Quoted 5 lines · Russell King
Quoted 1 line · Richard Gooch
But it's not actually broken, now that the locking is fixed.
Really? What about the case of the missing BKL for device opens that you haven't really commented on?
I did comment to you, privately, saying I was waiting to see what the consensus was on the issue of whether to move the BKL or not. I'll be sending a patch later this week to fix it.
Quoted 1 line
Seems like devfs _still_ has locking problems.
A pretty minor one, given the comment I was responding to: "devfs is unfixable". I've noticed that even Al has gone quiet on the "devfs races" issue, now that the new code is in place :-)
Regards, Richard.... Permanent: [email protected] Current: [email protected]
Re: [PATCH] 2.5.14 IDE 56
In reply to Thunder from the hillQuoted 7 lines · Richard Gooch
Quoted 2 lines · Russell King
Really? What about the case of the missing BKL for device opens that you haven't really commented on?
I did comment to you, privately, saying I was waiting to see what the consensus was on the issue of whether to move the BKL or not. I'll be sending a patch later this week to fix it.
Yes, and hey, we still have the problem a week layer, even after the discussion went dead.
Quoted 5 lines
Quoted 1 line
Seems like devfs _still_ has locking problems.
A pretty minor one, given the comment I was responding to: "devfs is unfixable". I've noticed that even Al has gone quiet on the "devfs races" issue, now that the new code is in place :-)
Never the less, your comment about "no locking problems" is inaccurate. devfs is calling at least one part of the kernel without obeying the existing locking rules. That's definitely a devfs bug.
Signature · 2 lines
Russell King ([email protected]) The developer of ARM Linux http://www.arm.linux.org.uk/personal/aboutme.html
Re: [PATCH] 2.5.14 IDE 56
In reply to Patrick MochelUz.ytkownik Patrick Mochel napisa?:
Quoted 42 lines · On Tue, 7 May 2002 [email protected] wrote:
Quoted 12 lines
Quoted 12 lines
/driverfs/root/pci0/00:1f.4/usb_bus/000/and it wouldn't be impossible (or even necessarily very hard) to make an IDE controller export the "IDE device tree" the same way a USB controller now exports the "USB device tree".
For things like hotplug etc, I think driverfs is eventually the only way to go, simply because it gives you the full (and unambiguous) path to _any_ device, and is completely bus-agnostic.
Quoted 7 lines
Quoted 1 line
But there is definitely a potential backwards-compatibility-issue.
One interesting thing here would be to have some optional link between the bus-oriented device tree and the function-oriented tree (ie. devfs or simply /dev). For example, an IDE node in driverfs could eventually hold symlinks to the entries it provides in /dev when using devfs (or just provide major/minor when not using devfs).
I agree with such a concept, but as Linus said, it should go the other way, from the functional interface to physical interface. There are many details involved in doing such a thing, but it should work something like this:
The logical subystems (ide disks, networking, etc) would register with the device model core and get a directory in driverfs:
/driverfs/class/ide/
Devices would be discovered and get a driverfs directory representing the physical location of the device:
/driverfs/root/pci0/07.2/
Note that no drivers have been bound to the device. When the driver is bound, it registers the device with the subsystem, passing in a subsystem-specific structure. These can be made to point in some way to the generic struct device of the device (from which the physical path can be inferred).
When this happens, the subsystem creates a directory underneath its driverfs directory, so you get:
/driverfs/class/ide/0/
And, a symlink is created to point to the directory in the physical path. As the driver discovers partitions on the device, it can create special nodes in its class directory.
At this point, userspace can be notified (via
/sbin/hotplug). That can create symlinks in /dev to the nodes that were just created, emulating current /dev behavior.
Quoted 7 lines
So, what does this do? To an extent, it reengineers the funtionality of devfs. I'll be the first to admit it. However, it centers less around the filesystem, and more on the device model core.
Most devices already register with their subsystems, so having the subsystesm pass device info onto the core is relatively easy.
As partitions are discovered, you get paths like:
/driverfs/class/ide/0/2
Just a side note...
Please please name it /devices/ Some old boys like me (age 30) can gain from similarities with some quite common "legacy" systems. We don't have to "invent" for the sake of it.
And /devices/ is the way I have named it in the corresponding documentation.
Re: [PATCH] 2.5.14 IDE 56
In reply to [email protected]Quoted 11 lines · Patrick Mochel
Which gives you a default name for the device. With
/sbin/hotplug, simple userspace policy, and symlinks in /dev, you can emulate the current device hierarchy. So, you get a device naming solution that gives you only the device names for the devices you have.This approach also de-emphasizes the dependency on major and minor numbers. If device nodes are created in kernel space initially, userspace doesn't need to know what the major/minor is for a particular device. The symlink to the device node is all that's need to operate on the device.
Quoted 5 lines
Without the need to coordinate between kernel and userspace, at least some majors/minors can be dynamically allocated as the subsystems and devices are registered with the core. (These can then be exported via files in driverfs). (This is similar to the dynamic allocation of minor numbers in the USB subsystem that showed up recently...)
And is exactly why this showed up in the USB subsystem :)
Quoted 1 line
Oh, and it's with a modern, clean filesystem, 1/5 the size of devfs.
And it removes the dependency of devfsd and its interface, replacing it with the existing /sbin/hotplug interface. This allows different people to implement different naming schemes if they so desire, moving naming policy out of the kernel into userspace, where it belongs.
Yes, there will probably be a "default" naming scheme, matching what we have today, but the ability to replace it with another one is _so_ much easier than having to try to tie into devfsd (like the devreg implementation does: http://www-124.ibm.com/devreg/ )
greg k-h
Re: [PATCH] 2.5.14 IDE 56
In reply to Linus TorvaldsUz.ytkownik Linus Torvalds napisa?:
Quoted 27 lines · Alan Cox
Quoted 4 lines
/proc/idehas useful information in it that you can't get easily by other means at the moment - which controller is driving the disks, what devices are present etc.I'd love for somebody to add the devices to the real device tree, at which point this kind of information would be very much visible..
Right now devicefs isn't even mounted by default, but it's the only _really_ generic way of showing things like this that we have. For people who haven't seen it before, do a
mount -t driverfs /devfs /devfs
and go look in there.. In particular, if you have a PCI system with a USB device tree (or _multiple_ such trees), notice how you can look at things like
/driverfs/root/pci0/00:1f.4/usb_bus/000/and it wouldn't be impossible (or even necessarily very hard) to make an IDE controller export the "IDE device tree" the same way a USB controller now exports the "USB device tree".
Quoted 5 lines
For things like hotplug etc, I think driverfs is eventually the only way to go, simply because it gives you the full (and unambiguous) path to _any_ device, and is completely bus-agnostic.
But there is definitely a potential backwards-compatibility-issue.
Linus - there are no backward compatibility issues here. No single application from my system does mess with /proc/ide. They showed you a list of programs which use /proc and not a list of programs which use anything out of /proc/ide... RedHat even disables all this chip set specific reporting in theyr public kernels. OK kudzu is using it, but it does not *rely on it*. Heck kudzu is running all the time I rebooted my system during developement and nothing ugly did happen.
for fdisk on my notebook, well it runs just fine:
[root@kozaczek root]# fdisk /dev/hda
The number of cylinders for this disk is set to 2584. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/hda: 240 heads, 63 sectors, 2584 cylinders Units = cylinders of 15120 * 512 bytes
Device Boot Start End Blocks Id System /dev/hda1 * 1 7 52888+ 83 Linux /dev/hda2 8 2556 19270440 5 Extended /dev/hda4 2557 2584 211680 a0 IBM Thinkpad hibernation /dev/hda5 8 2166 16322008+ 83 Linux /dev/hda6 2167 2219 400648+ 82 Linux swap
Neither the programmer who wrote fdisk or cdrecord or anything else was stiupid enough to use anything out there, since using a simple ioctl is easier anyway. I *did* check them. (Admittedly I don't care about kudzu, but fdisk an friends I was fully aware of.)
BTW. If one needs the size of the disk well we could attach it as a file size to the device file in /dev IMHO. Why not?
Re: [PATCH] 2.5.14 IDE 56
Quoted 2 lines
RedHat even disables all this chip set specific reporting in theyr public kernels. OK kudzu is using it, but it does not *rely on it*.
The boot kernel has a lot of it disabled not the main ones.
Quoted 2 lines
Heck kudzu is running all the time I rebooted my system during developement and nothing ugly did happen.
I can't speak directly for the Kudzu maintainer but I can say that having a sane way to obtain the list of ide devices (all of them not just non pcmcia) and the device bindings/type has been a long standing request.
If 2.6 breaks a 2.4 installer and nothing else I don't think its a big disaster and the cleanup may well be justified
Re: [PATCH] 2.5.14 IDE 56
Uz.ytkownik Alan Cox napisa?:
Quoted 7 lines
Quoted 2 lines
RedHat even disables all this chip set specific reporting in theyr public kernels. OK kudzu is using it, but it does not *rely on it*.
The boot kernel has a lot of it disabled not the main ones.
Quoted 8 lines
Quoted 2 lines
Heck kudzu is running all the time I rebooted my system during developement and nothing ugly did happen.
I can't speak directly for the Kudzu maintainer but I can say that having
a sane way to obtain the list of ide devices (all of them not just non pcmcia) and the device bindings/type has been a long standing request.If 2.6 breaks a 2.4 installer and nothing else I don't think its a big disaster and the cleanup may well be justified
Well personally I would just love if there where a "go ahead and don't care about "compatibility" for the following:
Make hdX gone and use the scsi device major/minor number stuff instead.
And then just making the ATA driver looking like if it where some incapable SCSI would actually reduce tons of code from kudzu and friends without the need for any adjustment there.
Re: [PATCH] 2.5.14 IDE 56
Quoted 4 lines
Make hdX gone and use the scsi device major/minor number stuff instead. And then just making the ATA driver looking like if it where some incapable SCSI would actually reduce tons of code from kudzu and friends without the need for any adjustment there.
The SCSI layer is significant overhead even in 2.5. Right now for example it appears to be the primary bottleneck for the aacraid drivers. ATA6 is also more capable than SCSI in several areas regardless of the notional market positioning.
Linus talked about having a /dev/disc/... which once you have 32bit dev_t makes complete sense. What you don't do however is throw IDE through the SCSI midlayer, you merely make the /dev/disc/ point call into the right drivers - be they raid, scsi or ide. That also lets the scsi emulation crap get ripped out of the megaraid and aacraid drivers which will up performance.
Alan
Re: [PATCH] 2.5.14 IDE 56
Uz.ytkownik Alan Cox napisa?:
Quoted 11 lines
Quoted 4 lines
Make hdX gone and use the scsi device major/minor number stuff instead. And then just making the ATA driver looking like if it where some incapable SCSI would actually reduce tons of code from kudzu and friends without the need for any adjustment there.
The SCSI layer is significant overhead even in 2.5. Right now for example it appears to be the primary bottleneck for the aacraid drivers. ATA6 is also more capable than SCSI in several areas regardless of the notional market positioning.
Quoted 8 lines
Linus talked about having a
/dev/disc/... which once you have 32bitdev_tmakes complete sense. What you don't do however is throw IDE through the SCSI midlayer, you merely make the/dev/disc/point call into the right drivers - be they raid, scsi or ide. That also lets the scsi emulation crap get ripped out of the megaraid and aacraid drivers which will up performance.Alan
Alan... you have taken me wrong. What I mean is just the following. Take away some minors from use by SCSI (or more propably a common repository) and use the same ioctl numbers where possible. Perhaps implement some ioctl here and there... not more!
Not the whole: "we are just another SCSI device on the driver level". That would not make sense indeed. Since in esp. the SCSI mid-layer isn't taht pritty too...
Re: [PATCH] 2.5.14 IDE 56
In reply to Alan CoxQuoted 1 line · Alan Cox
The SCSI layer is significant overhead even in 2.5.
i did some benchmarking on a high-end dual P3 Xeon (Serverworks chipset ) with QLogic 2300 (2gbit/s) 64/66 Fibre Channel controllers.
using the '/dev/sgX' interface to issue scsi reads/writes allowed me to hit the magical limit of 200mbyte/sec throughput. (basically just about linerate). (simultaneous "sg_read if=/dev/sgX mmap=1 bs=512 count=35M"; sg_read from the sg-tools package)
doing the same test thru the block-layer was basically capped at around 135mbyte/sec. (simultaneous "dd if=/dev/sdX of=/dev/null bs=512 count=35M").
whether the bottleneck was copy-from-kernel-to-userspace (ie. exhaustion of Front-Side-Bus / memory bandwidth) or related to block-layer overhead and scsi layer overheads, i haven't yet validated, but at a ~35% performance difference is relatively significant nontheless.
cpu utlization on the sg interface was under 10%. using 'dd' on the sd interface, both gigahertz P3 Xeons had 0% idle time.
cheers,
lincoln.
Re: [PATCH] 2.5.14 IDE 56
Lincoln,
You are right on the money!
There is about 35-40% throughput killjoy "copy-from-kernel-to-userspace". It is easy to demo if you have a bus analizer and can do accounting on the data io less the command block overhead.
CR3's are your friend, not ...
Quoted 25 lines · Lincoln Dale
Quoted 1 line · Alan Cox
The SCSI layer is significant overhead even in 2.5.
i did some benchmarking on a high-end dual P3 Xeon (Serverworks chipset ) with QLogic 2300 (2gbit/s) 64/66 Fibre Channel controllers.
using the '
/dev/sgX' interface to issue scsi reads/writes allowed me to hit the magical limit of 200mbyte/sec throughput. (basically just about linerate). (simultaneous "sg_readif=/dev/sgX mmap=1 bs=512 count=35M";sg_readfrom the sg-tools package)doing the same test thru the block-layer was basically capped at around 135mbyte/sec. (simultaneous "dd if=/dev/sdX of=/dev/null bs=512 count=35M").
whether the bottleneck was copy-from-kernel-to-userspace (ie. exhaustion of Front-Side-Bus / memory bandwidth) or related to block-layer overhead and scsi layer overheads, i haven't yet validated, but at a ~35% performance difference is relatively significant nontheless.
cpu utlization on the sg interface was under 10%. using 'dd' on the sd interface, both gigahertz P3 Xeons had 0% idle time.
cheers,
Quoted 8 lines
lincoln.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Andre Hedrick
LAD Storage Consulting Group
Re: [PATCH] 2.5.14 IDE 56
Quoted 6 lines
You are right on the money!
There is about 35-40% throughput killjoy "copy-from-kernel-to-userspace". It is easy to demo if you have a bus analizer and can do accounting on the data io less the command block overhead.CR3's are your friend, not ...
You should be able to verify that by using large O_DIRECT I/O's. The block layer itself may well be part of the overhead. With the scsi layer, the block->scsi handling code is definitely a bottleneck to performance
Re: [PATCH] 2.5.14 IDE 56
In reply to Lincoln DaleQuoted 2 lines
doing the same test thru the block-layer was basically capped at around 135mbyte/sec. (simultaneous "dd if=/dev/sdX of=/dev/null bs=512 count=35M").
Tweak your dd to use O_DIRECT and use an O_DIRECT capable fs - that tells you if its copy overhead or disk side stuff.
Re: [PATCH] 2.5.14 IDE 56
In reply to Alan CoxQuoted 15 lines · Lincoln Dale
Quoted 1 line · Alan Cox
The SCSI layer is significant overhead even in 2.5.
i did some benchmarking on a high-end dual P3 Xeon (Serverworks chipset ) with QLogic 2300 (2gbit/s) 64/66 Fibre Channel controllers.
using the '
/dev/sgX' interface to issue scsi reads/writes allowed me to hit the magical limit of 200mbyte/sec throughput. (basically just about linerate). (simultaneous "sg_readif=/dev/sgX mmap=1 bs=512 count=35M";sg_readfrom the sg-tools package)doing the same test thru the block-layer was basically capped at around 135mbyte/sec. (simultaneous "dd if=/dev/sdX of=/dev/null bs=512 count=35M").
Quoted 8 lines
whether the bottleneck was copy-from-kernel-to-userspace (ie. exhaustion of Front-Side-Bus / memory bandwidth) or related to block-layer overhead and scsi layer overheads, i haven't yet validated, but at a ~35% performance difference is relatively significant nontheless.
cpu utlization on the sg interface was under 10%. using 'dd' on the sd interface, both gigahertz P3 Xeons had 0% idle time.
You need to be careful with this stuff. Cache effects dominate.
I believe the /dev/sgX driver uses a fixed kernel-side buffer for the transfer. So the source of the copy_to_user() will always come out of cache if the CPU is snooping the busmastering. But not if the CPU is performing cache invalidates in response to that busmastering.
But for `dd', which has to copy the data out of pagecache, the copy_from_user() will get 100% misses on the source, guaranteed.
Also, the `sg_read' command reads everything into the same (small)
chunk of userspace memory. So the destination of copy_to_user()
is always in cache. Probably, the same is true with `dd bs=512', but one would have to go read the dd source to verify.
This is also why the scsi_debug driver runs so much faster than normal
devices: it copies everything out of a fixed in-kernel buffer. ie:
out of L1 cache. Fast.
Similarly, sg_dd' against scsi_debug is copying a fixed kernel buffer into a fixed userspace buffer But when dd' tries to do the same thing it incurs an additional copy into the pagecache. If the pagecache readahead window exceeds your L1 cache size (it does) then it will appear to be a lot slower.
Summary: the block layer ain't slow - it's memory which is slow ;)
-
Re: [PATCH] 2.5.14 IDE 56
Quoted 6 lines · Andrew Morton
Quoted 4 lines
whether the bottleneck was copy-from-kernel-to-userspace (ie. exhaustion of Front-Side-Bus / memory bandwidth) or related to block-layer overhead and scsi layer overheads, i haven't yet validated, but at a ~35% performance difference is relatively significant nontheless.
You need to be careful with this stuff. Cache effects dominate.
...
i've validated that the performance difference is due to copy_to_user().
i created a hack in the tree where a read() on a file opened with the option O_NOCOPY causes no copy_to_user() to occur. (diff at the bottom of this email).
on this test machine (dual P3 Xeon / 256K L2 cache, 2G PC133 SDRAM, QLogic 2300 FC HBA, 8 x 15K RPM disks). maximum theoretical performance is 2gbit/s (~200mbyte/sec). kernel is 2.4.18.
i get the following performance numbers with 256K reads syncronously from the disks:
/dev/md0 raid-0 with O_DIRECT: 91847kbyte/sec (2781usec
avg latency/read)
/dev/md0 raid-0: 129455kbyte/sec
(1978usec avg latency/read)
/dev/md0 raid-0 with O_NOCOPY: 195868kbyte/sec (1297usec avg latency/read)
requests split evenly across /dev/sd[e-l] w/ O_DIRECT:
78279kbyte/sec (3276usec
avg latency/read)
requests split evenly across /dev/sd[e-l]: 105130kbyte/sec
(2437usec avg latency/read)
requests split evenly across /dev/sd[e-l] w/ O_NOCOPY:
123050kb/sec (2088usec avg
latency/read)
there's some interesting numbers here.
- given the performance difference between O_NOCOPY and pristine on /dev/md0 one can definitely point at that being the copy_to_user()
overhead.
- however, when requests are split across multiple block-devices
(/dev/sd[e-l])
the difference are significantly decreased -- and something wierdo is
going on:
- readahead?
- scsi priorities?
perhaps some form of async i/o is required to get the performance back.
i'll do some experiments with a 2.5.xx and see if the block-layer changes cause any significant changes.
--- pristine/linux/include/asm-i386/fcntl.h Tue Sep 18
06:16:30 2001
+++ linux/include/asm-i386/fcntl.h Thu May 9 18:56:46 2002
@@ -20,6 +20,7 @@
#define O_LARGEFILE 0100000
#define O_DIRECTORY 0200000 /* must be a directory */
#define O_NOFOLLOW 0400000 /* don't follow links */
+#define O_NOCOPY 04 /* LTD HACK: dont do copy_to_user */
#define F_DUPFD 0 /* dup */
#define F_GETFD 1 /* get close_on_exec */
--- pristine/linux/mm/filemap.c Tue Feb 26 06:38:13 2002
+++ linux/mm/filemap.c Thu May 9 18:56:48 2002
@@ -1544,6 +1544,19 @@
return retval;
}
+int file_read_nocopy_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size)
+{
+ unsigned long count = desc->count;
+
+ if (size > count)
+ size = count;
+
+ desc->count = count - size;
+ desc->written += size;
+ desc->buf += size;
+ return size;
+}
+
int file_read_actor(read_descriptor_t * desc, struct page *page,
unsigned long offset, unsigned long size)
{
char *kaddr;
@@ -1591,7 +1604,7 @@
desc.count = count;
desc.buf = buf;
desc.error = 0;- do_generic_file_read(filp, ppos, &desc, file_read_actor);
+ do_generic_file_read(filp, ppos, &desc, ((filp->f_flags & O_NOCOPY) ? file_read_nocopy_actor : file_read_actor));
retval = desc.written;
if (!retval)cheers,
lincoln.
Re: [PATCH] 2.5.14 IDE 56
In reply to Andrew MortonQuoted 7 lines · Lincoln Dale
...
i've validated that the performance difference is due tocopy_to_user(). i created a hack in the tree where aread()on a file opened with the optionO_NOCOPYcauses nocopy_to_user()to occur. (diff at the bottom of this email).
Quoted 6 lines
on this test machine (dual P3 Xeon / 256K L2 cache, 2G PC133 SDRAM, QLogic 2300 FC HBA, 8 x 15K RPM disks).
maximum theoretical performance is 2gbit/s (~200mbyte/sec). kernel is 2.4.18.i get the following performance numbers with 256K reads syncronously from the disks:
For bulk read() and write() I/O the best sized buffer is 8 kbytes. 4k is pretty good, too. Anything larger blows the user-side buffer out of L1. This is for x86.
This is a pretty important point, so let's repeat it:
Userspace programmers who are writing bulk-transfer read/write loops should use an 8 kbyte transfer buffer.
Quoted 6 lines
/dev/md0 raid-0 with O_DIRECT: 91847kbyte/sec (2781usec avg latency/read) /dev/md0 raid-0: 129455kbyte/sec (1978usec avg latency/read) /dev/md0 raid-0 with O_NOCOPY: 195868kbyte/sec (1297usec avglatency/read)
hmm. Why is O_DIRECT always the slowest? (and it would presumably do even worse with an 8k transfer size).
-
O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14 IDE 56)
Quoted 7 lines · Andrew Morton
Quoted 2 lines
/dev/md0 raid-0 with O_DIRECT: 91847kbyte/sec (2781usec /dev/md0raid-0: 129455kbyte/sec (1978usec
Quoted 1 line
/dev/md0 raid-0 with O_NOCOPY: 195868kbyte/sec (1297usechmm. Why is
O_DIRECTalways the slowest? (and it would presumably do even worse with an 8k transfer size).
i just reproduced the test to validate the data. i'm using 8kbyte blocks here. on kernel is 2.4.18, O_DIRECT is still the slowest.
this machine has 2GB RAM, so it has 1.1GB RAM in HighMem.
booting a kernel with 'profile=2' set, the numbers were as follows:
- Base performance, /dev/md0 raid-0 8-disk array:
[root@mel-stglab-host1 src]# readprofile -r;
./test_disk_performance bs=8k blocks=4M /dev/md0
Completed writing 31250 mbytes in 214. 94761 seconds (153.05 Mbytes/sec), 53usec mean latency
- using /dev/md0 raid-0 8-disk array with O_DIRECT:
[root@mel-stglab-host1 src]# readprofile -r;
./test_disk_performance bs=8k blocks=4M direct /dev/md0
Completed reading 31250 mbytes in 1229.830726 seconds (26.64 Mbytes/sec), 306usec mean latency
- using /dev/md0 raid-0 8-disk array with O_NOCOPY hack:
[root@mel-stglab-host1 src]# readprofile -r;
./test_disk_performance bs=8k blocks=4M nocopy /dev/md0
Completed writing 31250 mbytes in 163.602116 seconds (200.29 Mbytes/sec), 39usec mean latency
so O_DIRECT in 2.4.18 still shows up as a 55% performance hit versus no O_DIRECT. anyone have any clues?
from the profile of the O_DIRECT kernel, we have:
[root@mel-stglab-host1 src]# cat /tmp/profile2.txt | sort -n -k3 |
tail -20
c01ceb90 submit_bh 270 2.4107
c01fc8c0 scsi_init_io_vc 286 0.7772
c0136ec0 create_bounce 323 0.9908
c0139d80 unlock_buffer 353 4.4125
c012f7d0 kmem_cache_alloc 465 1.6146
c0115a40 __wake_up 470 2.4479
c01fa720 __scsi_end_request 509 1.7674
c01fae00 scsi_request_fn 605 0.7002
c013cab0 end_buffer_io_kiobuf 675 10.5469
c01154e0 schedule 849 0.6170
c0131a40 rmqueue 868 1.5069
c025ede0 raid0_make_request 871 2.5923
c0225ee0 qla2x00_done 973 1.6436
c013cb60 brw_kiovec 1053 1.0446
c01ce400 __make_request 1831 1.1110
c01f30e0 scsi_dispatch_cmd 1854 2.0692
c011d010 do_softirq 2183 9.7455
c0136c30 bounce_end_io_read 13947 39.6222
c0105230 default_idle 231472 3616.7500
00000000 total 266665 0.1425contrast this to the profile where we're not using O_DIRECT:
[root@mel-stglab-host1 src]# cat /tmp/profile3_base.txt | sort -n
-k3 | tail -20
c012fdc0 kmem_cache_reap 369 0.4707
c013b330 set_bh_page 397 4.9625
c011d010 do_softirq 419 1.8705
c0131a40 rmqueue 466 0.8090
c01fa720 __scsi_end_request 484 1.6806
c012fa60 kmem_cache_free 496 3.8750
c013bd00 block_read_full_page 523 0.7783
c012f7d0 kmem_cache_alloc 571 1.9826
c013db39 _text_lock_buffer 729 0.9812
c0130ca0 shrink_cache 747 0.7781
c01cea70 generic_make_request 833 2.8924
c025ede0 raid0_make_request 930 2.7679
c013b280 get_unused_buffer_head 975 5.5398
c01fc8c0 scsi_init_io_vc 1003 2.7255
c013d490 try_to_free_buffers 1757 4.7745
c013a9d0 end_buffer_io_async 2482 14.1023
c01ce400 __make_request 2687 1.6305
c012a6e0 file_read_actor 6951 27.1523
c0105230 default_idle 15227 237.9219
00000000 total 45048 0.0241the biggest difference here is bounce_end_io_read in O_DIRECT.
given there's still lots of idle-time, i'll file up lockmeter on here and see if theres any gremlins there.
cheers,
lincoln.
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14 IDE 56)
Quoted 3 lines · Lincoln Dale
so
O_DIRECTin 2.4.18 still shows up as a 55% performance hit versus noO_DIRECT. anyone have any clues?
Yes.
O_DIRECT isn't doing any read-ahead.
For O_DIRECT to be a win, you need to make it asynchronous.
Linus
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14 IDE 56)
In message <[email protected]>, > : Li
Quoted 7 lines · nus Torvalds
Quoted 3 lines · Lincoln Dale
so
O_DIRECTin 2.4.18 still shows up as a 55% performance hit versus noO_DIRECT. anyone have any clues?
Quoted 7 lines
Yes.
O_DIRECTisn't doing any read-ahead.For
O_DIRECTto be a win, you need to make it asynchronous.Linus
O_DIRECT is especially useful for applications which maintain their own cache, e.g. a database. And adding Async to it is an even bigger bonus (another Oracleism we did in PTX). No read ahead, no attempt to keep the buffer in memory until memory pressure kicks in. Just a good tool for doing random IO (like an OLTP database would do).
gerrit
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14 IDE 56)
Quoted 8 lines · Gerrit Huizenga
In message <[email protected]>, > : Li
Quoted 2 lines · nus Torvalds
For
O_DIRECTto be a win, you need to make it asynchronous.
O_DIRECTis especially useful for applications which maintain their own cache, e.g. a database. And adding Async to it is an even bigger bonus (another Oracleism we did in PTX).
The thing that has always disturbed me about O_DIRECT is that the whole interface is just stupid, and was probably designed by a deranged monkey on some serious mind-controlling substances [*].
It's simply not very pretty, and it doesn't perform very well either because of the bad interfaces (where synchronocity of read/write is part of it, but the inherent page-table-walking is another issue).
I bet you could get _better_ performance more cleanly by splitting up the actual IO generation and the "user-space mapping" thing sanely. For example, if you want to do an O_DIRECT read into a buffer, there is no reason why it shouldn't be done in two phases:
(1) readahead: allocate pages, and start the IO asynchronously
(2) mmap the file with a MAP_UNCACHED flag, which causes read-faults to "steal" the page from the page cache and make it private to the mapping on page faults.
If you split it up like that, you can do much more interesting things than O_DIRECT can do (ie the above is inherently asynchronous - we'll wait only for IO to complete when the page is actually faulted in).
For O_DIRECT writes, you split it the other way around:
(1) mmwrite() takes the pages in the memory area, and moves them into the page cache, removing the page from the page table (and only copies if existing pages already exist)
(2) fdatasync_area(fd, offset, len)
Again, the above is likely to be a lot more efficient _and_ can do things that O_DIRECT only dreams on.
With my suggested _sane_ interface, I can do a noncached file copy that should be "perfect" even in the face of memory pressure by simply doing
addr = mmap( .. MAP_UNCACHED .. src .. ) mwrite(dst, addr, len);
which does true zero-copy (and, since mwrite removes it from the page table anyway, you can actually avoid even the TLB overhead trivially: if mwrite notices that the page isn't mapped, it will just take it directly from the page cache).
Sadly, database people don't seem to have any understanding of good taste, and various OS people end up usually just saying "Yes, Mr Oracle, I'll open up any orifice I have for your pleasure".
Linus
[*] In other words, it's an Oracleism.
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14
Quoted 7 lines
Quoted 3 lines
O_DIRECTis especially useful for applications which maintain their own cache, e.g. a database. And adding Async to it is an even bigger bonus (another Oracleism we did in PTX).The thing that has always disturbed me about
O_DIRECTis that the whole interface is just stupid, and was probably designed by a deranged monkey on some serious mind-controlling substances [*].
Used with aio its extremely nice. Without the aio patches its a bit lacking whenever readahead is useful
Alan
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14
Quoted 7 lines · Alan Cox
Quoted 4 lines
The thing that has always disturbed me about
O_DIRECTis that the whole interface is just stupid, and was probably designed by a deranged monkey on some serious mind-controlling substances [*].Used with aio its extremely nice. Without the aio patches its a bit lacking whenever readahead is useful
But the point is that AIO is needed just to cover up the fundamental idiocy in the interface. If the interface had been properly designed, it would have been useful _without_ AIO.
Linus
Re: O_DIRECT performance impact on 2.4.18
In reply to Linus TorvaldsQuoted 4 lines · In article <[email protected]> you…
I bet you could get _better_ performance more cleanly by splitting up the actual IO generation and the "user-space mapping" thing sanely. For example, if you want to do an
O_DIRECTread into a buffer, there is no reason why it shouldn't be done in two phases:
This works for your load, but it does not work for the load it is designed for. Sequentially reading and througput is not the way to measure it. You need random reading and lattency to see it's merrits.
Greetings
Bernd
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14 IDE 56)
In reply to Gerrit HuizengaQuoted 8 lines · Linus Torvalds
The thing that has always disturbed me about
O_DIRECTis that the whole interface is just stupid, and was probably designed by a deranged monkey on some serious mind-controlling substances [*].I bet you could get _better_ performance more cleanly by splitting up the actual IO generation and the "user-space mapping" thing sanely. For example, if you want to do an
O_DIRECTread into a buffer, there is no reason why it shouldn't be done in two phases:
You're only halfway right. You want to avoid the mmap altogether. To see why, postulate that you have infinitely fast I/O devices (I know that's not true but it's close enough if you get enough DMA channels going at once, it doesn't take very many to saturate memory). For any server application, now all your time is in the mmap(). And there is no need for it in general, it's just there because the upper layer of the system is too lame to handle real page frames.
Go read the splice notes, ftp://bitmover.com/pub/splice.ps because those were written after we had tuned things enough in IRIX that it was the VM manipulations that became the bottleneck.
Another way to think of it is this: figure out how fast the hardware could move the data. Now make it go that fast. Unless you can hide all the VM crud somehow, you won't achieve 100% of the hardware's capability.
I know I've done a bad job explaining the splice crud, but there is some pretty cool stuff in there, if you really got it, you'd see how the server stuff, the database stuff, the aio stuff, all I/O of any kind can be done in terms of the splice:pull() and splice:push() interfaces and that it is the absolute lowest cost way to have a generic I/O layer.
Signature · 2 lines
--- Larry McVoy lm at bitmover.com http://www.bitmover.com/lm
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14 IDE 56)
Quoted 2 lines · Larry McVoy
You're only halfway right. You want to avoid the mmap altogether.
See my details on doing the perfect zero-copy copy thing.
The mmap doesn't actually touch the page tables - it ends up being nothing but a "placeholder".
So if you do
addr = mmap( .. MAP_UNCACHED .. src .. ) mwrite(dst, addr, len);
then you can think of the mmap as just a "cookie" or the "hose" between the source and the destination.
Does it have to be an mmap? No. But the advantage of the mmap is that you can use the mmap to modify the stream if you want to, quite transparently. And it gives the whole thing a whole lot more flexibility, in that if you generate the data yourself, you'd just do the mwrite() - again with zero copy overhead.
And I personally believe that "generate the data yourself" is actually a very common case. A pure pipe between two places is not what a computer is good at, or what a computer should be used for.
Linus
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14 IDE 56)
Hello Linus ,
On Sat, 11 May 2002, Linus Torvalds wrote:
... Large snip ...
Quoted 3 lines
And I personally believe that "generate the data yourself" is actually a very common case. A pure pipe between two places is not what a computer is good at, or what a computer should be used for.
Hmmm , (This may not apply here But ...)
What about linux as a router (ip/ipx/...) or a bridge device ?
Tia , JimL
+------------------------------------------------------------------+
| James W. Laferriere | System Techniques | Give me VMS |
| Network Engineer | P.O. Box 854 | Give me Linux |
| [email protected] | Coudersport PA 16915 | only on AXP |
+------------------------------------------------------------------+
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14 IDE 56)
In reply to Linus Torvaldsas the person who started this whole thread and made the assertion that copying from A to B is common:
Quoted 3 lines · Linus Torvalds
And I personally believe that "generate the data yourself" is actually a very common case. A pure pipe between two places is not what a computer is good at, or what a computer should be used for.
i think you'd be surprised. if we include "pipe from disk to network" then a large number of 'server' applications do exactly this. webservers do. fileservers do. http caches do. streaming-media servers do.
sure, they may add additional headers on the front and still generate dynamic content in some cases, but the "common case" is 'pipe from disk to network' or 'pipe from network to disk'. 'network' is typically TCP but can be UDP (with rate-limiting) in some cases.
its very good to see this being discussed. thats a large step forward from many people believing the problem was nonexistent.
i'm skeptical that continuing to use the page-cache is the correct way to go -- many of these kinds of applications are doing their own form of memory-management and hot-content 'caching' so are happy to manage a few-to-several hundred megabytes of "page cache equivalent" data themselves. at least on many of the 2.3.xx linux releases, that was one of the big attractions of 'raw' devices -- they didn't get the box into an OOM situation.
if 2.5.xx and recent 2.4.xx has the issues of page-cache-doesn't-shrink-fast-enough solved, then its forseeable it will fly.
cheers,
lincoln.
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14 IDE 56)
In reply to Larry McVoyQuoted 4 lines · Linus Torvalds
See my details on doing the perfect zero-copy copy thing.
The mmap doesn't actually touch the page tables - it ends up being nothing but a "placeholder".
Huh, I must have missed something, does the mmap() not create any page tables at all?
Signature · 2 lines
--- Larry McVoy lm at bitmover.com http://www.bitmover.com/lm
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14 IDE 56)
Quoted 8 lines · Larry McVoy
Quoted 4 lines · Linus Torvalds
See my details on doing the perfect zero-copy copy thing.
The mmap doesn't actually touch the page tables - it ends up being nothing but a "placeholder".
Huh, I must have missed something, does the
mmap()not create any page tables at all?
It can. But go down to the end in my first explanation to see why it doesn't have to.
I'll write up the implementation notes and you'll see what I'm talking about:
- readahead(fd, offset, size)
Obvious (except the readahead is free to ignore the size, it's just a hint)
- mmap( MAP_UNCACHED )
This only sets up the "vma" descriptor (like all other MMAP's). It's exactly like a regular private mapping, except instead of just incrementing the page count on a page-in, it will look at whether the page can just be removed from the page cache and inserted as a private page into the mapping ("stealing" the page).
- fdatasync_area( fd, offset, len)
Obvious. It's fdatasync, except it only guarantees the specific range.
- mwrite(fd, addr, len)
This is really does the "reverse" of mmap(MAP_UNCACHED) (and like a mapping, addr/len have to be page-aligned).
This walks the page tables, and does the _smart_ thing:
- if no mapping exists, it looks at the backing store of the vma, and gets the page directly from the backing store instead of bothering to populate the page tables.
- if the mapped page exists, it removes it from the page table
- in either case, it moves the page it got into the page cache of the destination file descriptor.
NOTE on zero-copy / no-page-fault behaviour:
- mwrite has to walk the page tables _anyway_ (the same as O_DIRECT), since that's the only way to do zero-copy.
- since mwrite has to do that part, it's trivial to notice that the page tables don't exist. In fact, it's a very natural result of the whole algorithm.
- if user space doesn't touch the mapping itself in any way (other than point mwrite() at it), you never build up any page tables at all, and you never even need to touch the TLB (ie no flushes, no nothing).
- note how even "mmap( MAP_UNCACHED )" doesn't actually touch the TLB or the page tables (unless it uses MAP_FIXED and you use it to unmap a previous area, of course - that's all in the normal mmap code already)
See?
I will _guarantee_ that this is more efficient than any O_DIRECT ever was, and it will get very close to your "optimal" thing (it does need to look at some page tables, but since the page tables haven't ever really needed to be built up for the pure copy case, it will be able to decide that the page isn't there from the top-level page table if you align the virtual area properly - ie at 4MB boundaries on an x86).
I suspect that this is about a few hundred lines of code (and a lot of testing). And you can emulate O_DIRECT behaviour with it, along with splice (only for page-cache entities, though), and a lot of other off-by-one uses.
Linus
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14 IDE 56)
In message <[email protected]>, > : Lin
Quoted 9 lines · us Torvalds
Quoted 5 lines · Larry McVoy
Quoted 4 lines · Linus Torvalds
See my details on doing the perfect zero-copy copy thing.
The mmap doesn't actually touch the page tables - it ends up being nothing but a "placeholder".
Quoted 7 lines
I'll write up the implementation notes and you'll see what I'm talking about:
-
readahead(fd, offset, size)Obvious (except the readahead is free to ignore the size, it's just a hint)
[...snip... lots of good ideas...]
I'm not sure this is quite the same problem that Oracle (and others) typically used O_DIRECT for (not trying to be an apologist here, just making sure the right problem gets solved)...
Most of what Oracle was managing with O_DIRECT was its "Shared Global Area", which is usually a region of all possible memory that the OS and other applications aren't using. It uses that space like a giant buffer cache. Most of the IO's for OLTP applications were little bitty random 2K IOs. So, their ideal goal was to have the ability to say here's a list of 10,000 random 2K IOs I want you to do really quickly and spread them out at these spots within the SGS. Those IOs can be read asynchronously, but there needs to be some way to know when the bits make it from disk to memory. Think of it as something like a big async readv, ideally with the buffer cache and as much of the OS out of the way as possible.
When the SGA is "full" (memory pressure) they do big async, no buffer cache, non-deferred writev's (by non deferred, I mean that the write is actually scheduled for disk, not buffered in memory indefinitely - they really believe they are done with those buffers).
Now the mmap( MAP_UNCACHED ) thing might work, except that this isn't really a private mapping - it's a shared mapping. So something like tmpfs might be the answer, where the tmpfs had a property of being uncached (in fact, Oracle would love it if that space were pinned into memory/non-pageable/non-swappable). That way the clients don't block taking page faults and the server schedules activities to get the greatest throughput (e.g. schedule clients who wouldn't block).
Unfortunately, tmpfs takes away the niceness of the VM optimizations, I fear.
Oh, and Database DSS workloads (Decision Support, scan all disks looking for needles in a big haystack) has different tradeoffs, mostly needing to focus on lots of sequential IO where pre-fetching and reading, and discard buffers immediately after use are the primary focus and write performance is not critical.
gerrit
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14 IDE 56)
In reply to Larry McVoyWe did some i/o profiling about 6 years ago on a big scientific
app that had started in fortran and had been rewritten in c++
the fortran code used r/w on files and used temp files
the c++ did memmaps and had big data structures - taking advantage of memory management.
one thing I thought was interesting is that it was easy to see how a smart algorithm, not even such a smart one, could adapt i/o to the patterns of i/o in the fortran code, but the c++ i/o patters were really complex.
when everything goes into the page cache, it seems like you will loose information.
Quoted 40 lines · Lincoln Dale
as the person who started this whole thread and made the assertion that copying from A to B is common:
Quoted 3 lines · Linus Torvalds
And I personally believe that "generate the data yourself" is actually a very common case. A pure pipe between two places is not what a computer is good at, or what a computer should be used for.
i think you'd be surprised. if we include "pipe from disk to network" then a large number of 'server' applications do exactly this. webservers do. fileservers do. http caches do. streaming-media servers do.
sure, they may add additional headers on the front and still generate dynamic content in some cases, but the "common case" is 'pipe from disk to network' or 'pipe from network to disk'.
'network' is typically TCP but can be UDP (with rate-limiting) in some cases.its very good to see this being discussed. thats a large step forward from many people believing the problem was nonexistent.
i'm skeptical that continuing to use the page-cache is the correct way to go -- many of these kinds of applications are doing their own form of memory-management and hot-content 'caching' so are happy to manage a few-to-several hundred megabytes of "page cache equivalent" data themselves. at least on many of the 2.3.xx linux releases, that was one of the big attractions of 'raw' devices -- they didn't get the box into an OOM situation. if 2.5.xx and recent 2.4.xx has the issues of page-cache-doesn't-shrink-fast-enough solved, then its forseeable it will fly.
cheers,
lincoln.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 4 lines
--------------------------------------------------------- Victor Yodaiken Finite State Machine Labs: The RTLinux Company. www.fsmlabs.com www.rtlinux.com
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14 IDE 56)
In reply to Larry McVoyQuoted 10 lines · [email protected] wrote:
We did some i/o profiling about 6 years ago on a big scientific
app that had started in fortran and had been rewritten in c++
the fortran code used r/w on files and used temp files
the c++ did memmaps and had big data structures - taking advantage of memory management.
one thing I thought was interesting is that it was easy to see how a smart algorithm, not even such a smart one, could adapt i/o to the patterns of i/o in the fortran code, but the c++ i/o patters were really complex.
Quoted 3 lines
when everything goes into the page cache, it seems like you will loose information.
That is certainly the case. If the application is seekily writing to a file then we currently lay the file out on-disk in the order in which the application seeked. So reading the file back linearly is very slow.
Now this is not necessarily a bad thing - if the file was created seekily then it will probably be _used_ seekily so no big loss probably.
This problem is pretty unsolvable for filesystems which map blocks to their disk address at write(2) time. It can be solved for allocate-on-flush filesystems via a sort of the dirty page list, or by maintaining ->dirty_pages in a tree or whatever.
There is one "file" where this problem really does matter - the blockdev mapping "/dev/hda1". It is both highly fragmented and poorly sorted on the dirty_pages list.
It's pretty trivial to perform a sillysort at writeout time:
if we just wrote page N and the next page isn't N+1 then do a
pagecache probe for "N+1". That's probably sufficient. If
not, there's a simple little sort routine over at
http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html
which is appropriate to our lists.
I'll be taking a look at the sillysort option once I've cleared away some other I/O scheduling glitches.
-
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14 IDE 56)
In reply to Gerrit HuizengaQuoted 8 lines · Linus Torvalds
(1) readahead: allocate pages, and start the IO asynchronously
(2) mmap the file with aMAP_UNCACHEDflag, which causes read-faults to "steal" the page from the page cache and make it private to the mapping on page faults.If you split it up like that, you can do much more interesting things than
O_DIRECTcan do (ie the above is inherently asynchronous - we'll wait only for IO to complete when the page is actually faulted in).
I've never liked mmap although that may just be my advanced age ("we never had mmap, we copied files by cutting cuneiform in fresh
clay tablets, the way the gods intended ")
struct kio k;
k.count = RECORDSIZE;
fd1 = open("inputfile",KIO_READ);
fd1a = dup(fd1); //dup creates a non KIO descript for the samefile
fd2 = open("outputfile",KIO_WRITE);
while( (n=read(fd1,&k,sizeof struct kio)
{
write(fd2,&k,sizof struct kio);
if(k.seekposition%10000){
write(fd1a,"Another record sent,Mr E.\n",GROVELSIZE);
}
}Quoted 3 lines
Sadly, database people don't seem to have any understanding of good taste, and various OS people end up usually just saying "Yes, Mr Oracle, I'll open up any orifice I have for your pleasure".
When you drive by that campus in redwood city you start to understand how insignificant you are.
Signature · 4 lines
--------------------------------------------------------- Victor Yodaiken Finite State Machine Labs: The RTLinux Company. www.fsmlabs.com www.rtlinux.com
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14 IDE 56)
In reply to Linus TorvaldsQuoted 9 lines · Linus Torvalds
Quoted 2 lines · Lincoln Dale
so
O_DIRECTin 2.4.18 still shows up as a 55% performance hit versus noO_DIRECT. anyone have any clues?Yes.
O_DIRECTisn't doing any read-ahead.For
O_DIRECTto be a win, you need to make it asynchronous.
Will the use of O_DIRECT affect disk elevatoring?
Sorry if this is OT - I just need to know
Please cc: to me as I'm not on the list
roy
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14 IDE 56)
Quoted 1 line · Roy Sigurd Karlsbakk
Will the use of
O_DIRECTaffect disk elevatoring?
i believe the elevator is based on the 'block' layer and anything that goes thru it. so the answer is that the requests would use the elevator.
for the test in question, i was doing sequential reads from the first block of each disk until some block later on in the disk. (ie. a 2gbyte read or 18gbyte read). given that was the case and the only i/o ops were 'read' operations, elevator would make no difference here.
cheers,
lincoln.
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14 IDE 56)
In reply to Linus TorvaldsQuoted 5 lines · Roy Sigurd Karlsbakk
Quoted 4 lines · Linus Torvalds
Quoted 2 lines · Lincoln Dale
so
O_DIRECTin 2.4.18 still shows up as a 55% performance hit versus noO_DIRECT. anyone have any clues?
Quoted 7 lines
Quoted 5 lines
Yes.
O_DIRECTisn't doing any read-ahead.For
O_DIRECTto be a win, you need to make it asynchronous.Will the use of
O_DIRECTaffect disk elevatoring?
No, the I/O scheduler can't even tell whether it's being handed O_DIRECT buffers or not.
Jens
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14 IDE 56)
Quoted 8 lines · In message <[email protected]>, > : Jens Axboe writes:
Quoted 7 lines · Roy Sigurd Karlsbakk
Quoted 6 lines · Linus Torvalds
Quoted 2 lines · Lincoln Dale
so
O_DIRECTin 2.4.18 still shows up as a 55% performance hit versus noO_DIRECT. anyone have any clues?Yes.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
O_DIRECTisn't doing any read-ahead.For
O_DIRECTto be a win, you need to make it asynchronous.Will the use of
O_DIRECTaffect disk elevatoring?No, the I/O scheduler can't even tell whether it's being handed
O_DIRECTbuffers or not.
We tried disabling the elevator while doing Raw IO with DB2 a couple of weeks ago. The database performance degraded much more than expected. Disks were FC connected Tritons or SCSI connected ServerRaid (or both?). Oracle often asks for a patch to disable the elevator since they believe they can schedule IO better. We didn't try with Oracle in this case, but DB2 and RAW IO without and elevator was not a good choice.
gerrit
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14 IDE 56)
In reply to Jens AxboeQuoted 13 lines · Gerrit Huizenga
Quoted 12 lines · In message <[email protected]>, > : Jens Axboe writes:
Quoted 11 lines · Roy Sigurd Karlsbakk
Quoted 9 lines · Linus Torvalds
Quoted 2 lines · Lincoln Dale
so
O_DIRECTin 2.4.18 still shows up as a 55% performance hit versus noO_DIRECT. anyone have any clues?Yes.
O_DIRECTisn't doing any read-ahead.For
O_DIRECTto be a win, you need to make it asynchronous.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Will the use of
O_DIRECTaffect disk elevatoring?No, the I/O scheduler can't even tell whether it's being handed
O_DIRECTbuffers or not.We tried disabling the elevator while doing Raw IO with DB2 a couple of weeks ago. The database performance degraded much
I'm curious how you did this -- did you disable sorting and merging, or just sorting? Merging is pretty essential to getting decent I/O speeds in current kernels.
Quoted 5 lines
more than expected. Disks were FC connected Tritons or SCSI connected ServerRaid (or both?). Oracle often asks for a patch to disable the elevator since they believe they can schedule IO better. We didn't try with Oracle in this case, but DB2 and RAW IO without and elevator was not a good choice.
Due to excessive queue scan times, lock contention, or just slight waste of cycles?
Signature · 1 line
Jens Axboe
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14 IDE 56)
Quoted 19 lines · In message <[email protected]>, > : Jens Axboe writes:
Quoted 18 lines · Gerrit Huizenga
Quoted 16 lines · In message <[email protected]>, > : Jens Axboe writes:
Quoted 5 lines · Roy Sigurd Karlsbakk
Quoted 4 lines · Linus Torvalds
Quoted 2 lines · Lincoln Dale
so
O_DIRECTin 2.4.18 still shows up as a 55% performance hit versus noO_DIRECT. anyone have any clues?Quoted 7 lines
Quoted 5 lines
Yes.
O_DIRECTisn't doing any read-ahead.For
O_DIRECTto be a win, you need to make it asynchronous.Will the use of
O_DIRECTaffect disk elevatoring?No, the I/O scheduler can't even tell whether it's being handed
O_DIRECTbuffers or not.
Quoted 6 lines
Quoted 2 lines
We tried disabling the elevator while doing Raw IO with DB2 a couple of weeks ago. The database performance degraded much
I'm curious how you did this -- did you disable sorting and merging, or just sorting? Merging is pretty essential to getting decent I/O speeds in current kernels.
I believe sorting AND merging were turned off. BTW, this was 2.4 only, our primary focus is getting product into people's hands this year. We are hoping to play with the 2.5 IO scheduler, possibly in a few months.
Quoted 8 lines
Quoted 5 lines
more than expected. Disks were FC connected Tritons or SCSI connected ServerRaid (or both?). Oracle often asks for a patch to disable the elevator since they believe they can schedule IO better. We didn't try with Oracle in this case, but DB2 and RAW IO without and elevator was not a good choice.
Due to excessive queue scan times, lock contention, or just slight waste of cycles?
A lot more interrupts on the RAID device, indicating a lot more IOs, probably a direct result of disabling merging. Overall IO throughput dropped pretty dramatically, reducing database throughput.
A good indication to gen a patch with just sorting turned off and see where that gets us...
gerrit
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14IDE 56)
In reply to Andrew MortonQuoted 4 lines · Lincoln Dale
Quoted 2 lines · Andrew Morton
Quoted 2 lines
/dev/md0 raid-0 with O_DIRECT: 91847kbyte/sec (2781usec /dev/md0
Quoted 8 lines
Quoted 5 lines
raid-0: 129455kbyte/sec (1978usec
Quoted 1 line
/dev/md0 raid-0 with O_NOCOPY: 195868kbyte/sec (1297usechmm. Why is
O_DIRECTalways the slowest? (and it would presumably do even worse with an 8k transfer size).i just reproduced the test to validate the data. i'm using 8kbyte blocks here. on kernel is 2.4.18,
O_DIRECTis still the slowest.
8k would rather disadvantage O_DIRECT. It can't do readahead and it can't to write-behind. It'll be forced to do tons of tiny I/Os.
Quoted 3 lines
...
the biggest difference here is
bounce_end_io_readinO_DIRECT.
Well hopefully that will be gone in 2.4.20, for many popular controllers.
Not sure why it bit you here. It could be that the page allocator just happened to give you highmem pages for the O_DIRECT test. Turning off highmem may make the test more repeatable.
Quoted 2 lines
given there's still lots of idle-time, i'll file up lockmeter on here and see if theres any gremlins there.
lockmeter will go off the dial. All those copies happen at interrupt time, inside the global io_request_lock. It's horrid.
Try it with the block-highmem patch:
http://www.kernel.org/pub/linux/kernel/people/andrea/kernels/v2.4/2.4.19pre1aa1/00_block-highmem-all-18b-4.gz
-
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14IDE 56)
Quoted 3 lines · Andrew Morton
Try it with the block-highmem patch:
given i had to recompile the kernel to add lockmeter, i'd already cheated and changed PAGE_OFFSET from 0xc0000000 to 0x80000000, obviating the requirement for highmem altogether.
being fair to O_DIRECT and giving it 1mbyte disk-reads to work with and giving normal i/o 8kbyte reads to work with.
still using 2.4.18 with profile=2 enabled and lockmeter in the kernel but not turned on. still using the same disk spindles (just 6 this time), each a 18G 15K RPM disk spindle. i got tired of scanning the entire available space on an 18G disk so just dropped the test down to the first 2G of each disk.
O_DIRECT is still a ~30% performance hit versus just talking to the /dev/sdX device directly. profile traces at bottom.
normal block-device disks sd[m-r] without O_DIRECT, 64K x 8k reads:
[root@mel-stglab-host1 src]# readprofile -r;
./test_disk_performance blocks=64K bs=8k /dev/sd[m-r]
Completed reading 12000 mbytes in 125.028612 seconds (95.98 Mbytes/sec), 76usec mean
normal block-device disks sd[m-r] with O_DIRECT, 5K x 1 megabyte reads:
[root@mel-stglab-host1 src]# readprofile -r;
./test_disk_performance blocks=5K bs=1m direct /dev/sd[m-r]
Completed reading 12000 mbytes in 182.492975 seconds (65.76 Mbytes/sec), 15416usec mean
for interests-sake, compare this to using the 'raw' versions of the same disks:
[root@mel-stglab-host1 src]# readprofile -r;
./test_disk_performance blocks=5K bs=1m /dev/raw/raw[2-7]
Completed reading 12000 mbytes in 206.346371 seconds (58.15 Mbytes/sec), 16860usec mean
of course, these are all ~25% worse than if a mechanism of performing the i/o avoiding the copy_to_user() altogether:
[root@mel-stglab-host1 src]# readprofile -r;
./test_disk_performance blocks=64K bs=8k nocopy /dev/sd[m-r]
Completed reading 12000 mbytes in 97.846938 seconds (122.64 Mbytes/sec), 59usec mean
anyone want to see any other benchmarks performed? would a comparison to 2.5.x be useful?
comparative profile=2 traces:
- no O_DIRECT:
[root@mel-stglab-host1 src]# readprofile -v | sort -n -k3 | tail -10
80125060 _spin_lock_ 718 6.4107
8013bfc0 brw_kiovec 798 0.9591
801cbb40 generic_make_request 830 2.8819
801f9400 scsi_init_io_vc 831 2.2582
8013c840 try_to_free_buffers 1198 3.4034
8013a190 end_buffer_io_async 2453 12.7760
8012b100 file_read_actor 3459 36.0312
801cb4e0 __make_request 7532 4.6152
80105220 default_idle 106468 1663.5625
00000000 total 134102 0.0726 - O_DIRECT, disks /dev/sd[m-r]:
[root@mel-stglab-host1 src]# readprofile -v | sort -n -k3 | tail -10
801cbb40 generic_make_request 72 0.2500
8013ab00 set_bh_page 73 1.1406
801cbc60 submit_bh 116 1.0357
801f72a0 __scsi_end_request 133 0.4618
80139540 unlock_buffer 139 1.7375
8013bf10 end_buffer_io_kiobuf 302 4.7188
8013bfc0 brw_kiovec 357 0.4291
801cb4e0 __make_request 995 0.6097
80105220 default_idle 34243 535.0469
00000000 total 37101 0.0201- /dev/raw/raw[2-7]:
[root@mel-stglab-host1 src]# readprofile -v | sort -n -k3 | tail -10
8013bf50 wait_kio 349 3.1161
801cbb40 generic_make_request 461 1.6007
801cbc60 submit_bh 526 4.6964
80139540 unlock_buffer 666 8.3250
801f72a0 __scsi_end_request 699 2.4271
8013bf10 end_buffer_io_kiobuf 1672 26.1250
8013bfc0 brw_kiovec 1906 2.2909
801cb4e0 __make_request 10495 6.4308
80105220 default_idle 84418 1319.0312
00000000 total 103516 0.0560 - O_NOCOPY hack: (userspace doesn't actually get the read data)
801f9400 scsi_init_io_vc 785 2.1332
8013c840 try_to_free_buffers 950 2.6989
801f72a0 __scsi_end_request 966 3.3542
801cbb40 generic_make_request 1017 3.5312
8013bf10 end_buffer_io_kiobuf 1672 26.1250
8013a190 end_buffer_io_async 1693 8.8177
8013bfc0 brw_kiovec 1906 2.2909
801cb4e0 __make_request 13682 8.3836
80105220 default_idle 112345 1755.3906
00000000 total 144891 0.0784Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14IDE 56)
Quoted 72 lines · Lincoln Dale
Quoted 2 lines · Andrea Arcangeli
Quoted 2 lines
being fair to
O_DIRECTand giving it 1mbyte disk-reads to work with and giving normal i/o 8kbyte reads to work with...
Quoted 1 line
is any of the disks mounted?
no.
for theO_DIRECTtests i also didn't have the MD driver touching them. (ie. raidstop /dev/md[0-1]).Quoted 10 lines
Quoted 8 lines
O_DIRECTis still a ~30% performance hit versus just talking to the/dev/sdXdevice directly. profile traces at bottom.normal block-device disks sd[m-r] without
O_DIRECT, 64K x 8k reads:[root@mel-stglab-host1 src]# readprofile -r; ./test_disk_performance blocks=64K bs=8k /dev/sd[m-r] Completed reading 12000 mbytes in 125.028612 seconds (95.98Mbytes/sec), 76usec mean
can you post your
test_disk_performanceprogrami'll post the program later on this weekend. (its suffering from continual scope-creap and additional development. :) ).
but basically, its similar to 'dd' except works on multiple devices simultaneously.
operation consists of sequential-reads or sequential-writes.its main loop basically consists entirely of:
/* loop thru blocks */ for (blocknum=0; blocknum < blocks; blocknum++) { /* loop thru devices */ for (devicenum=0; devicenum < num_devices; devicenum++) { before_time = time_tick(); if (operation == 0) { /* read op */ amt_read = read(fd[devicenum], aligned_buffer[devicenum], block_size); } else { /* write-op */ amt_read = write(fd[devicenum], aligned_buffer[devicenum], block_size); } after_time = time_tick(); [check amt_read == block_size, calculate time histograms] } }the open call consists of:
for (i=0; i < num_devices; i++) { flags = (O_RDWR | O_LARGEFILE); if (nocopy) flags |= O_NOCOPY; if (direct) flags |= O_DIRECT; fd[i] = open(devices[i], flags); ...i've since 'expanded' its functionality a bit so that i can do tests where i'm rate-limiting different devices to different limits, variable read/write/seeks, etc etc.
Quoted 2 lines
so I in particular we
can see the semantics of blocks and bs? 64k*8k == 5k * 1M / 10.K == 1000
k == 1024
M == 1000*1000
m == 1024*1024
g == 1024*1024*1024
G == 1000*1000*1000
Quoted 3 lines
so the above is:
blocks = 64K, bs=8k means 64000 x 8192-byte read()s = 524288000 bytes blocks = 5K, bs=1m means 5000 x 1048576-byte read()s = 5242880000 bytes
if the program is doing only what shown in the main loop, then you're reading 10 times more data with O_DIRECT, that was my point in saying 64k*8k == 5k * 1M / 10, but I assume you took it into account (otherwise it means O_DIRECT is just 5 times faster than buffered-I/O for you)
Also I would suggest to measure the time taken by the whole workload, not only the time for read/write syscalls.
Quoted 9 lines
Quoted 7 lines
O_DIRECThas to do some more work to check for the coherency with the pagecache and it has some more overhead with the address space operations, butO_DIRECTby default uses the blocksize of the blkdev, that is set to 1k by default (if you never mounted it) versus the hardblocksize of 512bytes used by the raw device (assuming the sd[m-r] aren't mounted).i wonder if the MD driver set it to 512 bytes if it has been touched.
it is set to 512 bytes.
Quoted 8 lines
i'll reboot the box after each test to validate. (which, unfortunately, is about a 10 minute reboot cycle for 22 x SCSI disks and 16 FC disks).
Quoted 3 lines
This is most probably why
O_DIRECTis faster thanraw.c, otherwise they would run almost at the same rate, the pagecache coherency fast paths and the address space ops overhead ofO_DIRECTshouldn't be noticeable.as the statistics show,
O_DIRECTis about 5% superior toraw.c.
yep, as said that's because O_DIRECT uses the softblocksize (1k) large b_size, while raw uses the hardblocksize that is 512bytes, so raw wastes 2 times more memory and cpu in handling those list of smaller bh. That is fair comparison with the buffered-IO, also the buffered-IO uses 1k b_size.
Quoted 15 lines
Quoted 8 lines
Quoted 7 lines
of course, these are all ~25% worse than if a mechanism of performing the i/o avoiding the
copy_to_user()altogether:[root@mel-stglab-host1 src]# readprofile -r; ./test_disk_performance blocks=64K bs=8k nocopy /dev/sd[m-r] Completed reading 12000 mbytes in 97.846938 seconds (122.64Mbytes/sec), 59usec mean
Quoted 6 lines
the nocopy hack is not an interesting test for O_DIRECT/rawio, it doesn't walk pagetables, it doesn't allow the DMA to be done into userspace memory. If you want the pagecache to be visible into userspace (i.e. MAP_PRIVATE/MAP_SHARED) you must deal with pagetables somehow, and if you want the read/write syscalls to DMA directly into userspace memory (raw/O_DIRECT) you must still walk pagetables during those
Quoted 7 lines
the nocopy hack is interesting from the point-of-view of seeing what the
copy_to_user()overhead actually is.
it is interesting to compare that toO_DIRECT.i agree that doing pagecache-visible-in-userspace is hard to get right and to do it fast.
but i'm not proposing any such development.
Yes, I only wanted to make clear the no-copy hack will always be faster then anything that ends putting the data in user memory (or providing information where the data in userspace is) somehow.
Quoted 3 lines
what i am thinking is "interesting" is for privileged programs which can
mmap()/dev/memand have some async-i/o scheme which returns back physical-address information about blocks.
You'd at least need to reserve only a contigous part of the physical pages for that purposes, or you would run out of virtual address space on a 32bit arch, that just is a problem with fragmentation. Secondly you should use such mmapped /dev/mem area as your backing store for the application cache or it's again a copy-user. It seems very messy. I think writing a software TLB for a certain special VMA allowing the resolution of a virtual address in the VMA to a struct page with a very efficient lookup would be better if something to skip the overhead of the pagetable management. And it doesn't need special userspace hacks with horrible API.
Quoted 44 lines
sure, it has a lot of potential-security-issues associated with it, and isn't useful for anything but really big-iron program, but so has other schemes that involve "lets put this userspace module in the kernel to avoid user<->kernel copies".
Quoted 5 lines
syscalls before starting the DMA. If you don't want to explicitly deal with the pagetables then you need to
copy_user(case 1). In most archs where mem bandwith is very expensive avoiding the copy-user is a big global win (other cpus won't collapse in smp etc..).Quoted 8 lines
Your nocopy hack benchmark has some relevance only for usages of the data done by kernel. So if it is the kernel that reads the data directly from pagecache (i.e. a kernel module), then your nocopy benchmark matters. For example your nocopy benchmark also matters for sendfile zerocopy, it will read at 122M/sec. But if it's userspace supposed to receive the data (so not directly from pagecache on the kernel direct mapping, but in userspace mapped memory) it cannot be 122M/sec, it has to be less due the user address space management.
i guess i simply see that there are a bunch of possible big-iron programs which:
- read from [raw] disk
- write results to network
- don't actually look at the payloada few program like this that come to mind are:
- Samba
- (user-space) NFS
- [HTTP] caching softwareQuoted 1 line
Quoted 1 line
comparative profile=2 traces:
...
Quoted 3 lines
Can you use -k4? this is the number of hits per function, but we should take the size of the function into account too. Otherwise small functions won't show up.
will do.
Quoted 3 lines
Can you also give a spin to the same benchmark with 2.4.19pre8aa2? It has the vary-io stuff from Badari and futher kiobuf optimization from Chuck.
will do so.
Quoted 8 lines
Quoted 4 lines
(vary-io will work only with aic and qlogic, enabling it is a one liner if the driver is just ok with variable
bh->b_sizein the same I/O request). right fix for avoiding the flood of small bh is bio in 2.5, for 2.4 vary-io should be fine.i'm using the qlogic HBA driver from their web-site rather than the current driver in the kernel which doesn't function with the 2gbit/s HBAs. care to point out the line i should be looking for to change?
Sure just search the .h file for something like this:
#define QLOGICISP { \
detect: isp1020_detect, \
release: isp1020_release, \
info: isp1020_info, \
queuecommand: isp1020_queuecommand, \
abort: isp1020_abort, \
reset: isp1020_reset, \
bios_param: isp1020_biosparam, \
can_queue: QLOGICISP_REQ_QUEUE_LEN, \
this_id: -1, \
sg_tablesize: QLOGICISP_MAX_SG(QLOGICISP_REQ_QUEUE_LEN), \
cmd_per_lun: 1, \
present: 0, \
unchecked_isa_dma: 0, \
use_clustering: DISABLE_CLUSTERING, \
can_do_varyio: 1, \
}and add can_do_varyio: 1 like in the above file for qlogicisp.h.
(btw, then the vary-io will allow more efficient I/O handling than the buffered-IO, so it would get unfair with the so underpowered buffered-IO, but still it would be interesting to see the effect of varyio in numbers)
You also mentioned the md device. If you do I/O to a raid0 array with 5 disks attached to an MD device then your buffersize with O_DIRECT must be 5*512k at least or you cannot send bit large scsi commands to each scsi disk and performance would be very bad compared to reading 1M from each /dev/sd separately.
One thing I would also recommend is to write a threaded version of the program, that reads or writes to all the /dev/sd disks simultaneously, first w/ O_DIRECT then w/o O_DIRECT. The reason is that currently you aren't using all the disks at once with O_DIRECT due the lack of async-io, while for example async-writeback w/o O_DIRECT allows a better scaling over the disks, not to tell the fact you only benchmark the duration of the syscall sounds not accurate if async I/O happens over userspace (userspace can get stalled by completion interrupts etc.. and you're not measuring such overhead).
If you instead make a single raid0 array and you use a buffer size of nr_PV*512k (or nr_PV*1M even better) then also O_DIRECT without threading should perform similar to the buffered IO.
In my measurements the lack of async-io with O_DIRECT (with a single disk) wasn't significant in the bandwith numbers, let's say a few percent slower than the buffered-IO, but the CPU utilization and mem bandwith was so much optimized that I thought it definitely pays off even now without a kernel side async-io (note that I wasn't doing simultaneous I/O to multiple devices, futhmore the bandwith of the membus was not shared with any other workload).
Since you "stripe" by hand in all disks you do a different workload than my previous benchs and you definitely want to keep all the harddisk running at the same time. I would also suggest to benchmark a single disk, to see if there is still such a big performance difference (again: including the cost outside the syscalls too).
Thanks for the interesting big-iron number-feedback :)
Andrea
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14IDE 56)
Quoted 8 lines · Andrea Arcangeli
Quoted 3 lines
so the above is:
blocks = 64K, bs=8k means 64000 x 8192-byte read()s = 524288000 bytes blocks = 5K, bs=1m means 5000 x 1048576-byte read()s = 5242880000 bytesif the program is doing only what shown in the main loop, then you're reading 10 times more data with
O_DIRECT, that was my point in saying 64k*8k == 5k * 1M / 10, but I assume you took it into account (otherwise it meansO_DIRECTis just 5 times faster than buffered-I/O for you)
no- count them up above.
without O_DIRECT i was doing: 64000 x 8192 = 524288000 bytes with O_DIRECT i was doing: 5000 x 1048576 = 524288000 bytes.
ie. same amount of data.
regardless, the "mbyte/sec" is calculated at the very end.
Quoted 2 lines
Also I would suggest to measure the time taken by the whole workload, not only the time for read/write syscalls.
the time taken for the whole workload _is_ calculated at the very end of the workload. that way and "readahead" doesn't have an unfair advantage. i also have gettimeofday() calls to measure latency on a per-read or per-write basis
...
Quoted 4 lines
One thing I would also recommend is to write a threaded version of the program, that reads or writes to all the
/dev/sddisks simultaneously, first w/O_DIRECTthen w/oO_DIRECT. The reason is that currently you aren't using all the disks at once withO_DIRECTdue the lack of async-io
i've thought about doing that - shame that there isn't an async version of read(). the hard part is that i want to keep the disks at roughly the same "block" at the same time, so there will still need to be some syncronization of threads. otherwise, basic SCSI id priority means that it won't be fair across all disks. (remeber that i'm also attempting to measure latency)
...
Quoted 5 lines
Since you "stripe" by hand in all disks you do a different workload than my previous benchs and you definitely want to keep all the harddisk running at the same time. I would also suggest to benchmark a single disk, to see if there is still such a big performance difference (again: including the cost outside the syscalls too).
a single-disk means we hit the performance limits of a single disk spindle. ie. around 45mbyte/sec sustained throughput. if you don't think there's any real overhead in the MD driver, i'll just use that instead for now. (raid-0)
Quoted 1 line
Thanks for the interesting big-iron number-feedback :)
kinda fun. :-)
cheers,
lincoln.
Re: O_DIRECT on 2.4.19pre8aa2 md device
Quoted 11 lines · Lincoln Dale
g'day,
Quoted 2 lines · Andrea Arcangeli
I think raid0 is a good start to make all disks running at the same time for
O_DIRECTtoo (only make sure to use a buffer large nr_PV*512k orsame hardware as before -- dual P3 Xeon (733MHz), 133MHz FSB, 2G PC133 SDRAM.
this time, a raid-0 array using MD driver across 8 x 18G 15K RPM disks. md driver is using "128k chunks".
Quoted 7 lines
kernel is 2.4.19pre8aa2 with the qlogic 2300 HBA driver compiled with
vary_ioset to 1. FC network is all 2gbit/s. no highmem. kernel is booted using "profile=2" and has lockmeter compiled in also. system rebooted after each test.i promise its the same amount of data for each test this time: :-)
O_DIRECTblocksize = 4 megabytes, blocks = 28000: 112000 mbytes in
btw, since you've 8 disks it probably would be a bit faster with 8meg, so you submit at least 2 scsi commands for each disk at the same time, not only 1.
Quoted 5 lines
977.869706 seconds (120.10 Mbytes/sec)
'raw' blocksize = 4 megabytes, blocks = 28000: 112000 mbytes in
1659.551271 seconds (70.77 Mbytes/sec)
base blocksize = 8 kilobytes, blocks = 14336000: 112000 mbytes
in 918.287570 seconds (127.89 Mbytes/sec)
120 vs 127 is pretty good, also considering an 8meg buffer may be enough to give you such 7 mbyte/sec back too.
Quoted 4 lines
nocopy hack: blocksize = 8 kilobytes, blocks = 14336000: 112000 mbytes
in 671.560772 seconds (174.88 Mbytes/sec)net-effect is that
O_DIRECTstill has a performance hit versus base, 'raw'
yes, a performance hit in absolute disk performance is expected due the additional synchronization after each read/write syscall returns (the synchronous beahviour), if the mem bandwith is very high and the mem bandwith and cpu is otherwise unused, so if the machine is completly dedicated to I/O and the mem bandwith is high. But look at the profiling...
Quoted 25 lines
just sucks wind versus the others, even 'nocopy' cannot hit line-rate on the fibre-channel card. (its possible to hit 205mbytes/sec using
sg_toolssg_readorsg_dd).
O_DIRECT:[root@mel-stglab-host1 src]# readprofile -r; ./test_disk_performance bs=4m blocks=28000 direct /dev/md0 > /tmp/vary_direct.txt; readprofile -v | sort -n -k4 >> /tmp/vary_direct.txt Completed reading 112000 mbytes in 977.869706 seconds (120.10Mbytes/sec), 34849usec mean
[root@mel-stglab-host1 tmp]# tail -20 vary_direct.txt 8012aa50 mark_dirty_kiobuf 234 2.0893 8013f0e0 set_bh_page 134 2.0938 801d28b0 generic_make_request 785 2.5822 80136d40 __free_pages 137 2.8542 80142a10 max_block 406 3.1719 8011f950 do_softirq 724 3.2321 801405d0 brw_kiovec 3219 3.5296 80271370 md_make_request 484 4.3214 80200fb0 __scsi_end_request 1321 4.3454 8023d670 sd_find_queue 334 5.2188 80142c80 blkdev_get_block 358 5.5938 80140560 wait_kio 690 6.1607
Quoted 8 lines
80152820 end_kio_request 601 7.5125
80267320 raid0_make_request 3059 9.1042
8013e950 init_buffer 310 9.6875
801d29e0 submit_bh 1274 11.3750
801d22a0 __make_request 20967 13.5097
8013dd10 unlock_buffer 1283 16.0375
80140520 end_buffer_io_kiobuf 2946 46.0312
80106d20 default_idle 151886 2373.2188here you see the machine was basically idle for the whole time.
Quoted 20 lines
base:
[root@mel-stglab-host1 src]# readprofile -r; ./test_disk_performance bs=8k blocks=14336000 /dev/md0 > /tmp/vary_base.txt; readprofile -v | sort -n -k4 >> /tmp/vary_base.txt Completed reading 112000 mbytes in 918.287570 seconds (127.89Mbytes/sec), 63usec mean
[root@mel-stglab-host1 src]# tail -20 /tmp/vary_base.txt 80135010 delta_nr_cache_pages 591 6.1562 80203890 scsi_init_io_vc 3448 6.3382 801288b0 _spin_unlock_ 894 6.9844 8013f380 create_empty_buffers 717 7.4688 80133e60 kmem_cache_alloc 2152 7.9118 80267320 raid0_make_request 3125 9.3006 801d28b0 generic_make_request 2861 9.4112 801d29e0 submit_bh 1304 11.6429 8013f0e0 set_bh_page 795 12.4219 80108a48 system_call 766 13.6786 801d22a0 __make_request 23675 15.2545 8012e0c0 unlock_page 1990 15.5469
Quoted 8 lines
80140ea0 try_to_free_buffers 5294 15.7560
801340e0 kmem_cache_free 2563 20.0234
80136d40 __free_pages 1012 21.0833
801298cc .text.lock.lockmeter 3129 21.1419
801287d0 _spin_lock_ 4097 36.5804
8013e970 end_buffer_io_async 9310 48.4896
8012edd0 file_read_actor 26102 233.0536
80106d20 default_idle 59883 935.6719and here the machine was almost completly loaded in the file_read_actor, it was unusable for anything other than I/O.
To make a similar example my first pentium had a very slow harddisk that in DMA mode was running 10/20% slower than in PIO mode, but the cpu utilization of the DMA mode was so much lower that DMA was an huge global win during kernel compiles etc...
In any real usage where I/O is combined with CPU and mem bus utilization for computations, not only to move data from disk to userspace memory O_DIRECT is an _huge_ win as you found out. You have 100000 more usable ticks for computations over 150000 total ticks. I didn't do exact math but a rough measure is that with "buffered I/O" (i.e. base) only around 20% of the cpu was available for doing useful things, with O_DIRECT the 90% of the cpu is available for doing useful things, not to tell the difference in membus utilization. So I think the improvement of O_DIRECT is just huge and pays off as I also mentioned in an erarlier email in this thread, even if the absolute I/O performance may decrease of a few point percent due the synchronous behaviour (and one of the items for 2.5 is to optionally make the synchronous behaviour to go away, plus providing a generic_direct_IO that synchronizes with the pagecache via anchors and so allows O_DIRECT to be used with data journaling too).
And again, if you use larger buffers you may be able to fix also the last 8mbyte/sec difference :).
Andrea
Re: O_DIRECT on 2.4.19pre8aa2 md device
At 05:51 PM 21/05/2002 +0200, Andrea Arcangeli wrote:
...
Quoted 4 lines
In any real usage where I/O is combined with CPU and mem bus utilization for computations, not only to move data from disk to userspace memory
O_DIRECTis an _huge_ win as you found out. You have 100000 more usable ticks for computations over 150000 total ticks.
...
no disagreement there.
however, there is still an enormous difference between access-/dev/sdX-via-block-layer and access-dev/sdX-via-mmap (127mbyte/sec versus 175+mbyte/sec) that for many "disk intensive" applications is a huge difference.
if we _could_ produce superior performance with something like:
(a) additional improvements to O_DIRECT (say, a mmap() hack for O_DIRECT) whereby i/o can go direct-to-userspace or
userspace-can-mmap(readonly)-into-
kernel-space
or
(b) O_DIRECT with async-i/o
or
(c) /dev/rawN-like interface (eg. /dev/directN) within a fixed disk
buffer in kernel
(eg. physical memory allocated at bootup) that is populated readonly into user-space)
would such a hack be accepted in the 2.5 tree?
it sure isn't your "average desktop" setup where you hit these things as performance limitations, but many folk (myself included) have very specific applications which are essentially bottlenecked on PC hardware limitations. these limitations are a side-effect of how the linux kernel works. that doesn't mean that other OSes don't suffer from the same thing -- since no-other mainstream OS does the right thing, that doesn't mean that we cannot make linux even better.
obviously, many of the above would only be suitable for disk-read operations and less-so for disk-write -- but its probably easier to tackle these one by one.
cheers,
lincoln.
Re: O_DIRECT on 2.4.19pre8aa2 md device
In reply to Lincoln DaleQuoted 6 lines · Lincoln Dale
At 05:51 PM 21/05/2002 +0200, Andrea Arcangeli wrote:
...Quoted 4 lines
In any real usage where I/O is combined with CPU and mem bus utilization for computations, not only to move data from disk to userspace memory
O_DIRECTis an _huge_ win as you found out. You have 100000 more usable ticks for computations over 150000 total ticks.
Quoted 8 lines
...
no disagreement there.
however, there is still an enormous difference between access-/dev/sdX-via-block-layer and access-dev/sdX-via-mmap (127mbyte/sec versus 175+mbyte/sec) that for many "disk intensive" applications is a huge difference.
hmm wait a moment, in your last email 175MB/sec was the nocopy hack, not mmap("/dev/sda"). mmap has the same overhead of O_DIRECT in dealing with the user pagetables (actually O_DIRECT has the potential to be a bit lighter because map_user_kiobuf solves the page faults before triggering a real CPU page fault that has to pass through do_page_fault for every single page, and we prefault all of them before starting the I/O), so if 175MB/sec was the nocopy hack, 175MB/sec definitely cannot be the mmap too.
Infact a nice addition to your proggy would be to also benchmark the I/O bandwith using mmap driven I/O, instead of buffered I/O, raw, O_DIRECT and the nocopy hack. Like raw and O_DIRECT also the mmap driven I/O is zerocopy I/O, so only the buffered-IO would show the total waste of cpu and mem bandwith. I guess mmap will be on the same performance lines with O_DIRECT (potentially a bit faster thanks to readahead), at least during reads, writes are a bit different, you've to flush by hand with msync region by region like if they would be write syscalls, or to wait vm pressure.
175MB/sec means you only read to kernel space and you don't make such information visible to userspace, so it is unbeatable no matter what :). Only in kernel service like sendfile and/or tux can take advantage of it by taking the radix tree lock and looking up the radix tree to find the physical page.
Quoted 6 lines
if we _could_ produce superior performance with something like:
(a) additional improvements toO_DIRECT(say, ammap()hack forO_DIRECT) whereby i/o can go direct-to-userspace or
userspace-can-mmap(readonly)-into-
kernel-space
even if you get a direct physical view of some of the address space (as said in a earlier email on 32bit the lack of address space would reduce the place you can map to a little zone), you still need the information on the physical memory where the I/O gone, so that's still an API from kernel to user, so again an overhead compared to the nocopy hack. And that information is exactly the radix tree/hashtable (and btw, I still I'm not a believer in the radix tree and I wonder if anybody did any real benchmark on the big irons with a properly tuned hashtable that takes into account the highmem too like with Davem's patch, the last benchmarks I seen where fake IIRC, the bonus of the radix tree is the per-inode locking and that it reduces the amount of normal zone needed to be allocated statically for numa-q, of course until somebody notices they can exploit the radix tree with a few liner proggy and hogs the machine with unfreable radix tree metadata by allocating only 1 page of highmem cache for each radix tree leaf entry and that will need further instrumentation to the vm so that it will release highmem memory related to the lowmem radix tree metadata, at least it's only a security problem, not a pratical problem with useful users). Not to tell if there's a bug in your proggy you'd destabilize the kernel. The truth is, this is no different at all than writing a proper kernel service, if you need that kind of performance you should write kernel code, not user code, and to work with the pagecache directly. That's what tux does of course, that's what sendfile does too, sendfile is like a part of an userspace fileserver that is been moved in kernel space to send stuff over the wire in zerocopy with knowledge about kernel data structures incidentally like pagecache/raidx tree. You should build a sendfile like operation and anyways to do the stuff in kernel. So you also take all the advantages of tlb 4Mpages etc..etc.. that kernel code has. Also take in mind sendfile can just now work to copy data in the fs too, infact before 2.4.3 it was useful only for doing that fs copies avoiding passing through userspace before the pskb layer was introduced in the network code. Now thanks to the blkdev-in-pagecache introduced in 2.4.10 sendfile will even work with blkdevices, it couldn't work with blockdevices previously. Unfortunately /bin/cp never started using it, I made a patch to change cp to use sendfile it and to fallback to read/write if it returned -ENOSYS, but it is never been integrated, it's still available in my ftp area at suse.com/pub/people/andrea if anybody is interested to actually copy data in the filesystem without wasting mem bandwith (I don't copy heavily stuff around [I only create directory with -l] so it is never been a real need for me). The worst part of my /bin/cp sendfile patch is that sendfile isn't capable of being interrupted by a signal, so copying an huge file would hang the machine, but the same is just for huge read and write, so I consider that a kernel issue and I think userspace should just write the whole thing at once (however until the kernel remains uncapable of interrupting sendfile, userspace can as well sendfile in chunks of a few mbyte each so there's no risk of an accidental DoS at least, as far as the chunks are of the order of the few megs there should be no loss in performance). btw, now that sendfile64 is available in 2.5 the cp hack is doable again with LFS support too.
Returning to our topic :), the pagetables can be see as a representation of the same information encoded in the radix tree. They're the data structure meant to provide the information of where is the physical page where the I/O happened to userspace, and they provide a security layer between kernel and userspace unlike /dev/mem or a kernel service accessing the radix tree directly. instead of mapping physical contigous ram via /dev/mem, and telling userspace where's the ram it needs to use, the kenrel sets the pagetables that lead userspace to reach the right ram without having to deal with its physical position, and this provides protection and the app cannot crash the kernel (unless you find a bug in map_user_kiobuf :).
Quoted 2 lines
or
(b)O_DIRECTwith async-i/o
that's a different problem, this only increases the I/O pipeline, so it will only give you such 7mbyte/sec back, it won't reduce cpu utilization further or it won't make the I/O significantly faster (compared to using large buffers for synchronous read/writes). It makes sure that no disk is idle for no good reason, but it doesn't change at all the overhead in the VM side to provide the information from disk to userspace (and the other way around for writes).
Quoted 8 lines
or
(c)/dev/rawN-likeinterface (eg./dev/directN) within a fixed disk
buffer in kernel
(eg. physical memory allocated at bootup) that is populated readonly into
user-space)
would such a hack be accepted in the 2.5 tree?
Quoted 5 lines
it sure isn't your "average desktop" setup where you hit these things as performance limitations, but many folk (myself included) have very specific applications which are essentially bottlenecked on PC hardware limitations. these limitations are a side-effect of how the linux kernel works.
again, if you need to skip the overhead of passing the info to the usersapce you should write kernel code. If you want to take advantage of the protection of the userspace, you also need to pay for the pagetable settings or pagetable walking instead. Anything that knows physical pages is kernel code, writing userspace mapping /dev/mem is an illusion of writing userspace code, that's kernel code anyways. The framebuffer thing of X is different, X really only needs to talk to a device, it doesn't really care about the kernel, it doesn't need to communicate with the kernel, infact if it needs to communicate with the kernel to do that it needs proper kernel modules like the pci/drm/agpgart/mtrr kernel drivers. What the X server does with /dev/mem is no different than mmap("/dev/fb0") and using the so mapped framebuffer. For read and writes via pagecache or userspace memory, you instead need to enterely deal with kernel internals data structures instead that only the kernel knows, and that's why it's kernel code as soon as you want to bypass the protection layer of the pagetables.
One way to speedup overwrites would be to make faster the lookup from [virtual address,vma] to [physical page] using a data structure that would act as a software tlb, that could be attached to a vma, and to en abled with an mmap flag so you enable it only on the SGA, so an overwrite of disk data would be faster and you could skip the pagetable walking the second time, but if you seek an huge lot and the number of pages is huge, at least if they're not 4M pages, the number of entries to remeber would be quite huge and it would waste some ram, plus it wouldn't be a critical optimization, you would skip a few levels of indirection in the lookup, like a radix tree with only one level vs a radix tree with 3 levels of indirection and such data structure would need some sychronization during the vma modifications too.
Quoted 7 lines
that doesn't mean that other OSes don't suffer from the same thing -- since no-other mainstream OS does the right thing, that doesn't mean that we cannot make linux even better.
obviously, many of the above would only be suitable for disk-read operations and less-so for disk-write -- but its probably easier to tackle these one by one.
the point is, why are you reading from disk, what are you going to do with such data? For example, assume you read from disk to find the string "xxx" in a file the fastest possible, then the right way to exploit the max bandwith is to write a kernel module that triggers the readpage asynchronously (trivial in kernel, just don't wait_on_page until you need the data), lookup the radix tree, kmap the page and search the string, kunmap, start a new async readpage, lookup the next page, wait_on_page the next page and so on. That's the only way to run at the core 175MB/sec speed, anything running in userspace would be slower (even kernel code will be slower than 175MB if kmap actually does something with the pte if you've more than 1G and CONFIG_3G selected etc..)
Now I'm not suggesting to move a database to kernel space for the sake of performance, the layer of protection is foundamental for the reliability of the system, but if you have special needs for certain special things, then a kernel module accellerator is the only way to go faster than buffered-IO/read/mmap/O_DIRECT/raw or whatever that makes that disk data visible from disk to userspace and that in turn needs to deal with the virtual mappings too and not only with the physical pages mapped in the kernel direct mapping.
Long email sorry.
Andrea
high-end i/o performance of 2.4.19pre8aa2 (was: Re: O_DIRECT on 2.4.19pre8aa2 device)
g'day Andrea,
Quoted 4 lines · Andrea Arcangeli
Infact a nice addition to your proggy would be to also benchmark the I/O bandwith using mmap driven I/O, instead of buffered I/O, raw,
O_DIRECTand the nocopy hack. Like raw andO_DIRECTalso the mmap driven I/O is zerocopy I/O, so only the buffered-IO would show the total waste of cpu
..
i've had some spare time to enhance my benchmark program. it is now multithreaded and can do mmap() i/o also.
interestingly enough, it shows that mmap() actually sucks. i didn't take a "readprofile" to see why, but it used far more cpu time than anything else.
with the same hardware as before (Dual P3 Xeon 733MHz, 133MHz FSB, 2G PC133 SDRAM, QLogic 2300 HBA in 64/66 PCI slot) and same kernel (linux 2.4.19pre8 with vary-io, lockmeter & profile=2), the aggregate throughput across 8 x 15K RPM FC disks (2gbit/s FC switched network) are:
now that i've multithreaded the test app. the results change somewhat given we now have multiple threads issuing i/o operations:
raw i/o is slightly better than O_DIRECT again. mmap()'ed i/o is the worst.
[summary]
'base' Completed reading 81920 mbytes in 524.289107 seconds
(156.25 Mbytes/sec), 386usec mean/block
'nocopy' Completed reading 81920 mbytes in 435.653909 seconds
(188.04 Mbytes/sec), 302usec mean/block
'o_direct' Completed reading 81920 mbytes in 429.757513 seconds
(190.62 Mbytes/sec), 157655usec mean/block
'raw' Completed reading 81920 mbytes in 420.940382 seconds
(194.61 Mbytes/sec), 164368usec mean/block
'mmap' Completed reading 81920 mbytes in 1049.446053 seconds (78.06
Mbytes/sec), 401124usec mean/block
given i'm not hitting the peak performance of a single 2gbit/s fibre channel connection, i'll now migrate to dual FC HBAs and see what happens ... :-)
[detail]
(1)
# performance of a single disk-spindle using normal linux block i/o layer. use 10G worth of 8kbyte blocks. # this will show the peak performance of a single 15K RPM disk without any bus contention. [root@mel-stglab-host1 root]# ./test_disk_performance2 bs=8k blocks=1280k mode=basic /dev/sde Completed reading 10240 mbytes across 1 devices using 1310720 blocks of 8192 in 190.028450 seconds (53.89 Mbytes/sec), 151usec mean
(2)
# performance of multiple disk-spindles (8 disks, sde-sdl) using normal linux block i/o layer. # read 10G sequentially from each disk using 8kbyte blocks parallel across all disks. [root@mel-stglab-host1 root]# ./test_disk_performance2 bs=8k blocks=1280k mode=basic /dev/sd[e-l] Completed reading 81920 mbytes across 8 devices using 10485760 blocks of 8192 in 524.289107 seconds (156.25 Mbytes/sec), 386usec mean device #0 (/dev/sde) 10240 megabytes in 520.588206 seconds using 1310720 reads of 8192 bytes (19.67 Mbytes/sec), 320usec device #1 (/dev/sdf) 10240 megabytes in 509.305642 seconds using 1310720 reads of 8192 bytes (20.11 Mbytes/sec), 352usec device #2 (/dev/sdg) 10240 megabytes in 516.744421 seconds using 1310720 reads of 8192 bytes (19.82 Mbytes/sec), 351usec device #3 (/dev/sdh) 10240 megabytes in 519.215781 seconds using 1310720 reads of 8192 bytes (19.72 Mbytes/sec), 382usec device #4 (/dev/sdi) 10240 megabytes in 517.312922 seconds using 1310720 reads of 8192 bytes (19.79 Mbytes/sec), 339usec device #5 (/dev/sdj) 10240 megabytes in 524.289183 seconds using 1310720 reads of 8192 bytes (19.53 Mbytes/sec), 315usec device #6 (/dev/sdk) 10240 megabytes in 521.006994 seconds using 1310720 reads of 8192 bytes (19.65 Mbytes/sec), 322usec device #7 (/dev/sdl) 10240 megabytes in 518.434472 seconds using 1310720 reads of 8192 bytes (19.75 Mbytes/sec), 345usec
(3)
# same test as above, but using 'nocopy hack' so PC architecture isn't the bottleneck. # look at 8 disks (sde-sdl) using 8kbyte/block, 10G on each disk: (80G total) in parallel. # using 'nocopy' means we can measure peak performance without PC front-side-bus becoming # the bottleneck, but we're still using the normal read-file case. [root@mel-stglab-host1 root]# ./test_disk_performance2 bs=8k blocks=1280k mode=nocopy /dev/sd[e-l] Completed reading 81920 mbytes across 8 devices using 10485760 blocks of 8192 in 435.653909 seconds (188.04 Mbytes/sec), 302usec mean device #0 (/dev/sde) 10240 megabytes in 408.566056 seconds using 1310720 reads of 8192 bytes (25.06 Mbytes/sec), 305usec device #1 (/dev/sdf) 10240 megabytes in 411.353237 seconds using 1310720 reads of 8192 bytes (24.89 Mbytes/sec), 309usec device #2 (/dev/sdg) 10240 megabytes in 414.244129 seconds using 1310720 reads of 8192 bytes (24.72 Mbytes/sec), 295usec device #3 (/dev/sdh) 10240 megabytes in 416.225989 seconds using 1310720 reads of 8192 bytes (24.60 Mbytes/sec), 293usec device #4 (/dev/sdi) 10240 megabytes in 417.593914 seconds using 1310720 reads of 8192 bytes (24.52 Mbytes/sec), 268usec device #5 (/dev/sdj) 10240 megabytes in 422.646633 seconds using 1310720 reads of 8192 bytes (24.23 Mbytes/sec), 259usec device #6 (/dev/sdk) 10240 megabytes in 431.343133 seconds using 1310720 reads of 8192 bytes (23.74 Mbytes/sec), 209usec device #7 (/dev/sdl) 10240 megabytes in 435.654122 seconds using 1310720 reads of 8192 bytes (23.50 Mbytes/sec), 216usec
(4)
# use O_DIRECT to bypass readahead and most of block-layer memory-copies # since there isn't any readahead anymore, use a large buffer to achieve peak performance [root@mel-stglab-host1 root]# ./test_disk_performance2 bs=4m blocks=2560 mode=direct /dev/sd[e-l] Completed reading 81920 mbytes across 8 devices using 20480 blocks of 4194304 in 429.757513 seconds (190.62 Mbytes/sec), 157655usec mean device #0 (/dev/sde) 10240 megabytes in 412.931460 seconds using 2560 reads of 4194304 bytes (24.80 Mbytes/sec), 160898usec device #1 (/dev/sdf) 10240 megabytes in 414.531502 seconds using 2560 reads of 4194304 bytes (24.70 Mbytes/sec), 159234usec device #2 (/dev/sdg) 10240 megabytes in 414.585683 seconds using 2560 reads of 4194304 bytes (24.70 Mbytes/sec), 158187usec device #3 (/dev/sdh) 10240 megabytes in 415.257838 seconds using 2560 reads of 4194304 bytes (24.66 Mbytes/sec), 154983usec device #4 (/dev/sdi) 10240 megabytes in 416.209758 seconds using 2560 reads of 4194304 bytes (24.60 Mbytes/sec), 138563usec device #5 (/dev/sdj) 10240 megabytes in 419.144473 seconds using 2560 reads of 4194304 bytes (24.43 Mbytes/sec), 133593usec device #6 (/dev/sdk) 10240 megabytes in 424.031534 seconds using 2560 reads of 4194304 bytes (24.15 Mbytes/sec), 102836usec device #7 (/dev/sdl) 10240 megabytes in 429.773878 seconds using 2560 reads of 4194304 bytes (23.83 Mbytes/sec), 98300usec
(5)
# same as (4) but using /dev/raw/rawX instead of O_DIRECT [root@mel-stglab-host1 root]# ./test_disk_performance2 bs=4m blocks=2560 mode=basic /dev/raw/raw[1-8] Completed reading 81920 mbytes across 8 devices using 20480 blocks of 4194304 in 420.940382 seconds (194.61 Mbytes/sec), 164368usec mean device #0 (raw1) 10240 megabytes in 420.869676 seconds using 2560 reads of 4194304 bytes (24.33 Mbytes/sec), 164385usec device #1 (raw2) 10240 megabytes in 420.859291 seconds using 2560 reads of 4194304 bytes (24.33 Mbytes/sec), 164386usec device #2 (raw3) 10240 megabytes in 420.834023 seconds using 2560 reads of 4194304 bytes (24.33 Mbytes/sec), 164385usec device #3 (raw4) 10240 megabytes in 420.896964 seconds using 2560 reads of 4194304 bytes (24.33 Mbytes/sec), 163879usec device #4 (raw5) 10240 megabytes in 420.838551 seconds using 2560 reads of 4194304 bytes (24.33 Mbytes/sec), 164385usec device #5 (raw6) 10240 megabytes in 420.867115 seconds using 2560 reads of 4194304 bytes (24.33 Mbytes/sec), 164060usec device #6 (raw7) 10240 megabytes in 420.906691 seconds using 2560 reads of 4194304 bytes (24.33 Mbytes/sec), 164386usec device #7 (raw8) 10240 megabytes in 420.932318 seconds using 2560 reads of 4194304 bytes (24.33 Mbytes/sec), 164357usec
(6)
# use memory-mapped i/o, more for interests-sake looking at the efficiency of the virtual-mapping of the linux kernel. # use a large blocksize as it was shown that a 8kbyte blocksize is about 40% of the performance with a 4m blocksize [root@mel-stglab-host1 root]# ./test_disk_performance2 bs=4m blocks=2560 mode=mmap /dev/sd[e-l] Completed reading 81920 mbytes across 8 devices using 20480 blocks of 4194304 in 1049.446053 seconds (78.06 Mbytes/sec), 401124usec mean device #0 (/dev/sde) 10240 megabytes in 1045.814369 seconds using 2560 reads of 4194304 bytes (9.79 Mbytes/sec), 342912usec device #1 (/dev/sdf) 10240 megabytes in 1034.783187 seconds using 2560 reads of 4194304 bytes (9.90 Mbytes/sec), 430320usec device #2 (/dev/sdg) 10240 megabytes in 1046.222514 seconds using 2560 reads of 4194304 bytes (9.79 Mbytes/sec), 340732usec device #3 (/dev/sdh) 10240 megabytes in 1049.445858 seconds using 2560 reads of 4194304 bytes (9.76 Mbytes/sec), 353895usec device #4 (/dev/sdi) 10240 megabytes in 1047.926118 seconds using 2560 reads of 4194304 bytes (9.77 Mbytes/sec), 362176usec device #5 (/dev/sdj) 10240 megabytes in 1047.454030 seconds using 2560 reads of 4194304 bytes (9.78 Mbytes/sec), 377308usec device #6 (/dev/sdk) 10240 megabytes in 1043.274980 seconds using 2560 reads of 4194304 bytes (9.82 Mbytes/sec), 387720usec device #7 (/dev/sdl) 10240 megabytes in 1048.326277 seconds using 2560 reads of 4194304 bytes (9.77 Mbytes/sec), 347532usec
Quoted 12 lines
175MB/sec means you only read to kernel space and you don't make such information visible to userspace, so it is unbeatable no matter what :). Only in kernel service like sendfile and/or tux can take advantage of it by taking the radix tree lock and looking up the radix tree to find the physical page.
Quoted 5 lines
if we _could_ produce superior performance with something like:
(a) additional improvements toO_DIRECT(say, ammap()hack forO_DIRECT) whereby i/o can go direct-to-userspace or
userspace-can-mmap(readonly)-into-
kernel-space
Quoted 5 lines
even if you get a direct physical view of some of the address space (as said in a earlier email on 32bit the lack of address space would reduce the place you can map to a little zone), you still need the information on the physical memory where the I/O gone, so that's still an API from kernel to user, so again an overhead compared to the nocopy hack
[ ignoring the fact that O_DIRECT and /dev/rawN are faster than 'nocopy' for a moment ... :-) ]
around 18 months ago, i had it working.
basically, there was a character device-driver which allowed user-space to mmap() kernel space.
a seperate 'zone' existed that was reserved exclusively for data to/from disk and network.
this zone was sized to 75% of RAM -- and (on the hardware being used) with 2G RAM, meant that there was 1.5GB available in this space.
the kernel would indicate the physical address of a "skb" on network sockets and each packet put on the skbuff receive_q for a socket marked for 'zerocopy' would result in a zerocopy_buf_t being queued to user-space. user-space could poll to get a list of the current zerocopy_buf_t's. (this list wasn't copied to userspace using copy_to_user; user-space picked this list up via the mmap() into kernel space too)
userspace could control what to do with buffers by various ioctl() calls on the character-device. things like marking "i'm not interested in that buffer anymore" would result in atomic_dec_and_test() on the refcount and a subsequent skb_free() if there wasn't any more interest in the buffer. there were also ioctl()s for queueing the buffer on a different socket.
yes -- rather radical -- but it did bypass the bottleneck of memory-bandwidth becoming the bottleneck in an application which predominantly did:
- read-from-disk, send on network socket
- read from network socket, write to disk
- read from network socket, write to alternate network socket, write to disk
given user-space could crash at any point, there was some housekeeping that ensured that buffers tied to a process that had failed didn't stay around - they were cleaned up.
there was also some rudimentary checks to ensure that user-space passing buffer pointers to kernel-space was passing buffers that kernel-space already knew about. ie. you couldn't crash the kernel by passing a bad pointer.
i haven't resurrected this work since the VM underwent some radical changes -- but it wouldn't be too hard to do. it'd still be a bit ugly in the tie-ins to the tcp stack and buffer-cache but ....
i guess given O_DIRECT and /dev/rawN performance for to-disk/from-disk being what it currently is (very good), there's less importance on having it, if we could find a 'fast' way to queue to/from disk from/to network. perhaps Ben's async i/o is the way to go for those apps.
Quoted 1 line
Long email sorry.
i was travelling and it gave me a chance to test out the 8 hour battery life in my new laptop on a 14 hour flight. :-)
cheers,
lincoln.
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14IDE 56)
In reply to Lincoln DaleQuoted 4 lines · Lincoln Dale
O_DIRECT:
[root@mel-stglab-host1 src]# tail -20/tmp/direct.txt
8012a670follow_page25 0.1202
8012a740get_user_pages89 0.1918
follow-page and get_user_pages is the actual cpu cost of walking the pagetables. that could be trimmed down by wasting some memory for an efficient software-kernel-side tlb.
Quoted 10 lines
80136d40 __free_pages 10 0.2083
801d28b0 generic_make_request 83 0.2730
8012aa50 mark_dirty_kiobuf 35 0.3125
8013f0e0 set_bh_page 22 0.3438
8011f950 do_softirq 88 0.3929
8023d670 sd_find_queue 26 0.4062
80142a10 max_block 54 0.4219
80200fb0 __scsi_end_request 165 0.5428
80142c80 blkdev_get_block 37 0.5781
801405d0 brw_kiovec 581 0.6371Quoted 8 lines
80140560 wait_kio 90 0.8036
80152820 end_kio_request 76 0.9500
801d29e0 submit_bh 181 1.6161
8013e950 init_buffer 55 1.7188
801d22a0 __make_request 3073 1.9800
8013dd10 unlock_buffer 189 2.3625
80140520 end_buffer_io_kiobuf 408 6.3750
80106d20 default_idle 45686 713.8438the cpu cost is much smaller than base as you can see and most of it will be optimized away with vary-io that should lead to follow_page and get_user_pages to move down in the above profiling.
Quoted 15 lines
base:
[root@mel-stglab-host1 src]# tail -20 /tmp/base.txt 80133e60 kmem_cache_alloc 249 0.9154 80200fb0 __scsi_end_request 291 0.9572 80134fb0 delta_nr_inactive_pages 93 0.9688 801288b0 _spin_unlock_ 131 1.0234 8013f380 create_empty_buffers 107 1.1146 80135010 delta_nr_cache_pages 119 1.2396 801d28b0 generic_make_request 396 1.3026 8013f0e0 set_bh_page 102 1.5938 80108a48 system_call 91 1.6250 801d29e0 submit_bh 185 1.6518 801340e0 kmem_cache_free 217 1.6953 80140ea0 try_to_free_buffers 664 1.9762
Quoted 8 lines
801d22a0 __make_request 3214 2.0709
8012e0c0 unlock_page 283 2.2109
801298cc .text.lock.lockmeter 332 2.2432
80136d40 __free_pages 125 2.6042
801287d0 _spin_lock_ 585 5.2232
8013e970 end_buffer_io_async 1234 6.4271
8012edd0 file_read_actor 3732 33.3214
80106d20 default_idle 8875 138.6719as expected the biggest cost is file_read_actor.
Both profiling looks fine, as expected.
Quoted 14 lines
/dev/raw/rawN:[root@mel-stglab-host1 src]# tail -20 /tmp/raw.txt 80122c50 tqueue_bh 4 0.1250 8012a670 follow_page 33 0.1587 8012a740 get_user_pages 118 0.2543 80203890 scsi_init_io_vc 139 0.2555 8012aa50 mark_dirty_kiobuf 36 0.3214 80136d40 __free_pages 22 0.4583 8011f950 do_softirq 113 0.5045 801d28b0 generic_make_request 204 0.6711 8013e950 init_buffer 34 1.0625 8023d670 sd_find_queue 70 1.0938 8013f0e0 set_bh_page 74 1.1562 80200fb0 __scsi_end_request 365 1.2007
Quoted 8 lines
801405d0 brw_kiovec 1288 1.4123
80140560 wait_kio 193 1.7232
80152820 end_kio_request 166 2.0750
801d29e0 submit_bh 347 3.0982
8013dd10 unlock_buffer 357 4.4625
801d22a0 __make_request 11014 7.0966
80140520 end_buffer_io_kiobuf 835 13.0469
80106d20 default_idle 45156 705.5625expected again, as you can see the cost goes quite up for __make_request compared to O_DIRECT due the 512 b_size (raw compared to base is unfair because base uses 1k b_size and raw uses 512 b_size and that's why it's wasting so much cpu time there, o_direct vs base is instead fair because they both uses 1k of b_size, once o_direct will take advantage of varyio in your upgraded driver, the comparison between o_direct vs base will become unfair too, o_direct will be more advantaged by a virtual-common 4k b_size)
Quoted 14 lines
nocopy hack:
[root@mel-stglab-host1 src]# tail -20 /tmp/nocopy.txt 8012dec0 page_cache_read 197 0.7695 80134fb0 delta_nr_inactive_pages 77 0.8021 80133e60 kmem_cache_alloc 221 0.8125 8013f020 get_unused_buffer_head 182 0.9479 801288b0 _spin_unlock_ 124 0.9688 80135010 delta_nr_cache_pages 110 1.1458 8013f380 create_empty_buffers 114 1.1875 801d28b0 generic_make_request 375 1.2336 801d29e0 submit_bh 201 1.7946 8013f0e0 set_bh_page 121 1.8906 8012e0c0 unlock_page 254 1.9844 80108a48 system_call 116 2.0714
Quoted 8 lines
801d22a0 __make_request 3234 2.0838
80140ea0 try_to_free_buffers 707 2.1042
801340e0 kmem_cache_free 272 2.1250
801298cc .text.lock.lockmeter 392 2.6486
80136d40 __free_pages 134 2.7917
801287d0 _spin_lock_ 636 5.6786
8013e970 end_buffer_io_async 1200 6.2500
80106d20 default_idle 5226 81.6562very similar to o_direct, notice the overhead in _spin_lock_ here (and also in "base") it's certainly the page_cache lock that won't go away in 2.5 with radix tree because you're working on the same file, higher bandwith because the disks runs at the same time and possibly because read/write returns faster and part of the cost of the I/O happens outside your time measurements (for a more fair comparison you can benchmark the whole workload, not only how fast read/write returns).
Andrea
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14IDE 56)
In reply to Andrew MortonQuoted 5 lines · Andrew Morton
Quoted 2 lines
given there's still lots of idle-time, i'll file up lockmeter on here and see if theres any gremlins there.
lockmeter will go off the dial. All those copies happen at interrupt time, inside the global
io_request_lock. It's horrid.
Depends. For IDE, that is so. For SCSI, actually no io_request_lock is not held while doing the bounce copy. The write bounce copy never happens with io_request_lock held for either, the copy-back on reads only does if the caller holds io_request_lock while entering end_that_request_first() (or its own replacement, __scsi_end_request() for instance).
The read copy-back is nasty for most users regardless of io_request_lock status, because it happens with interrupts disabled.
Quoted 2 lines
Try it with the block-highmem patch:
http://www.kernel.org/pub/linux/kernel/people/andrea/kernels/v2.4/2.4.19pre1aa1/00_block-highmem-all-18b-4.gz
That's good advise :-)
Signature · 1 line
Jens Axboe
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14IDE 56)
In reply to Andrew MortonQuoted 8 lines · Andrew Morton
Quoted 7 lines · Lincoln Dale
Quoted 5 lines · Andrew Morton
Quoted 2 lines
/dev/md0 raid-0 with O_DIRECT: 91847kbyte/sec (2781usec /dev/md0raid-0: 129455kbyte/sec (1978usec
Quoted 1 line
/dev/md0 raid-0 with O_NOCOPY: 195868kbyte/sec (1297usec
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
hmm. Why is
O_DIRECTalways the slowest? (and it would presumably do even worse with an 8k transfer size).i just reproduced the test to validate the data. i'm using 8kbyte blocks here. on kernel is 2.4.18,
O_DIRECTis still the slowest.8k would rather disadvantage
O_DIRECT. It can't do readahead and it can't to write-behind. It'll be forced to do tons of tiny I/Os.
yes, that's the main factor. Suggested read/write buffer size with O_DIRECT are of the order of 512k at least (that's the high limit for a single scsi dma request in 2.4), and 1M even better so you I/O pipeline some more in the ll_rw_block layer.
Andrea
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14IDE 56)
In reply to Andrew MortonQuoted 9 lines · Lincoln Dale
Quoted 3 lines · Andrew Morton
Try it with the block-highmem patch:
given i had to recompile the kernel to add lockmeter, i'd already cheated and changed
PAGE_OFFSETfrom0xc0000000to0x80000000, obviating the requirement for highmem altogether.
Quoted 7 lines
being fair to
O_DIRECTand giving it 1mbyte disk-reads to work with and giving normal i/o 8kbyte reads to work with.
still using 2.4.18 with profile=2 enabled and lockmeter in the kernel but not turned on. still using the same disk spindles (just 6 this time), each a 18G 15K RPM disk spindle.
i got tired of scanning the entire available space on an 18G disk so just dropped the test down to the first 2G of each disk.
is any of the disks mounted?
Quoted 9 lines
O_DIRECTis still a ~30% performance hit versus just talking to the/dev/sdXdevice directly. profile traces at bottom.normal block-device disks sd[m-r] without
O_DIRECT, 64K x 8k reads:[root@mel-stglab-host1 src]# readprofile -r; ./test_disk_performance blocks=64K bs=8k /dev/sd[m-r] Completed reading 12000 mbytes in 125.028612 seconds (95.98Mbytes/sec), 76usec mean
can you post your test_disk_performance program so I in particular we can see the semantics of blocks and bs? 64k*8k == 5k * 1M / 10.
Quoted 5 lines
normal block-device disks sd[m-r] with
O_DIRECT, 5K x 1 megabyte reads:[root@mel-stglab-host1 src]# readprofile -r; ./test_disk_performance blocks=5K bs=1m direct /dev/sd[m-r] Completed reading 12000 mbytes in 182.492975 seconds (65.76
Quoted 8 lines
Mbytes/sec), 15416usec mean
for interests-sake, compare this to using the 'raw' versions of the same disks:
[root@mel-stglab-host1 src]# readprofile -r; ./test_disk_performance blocks=5K bs=1m /dev/raw/raw[2-7] Completed reading 12000 mbytes in 206.346371 seconds (58.15Mbytes/sec), 16860usec mean
O_DIRECT has to do some more work to check for the coherency with the pagecache and it has some more overhead with the address space operations, but O_DIRECT by default uses the blocksize of the blkdev, that is set to 1k by default (if you never mounted it) versus the hardblocksize of 512bytes used by the raw device (assuming the sd[m-r] aren't mounted).
This is most probably why O_DIRECT is faster than raw.c, otherwise they would run almost at the same rate, the pagecache coherency fast paths and the address space ops overhead of O_DIRECT shouldn't be noticeable.
Quoted 7 lines
of course, these are all ~25% worse than if a mechanism of performing the i/o avoiding the
copy_to_user()altogether:[root@mel-stglab-host1 src]# readprofile -r; ./test_disk_performance blocks=64K bs=8k nocopy /dev/sd[m-r] Completed reading 12000 mbytes in 97.846938 seconds (122.64Mbytes/sec), 59usec mean
the nocopy hack is not an interesting test for O_DIRECT/rawio, it doesn't walk pagetables, it doesn't allow the DMA to be done into userspace memory. If you want the pagecache to be visible into userspace (i.e. MAP_PRIVATE/MAP_SHARED) you must deal with pagetables somehow, and if you want the read/write syscalls to DMA directly into userspace memory (raw/O_DIRECT) you must still walk pagetables during those syscalls before starting the DMA. If you don't want to explicitly deal with the pagetables then you need to copy_user (case 1). In most archs where mem bandwith is very expensive avoiding the copy-user is a big global win (other cpus won't collapse in smp etc..).
Your nocopy hack benchmark has some relevance only for usages of the data done by kernel. So if it is the kernel that reads the data directly from pagecache (i.e. a kernel module), then your nocopy benchmark matters. For example your nocopy benchmark also matters for sendfile zerocopy, it will read at 122M/sec. But if it's userspace supposed to receive the data (so not directly from pagecache on the kernel direct mapping, but in userspace mapped memory) it cannot be 122M/sec, it has to be less due the user address space management.
Quoted 47 lines
anyone want to see any other benchmarks performed? would a comparison to 2.5.x be useful?
comparative profile=2 traces:
- noO_DIRECT:[root@mel-stglab-host1 src]# readprofile -v | sort -n -k3 | tail -10 80125060 _spin_lock_ 718 6.4107 8013bfc0 brw_kiovec 798 0.9591 801cbb40 generic_make_request 830 2.8819 801f9400 scsi_init_io_vc 831 2.2582 8013c840 try_to_free_buffers 1198 3.4034 8013a190 end_buffer_io_async 2453 12.7760 8012b100 file_read_actor 3459 36.0312 801cb4e0 __make_request 7532 4.6152 80105220 default_idle 106468 1663.5625 00000000 total 134102 0.0726-
O_DIRECT, disks /dev/sd[m-r]:[root@mel-stglab-host1 src]# readprofile -v | sort -n -k3 | tail -10 801cbb40 generic_make_request 72 0.2500 8013ab00 set_bh_page 73 1.1406 801cbc60 submit_bh 116 1.0357 801f72a0 __scsi_end_request 133 0.4618 80139540 unlock_buffer 139 1.7375 8013bf10 end_buffer_io_kiobuf 302 4.7188 8013bfc0 brw_kiovec 357 0.4291 801cb4e0 __make_request 995 0.6097 80105220 default_idle 34243 535.0469 00000000 total 37101 0.0201- /dev/raw/raw[2-7]:
[root@mel-stglab-host1 src]# readprofile -v | sort -n -k3 | tail -10 8013bf50 wait_kio 349 3.1161 801cbb40 generic_make_request 461 1.6007 801cbc60 submit_bh 526 4.6964 80139540 unlock_buffer 666 8.3250 801f72a0 __scsi_end_request 699 2.4271 8013bf10 end_buffer_io_kiobuf 1672 26.1250 8013bfc0 brw_kiovec 1906 2.2909 801cb4e0 __make_request 10495 6.4308 80105220 default_idle 84418 1319.0312 00000000 total 103516 0.0560-
O_NOCOPYhack: (userspace doesn't actually get the read data)
Quoted 10 lines
801f9400 scsi_init_io_vc 785 2.1332
8013c840 try_to_free_buffers 950 2.6989
801f72a0 __scsi_end_request 966 3.3542
801cbb40 generic_make_request 1017 3.5312
8013bf10 end_buffer_io_kiobuf 1672 26.1250
8013a190 end_buffer_io_async 1693 8.8177
8013bfc0 brw_kiovec 1906 2.2909
801cb4e0 __make_request 13682 8.3836
80105220 default_idle 112345 1755.3906
00000000 total 144891 0.0784Can you use -k4? this is the number of hits per function, but we should take the size of the function into account too. Otherwise small functions won't show up.
Can you also give a spin to the same benchmark with 2.4.19pre8aa2? It has the vary-io stuff from Badari and futher kiobuf optimization from Chuck. (vary-io will work only with aic and qlogic, enabling it is a one liner if the driver is just ok with variable bh->b_size in the same I/O request). right fix for avoiding the flood of small bh is bio in 2.5, for 2.4 vary-io should be fine.
thanks,
Andrea
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14IDE 56)
Quoted 2 lines · Andrea Arcangeli
Quoted 2 lines
being fair to
O_DIRECTand giving it 1mbyte disk-reads to work with and giving normal i/o 8kbyte reads to work with.
..
Quoted 1 line
is any of the disks mounted?
no.
for the O_DIRECT tests i also didn't have the MD driver touching them. (ie. raidstop /dev/md[0-1]).
Quoted 10 lines
Quoted 8 lines
O_DIRECTis still a ~30% performance hit versus just talking to the/dev/sdXdevice directly. profile traces at bottom.normal block-device disks sd[m-r] without
O_DIRECT, 64K x 8k reads:[root@mel-stglab-host1 src]# readprofile -r; ./test_disk_performance blocks=64K bs=8k /dev/sd[m-r] Completed reading 12000 mbytes in 125.028612 seconds (95.98Mbytes/sec), 76usec mean
can you post your
test_disk_performanceprogram
i'll post the program later on this weekend. (its suffering from continual scope-creap and additional development. :) ).
but basically, its similar to 'dd' except works on multiple devices simultaneously. operation consists of sequential-reads or sequential-writes.
its main loop basically consists entirely of:
/* loop thru blocks */
for (blocknum=0; blocknum < blocks; blocknum++) {
/* loop thru devices */
for (devicenum=0; devicenum < num_devices; devicenum++) {
before_time = time_tick();
if (operation == 0) {
/* read op */
amt_read = read(fd[devicenum],
aligned_buffer[devicenum], block_size);
} else {
/* write-op */
amt_read = write(fd[devicenum],
aligned_buffer[devicenum], block_size);
}
after_time = time_tick();
[check amt_read == block_size, calculate time
histograms]
}
}the open call consists of:
for (i=0; i < num_devices; i++) {
flags = (O_RDWR | O_LARGEFILE);
if (nocopy) flags |= O_NOCOPY;
if (direct) flags |= O_DIRECT;
fd[i] = open(devices[i], flags);
...i've since 'expanded' its functionality a bit so that i can do tests where i'm rate-limiting different devices to different limits, variable read/write/seeks, etc etc.
Quoted 2 lines
so I in particular we
can see the semantics of blocks and bs? 64k*8k == 5k * 1M / 10.
K == 1000
k == 1024
M == 1000*1000
m == 1024*1024
g == 1024*1024*1024
G == 1000*1000*1000
so the above is:
blocks = 64K, bs=8k means 64000 x 8192-byte read()s = 524288000 bytes blocks = 5K, bs=1m means 5000 x 1048576-byte read()s = 5242880000 bytes
Quoted 6 lines
O_DIRECThas to do some more work to check for the coherency with the pagecache and it has some more overhead with the address space operations, butO_DIRECTby default uses the blocksize of the blkdev, that is set to 1k by default (if you never mounted it) versus the hardblocksize of 512bytes used by the raw device (assuming the sd[m-r] aren't mounted).
i wonder if the MD driver set it to 512 bytes if it has been touched.
i'll reboot the box after each test to validate. (which, unfortunately, is about a 10 minute reboot cycle for 22 x SCSI disks and 16 FC disks).
Quoted 3 lines
This is most probably why
O_DIRECTis faster thanraw.c, otherwise they would run almost at the same rate, the pagecache coherency fast paths and the address space ops overhead ofO_DIRECTshouldn't be noticeable.
as the statistics show, O_DIRECT is about 5% superior to raw.c.
Quoted 7 lines
Quoted 6 lines
of course, these are all ~25% worse than if a mechanism of performing the i/o avoiding the
copy_to_user()altogether:[root@mel-stglab-host1 src]# readprofile -r; ./test_disk_performance blocks=64K bs=8k nocopy /dev/sd[m-r] Completed reading 12000 mbytes in 97.846938 seconds (122.64Mbytes/sec), 59usec mean
Quoted 6 lines
the nocopy hack is not an interesting test for O_DIRECT/rawio, it doesn't walk pagetables, it doesn't allow the DMA to be done into userspace memory. If you want the pagecache to be visible into userspace (i.e. MAP_PRIVATE/MAP_SHARED) you must deal with pagetables somehow, and if you want the read/write syscalls to DMA directly into userspace memory (raw/O_DIRECT) you must still walk pagetables during those
the nocopy hack is interesting from the point-of-view of seeing what the copy_to_user() overhead actually is. it is interesting to compare that to O_DIRECT.
i agree that doing pagecache-visible-in-userspace is hard to get right and to do it fast. but i'm not proposing any such development.
what i am thinking is "interesting" is for privileged programs which can mmap() /dev/mem and have some async-i/o scheme which returns back physical-address information about blocks.
sure, it has a lot of potential-security-issues associated with it, and isn't useful for anything but really big-iron program, but so has other schemes that involve "lets put this userspace module in the kernel to avoid user<->kernel copies".
Quoted 5 lines
syscalls before starting the DMA. If you don't want to explicitly deal with the pagetables then you need to
copy_user(case 1). In most archs where mem bandwith is very expensive avoiding the copy-user is a big global win (other cpus won't collapse in smp etc..).
Quoted 8 lines
Your nocopy hack benchmark has some relevance only for usages of the data done by kernel. So if it is the kernel that reads the data directly from pagecache (i.e. a kernel module), then your nocopy benchmark matters. For example your nocopy benchmark also matters for sendfile zerocopy, it will read at 122M/sec. But if it's userspace supposed to receive the data (so not directly from pagecache on the kernel direct mapping, but in userspace mapped memory) it cannot be 122M/sec, it has to be less due the user address space management.
i guess i simply see that there are a bunch of possible big-iron programs which:
- read from [raw] disk
- write results to network
- don't actually look at the payload
a few program like this that come to mind are:
- Samba
- (user-space) NFS
- [HTTP] caching software
Quoted 1 line
Quoted 1 line
comparative profile=2 traces:
...
Quoted 3 lines
Can you use -k4? this is the number of hits per function, but we should take the size of the function into account too. Otherwise small functions won't show up.
will do.
Quoted 3 lines
Can you also give a spin to the same benchmark with 2.4.19pre8aa2? It has the vary-io stuff from Badari and futher kiobuf optimization from Chuck.
will do so.
Quoted 4 lines
(vary-io will work only with aic and qlogic, enabling it is a one liner if the driver is just ok with variable
bh->b_sizein the same I/O request). right fix for avoiding the flood of small bh is bio in 2.5, for 2.4 vary-io should be fine.
i'm using the qlogic HBA driver from their web-site rather than the current driver in the kernel which doesn't function with the 2gbit/s HBAs. care to point out the line i should be looking for to change?
cheers,
lincoln.
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14IDE 56)
Quoted 10 lines · Lincoln Dale
Quoted 8 lines · Andrea Arcangeli
Quoted 3 lines
so the above is:
blocks = 64K, bs=8k means 64000 x 8192-byte read()s = 524288000 bytes blocks = 5K, bs=1m means 5000 x 1048576-byte read()s = 5242880000 bytesif the program is doing only what shown in the main loop, then you're reading 10 times more data with
O_DIRECT, that was my point in saying 64k*8k == 5k * 1M / 10, but I assume you took it into account (otherwise it meansO_DIRECTis just 5 times faster than buffered-I/O for you)
Quoted 5 lines
no- count them up above.
withoutO_DIRECTi was doing: 64000 x 8192 = 524288000 bytes withO_DIRECTi was doing: 5000 x 1048576 = 524288000 bytes.ie. same amount of data.
I don't mind the 1024/1000 difference, in this context let's assume k=K,m=M and g=G, I only mind the 1 order of magintude difference. python tells me:
w/o O_DIRECT 64000 * 8192 = 524288000 w/ O_DIRECT 5000 * 1048576 = 5242880000 ^ note the additional zero
they're both _bytes_, it's apples against apples.
You instead wrote:
without O_DIRECT i was doing: 64000 x 8192 = 524288000 with O_DIRECT i was doing: 5000 x 1048576 = 524288000
in the above you're losing a 0 at the end in the O_DIRECT case.
Quoted 1 line
regardless, the "mbyte/sec" is calculated at the very end.
So I assume the 1 order of magnitude difference didn't affect the benchmark results anyways. That's quite expectable otherwise as said in the earlier email O_DIRECT would be just running 5 times faster than non-O_DIRECT :).
Quoted 8 lines
Quoted 3 lines
Also I would suggest to measure the time taken by the whole workload, not only
the time for read/write syscalls.the time taken for the whole workload _is_ calculated at the very end of the workload. that way and "readahead" doesn't have an unfair advantage. i also have
gettimeofday()calls to measure latency on a per-read or per-write basis
Ok fine, by only reading the pseudocode of the main loop it wasn't obvious (I mistaken the latency accounting for the global throughput accounting). thanks for the clarification.
Quoted 26 lines
...
Quoted 7 lines
One thing I would also recommend is to write a threaded version of the program,
that reads or writes to all the/dev/sddisks simultaneously, first w/O_DIRECT
then w/oO_DIRECT. The reason is that currently you aren't using all the disks
at once withO_DIRECTdue the lack of async-ioi've thought about doing that - shame that there isn't an async version of
read(). the hard part is that i want to keep the disks at roughly the same "block" at the same time, so there will still need to be some syncronization of threads.
otherwise, basic SCSI id priority means that it won't be fair across all disks. (remeber that i'm also attempting to measure latency)...
Quoted 8 lines
Since you "stripe" by hand in all disks you do a different workload than my previous benchs and you definitely want to keep all the harddisk running at the
same time. I would also suggest to benchmark a single disk, to see if there is
still such a big performance difference (again: including the cost outside the
syscalls too).
Quoted 4 lines
a single-disk means we hit the performance limits of a single disk spindle. ie. around 45mbyte/sec sustained throughput.
if you don't think there's any real overhead in the MD driver, i'll just use that instead for now. (raid-0)
I think raid0 is a good start to make all disks running at the same time for O_DIRECT too (only make sure to use a buffer large nr_PV*512k or nr_PV*1M to allow the generation of large dma transactions to each disk). The overhead of raid-0 shouldn't be noticeable, it should be minimal compared to the overhead of the 1k bhs.
Andrea
O_DIRECT on 2.4.19pre8aa2 md device
g'day,
Quoted 2 lines · Andrea Arcangeli
I think raid0 is a good start to make all disks running at the same time for
O_DIRECTtoo (only make sure to use a buffer large nr_PV*512k or
same hardware as before -- dual P3 Xeon (733MHz), 133MHz FSB, 2G PC133 SDRAM.
this time, a raid-0 array using MD driver across 8 x 18G 15K RPM disks. md driver is using "128k chunks".
kernel is 2.4.19pre8aa2 with the qlogic 2300 HBA driver compiled with vary_io set to 1. FC network is all 2gbit/s. no highmem. kernel is booted using "profile=2" and has lockmeter compiled in also.
system rebooted after each test.
i promise its the same amount of data for each test this time: :-)
O_DIRECT blocksize = 4 megabytes, blocks = 28000: 112000 mbytes in
977.869706 seconds (120.10 Mbytes/sec)
'raw' blocksize = 4 megabytes, blocks = 28000: 112000 mbytes in
1659.551271 seconds (70.77 Mbytes/sec)
base blocksize = 8 kilobytes, blocks = 14336000: 112000 mbytes
in 918.287570 seconds (127.89 Mbytes/sec)
nocopy hack: blocksize = 8 kilobytes, blocks = 14336000: 112000 mbytes
in 671.560772 seconds (174.88 Mbytes/sec)
net-effect is that O_DIRECT still has a performance hit versus base, 'raw' just sucks wind versus the others, even 'nocopy' cannot hit line-rate on the fibre-channel card. (its possible to hit 205mbytes/sec using sg_tools sg_read or sg_dd).
O_DIRECT:
[root@mel-stglab-host1 src]# readprofile -r;
./test_disk_performance bs=4m blocks=28000 direct /dev/md0 > /tmp/vary_direct.txt; readprofile -v | sort -n -k4 >> /tmp/vary_direct.txt
Completed reading 112000 mbytes in 977.869706 seconds (120.10 Mbytes/sec), 34849usec mean
[root@mel-stglab-host1 tmp]# tail -20 vary_direct.txt
8012aa50 mark_dirty_kiobuf 234 2.0893
8013f0e0 set_bh_page 134 2.0938
801d28b0 generic_make_request 785 2.5822
80136d40 __free_pages 137 2.8542
80142a10 max_block 406 3.1719
8011f950 do_softirq 724 3.2321
801405d0 brw_kiovec 3219 3.5296
80271370 md_make_request 484 4.3214
80200fb0 __scsi_end_request 1321 4.3454
8023d670 sd_find_queue 334 5.2188
80142c80 blkdev_get_block 358 5.5938
80140560 wait_kio 690 6.1607
80152820 end_kio_request 601 7.5125
80267320 raid0_make_request 3059 9.1042
8013e950 init_buffer 310 9.6875
801d29e0 submit_bh 1274 11.3750
801d22a0 __make_request 20967 13.5097
8013dd10 unlock_buffer 1283 16.0375
80140520 end_buffer_io_kiobuf 2946 46.0312
80106d20 default_idle 151886 2373.2188'raw':
[root@mel-stglab-host1 src]# readprofile -r;
./test_disk_performance bs=4m blocks=28000 /dev/raw/raw1 > /tmp/vary_raw.txt; readprofile -v | sort -n -k4 >> /tmp/vary_raw.txt
Completed reading 112000 mbytes in 1659.551271 seconds (70.77 Mbytes/sec), 59167usec mean
[root@mel-stglab-host1 src]# tail -20 /tmp/vary_raw.txt
8012a740 get_user_pages 636 1.3707
80203890 scsi_init_io_vc 989 1.8180
80136d40 __free_pages 126 2.6250
8012aa50 mark_dirty_kiobuf 300 2.6786
8011f950 do_softirq 836 3.7321
801d28b0 generic_make_request 1727 5.6809
8013e950 init_buffer 237 7.4062
801405d0 brw_kiovec 7164 7.8553
80200fb0 __scsi_end_request 2574 8.4671
8023d670 sd_find_queue 602 9.4062
80140560 wait_kio 1155 10.3125
80271370 md_make_request 1176 10.5000
8013f0e0 set_bh_page 799 12.4844
80152820 end_kio_request 1084 13.5500
80267320 raid0_make_request 5904 17.5714
801d29e0 submit_bh 2426 21.6607
8013dd10 unlock_buffer 2540 31.7500
801d22a0 __make_request 77413 49.8795
80140520 end_buffer_io_kiobuf 5540 86.5625
80106d20 default_idle 214369 3349.5156base:
[root@mel-stglab-host1 src]# readprofile -r;
./test_disk_performance bs=8k blocks=14336000 /dev/md0 > /tmp/vary_base.txt; readprofile -v | sort -n -k4 >> /tmp/vary_base.txt
Completed reading 112000 mbytes in 918.287570 seconds (127.89 Mbytes/sec), 63usec mean
[root@mel-stglab-host1 src]# tail -20 /tmp/vary_base.txt
80135010 delta_nr_cache_pages 591 6.1562
80203890 scsi_init_io_vc 3448 6.3382
801288b0 _spin_unlock_ 894 6.9844
8013f380 create_empty_buffers 717 7.4688
80133e60 kmem_cache_alloc 2152 7.9118
80267320 raid0_make_request 3125 9.3006
801d28b0 generic_make_request 2861 9.4112
801d29e0 submit_bh 1304 11.6429
8013f0e0 set_bh_page 795 12.4219
80108a48 system_call 766 13.6786
801d22a0 __make_request 23675 15.2545
8012e0c0 unlock_page 1990 15.5469
80140ea0 try_to_free_buffers 5294 15.7560
801340e0 kmem_cache_free 2563 20.0234
80136d40 __free_pages 1012 21.0833
801298cc .text.lock.lockmeter 3129 21.1419
801287d0 _spin_lock_ 4097 36.5804
8013e970 end_buffer_io_async 9310 48.4896
8012edd0 file_read_actor 26102 233.0536
80106d20 default_idle 59883 935.6719nocopy hack:
[root@mel-stglab-host1 src]# readprofile -r;
./test_disk_performance bs=8k blocks=14336000 nocopy /dev/md0 > /tmp/vary_nocopy.txt; readprofile -v | sort -n -k4 >> /tmp/vary_nocopy.txt
Completed reading 112000 mbytes in 671.560772 seconds (174.88 Mbytes/sec), 46usec mean
[root@mel-stglab-host1 src]# tail -20 /tmp/vary_nocopy.txt
8013f020 get_unused_buffer_head 1152 6.0000
80134fb0 delta_nr_inactive_pages 583 6.0729
80135010 delta_nr_cache_pages 617 6.4271
801288b0 _spin_unlock_ 854 6.6719
80133e60 kmem_cache_alloc 2154 7.9191
8013f380 create_empty_buffers 785 8.1771
80267320 raid0_make_request 3112 9.2619
801d28b0 generic_make_request 2876 9.4605
801d29e0 submit_bh 1293 11.5446
8013f0e0 set_bh_page 759 11.8594
80108a48 system_call 778 13.8929
8012e0c0 unlock_page 1814 14.1719
80140ea0 try_to_free_buffers 4908 14.6071
801d22a0 __make_request 23997 15.4620
801340e0 kmem_cache_free 2562 20.0156
80136d40 __free_pages 980 20.4167
801298cc .text.lock.lockmeter 3411 23.0473
801287d0 _spin_lock_ 4099 36.5982
8013e970 end_buffer_io_async 8741 45.5260
80106d20 default_idle 39093 610.8281cheers,
lincoln.
Re: O_DIRECT performance impact on 2.4.18 (was: Re: [PATCH] 2.5.14IDE 56)
In reply to Andrea ArcangeliQuoted 6 lines · Andrea Arcangeli
Can you also give a spin to the same benchmark with 2.4.19pre8aa2? It has the vary-io stuff from Badari and futher kiobuf optimization from Chuck. (vary-io will work only with aic and qlogic, enabling it is a one liner if the driver is just ok with variable
bh->b_sizein the same I/O request). right fix for avoiding the flood of small bh is bio in 2.5, for 2.4 vary-io should be fine.
2.4.19pre8aa2 booted with "profile=2" on dual P3-Xeon (733MHz), 2G PC133 SDRAM, qlogic 2300 HBA (firmware 3.01.02 driver version 6.0b20). 8 x 15K RPM 18G FC disks are directly-attached using 2gbit/s FC (actually, its via a FC switch but that makes zero difference..). kernel is set with PAGE_OFFSET_RAW at 8000000 (ie. no highmem defined)
no idea if the "vary-io" stuff is enabled for the qlogic driver or not -- some hints as to what to look for needed here..) a clean reboot was done prior to each test.
the benchmark results, in summary:
O_DIRECT 62.02 mbyte/sec (2048 x 1048576byte reads)
/dev/rawN 52.31 mbyte/sec (2048 x 1048576byte reads)
base: 127.71 mbyte/sec (262144 x 8192byte reads)
nocopy hack: 182.17 mbyte/sec (262144 x 8192byte reads)
we can still say that:
- 'nocopy' is still 50% faster than copy_to_user(). ie. overhead ofcopy_to_user worth
~60mbyte/sec and 18usec latency
- O_DIRECT is superior to /dev/raw/rawN but is still a huge performance hit versus normal i/o on the block devices.
the benchmark results, in detail: (traces for each at bottom of email)
- O_DIRECT and disk devices never touched (ie. no filesystem on them at all), 2.4.19pre8aa2 performance is down slightly to 62mbyte/sec (compared to 65mbyte/sec with 2.4.18):
[root@mel-stglab-host1 src]# readprofile -r; \
./test_disk_performance blocks=2K bs=1m direct /dev/sd[e-l] >/tmp/direct.txt; \
readprofile -v | sort -n -k4 >> /tmp/direct.txt
Completed reading 16000 mbytes in 257.977850 seconds (62.02
Mbytes/sec), 15867usec mean
- i/o without O_DIRECT on 2.4.19pre8aa2 basically has DOUBLE the performance:
[root@mel-stglab-host1 src]# readprofile -r; \
./test_disk_performance blocks=256K bs=8k /dev/sd[e-l] > /tmp/base.txt; \
readprofile -v | sort -n -k4 >> /tmp/base.txt Completed reading 16000 mbytes in 125.288417 seconds (127.71
Mbytes/sec), 59usec mean
- same rest using i/o on /dev/raw/rawN instead:
[root@mel-stglab-host1 src]# readprofile -r; \
./test_disk_performance blocks=2K bs=1m /dev/raw/raw[1-8] > /tmp/raw.txt; \
readprofile -v | sort -n -k4 >> /tmp/raw.txt Completed reading 16000 mbytes in 305.878143 seconds (52.31
Mbytes/sec), 18583usec mean
- to round out the numbers, we still have a bogus file_read_actor() that
doesn't actually
do the copy_to_user, thereby showing the overhead associated with that:
[root@mel-stglab-host1 src]# readprofile -r; \
./test_disk_performance blocks=256K bs=8k nocopy /dev/sd[e-l] > /tmp/nocopy.txt; \
readprofile -v | sort -n -k4 >> /tmp/nocopy.txt Completed reading 16000 mbytes in 87.827854 seconds (182.17
Mbytes/sec), 41usec mean
O_DIRECT:
[root@mel-stglab-host1 src]# tail -20 /tmp/direct.txt
8012a670 follow_page 25 0.1202
8012a740 get_user_pages 89 0.1918
80136d40 __free_pages 10 0.2083
801d28b0 generic_make_request 83 0.2730
8012aa50 mark_dirty_kiobuf 35 0.3125
8013f0e0 set_bh_page 22 0.3438
8011f950 do_softirq 88 0.3929
8023d670 sd_find_queue 26 0.4062
80142a10 max_block 54 0.4219
80200fb0 __scsi_end_request 165 0.5428
80142c80 blkdev_get_block 37 0.5781
801405d0 brw_kiovec 581 0.6371
80140560 wait_kio 90 0.8036
80152820 end_kio_request 76 0.9500
801d29e0 submit_bh 181 1.6161
8013e950 init_buffer 55 1.7188
801d22a0 __make_request 3073 1.9800
8013dd10 unlock_buffer 189 2.3625
80140520 end_buffer_io_kiobuf 408 6.3750
80106d20 default_idle 45686 713.8438base:
[root@mel-stglab-host1 src]# tail -20 /tmp/base.txt
80133e60 kmem_cache_alloc 249 0.9154
80200fb0 __scsi_end_request 291 0.9572
80134fb0 delta_nr_inactive_pages 93 0.9688
801288b0 _spin_unlock_ 131 1.0234
8013f380 create_empty_buffers 107 1.1146
80135010 delta_nr_cache_pages 119 1.2396
801d28b0 generic_make_request 396 1.3026
8013f0e0 set_bh_page 102 1.5938
80108a48 system_call 91 1.6250
801d29e0 submit_bh 185 1.6518
801340e0 kmem_cache_free 217 1.6953
80140ea0 try_to_free_buffers 664 1.9762
801d22a0 __make_request 3214 2.0709
8012e0c0 unlock_page 283 2.2109
801298cc .text.lock.lockmeter 332 2.2432
80136d40 __free_pages 125 2.6042
801287d0 _spin_lock_ 585 5.2232
8013e970 end_buffer_io_async 1234 6.4271
8012edd0 file_read_actor 3732 33.3214
80106d20 default_idle 8875 138.6719/dev/raw/rawN:
[root@mel-stglab-host1 src]# tail -20 /tmp/raw.txt
80122c50 tqueue_bh 4 0.1250
8012a670 follow_page 33 0.1587
8012a740 get_user_pages 118 0.2543
80203890 scsi_init_io_vc 139 0.2555
8012aa50 mark_dirty_kiobuf 36 0.3214
80136d40 __free_pages 22 0.4583
8011f950 do_softirq 113 0.5045
801d28b0 generic_make_request 204 0.6711
8013e950 init_buffer 34 1.0625
8023d670 sd_find_queue 70 1.0938
8013f0e0 set_bh_page 74 1.1562
80200fb0 __scsi_end_request 365 1.2007
801405d0 brw_kiovec 1288 1.4123
80140560 wait_kio 193 1.7232
80152820 end_kio_request 166 2.0750
801d29e0 submit_bh 347 3.0982
8013dd10 unlock_buffer 357 4.4625
801d22a0 __make_request 11014 7.0966
80140520 end_buffer_io_kiobuf 835 13.0469
80106d20 default_idle 45156 705.5625nocopy hack:
[root@mel-stglab-host1 src]# tail -20 /tmp/nocopy.txt
8012dec0 page_cache_read 197 0.7695
80134fb0 delta_nr_inactive_pages 77 0.8021
80133e60 kmem_cache_alloc 221 0.8125
8013f020 get_unused_buffer_head 182 0.9479
801288b0 _spin_unlock_ 124 0.9688
80135010 delta_nr_cache_pages 110 1.1458
8013f380 create_empty_buffers 114 1.1875
801d28b0 generic_make_request 375 1.2336
801d29e0 submit_bh 201 1.7946
8013f0e0 set_bh_page 121 1.8906
8012e0c0 unlock_page 254 1.9844
80108a48 system_call 116 2.0714
801d22a0 __make_request 3234 2.0838
80140ea0 try_to_free_buffers 707 2.1042
801340e0 kmem_cache_free 272 2.1250
801298cc .text.lock.lockmeter 392 2.6486
80136d40 __free_pages 134 2.7917
801287d0 _spin_lock_ 636 5.6786
8013e970 end_buffer_io_async 1200 6.2500
80106d20 default_idle 5226 81.6562Re: [PATCH] 2.5.14 IDE 56
In reply to Andrew MortonQuoted 3 lines · Andrew Morton
For bulk
read()andwrite()I/O the best sized buffer is 8 kbytes. 4k is pretty good, too. Anything larger blows the user-side buffer out of L1. This is for x86.
Modern x86 support prefetch hints for the CPU to tell it to not pollute the caches with "streaming data". I bet using them would be a big win. The rep ; movsl loop used in copy*user isn't very good on modern x86 anyways (it is ok on PPro, but loses on Athlon and P4)
I'm (slowly) working on such functions for x86-64, it should be eventually possible to backport them to i386.
-Andi
Re: [PATCH] 2.5.14 IDE 56
In reply to Andrew MortonQuoted 10 lines · Andi Kleen
Quoted 3 lines · Andrew Morton
For bulk
read()andwrite()I/O the best sized buffer is 8 kbytes. 4k is pretty good, too. Anything larger blows the user-side buffer out of L1. This is for x86.Modern x86 support prefetch hints for the CPU to tell it to not pollute the caches with "streaming data". I bet using them would be a big win.
Maybe. For your basic:
for (many) {
read(fd1, buf, 8192);
write(fd2, buf, 8192);
}you want `buf' cached, but not the pagecache for fd1 and fd2. If the prefetch hints can express that then yes, nice.
Quoted 3 lines
The rep ; movsl loop used in copy*user isn't
very good on modern x86 anyways (it is ok on PPro, but loses on Athlon and P4)
On PII and PIII, rep;movsl is slower than an open-coded duff-device copy for all src/dest alignments except for the case where both are eight-byte-aligned. By up to 20%, iirc. four-byte-aligned to four-byte-aligned isn't too bad.
Of course, a lot of copy_*_users are well-aligned. But a lot are not. I ended up deciding that switching to the duff-device copy would be a very small overall win, when you weight it by the alignment patterns of normal kernel usage.
But making a runtime slection of which copy function to use (based on src/dest alignment) could speed up the kernel's most expensive function by maybe 10-15% overall.
The test proggy is in http://www.zip.com.au/~akpm/linux/cptimer.tar.gz
-
Re: [PATCH] 2.5.14 IDE 56
In reply to Andrew MortonQuoted 14 lines · Andrew Morton
Quoted 10 lines · Andi Kleen
Quoted 3 lines · Andrew Morton
For bulk
read()andwrite()I/O the best sized buffer is 8 kbytes. 4k is pretty good, too. Anything larger blows the user-side buffer out of L1. This is for x86.Modern x86 support prefetch hints for the CPU to tell it to not pollute the caches with "streaming data". I bet using them would be a big win.
Maybe. For your basic:
Quoted 7 lines
for (many) { read(fd1, buf, 8192); write(fd2, buf, 8192); }you want `buf' cached, but not the pagecache for fd1 and fd2. If the prefetch hints can express that then yes, nice.
SSE has prefetchnta
3dnow has something similar.
In addition you can use movnti* for stores. These should be faster because they use write combining and avoid the latency of fetching the cache line of the destination just to overwrite it.
The tricky bit is to avoid prefetches over the boundary of your copy. Prefetching from an uncached area or write combined area (like the AGP gart which could start in next page) triggers hardware bugs in various boxes. This unfortunately complicates the prefetching loops a bit.
Quoted 10 lines
Quoted 4 lines
The rep ; movsl loop used in copy*user isn't
very good on modern x86 anyways (it is ok on PPro, but loses on Athlon and P4)On PII and PIII, rep;movsl is slower than an open-coded duff-device copy for all src/dest alignments except for the case where both are eight-byte-aligned. By up to 20%, iirc. four-byte-aligned to four-byte-aligned isn't too bad.
That's surprising. AFAIK on PPro rep ; movs does magic prefetch tricks in microcode, so it should be eventually faster if you do not use explicit prefetching and you're not cache hot for bigger copies (in smaller ones the setup overhead may dominate)
On Athlon rep ; movs loses clearly compared to an unrolled loop.
-Andi
Re: [PATCH] 2.5.14 IDE 56
In reply to Andrew MortonHi!
Quoted 5 lines
The tricky bit is to avoid prefetches over the boundary of your copy. Prefetching from an uncached area or write combined area (like the AGP gart which could start in next page) triggers hardware bugs in various boxes. This unfortunately complicates the prefetching loops a bit.
CONFIG_MY_MACHINE_AINT_BORKEN? We definitely could assume that on x86-64.
Pavel
Signature · 2 lines
Philips Velo 1: 1"x4"x8", 300gram, 60, 12MB, 40bogomips, linux, mutt, details at http://atrey.karlin.mff.cuni.cz/~pavel/velo/index.html.
Re: [PATCH] 2.5.14 IDE 56
In reply to Andrew MortonQuoted 9 lines · Pavel Machek
Hi!
Quoted 5 lines
The tricky bit is to avoid prefetches over the boundary of your copy. Prefetching from an uncached area or write combined area (like the AGP gart which could start in next page) triggers hardware bugs in various boxes. This unfortunately complicates the prefetching loops a bit.
CONFIG_MY_MACHINE_AINT_BORKEN? We definitely could assume that on x86-64.
I was advised by AMD that I should better avoid it even for future boxes.
-Andi
Re: [PATCH] 2.5.14 IDE 56
In reply to Martin DaleckiQuoted 3 lines · Alan Cox
I can't speak directly for the Kudzu maintainer but I can say that having a sane way to obtain the list of ide devices (all of them not just non pcmcia) and the device bindings/type has been a long standing request.
Can't one simply do something like:
char device_string[20];
int i, type, major=0, minor=0;
for(i=0; i<26; i++) {
snprintf(device_string, sizeof(device_string), "/dev/hd%c", 'a'+i);
if ((fd=open(device_string, O_RDONLY | O_NONBLOCK)) < 0) {
continue;
}
switch ('a'+i) {
case 'a':
major=3;minor=0;
break;
case 'b':
major=3;minor=64;
break;
case 'c':
major=22;minor=0;
break;
case 'd':
major=22;minor=64;
break;
.....
}etc.... to detect the available ide devices without groveling through /proc/ide?
-Erik
--
Erik B. Andersen http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--
Re: [PATCH] 2.5.14 IDE 56
Quoted 6 lines
int i, type, major=0, minor=0;
for(i=0; i<26; i++) { snprintf(device_string, sizeof(device_string), "/dev/hd%c", 'a'+i); if ((fd=open(device_string, O_RDONLY | O_NONBLOCK)) < 0) { continue; }
If it opened is it there. Suppose its an IDE floppy and no media is present. Maybe its hiding in ide-scsi instead. It ends up being detective work. The /device set up makes it explicit and clean
Re: [PATCH] 2.5.14 IDE 56
In reply to Erik AndersenQuoted 10 lines · Alan Cox
Quoted 6 lines
int i, type, major=0, minor=0;
for(i=0; i<26; i++) { snprintf(device_string, sizeof(device_string), "/dev/hd%c", 'a'+i); if ((fd=open(device_string, O_RDONLY | O_NONBLOCK)) < 0) { continue; }If it opened is it there. Suppose its an IDE floppy and no media is present. Maybe its hiding in ide-scsi instead. It ends up being detective work.
That suggests to me that IDE floppy needs to be fixed to open even when no media is present when provided with the O_NONBLOCK flag, which would be consistant with how CDROMs, and everything SCSI works.
As for ide-scsi, I thought that was going to go away?
Quoted 1 line
work. The /device set up makes it explicit and clean
agreed. But I don't expect to see that showing up soon in 2.4.x, which is what most people (like me) will be using for the next year or two. Sure 2.5.x it might work, but it might eat your disk too. So is groping about in /proc/ide the only way to get reliable ide device detection for 2.4.x, or is there some other way?
-Erik
--
Erik B. Andersen http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--
Re: [PATCH] 2.5.14 IDE 56
Quoted 6 lines
That suggests to me that IDE floppy needs to be fixed to open even when no media is present when provided with the
O_NONBLOCKflag, which would be consistant with how CDROMs, and everything SCSI works.As for ide-scsi, I thought that was going to go away?
If we move to a more general device tree and you can set the mode you wish to use when accessing the device it can do. Right now the "mode" so to speak is implied by the file you open rather than by how you send it commands and what you ask it to do
Re: [PATCH] 2.5.14 IDE 56
In reply to Martin DaleckiQuoted 1 line · Erik Andersen
if ((fd=open(device_string, O_RDONLY | O_NONBLOCK)) < 0) {...
Quoted 2 lines
etc.... to detect the available ide devices without groveling through
/proc/ide?
This goes splat with removable IDE devices like ZIP drives etc. They fail to open() unless you put a disk in them.
Signature · 2 lines
| Dave Jones. http://www.codemonkey.org.uk | SuSE Labs
Re: [PATCH] 2.5.14 IDE 56
In reply to Linus TorvaldsUz.ytkownik [email protected] napisa?:
Quoted 29 lines
Quoted 11 lines
/driverfs/root/pci0/00:1f.4/usb_bus/000/and it wouldn't be impossible (or even necessarily very hard) to make an IDE controller export the "IDE device tree" the same way a USB controller now exports the "USB device tree".
For things like hotplug etc, I think driverfs is eventually the only way to go, simply because it gives you the full (and unambiguous) path to _any_ device, and is completely bus-agnostic.
But there is definitely a potential backwards-compatibility-issue.
One interesting thing here would be to have some optional link between the bus-oriented device tree and the function-oriented tree (ie. devfs or simply /dev). For example, an IDE node in driverfs could eventually hold symlinks to the entries it provides in /dev when using devfs (or just provide major/minor when not using devfs).
What do you think ?
One problem I've been faced with on ppc is to be able to match a linux device with what the firmware (Open Firmware) thinks that device is. The firmware view is bus-centered and it would be pretty easy to provide some additional entries in driverfs that give the OF fullpath of a given device. But then, the link between the actual driver in driverfs and the "device" as used by, for example, the filesystem isn't trivial.
Quoted 4 lines
Ben.
This is the "first" IDE controller on my notebook:
./devices/root/pci0/00:07.1/01f0
./devices/root/pci0/00:07.1/01f0/0
./devices/root/pci0/00:07.1/01f0/0/power
./devices/root/pci0/00:07.1/01f0/0/name
./devices/root/pci0/00:07.1/01f0/0/status
./devices/root/pci0/00:07.1/01f0/power
./devices/root/pci0/00:07.1/01f0/name
./devices/root/pci0/00:07.1/01f0/status
Guys I have done it already!
For your convenience I will attach the ata prefix to the currently used port number in the next patch round.
OK?
Re: [PATCH] 2.5.14 IDE 56
In reply to Linus TorvaldsHi!
Quoted 2 lines
BTW. If one needs the size of the disk well we could attach it as a file size to the device file in /dev IMHO. Why not?
Seems like good idea. (I don't know how happy du is going to be that. OTOH is du is not happy, we should fix it not to count block devices...)
Pavel
Signature · 2 lines
Philips Velo 1: 1"x4"x8", 300gram, 60, 12MB, 40bogomips, linux, mutt, details at http://atrey.karlin.mff.cuni.cz/~pavel/velo/index.html.
Re: [PATCH] 2.5.14 IDE 56
In reply to Linus TorvaldsQuoted 8 lines · Pavel Machek
Hi!
Quoted 2 lines
BTW. If one needs the size of the disk well we could attach it as a file size to the device file in /dev IMHO. Why not?
Seems like good idea. (I don't know how happy du is going to be that. OTOH is du is not happy, we should fix it not to count block devices...)
Pavel
The number /usr/bin/du shows is the block usage, not the logical size; you could use the logical size for this...
Signature · 2 lines
Daniel Jacobowitz Carnegie Mellon University MontaVista Software Debian GNU/Linux Developer
Re: [PATCH] 2.5.14 IDE 56
In reply to Linus TorvaldsQuoted 9 lines · Martin Dalecki
Uz.ytkownik Linus Torvalds napisa?:
Quoted 1 line
But there is definitely a potential backwards-compatibility-issue.
Linus - there are no backward compatibility issues here. No single application from my system does mess with
/proc/ide. They showed you a list of programs which use /proc and not a list of programs which use anything out of/proc/ide...
To be thorough, I greped for /proc/ide not just /proc, the exact command was:
find /sbin /usr/sbin /bin /usr/bin /lib /usr/lib /usr/bin/X11/ -xdev -perm +111 | xargs grep -l /proc/ide 2>/dev/null
Padraig.
Re: [PATCH] 2.5.14 IDE 56
In reply to Alan CoxHi!
Quoted 5 lines
/driverfs/root/pci0/00:1f.4/usb_bus/000/and it wouldn't be impossible (or even necessarily very hard) to make an IDE controller export the "IDE device tree" the same way a USB controller now exports the "USB device tree".
Look harder, it should be already there.
Pavel
Signature · 2 lines
Philips Velo 1: 1"x4"x8", 300gram, 60, 12MB, 40bogomips, linux, mutt, details at http://atrey.karlin.mff.cuni.cz/~pavel/velo/index.html.
Re: [PATCH] 2.5.14 IDE 56
In reply to Padraig BradyQuoted 4 lines · Padraig Brady
All the info I've ever needed is
/proc/ide/hdx/capacitywhich I could get from/proc/partitionswith more a bit more effort, so I vote for removing/proc/ide.
Note that one thing that we might do is to leave the remnants of /proc/ide but _without_ the very verbose per-chipset reporting.
At least to me it looks like it's all the chipset reporting that causes the huge kernel bloat, and it shouldn't be impossible to reinstate a minimal /proc/ide without those parts - while still keeping most of the backwards compatibility.
However, since I really don't much like the idea of having special "ide-only" /proc files, I personally think any information people actually used should be either in truly generic files (/proc/partitions as an example), _or_ they should be in the generic device tree (talk to Pat Mochel about that).
So my personal reaction to removal of /proc/ide is: "good riddance, but if it turns out that we seriously need it for backwards compatibility, we can add back a skeleton without the bloat".
(Side note: I'm afraid that don't think backwards compatibility weighs very heavily on an embedded setup - I'm more thinking about things like "a regular RedHat/SuSE/Debian/whatever install won't work any more".)
As to existing binaries (your list is interesting), I don't see what they are doing about ide-specific stuff, since I sure hope those binaries are happy with a SCSI-only system.
Quoted 3 lines
For e.g. could the same arguments could be made for lspci only interface to pci info rather than
/proc/bus/pci? The following references are made to/proc/bus/pcion my system:
I personally do like ASCII /proc files, as long as they don't add maintainability problems etc.
Linus
Re: [PATCH] 2.5.14 IDE 56
[email protected] (Linus Torvalds) wrote on 07.05.02 in <[email protected]>:
Quoted 6 lines · Padraig Brady
Quoted 4 lines
All the info I've ever needed is
/proc/ide/hdx/capacitywhich I could get from/proc/partitionswith more a bit more effort, so I vote for removing/proc/ide.
Quoted 7 lines
Note that one thing that we might do is to leave the remnants of
/proc/idebut _without_ the very verbose per-chipset reporting.At least to me it looks like it's all the chipset reporting that causes the huge kernel bloat, and it shouldn't be impossible to reinstate a minimal
/proc/idewithout those parts - while still keeping most of the backwards compatibility.
What I'd like to see - in whatever exact form - is the IDE equivalent to /proc/scsi/scsi. (And in fact, the SCSI version could use addition of at least the disk size and the sdX mapping.)
It's rather useful for getting a quick overview of what's on a system, and where.
Incidentally, is there a compelling reason why block device boot messages are all different?
Quoted 5 lines
However, since I really don't much like the idea of having special "ide-only" /proc files, I personally think any information people actually used should be either in truly generic files (
/proc/partitionsas an example), _or_ they should be in the generic device tree (talk to Pat Mochel about that).
/proc/bus/ide or something like that? Sure, why not? Exact place is pretty much irrelevant except to legacy code.
MfG Kai
Re: [PATCH] 2.5.14 IDE 56
In reply to Linus TorvaldsQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"linus" == Linus Torvalds <[email protected]> writes:
Hi
linus> (Side note: I'm afraid that don't think backwards compatibility weighs linus> very heavily on an embedded setup - I'm more thinking about things like "a linus> regular RedHat/SuSE/Debian/whatever install won't work any more".)
here at Mandrake we have a patch for the install kernel to remove the /proc/ide, and I think that we got it from redhat, that means that at least two distros preffer to save ~25kb in the boot kernels than the reporting that they do :p
Later, Juan.
Signature · 2 lines
In theory, practice and theory are the same, but in practice they are different -- Larry McVoy
Re: [PATCH] 2.5.14 IDE 56
Quoted 8 lines · Juan Quintela
linus> (Side note: I'm afraid that don't think backwards compatibility weighs linus> very heavily on an embedded setup - I'm more thinking about things like "a linus> regular RedHat/SuSE/Debian/whatever install won't work any more".)
here at Mandrake we have a patch for the install kernel to remove the
/proc/ide, and I think that we got it from redhat, that means that at least two distros preffer to save ~25kb in the boot kernels than the reporting that they do :p
Well, that's a good sign in that it implies that things certainyl work fine without /proc/ide.
However, I think I phrased things badly: I'm not actually worried about the RedHat or Mandrake "act of installation" itself - since that will always use whatever kernel RH or Mandrake put on their CD's, and they can always change their install scripts/programs to match the kernel they use.
I'm more worried about the issue of "I installed RH-x.x, and then I upgraded the kernel, and now program xyz won't work any more", where "xyz" is something perfectly reasonable and common.
For example, let's say that some strange version of "mount" _requires_ /proc/ide to work (don't ask me why), and that Mandrake happened to ship that version in their 8.2 release, and if you use the new 2.5.15 kernel on that installation, it simply won't work. THAT would be a problem where some backwards compatibility crud is probably worth it.
But if /proc/ide removal breaks an embedded device (on which the kernel is not normally upgraded by "normal" people that aren't willing to upgrade other stuff at the same time), I won't worry too much. Or if the /proc/ide changs mean that the actual installer has to be re-done, I won't worry.
And even breaking one or two applications might be quite acceptable: I worry more about maintainability than _perfect_ backwards compatibility.
Linus
Re: [PATCH] 2.5.14 IDE 56
In reply to Padraig BradyQuoted 39 lines · Padraig Brady
Quoted 30 lines · Linus Torvalds
[ First off: any IDE-only thing that doesn't work for SCSI or other disks
doesn't solve a generic problem, so the complaint that some generic tools might use it is totally invalid. ]Quoted 4 lines · Anton Altaparmakov
Linux's power is exactly that it can be used on anything from a wristwatch to a huge server and that it is flexible about everything. You are breaking this flexibility for no apparent reason. (I don't accept "I can't cope with this so I remove it." as a reason, sorry).
Run the 57 patch, and complain if something doesn't work.
Linux's power is that we FIX stuff. That we make it the best system possible, and that we don't just whine and argue about things.
Quoted 3 lines
As the new IDE maintainer so far we have only seen you removing one feature after the other in the name of cleanup, without adequate or even any at all(!) replacements,
Who cares? Have you found _anything_ that Martin removed that was at all worthwhile? I sure haven't.
Guys, you have to realize that the IDE layer has eight YEARS of absolute crap in it. Seriously. It's _never_ been cleaned up before. It has stuff so distasteful that t's scary.
Quoted 7 lines
Take it from me: it's a _lot_ easier to add cruft and crap on top of clean code. You can do it yourself if you want to. You don't need a maintainer to add barnacles.
All the information that
/proc/idegave you is basically available in hdparm, and for your dear embedded system it apparently takes up less space by being in user space. So what is the problem?
Quoted 5 lines
Well my "dear" embedded system doesn't have libc :-(
So 35664 saved in kernel (less on disk), requires 25212 extra for hdparm + more for static linked uclibc (hope it works ;-)). As a side note if this happens hdparm would be a requirement for busybox IMHO, anyway getting back on topic...
Link your embeded stuff against a stripped-down shared libc...
-rwxr-xr-x 1 root root 876 Apr 26 13:08 crt1.o -rwxr-xr-x 1 root root 160824 Feb 25 13:30 ld-linux.so.2 -rwxr-xr-x 1 root root 160824 Apr 30 11:31 ld.so -rwxr-xr-x 1 root root 2376745 Feb 25 13:29 libc.so.6 -rwxr-xr-x 1 root root 368551 Feb 25 13:29 libm.so.6
This does most everything an embedded system needs. You can extract the objects from a shared object file (copy), remove the ones you obviously don't need, make a new shared object file and link. Keep adding objects until you don't have a any more unresolved symbols.
ld allows you to link to whatever you need. I put my special 'libc' plus another private shared library in /opt/lib. On the target machine, /opt/lib is a sym-link to /lib.
LPATH=/opt/lib
ELINK=-rpath-link $(LPATH) \
-rpath $(LPATH) \
-L $(LPATH) -m elf_i386 \
-dynamic-linker \
$(LPATH)/ld-linux.so.2 \
$(LPATH)/crt1.o \
$(LPATH)/crtendS.o \
$(LPATH)/libc.so.6 \
$(LPATH)/libm.so.6
program: program.o
ld -o program program.o $(ELINK)
Cheers,
Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).
Windows-2000/Professional isn't.
Re: [PATCH] 2.5.14 IDE 56
In reply to Linus TorvaldsUz.ytkownik Padraig Brady napisa?:
Quoted 73 lines
Quoted 33 lines · Linus Torvalds
[ First off: any IDE-only thing that doesn't work for SCSI or other
disks
doesn't solve a generic problem, so the complaint that some generic tools might use it is totally invalid. ]Quoted 4 lines · Anton Altaparmakov
Linux's power is exactly that it can be used on anything from a wristwatch to a huge server and that it is flexible about everything. You are breaking this flexibility for no apparent reason. (I don't accept "I can't cope with this so I remove it." as a reason, sorry).
Run the 57 patch, and complain if something doesn't work.
Linux's power is that we FIX stuff. That we make it the best system possible, and that we don't just whine and argue about things.
Quoted 3 lines
As the new IDE maintainer so far we have only seen you removing one feature after the other in the name of cleanup, without adequate or even any at all(!) replacements,
Who cares? Have you found _anything_ that Martin removed that was at all worthwhile? I sure haven't.
Guys, you have to realize that the IDE layer has eight YEARS of absolute crap in it. Seriously. It's _never_ been cleaned up before. It has stuff so distasteful that t's scary.
Quoted 7 lines
Take it from me: it's a _lot_ easier to add cruft and crap on top of clean code. You can do it yourself if you want to. You don't need a maintainer to add barnacles.
All the information that
/proc/idegave you is basically available in hdparm, and for your dear embedded system it apparently takes up less space by being in user space. So what is the problem?Well my "dear" embedded system doesn't have libc :-(
So 35664 saved in kernel (less on disk), requires 25212 extra for hdparm + more for static linked uclibc (hope it works ;-)). As a side note if this happens hdparm would be a requirement for busybox IMHO, anyway getting back on topic...All the info I've ever needed is
/proc/ide/hdx/capacitywhich I could get from/proc/partitionswith more a bit more effort, so I vote for removing/proc/ide.I think everyone realises Martin is doing great and much needed work on IDE (btw I'll have those flash support patches soon Martin ;-)), but I did think this change needed debate. In general I know it's a hard decision what to export in proc, especially if there are existing dependencies, a few already mentioned possibles in RH7.1:
/sbin/mkinitrd/sbin/fdisk/sbin/sfdisk/sbin/sndconfig/usr/sbin/mouseconfig/usr/sbin/kudzu/usr/sbin/module_upgrade/usr/sbin/updfstab/usr/sbin/glidelink/usr/sbin/sndconfig/usr/lib/python1.5/site-packages/_kudzumodule.so/usr/bin/X11/Xconfigurator
Quoted 3 lines
For e.g. could the same arguments could be made for lspci only interface to pci info rather than
/proc/bus/pci? The following references are made to/proc/bus/pcion my system:
In esp. in sigth of the fact that we have a device tree filesystem, I rather think that /prco/bus/pci is obsolete indeed.
Re: [PATCH] 2.5.14 IDE 56
In reply to Linus TorvaldsQuoted 7 lines · Martin Dalecki
Quoted 4 lines
For e.g. could the same arguments could be made for lspci only interface to pci info rather than
/proc/bus/pci? The following references are made to/proc/bus/pcion my system:In esp. in sigth of the fact that we have a device tree filesystem, I rather think that /prco/bus/pci is obsolete indeed.
Not quite yet. I considered moving the functionality of /proc/bus/pci into driverfs, but couldn't find a good solid reason to do it (and it would involve changing lspci and any other userspace programs that use it today.)
Now reimplementing /proc/bus/pci as a stand alone filesystem mounted in that position (like usbfs is) is another story. pcifs anyone? :)
thanks,
greg k-h
Re: [PATCH] 2.5.14 IDE 56
In reply to Anton AltaparmakovQuoted 7 lines · Linus Torvalds
Quoted 3 lines · Anton Altaparmakov
As the new IDE maintainer so far we have only seen you removing one feature after the other in the name of cleanup, without adequate or even any at all(!) replacements,
Who cares? Have you found _anything_ that Martin removed that was at all worthwhile? I sure haven't.
I'm still hoping a patch will show up that will allow me to regain access to my compactflash cards and IBM microdrive disks. The code currently doesn't rescan for new drives when a card has been inserted, although it still seems to have all the necessary logic.
Jan
Re: [PATCH] 2.5.14 IDE 56
In reply to Anton AltaparmakovUz.ytkownik Jan Harkes napisa?:
Quoted 8 lines · Linus Torvalds
Quoted 7 lines · Anton Altaparmakov
Quoted 4 lines
As the new IDE maintainer so far we have only seen you removing one feature after the other in the name of cleanup, without adequate or even any at all(!) replacements,
Quoted 9 lines
Quoted 2 lines
Who cares? Have you found _anything_ that Martin removed that was at all worthwhile? I sure haven't.
I'm still hoping a patch will show up that will allow me to regain access to my compactflash cards and IBM microdrive disks. The code currently doesn't rescan for new drives when a card has been inserted, although it still seems to have all the necessary logic.
Yes I'm fully aware of this, but the whole initialization is currently much in flux and I will return to this issue back if I think that things are in shape there. OK?
Re: [PATCH] 2.5.14 IDE 56
In reply to Anton AltaparmakovQuoted 9 lines · Martin Dalecki
Uz.ytkownik Jan Harkes napisa?:
Quoted 4 lines
I'm still hoping a patch will show up that will allow me to regain access to my compactflash cards and IBM microdrive disks. The code currently doesn't rescan for new drives when a card has been inserted, although it still seems to have all the necessary logic.
Yes I'm fully aware of this, but the whole initialization is currently much in flux and I will return to this issue back if I think that things are in shape there. OK?
I thought so, you already indicated so around the time that it broke. There is still a 2.4 kernel when I really need to get to the data.
Jan
Re: [PATCH] 2.5.14 IDE 56
In reply to Anton AltaparmakovQuoted 7 lines · Jan Harkes
Quoted 6 lines · Martin Dalecki
Uz.ytkownik Jan Harkes napisa?:
Quoted 4 lines
I'm still hoping a patch will show up that will allow me to regain access to my compactflash cards and IBM microdrive disks. The code currently doesn't rescan for new drives when a card has been inserted, although it still seems to have all the necessary logic.
Quoted 6 lines
Quoted 3 lines
Yes I'm fully aware of this, but the whole initialization is currently much in flux and I will return to this issue back if I think that things are in shape there. OK?
I thought so, you already indicated so around the time that it broke. There is still a 2.4 kernel when I really need to get to the data.
I usually do
blockdev --rereadpt /dev/sde
or so. That still works for me with 2.5.13.
Andries
Re: [PATCH] 2.5.14 IDE 56
In reply to Anton AltaparmakovQuoted 12 lines · Guest section DW
Quoted 11 lines · Jan Harkes
Quoted 9 lines · Martin Dalecki
Uz.ytkownik Jan Harkes napisa?:
Quoted 4 lines
I'm still hoping a patch will show up that will allow me to regain access to my compactflash cards and IBM microdrive disks. The code currently doesn't rescan for new drives when a card has been inserted, although it still seems to have all the necessary logic.
Yes I'm fully aware of this, but the whole initialization is currently much in flux and I will return to this issue back if I think that things are in shape there. OK?
Quoted 8 lines
Quoted 2 lines
I thought so, you already indicated so around the time that it broke. There is still a 2.4 kernel when I really need to get to the data.
I usually do
blockdev --rereadpt /dev/sdeor so. That still works for me with 2.5.13.
For SCSI devices probably, but I get "/dev/hde: No such device" (ENODEV) when a CF card is inserted and recognized.
(dmesg)
hde: SanDisk SDCFB-32, ATA DISK drive
ide2 at 0x100-0x107,0x10e on irq 3
ide_cs: hde: Vcc = 3.3, Vpp = 0.0When the CF card is not inserted I get a subtly different error "/dev/hde: No such device or address" (ENXIO).
It looks like the drive <-> driver association is only set up when the ide-disk driver module is loaded and not when new hardware is found.
Jan
Re: [PATCH] 2.5.14 IDE 56
In reply to Anton AltaparmakovUz.ytkownik Guest section DW napisa?:
Quoted 19 lines · Jan Harkes
Quoted 10 lines · Martin Dalecki
Quoted 8 lines
Uz.ytkownik Jan Harkes napisa?:
Quoted 4 lines
I'm still hoping a patch will show up that will allow me to regain access to my compactflash cards and IBM microdrive disks. The code currently doesn't rescan for new drives when a card has been inserted, although it still seems to have all the necessary logic.
Quoted 6 lines
Quoted 3 lines
Yes I'm fully aware of this, but the whole initialization is currently much in flux and I will return to this issue back if I think that things are in shape there. OK?
I thought so, you already indicated so around the time that it broke. There is still a 2.4 kernel when I really need to get to the data.
Quoted 5 lines
I usually do
blockdev --rereadpt /dev/sdeor so. That still works for me with 2.5.13.
What you have to do by hand now is the rescanning for partition information. What you do is triggering just that. And if I think about it... and you know I'm evil... hmmm...
well why just don't let it be like that. It's functionally somehow the responsibility of the /sbin/hotplug thing anyway...
Re: [PATCH] 2.5.14 IDE 56
Quoted 3 lines
about it... and you know I'm evil... hmmm...
well why just don't let it be like that. It's functionally somehow the responsibility of the/sbin/hotplugthing anyway...
How do you intend to order a sequence of I/O operations precisely against a partition table change driven from user space ? Thats one I can't see a nice answer for, and having a raid controller that can do on the fly volume resizing/creation/deletion its not just a matter of curiosity
Re: [PATCH] 2.5.14 IDE 56
Uz.ytkownik Alan Cox napisa?:
Quoted 7 lines
Quoted 3 lines
about it... and you know I'm evil... hmmm...
well why just don't let it be like that. It's functionally somehow the responsibility of the/sbin/hotplugthing anyway...How do you intend to order a sequence of I/O operations precisely against a partition table change driven from user space ? Thats one I can't see a nice answer for, and having a raid controller that can do on the fly volume resizing/creation/deletion its not just a matter of curiosity
Nahh Alan we are just talking about the ide-cs stuff. I'm not that "evil".
Re: [PATCH] 2.5.14 IDE 56
In reply to Linus TorvaldsQuoted 11 lines · Martin Dalecki
Uz.ytkownik Padraig Brady napisa?:
Quoted 5 lines
Am I going to have to parse hdparm output?
....
geometry = 2434/255/63, sectors = 39102336, start = 0Am I going to need hdparm on my embedded system?
Yes. Or just fsck hardcode the defaults.
hardcode defaults?
Also are the following standard RH7.1 programs going to need changing?
[padraig@pixelbeat padraig]$ find /sbin /usr/sbin /bin /usr/bin /lib /usr/lib /usr/bin/X11/ -xdev -perm +111 | xargs grep -l /proc/ide 2>/dev/null /sbin/mkinitrd/sbin/fdisk/sbin/sfdisk/sbin/sndconfig/usr/sbin/mouseconfig/usr/sbin/kudzu/usr/sbin/module_upgrade/usr/sbin/updfstab/usr/sbin/glidelink/usr/sbin/sndconfig/usr/lib/python1.5/site-packages/_kudzumodule.so/usr/bin/X11/Xconfigurator
Padraig.
Re: [PATCH] 2.5.14 IDE 57
In reply to Linus TorvaldsQuoted 16 lines · Dave Jones
Quoted 3 lines · Anton Altaparmakov
How do I get this information with hdparm please?
[aia21@drop ide]$ cat via
Bartlomiej Zolnierkiewicz moved all this stuff to userspace a long time ago in 'ideinfo'.
Quoted 8 lines
[aia21@drop hda]$ cat cache
1916
[aia21@drop hda]$ cat capacity
80418240
[aia21@drop hda]$ cat geometry
physical 79780/16/63
logical 5005/255/63
Quoted 3 lines
Quoted 1 line
And hdparm never gives you the physical geometry AFAICS.
Why would a normal user ever need to know this info?
Well one application we have here is a backup script in a web interface (php running as nobody), which copies a whole disk (compact flash) to the client while indicating the total size to the client for feedback:
Header("Content-type: application/octet-stream"); $flash_size=cat /proc/ide/hda/capacity; $flash_size=$flash_size*512;Header("Content-length: $flash_size"); Header("Content-Disposition: attachment; filename=flash.img"); passthru("/bin/suid_copy_flash");
Now you could of course have a /bin/suid_get_flash_size but this is messy/less efficient?
Padraig.
PATCH 1/1 IDE 58
In reply to Linus TorvaldsTue May 7 14:28:47 CEST 2002 ide-clean-58
- Apply m68k fixes by Roman Zippel.
- Apply CDROM PIO mode fix by Osamu Tamita.
(You are true "Hawk-eye" hovering over my head! Respect - and many Thanks.)
- Virtualize the udma_enable method as well to help ARM and PPC people. Please please if you would like to have some other methods virtualized in a similar way - just tell me or even better do it yourself at the end of ide-dma.c. I *don't mind* patches.
- Fix the pmac code to adhere to the new API. It's supposed to work again. However this is blind coding... I give myself 80% chances for it to work ;-).
drivers/ide/buddha.c +16 -10
@@ -1,10 +1,10 @@/* * linux/drivers/ide/buddha.c -- Amiga Buddha, Catweasel and X-Surf IDE Driver * -* Copyright (C) 1997 by Geert Uytterhoeven +* Copyright (C) 1997, 2001 by Geert Uytterhoeven and others * -* This driver was written by based on the specifications in README.buddha and -* the X-Surf info from Inside_XSurf.txt available at +* This driver was written based on the specifications in README.buddha and +* the X-Surf info from Inside_XSurf.txt available at * http://www.jschoenfeld.com * * This file is subject to the terms and conditions of the GNU General Public
@@ -52,7 +52,7 @@ BUDDHA_BASE1, BUDDHA_BASE2, BUDDHA_BASE3 }; -static const u_int xsurf_bases[XSURF_NUM_HWIFS ]__initdata = { +static u_int xsurf_bases[XSURF_NUM_HWIFS ]__initdata = {XSURF_BASE1 ,XSURF_BASE2 };
@@ -97,7 +97,7 @@ BUDDHA_IRQ1, BUDDHA_IRQ2, BUDDHA_IRQ3 }; -static const int xsurf_irqports[XSURF_NUM_HWIFS ]__initdata = { +static int xsurf_irqports[XSURF_NUM_HWIFS ]__initdata = {XSURF_IRQ1 ,XSURF_IRQ2 };
@@ -108,8 +108,9 @@* Board information */ -enum BuddhaType_Enum {BOARD_BUDDHA ,BOARD_CATWEASEL ,BOARD_XSURF }; -typedef enum BuddhaType_Enum BuddhaType ; +typedef enum BuddhaType_Enum { +BOARD_BUDDHA ,BOARD_CATWEASEL ,BOARD_XSURF +}BuddhaType ;/*
@@ -175,15 +176,20 @@if (!request_mem_region (board+XSURF_BASE1 ,0x1000 ,"IDE" ))continue ;if (!request_mem_region (board+XSURF_BASE2 ,0x1000 ,"IDE" )) + goto fail_base2; +if (!request_mem_region (board+XSURF_IRQ1 ,0x8 ,"IDE" )) { +release_mem_region (board+XSURF_BASE2 ,0x1000 ); +fail_base2: +release_mem_region (board+XSURF_BASE1 ,0x1000 );continue ; -if (!request_mem_region (board+XSURF_IRQ1 ,0x8 ,"IDE" )) -continue ; + } } buddha_board =ZTWO_VADDR (board);/* write to BUDDHA_IRQ_MR to enable the board IRQ */ /* X-Surf doesn't have this. IRQs are always on */ -if (type !=BOARD_XSURF ) *(char *)(buddha_board+BUDDHA_IRQ_MR ) =0 ; +if (type !=BOARD_XSURF ) +z_writeb (0 , buddha_board+BUDDHA_IRQ_MR );for (i=0 ;i<buddha_num_hwifs;i++) {if (type !=BOARD_XSURF ) {
drivers/ide/Config.in +1 -1
@@ -103,7 +103,7 @@ dep_mbool ' Amiga IDE Doubler support (EXPERIMENTAL)' CONFIG_BLK_DEV_IDEDOUBLER $CONFIG_BLK_DEV_GAYLE $CONFIG_EXPERIMENTAL fi if [ "$CONFIG_ZORRO" = "y" -a "$CONFIG_EXPERIMENTAL" = "y" ]; then - dep_mbool ' Buddha/Catweasel IDE interface support (EXPERIMENTAL)' CONFIG_BLK_DEV_BUDDHA $CONFIG_ZORRO $CONFIG_EXPERIMENTAL + dep_mbool ' Buddha/Catweasel/X-Surf IDE interface support (EXPERIMENTAL)' CONFIG_BLK_DEV_BUDDHA $CONFIG_ZORRO $CONFIG_EXPERIMENTAL fi if [ "$CONFIG_ATARI" = "y" ]; then dep_bool ' Falcon IDE interface support' CONFIG_BLK_DEV_FALCON_IDE $CONFIG_ATARI
drivers/ide/falconide.c +1 -1
@@ -7,7 +7,7 @@* License. See the file COPYING in the main directory of this archive for * more details. */ -#include <linux/config.h> +#include <linux/types.h> #include <linux/mm.h> #include <linux/interrupt.h>
drivers/ide/ide.c +1 -0
@@ -2097,6 +2097,7 @@ ch->atapi_read = old.atapi_read; ch->atapi_write = old.atapi_write; ch->XXX_udma = old.XXX_udma; + ch->udma_enable = old.udma_enable; ch->udma_start = old.udma_start; ch->udma_stop = old.udma_stop; ch->udma_read = old.udma_read;
drivers/ide/ide-cd.c +1 -1
@@ -962,7 +962,7 @@/* First, figure out if we need to bit-bucket any of the leading sectors. */ - nskip =MIN (rq->current_nr_sectors -bio_sectors (rq->bio), sectors_to_transfer); + nskip =MIN ((int )(rq->current_nr_sectors -bio_sectors (rq->bio)), sectors_to_transfer);while (nskip >0 ) {/* We need to throw away a sector. */
drivers/ide/ide-dma.c +14 -2
@@ -533,8 +533,20 @@ {struct ata_channel *ch = drive->channel;int set_high =1 ; -u8 unit = (drive->select.b.unit &0x01 ); -u64 addr =BLK_BOUNCE_HIGH ; +u8 unit; +u64 addr; + + +/* Method overloaded by host chip specific code. */ +if (ch->udma_enable) { + ch->udma_enable (drive, on, verbose); + +return ; + } + +/* Fall back to the default implementation. */ + unit = (drive->select.b.unit &0x01 ); + addr =BLK_BOUNCE_HIGH ;if (!on) {if (verbose)
drivers/ide/ide-pmac.c +176 -108
327 lines not on this page · raw message
drivers/ide/ide-taskfile.c +0 -2
@@ -39,8 +39,6 @@ #define DTF(x...)#endif -#define SUPPORT_VLB_SYNC 1 -/* * for now, taskfile requests are special :/ */
include/asm-m68k/ide.h +1 -0
@@ -121,6 +121,7 @@#define inb (p) in_8(ADDR_TRANS_B(p))#define inb_p (p) in_8(ADDR_TRANS_B(p))#define inw (p) in_be16(ADDR_TRANS_W(p)) +#define inw_p (p) in_be16(ADDR_TRANS_W(p))#define outb (v,p) out_8(ADDR_TRANS_B(p),v)#define outb_p (v,p) out_8(ADDR_TRANS_B(p),v)#define outw (v,p) out_be16(ADDR_TRANS_W(p),v)
include/linux/ide.h +2 -0
@@ -459,6 +459,8 @@int (*XXX_udma)(struct ata_device *); +void (*udma_enable)(struct ata_device *,int ,int ); +int (*udma_start) (struct ata_device *,struct request *rq);int (*udma_stop) (struct ata_device *);
Re: [PATCH] IDE 58
Quoted 7 lines · Martin Dalecki
- Virtualize the
udma_enablemethod as well to help ARM and PPC people. Please please if you would like to have some other methods virtualized in a similar way - just tell me or even better do it yourself at the end ofide-dma.c. I *don't mind* patches.- Fix the pmac code to adhere to the new API. It's supposed to work again. However this is blind coding... I give myself 80% chances for it to work ;-).
OK, now I am truly impressed. Not only does it compile cleanly, it works first go!
I am using the tiny patch below, it sets the unmask flag so interrupts will be unmasked by default (which is safe on powermacs).
Thanks,
Paul.
drivers/ide/ide-pmac.c +1 -0
@@ -343,6 +343,7 @@ ide_hwifs[ix].autodma =1 ;#endif } + ide_hwifs[ix].unmask =1 ; }#if 0
Re: [PATCH] IDE 58
In reply to Linus TorvaldsUz.ytkownik Paul Mackerras napisa?:
Quoted 8 lines
Quoted 5 lines · Martin Dalecki
- Virtualize the
udma_enablemethod as well to help ARM and PPC people. Please please if you would like to have some other methods virtualized in a similar way - just tell me or even better do it yourself at the end ofide-dma.c. I *don't mind* patches.
Quoted 6 lines
Quoted 2 lines
- Fix the pmac code to adhere to the new API. It's supposed to work again. However this is blind coding... I give myself 80% chances for it to work ;-).
OK, now I am truly impressed. Not only does it compile cleanly, it works first go!
Thank you.
BTW> I would really love it if the cris architecture people could "lend me" some small developement system for they interresting CPU. In return I could give them what's certainly worth "several weeks of developers time". (If you hear me: this is a hint if you need an argument for your management.)
This unfortunately is the somehow most wired ATA interface around. Which is due to the fact that the interface cell is directly mapped to some CPU registers. As a CPU design I think it's a fine approach. Don't take me wrong. You save yourself the whole silicon which is needed for BM access arbitration and general handling and so on... Very nice tought out. But on the software side this is a bit wired, since you can't use the generic I/O primitives of the arch in question.
This makes my cleanup of the portability layer a bit hard to finish on the software side.
Quoted 2 lines
I am using the tiny patch below, it sets the unmask flag so interrupts will be unmasked by default (which is safe on powermacs).
And on every other fscking PCI based system... (modulo the "problematic"
cmd640 and RZ1000). Should have been done a long time ago this way... I will adjust the others as well.
Quoted 15 lines
Thanks,
Paul.diff -urN
linux-2.5/drivers/ide/ide-pmac.cpmac-2.5/drivers/ide/ide-pmac.cdrivers/ide/ide-pmac.c +1
-0@@ -343,6 +343,7 @@ ide_hwifs[ix].autodma =1 ;#endif } + ide_hwifs[ix].unmask =1 ; }#if 0
Re: [PATCH] IDE 58
Quoted 2 lines · Martin Dalecki
BTW> I would really love it if the cris architecture people could "lend me" some small developement system for they interresting CPU.
We'll consider it :) However,
Quoted 7 lines
This unfortunately is the somehow most wired ATA interface around. Which is due to the fact that the interface cell is directly mapped to some CPU registers. As a CPU design I think it's a fine approach. Don't take me wrong. You save yourself the whole silicon which is needed for BM access arbitration and general handling and so on... Very nice tought out. But on the software side this is a bit wired, since you can't use the generic I/O primitives of the arch in question.
I don't see why all IDE-interfaces in the world have to be I/O-mapped just because the first PC implementations used that. Sure it was an extended ISA-bus but the ISA bus is long gone and we don't all run PC's anymore either.
So the simple abstraction we need to hit IDE-bus registers is a macro or inline, instead of a call of an I/O-primitive. It was too much work to abstract this when I inserted the CRIS-arch IDE-driver in the first place so I found a workaround but now seems like a better time..
Similarily, there is no reason at all why the CPU has to do _polling_ just because the IDE _bus_ is using a PIO-mode. It probably does that on legacy PC's but HW designed, hrm, more optimally can use DMA. Hence the hooks for the ide_func_t.
So I'd figure the software side really would be _easier_ to implement with those assumptions about how an IDE-interface is supposed to work gone.
Quoted 2 lines
This makes my cleanup of the portability layer a bit hard to finish on the software side.
I understand that, so lets keep the discussion going and I'll check over your current cleanup.
/Bjorn
Re: [PATCH] IDE 58
Quoted 9 lines
I don't see why all IDE-interfaces in the world have to be I/O-mapped just because the first PC implementations used that. Sure it was an extended ISA-bus but the ISA bus is long gone and we don't all run PC's anymore either.
So the simple abstraction we need to hit IDE-bus registers is a macro or inline, instead of a call of an I/O-primitive. It was too much work to abstract this when I inserted the CRIS-arch IDE-driver in the first place so I found a workaround but now seems like a better time..
No, not a macro. There are cases where you want different access methods on the same machine. For example, pmacs can have the "mac-io" (ide-pmac) controller, which is MMIO based, _and_ a PCI-based legacy IDE controller using inx/outx like IOs. (A typical example is the Blue&White G3 who has both on the motherboard).
Ultimately, you want the hwif (or what it becomes in 2.5) provide a set of functions for accessing taskfile registers and doing the PIO data stream read/writes (that is replace inb/outb and insw/outsw).
Quoted 22 lines
Similarily, there is no reason at all why the CPU has to do _polling_ just because the IDE _bus_ is using a PIO-mode. It probably does that on legacy PC's but HW designed, hrm, more optimally can use DMA. Hence the hooks for the
ide_func_t.So I'd figure the software side really would be _easier_ to implement with those assumptions about how an IDE-interface is supposed to work gone.
Quoted 2 lines
This makes my cleanup of the portability layer a bit hard to finish on the software side.
I understand that, so lets keep the discussion going and I'll check over your current cleanup.
/Bjorn
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] IDE 58
In reply to Bjorn WesenUz.ytkownik Bjorn Wesen napisa?:
Quoted 18 lines · Martin Dalecki
Quoted 3 lines
BTW> I would really love it if the cris architecture people could "lend me" some small developement system for they interresting CPU.
We'll consider it :) However,
Quoted 7 lines
This unfortunately is the somehow most wired ATA interface around. Which is due to the fact that the interface cell is directly mapped to some CPU registers. As a CPU design I think it's a fine approach. Don't take me wrong. You save yourself the whole silicon which is needed for BM access arbitration and general handling and so on... Very nice tought out. But on the software side this is a bit wired, since you can't use the generic I/O primitives of the arch in question.
Quoted 1 line
I don't see why all IDE-interfaces in the world have to be I/O-mapped just because the first PC implementations used that. Sure it was an extended ISA-bus but the ISA bus is long gone and we don't all run PC's anymore either.
Hey I agree and anticipate the design decisions for the Cris CPU as good and surprisingly refreshing. Like for example the whole concept of the compacted command set and so on. They are just *cute*... It's about a year ago I did study the public available documentation on it.
Quoted 1 line
So the simple abstraction we need to hit IDE-bus registers is a macro or inline, instead of a call of an I/O-primitive. It was too much work to abstract this when I inserted the CRIS-arch IDE-driver in the first place so I found a workaround but now seems like a better time..
I don't think that it's always the proper aproach for hardware portability to do it on the "micro operation" level. That's good for generics like inb outb. In the case of the ATA interface it's better to do it on the "functional" level above... Just like you did with ata_read() and ata_write() as they are called now. You can see I picked it up and when I sort the transport method detecion/setting out I will apply it to the other friends from the ata_read_xxx family as well. And then we have the same aproach in the udma_ familiy I just introduced.
Quoted 1 line
Similarily, there is no reason at all why the CPU has to do _polling_ just because the IDE _bus_ is using a PIO-mode. It probably does that on legacy PC's but HW designed, hrm, more optimally can use DMA. Hence the hooks for the
ide_func_t.
Well right now I think if you look at the IDE 58 patch you will see that ide_func_t is a 'bit ugly', simple becouse it is introducing just another entity to the game. We don't need it.
struct ata_chanell *is* the central entitiy for operations from the host view. In my whole expierence as a programmer it always turned out to be most sane to make the software design be a homological mapping of the generalized hardware design on this level of coding. It's just natural functions are there to serve a specific purpose.
Quoted 8 lines
So I'd figure the software side really would be _easier_ to implement with those assumptions about how an IDE-interface is supposed to work gone.
Quoted 2 lines
This makes my cleanup of the portability layer a bit hard to finish on the software side.
I understand that, so lets keep the discussion going and I'll check over your current cleanup.
Well please consider: iff I had access to the hardware it would possibly save you a lot of reading through bad english ;-).
Quoted 1 line
/Bjorn
Regards.
Re: [PATCH] IDE 58
Quoted 5 lines · Martin Dalecki
I don't think that it's always the proper aproach for hardware portability to do it on the "micro operation" level. That's good for generics like inb outb. In the case of the ATA interface it's better to do it on the "functional" level above...
Amen.
Helleluja.
Listen to the man.
Please don't play games with "ide_outb()" etc, which cause 99% of the architectures to have to make the 1:1 translation to just "outb()", and which also makes it incredibly cumbersome to handle multiple _different_ controllers that just happen to use different schemes.
Instead, making the virtualization at a higher point means that you can have _one_ set of common operations for traditional PCI/ATA controllers (and that one set uses inx/outx/readx/writex), and then you have a few others for the "strange" cases.
And done properly with per-controller (or drive - you may want to virtualize at the drive level just because you could separate out different kinds of drive accesses that way too) function pointers you can then _mix_ access methods, without getting completely idiotic run-time checks inside "ide_out()".
Linus
Re: [PATCH] IDE 58
Quoted 5 lines
And done properly with per-controller (or drive - you may want to virtualize at the drive level just because you could separate out different kinds of drive accesses that way too) function pointers you can then _mix_ access methods, without getting completely idiotic run-time checks inside "
ide_out()".
Which ends up basically into having function pointers in the ata_channel (or ata_drive, but I doubt that would be really necessary) a set of 4 access functions: taskfile_in/out for access to taskfile registers (8 bits), and data_in/out for steaming datas in/out of the data reg (16 bits).
That would cleanly solve my problem of mixing MMIO and PIO controllers in the same machine, that would solve the crazy byteswapping needed by some controllers for PIO at least, etc...
I would even suggest not caring about the taskfile register address at all (that is kill the array of port addresses) but just pass the taskfile_in/out functions the register number (cyl_hi, cyl_lo, select, ....) as a nice symbolic constant, and let the channel specific implementation figure it out. I haven't checked if you already killed all of the request/release region crap done by the common ide code, that is matter is completely internal to the host controller driver, etc...
Now, andre may tell us we need one more set for "slow IO" versions for some HW, I don't know the details for these so I'll let the old man speak up here.
Ben.
Re: [PATCH] IDE 58
Quoted 4 lines
ata_channel(orata_drive, but I doubt that would be really necessary) a set of 4 access functions: taskfile_in/out for access to taskfile registers (8 bits), and data_in/out for steaming datas in/out of the data reg (16 bits).
Please push it higher level than that. Load the taskfile as a set in each method. Remember its 1 potentially paired instruction to do an MMIO write, its a whole mess of synchronziation and stalls to do a function pointer.
Quoted 4 lines
address at all (that is kill the array of port addresses) but just pass the taskfile_in/out functions the register number (
cyl_hi,cyl_lo, select, ....) as a nice symbolic constant, and let the channel specific implementation figure it out.
Pass dev->taskfile_load() a struct at least for the common paths. Make the PIO block transfers also single callbacks for each block not word.
Alan
Re: [PATCH] IDE 58
Quoted 5 lines
Please push it higher level than that. Load the taskfile as a set in each method. Remember its 1 potentially paired instruction to do an MMIO write, its a whole mess of synchronziation and stalls to do a function pointer.
I though about that, but what about corner cases where only a single register can be accessed ? (typically alt status). Provide specific routines ? Also, how does the extended addressing works ? by writing several times to the cyl registers ? That would have to be dealt with as well in each host driver then.
Quoted 7 lines
Quoted 4 lines
address at all (that is kill the array of port addresses) but just pass the taskfile_in/out functions the register number (
cyl_hi,cyl_lo, select, ....) as a nice symbolic constant, and let the channel specific implementation figure it out.Pass
dev->taskfile_load()a struct at least for the common paths. Make the PIO block transfers also single callbacks for each block not word.
Right. We could go the darwin (apple) way and have taskfile_load/store functions doing the entire registers controlled by a bitmask of which registers has to be touched. it has a cost (testing each bit and conditionally branching, which can suck hard) but probably less than an indirect function call which isn't predictable.
Ben.
Re: [PATCH] IDE 58
Quoted 5 lines
I though about that, but what about corner cases where only a single register can be accessed ? (typically alt status). Provide specific routines ? Also, how does the extended addressing works ? by writing several times to the cyl registers ? That would have to be dealt with as well in each host driver then.
There are lots of cases we don't care about speed - things like setup of the controller, changing UDMA mode etc.
Quoted 4 lines
Right. We could go the darwin (apple) way and have taskfile_load/store functions doing the entire registers controlled by a bitmask of which registers has to be touched. it has a cost (testing each bit and conditionally branching, which can suck hard) but probably less than
Get yourself a conditional move instruction 8)
Quoted 1 line
an indirect function call which isn't predictable.
Or you have a small set of such functions for the critical paths - ie doing actual block I/O which pass the set of values required to do that operation and do the stores. What are the performance critical paths
Begin a disk write
Begin a disk read
PIO transfer in
PIO transfer out
End a disk I/O fastpaths (no error case)
Maybe ATAPI command writes ?
beyond that I doubt the rest are critical
Alan
Re: [PATCH] IDE 58
Quoted 8 lines
Quoted 5 lines
I though about that, but what about corner cases where only a single register can be accessed ? (typically alt status). Provide specific routines ? Also, how does the extended addressing works ? by writing several times to the cyl registers ? That would have to be dealt with as well in each host driver then.
There are lots of cases we don't care about speed - things like setup of the controller, changing UDMA mode etc.
Right, so we keep the basic indiret access functions, and add the taskfile ones on top for performances, that's what you mean ?
Quoted 6 lines
Quoted 4 lines
Right. We could go the darwin (apple) way and have taskfile_load/store functions doing the entire registers controlled by a bitmask of which registers has to be touched. it has a cost (testing each bit and conditionally branching, which can suck hard) but probably less than
Get yourself a conditional move instruction 8)
Hehe, let's make an ARM/PPC hybrid ;)
Quoted 12 lines
Quoted 1 line
an indirect function call which isn't predictable.
Or you have a small set of such functions for the critical paths - ie doing actual block I/O which pass the set of values required to do that operation and do the stores. What are the performance critical paths
Begin a disk write
Begin a disk read
PIO transfer in
PIO transfer out
End a disk I/O fastpaths (no error case)
Quoted 3 lines
Maybe ATAPI command writes ?
beyond that I doubt the rest are critical
Well, I would normally agree with the above... except that IDE is so full of corner cases that I don't want to see dealt with in each host controller driver...
Ben.
Re: [PATCH] IDE 58
Quoted 2 lines · On Wed, 8 May 2002 22:04:57 +0200 Benjamin Herrenschmidt…
Hehe, let's make an ARM/PPC hybrid ;)
Me wantee :)
Re: [PATCH] IDE 58
In reply to Alan CoxQuoted 8 lines · Alan Cox
Quoted 5 lines
I though about that, but what about corner cases where only a single register can be accessed ? (typically alt status). Provide specific routines ? Also, how does the extended addressing works ? by writing several times to the cyl registers ? That would have to be dealt with as well in each host driver then.
There are lots of cases we don't care about speed - things like setup of the controller, changing UDMA mode etc.
Erm, think about the state diagram for testing the acceptance and command migration if TAG is going to be standard.
Quoted 2 lines
Begin a disk write
Begin a disk read
test command accept/reject
repeat 'til done:check_status
Quoted 2 lines
PIO transfer in
PIO transfer out
io hardware atomic segment or burst
(for linus, "atomic" is what is needed to complete, not just linusism")
goto repeat if !done with entire request
The above is where data integrity is lost if error happens.
Quoted 5 lines
End a disk I/O fastpaths (no error case)
Maybe ATAPI command writes ?
beyond that I doubt the rest are critical
There are several other cases, but 95% is the command block execution. The rest is sense data.
Cheers,
Andre Hedrick
LAD Storage Consulting Group
Re: [PATCH] IDE 58
In reply to Alan CoxAlan, we talked about this and the driver/hardware has a flaw. If you count the total number of single IO operations to check status/error et al., it is out right fugly. Preprocessing will kill us like today.
Quoted 18 lines · Alan Cox
Quoted 4 lines
ata_channel(orata_drive, but I doubt that would be really necessary) a set of 4 access functions: taskfile_in/out for access to taskfile registers (8 bits), and data_in/out for steaming datas in/out of the data reg (16 bits).Please push it higher level than that. Load the taskfile as a set in each method. Remember its 1 potentially paired instruction to do an MMIO write, its a whole mess of synchronziation and stalls to do a function pointer.
Quoted 4 lines
address at all (that is kill the array of port addresses) but just pass the taskfile_in/out functions the register number (
cyl_hi,cyl_lo, select, ....) as a nice symbolic constant, and let the channel specific implementation figure it out.Pass
dev->taskfile_load()a struct at least for the common paths. Make the PIO block transfers also single callbacks for each block not word.
Quoted 7 lines
Alan
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Andre Hedrick
LAD Storage Consulting Group
Re: [PATCH] IDE 58
Quoted 4 lines
Alan, we talked about this and the driver/hardware has a flaw. If you count the total number of single IO operations to check status/error et al., it is out right fugly. Preprocessing will kill us like today.
So we can still end up having both
- The single ops indirected like I first proposed (with maybe the
addition of slow versions but that could be a parameter, and 32 bits versions)
- A couple of "apply this taskfile" versions with well known semantics
used only in normal cases for perfs.
Ben.
Re: [PATCH] IDE 58
In reply to Andre HedrickUz.ytkownik Andre Hedrick napisa?:
Quoted 4 lines
Alan, we talked about this and the driver/hardware has a flaw. If you count the total number of single IO operations to check status/error et al., it is out right fugly. Preprocessing will kill us like today.
You mean the preprocessing in the devices firmware program of course?
Just to confirm I did get it right...
Re: [PATCH] IDE 58
In reply to Benjamin HerrenschmidtQuoted 5 lines · On Wed, 8 May 2002 21:10:54 +0200 Benjamin Herrenschmidt…
That would cleanly solve my problem of mixing MMIO and PIO controllers in the same machine, that would solve the crazy byteswapping needed by some controllers for PIO at least, etc...
Its good here on the old and slightly odd Acorn Podule bus interface...
Re: [PATCH] IDE 58
In reply to Linus TorvaldsQuoted 26 lines · Benjamin Herrenschmidt
Quoted 5 lines
And done properly with per-controller (or drive - you may want to virtualize at the drive level just because you could separate out different kinds of drive accesses that way too) function pointers you can then _mix_ access methods, without getting completely idiotic run-time checks inside "
ide_out()".Which ends up basically into having function pointers in the
ata_channel(orata_drive, but I doubt that would be really necessary) a set of 4 access functions: taskfile_in/out for access to taskfile registers (8 bits), and data_in/out for steaming datas in/out of the data reg (16 bits).That would cleanly solve my problem of mixing MMIO and PIO controllers in the same machine, that would solve the crazy byteswapping needed by some controllers for PIO at least, etc...
I would even suggest not caring about the taskfile register address at all (that is kill the array of port addresses) but just pass the taskfile_in/out functions the register number (
cyl_hi,cyl_lo, select, ....) as a nice symbolic constant, and let the channel specific implementation figure it out. I haven't checked if you already killed all of the request/release region crap done by the common ide code, that is matter is completely internal to the host controller driver, etc...
Quoted 3 lines
Now, andre may tell us we need one more set for "slow IO" versions for some HW, I don't know the details for these so I'll let the old man speak up here.
I'd suggest pointers in the ata_channel that abstract out the functions of the host controllers. For most controllers we can have a common PCI IDE library that implements them, and provides a reference implementation for the weird cases.
Quoted 1 line
From the ata-6 draft there are the following protocols, that should
be implementable on an IDE host controller.
- Software reset protocol
- Non-data command protocol
- PIO data-in command protocol
- PIO data-out command protocol
- DMA command protocol
- PACKET command protocol
- READ/WRITE DMA QUEUED command protocol
- EXECUTE DEVICE DIAGNOSTIC command protocol
- DEVICE RESET command protocol
- Ultra DMA data-in commands
- Ultra DMA data-out commands
Given the high level of the protocol abstraction we aren't likely to beat ourselves to death with extra cpu or io overhead. Nor is this an insane number of things to implement.
Perhaps more can be factored out (controllers being so similiar) but that is the abstraction we need for the layer sending commands to ATA devices. This allows the higher layers to focus on sending commands to ATA devices.
Eric
Re: [PATCH] 2.5.14 IDE 56
In reply to Linus TorvaldsQuoted 1 line · Martin Dalecki
Mon May 6 13:29:44 CEST 2002 ide-clean-56
+ printk("%s: reset timed-out, status=0x%02x\n", ch->name, stat);
"timed out" (no dash)
--
vda
PATCH 1/1 2.5.14 IDE 59
In reply to Linus TorvaldsWed May 8 17:06:57 CEST 2002 ide-clean-59
Basically PCI driver handling reorganization. This is one step further ahead toward the goal of fully modularized host chip drivers.
- Adjust ide-scsi to the new error handling. Just don't try any device resets there.
- Add unmasking of IRQ per default to the PMac PCI code.
- Split up the crap table from ide-pci. Let the corresponding drivers do registration of the functions they provide. This small change makes this patch rather big.
- Hard code the number of ports requested for DMA engines. They are always precisely 8 on PCs. If you hove something different to deal with, well then please just provide your own init_dma method.
- Remove the HDIO_GETGEO_BIG ioctl. Patch by Andries Brouwer. Applies unmodified.
- Make ON_BOARD be equal 0, so we can spare ourself some typing in structure initialization.
- Normalize the terminology in the host chip drivers. It will make spotting the tons of common code found there later easier.
Re: [PATCH] 2.5.14 IDE 59
In reply to Linus TorvaldsQuoted 3 lines · Martin Dalecki
Wed May 8 17:06:57 CEST 2002 ide-clean-59
Basically PCI driver handling reorganization. This is one step further ahead toward the goal of fully modularized host chip drivers.
Martin, could you fix the broken build with the following config? I'd rather not stick my hand in this pot while it's being vigorously stirred, though I would like to get some test boots in.
Cheers,
Bill
#
# Automatically generated make config: don't edit
#CONFIG_X86=yCONFIG_ISA=y
# CONFIG_SBUS is not setCONFIG_UID16=y
#
# Code maturity level options
#CONFIG_EXPERIMENTAL=y
#
# General setup
#CONFIG_NET=yCONFIG_SYSVIPC=yCONFIG_BSD_PROCESS_ACCT=yCONFIG_SYSCTL=y
#
# Loadable module support
#
# CONFIG_MODULES is not set
#
# Processor type and features
#
# CONFIG_M386 is not set
# CONFIG_M486 is not setCONFIG_M586=y
# CONFIG_M586TSC is not set
# CONFIG_M586MMX is not set
# CONFIG_M686 is not set
# CONFIG_MPENTIUMIII is not set
# CONFIG_MPENTIUM4 is not set
# CONFIG_MK6 is not set
# CONFIG_MK7 is not set
# CONFIG_MELAN is not set
# CONFIG_MCRUSOE is not set
# CONFIG_MWINCHIPC6 is not set
# CONFIG_MWINCHIP2 is not set
# CONFIG_MWINCHIP3D is not set
# CONFIG_MCYRIXIII is not setCONFIG_X86_WP_WORKS_OK=yCONFIG_X86_INVLPG=yCONFIG_X86_CMPXCHG=yCONFIG_X86_XADD=yCONFIG_X86_BSWAP=yCONFIG_X86_POPAD_OK=y
# CONFIG_RWSEM_GENERIC_SPINLOCK is not setCONFIG_RWSEM_XCHGADD_ALGORITHM=yCONFIG_X86_L1_CACHE_SHIFT=5CONFIG_X86_USE_STRING_486=yCONFIG_X86_ALIGNMENT_16=yCONFIG_X86_PPRO_FENCE=yCONFIG_X86_F00F_BUG=y
# CONFIG_X86_MCE is not set
# CONFIG_X86_MCE_NONFATAL is not set
# CONFIG_X86_MCE_P4THERMAL is not set
# CONFIG_TOSHIBA is not set
# CONFIG_I8K is not set
# CONFIG_MICROCODE is not set
# CONFIG_X86_MSR is not set
# CONFIG_X86_CPUID is not setCONFIG_NOHIGHMEM=y
# CONFIG_HIGHMEM4G is not set
# CONFIG_HIGHMEM64G is not set
# CONFIG_MATH_EMULATION is not set
# CONFIG_MTRR is not setCONFIG_SMP=y
# CONFIG_PREEMPT is not set
# CONFIG_MULTIQUAD is not setCONFIG_HAVE_DEC_LOCK=y
#
# General options
#
#
# ACPI Support
#
# CONFIG_ACPI is not setCONFIG_X86_IO_APIC=yCONFIG_X86_LOCAL_APIC=yCONFIG_PCI=y
# CONFIG_PCI_GOBIOS is not set
# CONFIG_PCI_GODIRECT is not setCONFIG_PCI_GOANY=yCONFIG_PCI_BIOS=yCONFIG_PCI_DIRECT=yCONFIG_PCI_NAMES=y
# CONFIG_EISA is not set
# CONFIG_MCA is not set
# CONFIG_HOTPLUG is not set
# CONFIG_PCMCIA is not set
# CONFIG_HOTPLUG_PCI is not setCONFIG_KCORE_ELF=y
# CONFIG_KCORE_AOUT is not setCONFIG_BINFMT_AOUT=yCONFIG_BINFMT_ELF=yCONFIG_BINFMT_MISC=y
# CONFIG_PM is not set
# CONFIG_APM is not set
#
# Memory Technology Devices (MTD)
#
# CONFIG_MTD is not set
#
# Parallel port support
#
# CONFIG_PARPORT is not set
#
# Plug and Play configuration
#
# CONFIG_PNP is not set
# CONFIG_ISAPNP is not set
# CONFIG_PNPBIOS is not set
#
# Block devices
#
# CONFIG_BLK_DEV_FD is not set
# CONFIG_BLK_DEV_XD is not set
# CONFIG_PARIDE is not set
# CONFIG_BLK_CPQ_DA is not set
# CONFIG_BLK_CPQ_CISS_DA is not set
# CONFIG_CISS_SCSI_TAPE is not set
# CONFIG_BLK_DEV_DAC960 is not setCONFIG_BLK_DEV_LOOP=y
# CONFIG_BLK_DEV_NBD is not setCONFIG_BLK_DEV_RAM=yCONFIG_BLK_DEV_RAM_SIZE=65536
# CONFIG_BLK_DEV_INITRD is not set
#
# Multi-device support (RAID and LVM)
#
# CONFIG_MD is not set
# CONFIG_BLK_DEV_MD is not set
# CONFIG_MD_LINEAR is not set
# CONFIG_MD_RAID0 is not set
# CONFIG_MD_RAID1 is not set
# CONFIG_MD_RAID5 is not set
# CONFIG_MD_MULTIPATH is not set
# CONFIG_BLK_DEV_LVM is not set
#
# Networking options
#
# CONFIG_PACKET is not set
# CONFIG_NETLINK_DEV is not set
# CONFIG_NETFILTER is not set
# CONFIG_FILTER is not setCONFIG_UNIX=yCONFIG_INET=y
# CONFIG_IP_MULTICAST is not set
# CONFIG_IP_ADVANCED_ROUTER is not set
# CONFIG_IP_PNP is not set
# CONFIG_NET_IPIP is not set
# CONFIG_NET_IPGRE is not set
# CONFIG_ARPD is not set
# CONFIG_INET_ECN is not set
# CONFIG_SYN_COOKIES is not set
# CONFIG_IPV6 is not set
# CONFIG_KHTTPD is not set
# CONFIG_ATM is not set
# CONFIG_VLAN_8021Q is not set
#
#
#
# CONFIG_IPX is not set
# CONFIG_ATALK is not set
#
# Appletalk devices
#
# CONFIG_DEV_APPLETALK is not set
# CONFIG_DECNET is not set
# CONFIG_BRIDGE is not set
# CONFIG_X25 is not set
# CONFIG_LAPB is not set
# CONFIG_LLC is not set
# CONFIG_NET_DIVERT is not set
# CONFIG_ECONET is not set
# CONFIG_WAN_ROUTER is not set
# CONFIG_NET_FASTROUTE is not set
# CONFIG_NET_HW_FLOWCONTROL is not set
#
# QoS and/or fair queueing
#
# CONFIG_NET_SCHED is not set
#
# Telephony Support
#
# CONFIG_PHONE is not set
# CONFIG_PHONE_IXJ is not set
# CONFIG_PHONE_IXJ_PCMCIA is not set
#
# ATA/IDE/MFM/RLL support
#CONFIG_IDE=y
#
# ATA and ATAPI Block devices
#CONFIG_BLK_DEV_IDE=y
#
# Please see Documentation/ide.txt for help/info on IDE drives #
# CONFIG_BLK_DEV_HD_IDE is not set
# CONFIG_BLK_DEV_HD is not set CONFIG_BLK_DEV_IDEDISK=y
# CONFIG_IDEDISK_MULTI_MODE is not set
# CONFIG_IDEDISK_STROKE is not set
# CONFIG_BLK_DEV_IDEDISK_VENDOR is not set
# CONFIG_BLK_DEV_IDEDISK_FUJITSU is not set
# CONFIG_BLK_DEV_IDEDISK_IBM is not set
# CONFIG_BLK_DEV_IDEDISK_MAXTOR is not set
# CONFIG_BLK_DEV_IDEDISK_QUANTUM is not set
# CONFIG_BLK_DEV_IDEDISK_SEAGATE is not set
# CONFIG_BLK_DEV_IDEDISK_WD is not set
# CONFIG_BLK_DEV_COMMERIAL is not set
# CONFIG_BLK_DEV_TIVO is not set
# CONFIG_BLK_DEV_IDECS is not set CONFIG_BLK_DEV_IDECD=y
# CONFIG_BLK_DEV_IDETAPE is not set CONFIG_BLK_DEV_IDEFLOPPY=y
# CONFIG_BLK_DEV_IDESCSI is not set
#
# ATA host chip set support
#CONFIG_BLK_DEV_CMD640=y
# CONFIG_BLK_DEV_CMD640_ENHANCED is not set
# CONFIG_BLK_DEV_ISAPNP is not setCONFIG_BLK_DEV_RZ1000=y
#
# PCI host chip set support
#
# CONFIG_BLK_DEV_OFFBOARD is not setCONFIG_IDEPCI_SHARE_IRQ=y
# CONFIG_BLK_DEV_IDEDMA_PCI is not set
# CONFIG_IDEDMA_PCI_AUTO is not set
# CONFIG_IDEDMA_ONLYDISK is not set
# CONFIG_BLK_DEV_IDEDMA is not set
# CONFIG_BLK_DEV_IDE_TCQ is not set
# CONFIG_BLK_DEV_IDE_TCQ_DEFAULT is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC62XX_TUNING is not set
# CONFIG_BLK_DEV_ALI15X3 is not set
# CONFIG_WDC_ALI15X3 is not set
# CONFIG_BLK_DEV_AMD74XX is not set
# CONFIG_BLK_DEV_CMD64X is not set
# CONFIG_BLK_DEV_CY82C693 is not set
# CONFIG_BLK_DEV_CS5530 is not set
# CONFIG_BLK_DEV_HPT34X is not set
# CONFIG_HPT34X_AUTODMA is not set
# CONFIG_BLK_DEV_HPT366 is not set
# CONFIG_BLK_DEV_PIIX is not set
# CONFIG_BLK_DEV_NS87415 is not set
# CONFIG_BLK_DEV_OPTI621 is not set
# CONFIG_BLK_DEV_PDC_ADMA is not set
# CONFIG_BLK_DEV_PDC202XX is not set
# CONFIG_PDC202XX_BURST is not set
# CONFIG_PDC202XX_FORCE is not set
# CONFIG_BLK_DEV_SVWKS is not set
# CONFIG_BLK_DEV_SIS5513 is not set
# CONFIG_BLK_DEV_TRM290 is not set
# CONFIG_BLK_DEV_VIA82CXXX is not set
# CONFIG_BLK_DEV_SL82C105 is not set
# CONFIG_IDE_CHIPSETS is not set
# CONFIG_IDEDMA_AUTO is not set
# CONFIG_DMA_NONPCI is not set
# CONFIG_BLK_DEV_ATARAID is not set
# CONFIG_BLK_DEV_ATARAID_PDC is not set
# CONFIG_BLK_DEV_ATARAID_HPT is not set
#
# SCSI support
#
# CONFIG_SCSI is not set
#
# Fusion MPT device support
#
# CONFIG_FUSION is not set
#
# IEEE 1394 (FireWire) support (EXPERIMENTAL)
#
# CONFIG_IEEE1394 is not set
#
# I2O device support
#
# CONFIG_I2O is not set
# CONFIG_I2O_PCI is not set
# CONFIG_I2O_BLOCK is not set
# CONFIG_I2O_LAN is not set
# CONFIG_I2O_SCSI is not set
# CONFIG_I2O_PROC is not set
#
# Network device support
#CONFIG_NETDEVICES=y
#
# ARCnet devices
#
# CONFIG_ARCNET is not setCONFIG_DUMMY=y
# CONFIG_BONDING is not set
# CONFIG_EQUALIZER is not set
# CONFIG_TUN is not set
# CONFIG_ETHERTAP is not set
#
# Ethernet (10 or 100Mbit)
#
# CONFIG_NET_ETHERNET is not set
#
# Ethernet (1000 Mbit)
#
# CONFIG_ACENIC is not set
# CONFIG_DL2K is not set
# CONFIG_E1000 is not set
# CONFIG_MYRI_SBUS is not set
# CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set
# CONFIG_SK98LIN is not set
# CONFIG_TIGON3 is not set
# CONFIG_FDDI is not set
# CONFIG_HIPPI is not set
# CONFIG_PLIP is not set
# CONFIG_PPP is not set
# CONFIG_SLIP is not set
#
# Wireless LAN (non-hamradio)
#
# CONFIG_NET_RADIO is not set
#
# Token Ring devices
#
# CONFIG_TR is not set
# CONFIG_NET_FC is not set
# CONFIG_RCPCI is not set
# CONFIG_SHAPER is not set
#
# Wan interfaces
#
# CONFIG_WAN is not set
#
# "Tulip" family network device support
#
# CONFIG_NET_TULIP is not set
#
# Amateur Radio support
#
# CONFIG_HAMRADIO is not set
#
# IrDA (infrared) support
#
# CONFIG_IRDA is not set
#
# ISDN subsystem
#
# CONFIG_ISDN_BOOL is not set
#
# Old CD-ROM drivers (not SCSI, not IDE)
#
# CONFIG_CD_NO_IDESCSI is not set
#
# Input device support
#
# CONFIG_INPUT is not set
# CONFIG_INPUT_KEYBDEV is not set
# CONFIG_INPUT_MOUSEDEV is not set
# CONFIG_INPUT_JOYDEV is not set
# CONFIG_INPUT_EVDEV is not set
# CONFIG_GAMEPORT is not setCONFIG_SOUND_GAMEPORT=y
# CONFIG_GAMEPORT_NS558 is not set
# CONFIG_GAMEPORT_L4 is not set
# CONFIG_INPUT_EMU10K1 is not set
# CONFIG_GAMEPORT_PCIGAME is not set
# CONFIG_GAMEPORT_FM801 is not set
# CONFIG_GAMEPORT_CS461x is not set
# CONFIG_SERIO is not set
# CONFIG_SERIO_SERPORT is not set
#
# Character devices
#CONFIG_VT=yCONFIG_VT_CONSOLE=y
# CONFIG_SERIAL is not set
# CONFIG_SERIAL_EXTENDED is not set
# CONFIG_SERIAL_NONSTANDARD is not setCONFIG_UNIX98_PTYS=yCONFIG_UNIX98_PTY_COUNT=2048
#
# I2C support
#
# CONFIG_I2C is not set
#
# Mice
#
# CONFIG_BUSMOUSE is not set
# CONFIG_MOUSE is not set
# CONFIG_QIC02_TAPE is not set
#
# Watchdog Cards
#
# CONFIG_WATCHDOG is not set
# CONFIG_INTEL_RNG is not set
# CONFIG_NVRAM is not set
# CONFIG_RTC is not set
# CONFIG_DTLK is not set
# CONFIG_R3964 is not set
# CONFIG_APPLICOM is not set
# CONFIG_SONYPI is not set
#
# Ftape, the floppy tape device driver
#
# CONFIG_FTAPE is not set
# CONFIG_AGP is not set
# CONFIG_DRM is not set
# CONFIG_MWAVE is not set
#
# Multimedia devices
#
# CONFIG_VIDEO_DEV is not set
#
# File systems
#
# CONFIG_QUOTA is not set
# CONFIG_AUTOFS_FS is not set
# CONFIG_AUTOFS4_FS is not set
# CONFIG_REISERFS_FS is not set
# CONFIG_REISERFS_CHECK is not set
# CONFIG_REISERFS_PROC_INFO is not set
# CONFIG_ADFS_FS is not set
# CONFIG_ADFS_FS_RW is not set
# CONFIG_AFFS_FS is not set
# CONFIG_HFS_FS is not set
# CONFIG_BFS_FS is not set
# CONFIG_EXT3_FS is not set
# CONFIG_JBD is not set
# CONFIG_JBD_DEBUG is not setCONFIG_FAT_FS=yCONFIG_MSDOS_FS=y
# CONFIG_UMSDOS_FS is not setCONFIG_VFAT_FS=y
# CONFIG_EFS_FS is not set
# CONFIG_JFFS_FS is not set
# CONFIG_JFFS2_FS is not set
# CONFIG_CRAMFS is not setCONFIG_TMPFS=yCONFIG_RAMFS=yCONFIG_ISO9660_FS=yCONFIG_JOLIET=y
# CONFIG_ZISOFS is not set
# CONFIG_JFS_FS is not set
# CONFIG_JFS_DEBUG is not set
# CONFIG_JFS_STATISTICS is not setCONFIG_MINIX_FS=y
# CONFIG_VXFS_FS is not set
# CONFIG_NTFS_FS is not set
# CONFIG_NTFS_DEBUG is not set
# CONFIG_HPFS_FS is not setCONFIG_PROC_FS=y
# CONFIG_DEVFS_FS is not set
# CONFIG_DEVFS_MOUNT is not set
# CONFIG_DEVFS_DEBUG is not setCONFIG_DEVPTS_FS=y
# CONFIG_QNX4FS_FS is not set
# CONFIG_QNX4FS_RW is not set
# CONFIG_ROMFS_FS is not setCONFIG_EXT2_FS=y
# CONFIG_SYSV_FS is not setCONFIG_UDF_FS=yCONFIG_UDF_RW=y
# CONFIG_UFS_FS is not set
# CONFIG_UFS_FS_WRITE is not set
#
# Network File Systems
#
# CONFIG_CODA_FS is not set
# CONFIG_INTERMEZZO_FS is not set
# CONFIG_NFS_FS is not set
# CONFIG_NFS_V3 is not set
# CONFIG_ROOT_NFS is not set
# CONFIG_NFSD is not set
# CONFIG_NFSD_V3 is not set
# CONFIG_NFSD_TCP is not set
# CONFIG_SUNRPC is not set
# CONFIG_LOCKD is not set
# CONFIG_EXPORTFS is not set
# CONFIG_SMB_FS is not set
# CONFIG_NCP_FS is not set
# CONFIG_NCPFS_PACKET_SIGNING is not set
# CONFIG_NCPFS_IOCTL_LOCKING is not set
# CONFIG_NCPFS_STRONG is not set
# CONFIG_NCPFS_NFS_NS is not set
# CONFIG_NCPFS_OS2_NS is not set
# CONFIG_NCPFS_SMALLDOS is not set
# CONFIG_NCPFS_NLS is not set
# CONFIG_NCPFS_EXTRAS is not set
# CONFIG_ZISOFS_FS is not set
#
# Partition Types
#
# CONFIG_PARTITION_ADVANCED is not setCONFIG_MSDOS_PARTITION=y
# CONFIG_SMB_NLS is not setCONFIG_NLS=y
#
# Native Language Support
#CONFIG_NLS_DEFAULT="iso8859-1"
# CONFIG_NLS_CODEPAGE_437 is not set
# CONFIG_NLS_CODEPAGE_737 is not set
# CONFIG_NLS_CODEPAGE_775 is not set
# CONFIG_NLS_CODEPAGE_850 is not set
# CONFIG_NLS_CODEPAGE_852 is not set
# CONFIG_NLS_CODEPAGE_855 is not set
# CONFIG_NLS_CODEPAGE_857 is not set
# CONFIG_NLS_CODEPAGE_860 is not set
# CONFIG_NLS_CODEPAGE_861 is not set
# CONFIG_NLS_CODEPAGE_862 is not set
# CONFIG_NLS_CODEPAGE_863 is not set
# CONFIG_NLS_CODEPAGE_864 is not set
# CONFIG_NLS_CODEPAGE_865 is not set
# CONFIG_NLS_CODEPAGE_866 is not set
# CONFIG_NLS_CODEPAGE_869 is not set
# CONFIG_NLS_CODEPAGE_936 is not set
# CONFIG_NLS_CODEPAGE_950 is not set
# CONFIG_NLS_CODEPAGE_932 is not set
# CONFIG_NLS_CODEPAGE_949 is not set
# CONFIG_NLS_CODEPAGE_874 is not set
# CONFIG_NLS_ISO8859_8 is not set
# CONFIG_NLS_CODEPAGE_1250 is not set
# CONFIG_NLS_CODEPAGE_1251 is not setCONFIG_NLS_ISO8859_1=y
# CONFIG_NLS_ISO8859_2 is not set
# CONFIG_NLS_ISO8859_3 is not set
# CONFIG_NLS_ISO8859_4 is not set
# CONFIG_NLS_ISO8859_5 is not set
# CONFIG_NLS_ISO8859_6 is not set
# CONFIG_NLS_ISO8859_7 is not set
# CONFIG_NLS_ISO8859_9 is not set
# CONFIG_NLS_ISO8859_13 is not set
# CONFIG_NLS_ISO8859_14 is not set
# CONFIG_NLS_ISO8859_15 is not set
# CONFIG_NLS_KOI8_R is not set
# CONFIG_NLS_KOI8_U is not set
# CONFIG_NLS_UTF8 is not set
#
# Console drivers
#CONFIG_VGA_CONSOLE=y
# CONFIG_VIDEO_SELECT is not set
# CONFIG_MDA_CONSOLE is not set
#
# Frame-buffer support
#
# CONFIG_FB is not set
#
# Sound
#
# CONFIG_SOUND is not set
#
# USB support
#
# CONFIG_USB is not set
#
# Bluetooth support
#
# CONFIG_BLUEZ is not set
#
# Kernel hacking
#CONFIG_DEBUG_KERNEL=yCONFIG_DEBUG_SLAB=yCONFIG_DEBUG_IOVIRT=yCONFIG_MAGIC_SYSRQ=yCONFIG_DEBUG_SPINLOCK=y
#
# Library routines
#
# CONFIG_CRC32 is not set
# CONFIG_ZLIB_INFLATE is not set
# CONFIG_ZLIB_DEFLATE is not set
Re: [PATCH] 2.5.14 IDE 57
In reply to Linus TorvaldsQuoted 3 lines · Martin Dalecki
Tue May 7 02:37:49 CEST 2002 ide-clean-57
Nuke
/proc/ide.
I actually agree with you here. /proc has turned into a bloated mess of unparsable text files. It would be nice if we could move some of this information to a uniform sysctl() interface. I hope you'll work a bit on that (if it isn't already implemented!).
PATCH 1/1 2.5.15 IDE 60
In reply to Linus TorvaldsFri May 10 16:17:01 CEST 2002 ide-clean-60
Synchronize with 2.5.15
- Rewrite ioctl handling.
- Apply fix for hpt366 "hang on boot" by Andre.
- Remove stale XXX_tune_req. It was no longer used.
- Propagate rq through ide_error(), ide_end_drive_cmd(), ide_dump_status(), ide_wait_stat().
- Push the current drive down to ata_channel from hwgroup.
- Push the timer down to the ata_channel structure. Most probably it will end at the drive.
drivers/ide/hpt366.c +2 -2
@@ -670,8 +670,8 @@* Disable the "fast interrupt" prediction. */ pci_read_config_byte (dev, regfast, &drive_fast); -if (drive_fast &0x02 ) -pci_write_config_byte (dev, regfast, drive_fast & ~0x20 ); +if (drive_fast &0x80 ) +pci_write_config_byte (dev, regfast, drive_fast & ~0x80 );pci_read_config_dword (dev, regtime, ®1); reg2 = pci_bus_clock_list(speed,
drivers/ide/ide.c +164 -213
667 lines not on this page · raw message
drivers/ide/ide-cd.c +10 -16
@@ -594,7 +594,7 @@ pc = (struct packet_command *) rq->special; pc->stat =1 ;cdrom_end_request (drive, rq,1 ); - *startstop =ide_error (drive,"request sense failure" , stat); + *startstop =ide_error (drive, rq,"request sense failure" , stat);return 1 ; }else if (rq->flags & (REQ_PC |REQ_BLOCK_PC )) {
@@ -614,7 +614,7 @@return 0 ; }else if (!pc->quiet) {/* Otherwise, print an error. */ -ide_dump_status (drive,"packet command error" , stat); +ide_dump_status (drive, rq,"packet command error" , stat); }/* Set the error flag and complete the request.
@@ -662,18 +662,18 @@ sense_key == DATA_PROTECT) {/* No point in retrying after an illegal request or data protect error.*/ -ide_dump_status (drive,"command error" , stat); +ide_dump_status (drive, rq,"command error" , stat);cdrom_end_request (drive, rq,0 ); } else if (sense_key == MEDIUM_ERROR) {/* No point in re-trying a zillion times on a bad * sector. The error is not correctable at all. */ -ide_dump_status (drive,"media error (bad sector)" , stat); +ide_dump_status (drive, rq,"media error (bad sector)" , stat);cdrom_end_request (drive, rq,0 ); } else if ((err & ~ABRT_ERR) != 0) {/* Go to the default handler for other errors. */ - *startstop =ide_error (drive, __FUNCTION__, stat); + *startstop =ide_error (drive, rq, __FUNCTION__, stat);return 1 ; } else if ((++rq->errors > ERROR_MAX)) {/* We've racked up too many retries. Abort. */
@@ -732,7 +732,7 @@struct cdrom_info *info = drive->driver_data;/* Wait for the controller to be idle. */ -if (ide_wait_stat (&startstop, drive,0 ,BUSY_STAT ,WAIT_READY )) +if (ide_wait_stat (&startstop, drive, rq,0 ,BUSY_STAT ,WAIT_READY ))return startstop;if (info->dma) {
@@ -789,7 +789,7 @@return startstop; }else {/* Otherwise, we must wait for DRQ to get set. */ -if (ide_wait_stat (&startstop, drive,DRQ_STAT ,BUSY_STAT ,WAIT_READY )) +if (ide_wait_stat (&startstop, drive, rq,DRQ_STAT ,BUSY_STAT ,WAIT_READY ))return startstop; }
@@ -917,7 +917,7 @@__ide_end_request (drive, rq,1 , rq->nr_sectors);return ide_stopped; }else -return ide_error (drive,"dma error" , stat); +return ide_error (drive, rq,"dma error" , stat); }/* Read the interrupt reason and the transfer length. */
@@ -1496,7 +1496,7 @@*/ if (dma) {if (dma_error) -return ide_error (drive,"dma error" , stat); +return ide_error (drive, rq,"dma error" , stat);__ide_end_request (drive, rq,1 , rq->nr_sectors);return ide_stopped;
@@ -2659,12 +2659,6 @@return nslots; } -static void ide_cdrom_add_settings (ide_drive_t *drive) -{ -ide_add_setting (drive,"dsc_overlap" , -SETTING_RW ,-1 ,-1 ,TYPE_BYTE ,0 ,1 ,1 ,1 , &drive->dsc_overlap,NULL ); -} -static int ide_cdrom_setup (ide_drive_t *drive) {
@@ -2798,7 +2792,7 @@ info->devinfo.handle =NULL ;return 1 ; } -ide_cdrom_add_settings (drive); +return 0 ; }
drivers/ide/ide-disk.c +156 -26
226 lines not on this page · raw message
drivers/ide/ide-dma.c +3 -3
@@ -208,7 +208,7 @@printk (KERN_ERR "%s: dma_intr: bad DMA status (dma_stat=%x)\n" , drive->name, dma_stat); } -return ide_error (drive,"dma_intr" , stat); +return ide_error (drive, rq,"dma_intr" , stat); }/*
@@ -375,7 +375,7 @@/* * 1 dma-ing, 2 error, 4 intr */ -static int dma_timer_expiry (struct ata_device *drive,struct request *__rq) +static int dma_timer_expiry (struct ata_device *drive,struct request *rq) {/* FIXME: What's that? */ u8 dma_stat =inb (drive->channel->dma_base+2 );
@@ -390,7 +390,7 @@if (dma_stat &2 ) {/* ERROR */ u8 stat =GET_STAT (); -return ide_error (drive,"dma_timer_expiry" , stat); +return ide_error (drive, rq,"dma_timer_expiry" , stat); }if (dma_stat &1 )/* DMAing */ return WAIT_CMD ;
drivers/ide/ide-features.c +1 -1
@@ -393,7 +393,7 @@enable_irq (hwif->irq);if (error) { -ide_dump_status (drive,"set_drive_speed_status" , stat); +ide_dump_status (drive,NULL ,"set_drive_speed_status" , stat);return error; }
drivers/ide/ide-floppy.c +5 -13
@@ -692,7 +692,7 @@return 0 ; } rq->errors = error; -ide_end_drive_cmd (drive,0 ,0 ); +ide_end_drive_cmd (drive, rq,0 ,0 );return 0 ; }
@@ -1006,7 +1006,7 @@idefloppy_floppy_t *floppy = drive->driver_data;idefloppy_ireason_reg_t ireason; -if (ide_wait_stat (&startstop,drive,DRQ_STAT ,BUSY_STAT ,WAIT_READY )) { +if (ide_wait_stat (&startstop, drive, rq,DRQ_STAT ,BUSY_STAT ,WAIT_READY )) {printk (KERN_ERR "ide-floppy: Strange, packet command initiated yet DRQ isn't asserted\n" );return startstop; }
@@ -1043,13 +1043,13 @@return IDEFLOPPY_WAIT_CMD ;/* Timeout for the packet command */ } -static ide_startstop_t idefloppy_transfer_pc1 (struct ata_device *drive,struct request *__rq) +static ide_startstop_t idefloppy_transfer_pc1 (struct ata_device *drive,struct request *rq) {idefloppy_floppy_t *floppy = drive->driver_data;ide_startstop_t startstop;idefloppy_ireason_reg_t ireason; -if (ide_wait_stat (&startstop,drive,DRQ_STAT ,BUSY_STAT ,WAIT_READY )) { +if (ide_wait_stat (&startstop, drive, rq,DRQ_STAT ,BUSY_STAT ,WAIT_READY )) {printk (KERN_ERR "ide-floppy: Strange, packet command initiated yet DRQ isn't asserted\n" );return startstop; }
@@ -1960,14 +1960,6 @@return 0 ; } -static void idefloppy_add_settings (ide_drive_t *drive) -{ -ide_add_setting (drive,"bios_cyl" ,SETTING_RW ,-1 ,-1 ,TYPE_INT ,0 ,1023 ,1 ,1 , &drive->bios_cyl,NULL ); -ide_add_setting (drive,"bios_head" ,SETTING_RW ,-1 ,-1 ,TYPE_BYTE ,0 ,255 ,1 ,1 , &drive->bios_head,NULL ); -ide_add_setting (drive,"bios_sect" ,SETTING_RW ,-1 ,-1 ,TYPE_BYTE ,0 ,63 ,1 ,1 , &drive->bios_sect,NULL ); - -} -/* * Driver initialization. */
@@ -2009,7 +2001,7 @@ } (void )idefloppy_get_capacity (drive); -idefloppy_add_settings (drive); +for (i =0 ; i <MAX_DRIVES ; ++i) {struct ata_channel *hwif = drive->channel;
drivers/ide/ide-probe.c +7 -6
@@ -628,9 +628,6 @@return 1 ; }memset (hwgroup,0 ,sizeof (*hwgroup)); -init_timer (&hwgroup->timer); - hwgroup->timer.function = &ide_timer_expiry; - hwgroup->timer.data = (unsigned long ) hwgroup; }/*
@@ -659,6 +656,11 @@* Everything is okay. Tag us as member of this hardware group. */ ch->hwgroup = hwgroup; + +init_timer (&ch->timer); + ch->timer.function = &ide_timer_expiry; + ch->timer.data = (unsigned long ) ch; +for (i =0 ; i <MAX_DRIVES ; ++i) {struct ata_device *drive = &ch->drives[i];request_queue_t *q;
@@ -667,8 +669,8 @@if (!drive->present)continue ; -if (!hwgroup->XXX_drive) - hwgroup->XXX_drive = drive; +if (!ch->drive) + ch->drive = drive;/* * Init the per device request queue
@@ -842,7 +844,6 @@for (unit =0 ; unit <MAX_DRIVES ; ++unit) {char name[80 ]; -ide_add_generic_settings (ch->drives + unit); ch->drives[unit].dn = ((ch->unit ?2 :0 ) + unit);sprintf (name,"host%d/bus%d/target%d/lun%d" , ch->index, ch->unit, unit, ch->drives[unit].lun);
drivers/ide/ide-tape.c +4 -40
74 lines not on this page · raw message
drivers/ide/ide-taskfile.c +12 -12
@@ -308,7 +308,7 @@struct ata_taskfile *args = rq->special;ide_startstop_t startstop; -if (ide_wait_stat (&startstop, drive,DATA_READY , drive->bad_wstat,WAIT_DRQ )) +if (ide_wait_stat (&startstop, drive, rq,DATA_READY , drive->bad_wstat,WAIT_DRQ ))return startstop;ata_poll_drive_ready (drive);
@@ -329,7 +329,7 @@*/ if (!rq->nr_sectors) {if (stat & (ERR_STAT |DRQ_STAT )) { - startstop =ide_error (drive,"task_mulout_intr" , stat); + startstop =ide_error (drive, rq,"task_mulout_intr" , stat);return startstop; }
@@ -342,7 +342,7 @@if (!OK_STAT (stat,DATA_READY ,BAD_R_STAT )) {if (stat & (ERR_STAT |DRQ_STAT )) { - startstop =ide_error (drive,"task_mulout_intr" , stat); + startstop =ide_error (drive, rq,"task_mulout_intr" , stat);return startstop; }
@@ -489,12 +489,12 @@/* * This is invoked on completion of a WIN_RESTORE (recalibrate) cmd. */ -ide_startstop_t recal_intr (struct ata_device *drive,struct request *__rq) +ide_startstop_t recal_intr (struct ata_device *drive,struct request *rq) {u8 stat;if (!OK_STAT (stat =GET_STAT (),READY_STAT ,BAD_STAT )) -return ide_error (drive,"recal_intr" , stat); +return ide_error (drive, rq,"recal_intr" , stat);return ide_stopped; }
@@ -511,11 +511,11 @@if (!OK_STAT (stat =GET_STAT (),READY_STAT ,BAD_STAT )) {/* Keep quiet for NOP because it is expected to fail. */ if (args && args->taskfile.command !=WIN_NOP ) -return ide_error (drive,"task_no_data_intr" , stat); +return ide_error (drive, rq,"task_no_data_intr" , stat); }if (args) -ide_end_drive_cmd (drive, stat,GET_ERR ()); +ide_end_drive_cmd (drive, rq, stat,GET_ERR ());return ide_stopped; }
@@ -523,7 +523,7 @@/* * Handler for command with PIO data-in phase */ -static ide_startstop_t task_in_intr (struct ata_device *drive,struct request *rq) +static ide_startstop_t task_in_intr (struct ata_device *drive,struct request *rq) {u8 stat =GET_STAT ();char *pBuf =NULL ;
@@ -531,7 +531,7 @@if (!OK_STAT (stat,DATA_READY ,BAD_R_STAT )) {if (stat & (ERR_STAT |DRQ_STAT )) { -return ide_error (drive,"task_in_intr" , stat); +return ide_error (drive, rq,"task_in_intr" , stat); }if (!(stat &BUSY_STAT )) {DTF ("task_in_intr to Soon wait for next interrupt\n" );
@@ -569,7 +569,7 @@struct ata_taskfile *args = rq->special;ide_startstop_t startstop; -if (ide_wait_stat (&startstop, drive,DATA_READY , drive->bad_wstat,WAIT_DRQ )) { +if (ide_wait_stat (&startstop, drive, rq,DATA_READY , drive->bad_wstat,WAIT_DRQ )) {printk (KERN_ERR "%s: no DRQ after issuing %s\n" , drive->name, drive->mult_count ?"MULTWRITE" :"WRITE" );return startstop; }
@@ -600,7 +600,7 @@unsigned long flags;if (!OK_STAT (stat,DRIVE_READY ,drive->bad_wstat)) -return ide_error (drive,"task_out_intr" , stat); +return ide_error (drive, rq,"task_out_intr" , stat);if (!rq->current_nr_sectors)if (!ide_end_request (drive, rq,1 ))
@@ -632,7 +632,7 @@if (!OK_STAT (stat =GET_STAT (),DATA_READY ,BAD_R_STAT )) {if (stat & (ERR_STAT |DRQ_STAT )) { -return ide_error (drive,"task_mulin_intr" , stat); +return ide_error (drive, rq,"task_mulin_intr" , stat); }/* no data yet, so wait for another interrupt */ ide_set_handler (drive, task_mulin_intr,WAIT_CMD ,NULL );
drivers/ide/pdc4030.c +19 -18
@@ -185,7 +185,7 @@if (pdc4030_cmd (drive,PROMISE_GET_CONFIG )) {return 0 ; } -if (ide_wait_stat (&startstop, drive,DATA_READY ,BAD_W_STAT ,WAIT_DRQ )) { +if (ide_wait_stat (&startstop, drive,NULL ,DATA_READY ,BAD_W_STAT ,WAIT_DRQ )) {printk (KERN_INFO "%s: Failed Promise read config!\n" ,hwif->name);return 0 ;
@@ -309,14 +309,14 @@*/ static ide_startstop_t promise_read_intr (struct ata_device *drive,struct request *rq) { -byte stat; +u8 stat;int total_remaining;unsigned int sectors_left, sectors_avail, nsect;unsigned long flags;char *to;if (!OK_STAT (stat=GET_STAT (),DATA_READY ,BAD_R_STAT )) { -return ide_error (drive,"promise_read_intr" , stat); +return ide_error (drive, rq,"promise_read_intr" , stat); } read_again:
@@ -348,17 +348,18 @@if ((rq->current_nr_sectors -= nsect) <=0 ) {ide_end_request (drive, rq,1 ); } -/* -* Now the data has been read in, do the following: -* -* if there are still sectors left in the request, -* if we know there are still sectors available from the interface, -* go back and read the next bit of the request. -* else if DRQ is asserted, there are more sectors available, so -* go back and find out how many, then read them in. -* else if BUSY is asserted, we are going to get an interrupt, so -* set the handler for the interrupt and just return -*/ + +/* +* Now the data has been read in, do the following: +* +* if there are still sectors left in the request, if we know there are +* still sectors available from the interface, go back and read the +* next bit of the request. else if DRQ is asserted, there are more +* sectors available, so go back and find out how many, then read them +* in. else if BUSY is asserted, we are going to get an interrupt, so +* set the handler for the interrupt and just return +*/ +if (total_remaining >0 ) {if (sectors_avail) goto read_next;
@@ -375,7 +376,7 @@ }printk (KERN_ERR "%s: Eeek! promise_read_intr: sectors left " "!DRQ !BUSY\n" , drive->name); -return ide_error (drive,"promise read intr" , stat); +return ide_error (drive, rq,"promise read intr" , stat); }return ide_stopped; }
@@ -400,7 +401,7 @@ ch->poll_timeout =0 ;printk (KERN_ERR "%s: completion timeout - still busy!\n" , drive->name); -return ide_error (drive,"busy timeout" ,GET_STAT ()); +return ide_error (drive, rq,"busy timeout" ,GET_STAT ()); } ch->poll_timeout =0 ;
@@ -478,7 +479,7 @@ } ch->poll_timeout =0 ;printk (KERN_ERR "%s: write timed out!\n" ,drive->name); -return ide_error (drive,"write timeout" ,GET_STAT ()); +return ide_error (drive, rq,"write timeout" ,GET_STAT ()); }/*
@@ -613,7 +614,7 @@* call the promise_write function to deal with writing the data out * NOTE: No interrupts are generated on writes. Write completion must be polled */ -if (ide_wait_stat (&startstop, drive,DATA_READY , drive->bad_wstat,WAIT_DRQ )) { +if (ide_wait_stat (&startstop, drive, rq,DATA_READY , drive->bad_wstat,WAIT_DRQ )) {printk (KERN_ERR "%s: no DRQ after issuing " "PROMISE_WRITE\n" , drive->name);return startstop;
drivers/ide/tcq.c +30 -22
174 lines not on this page · raw message
drivers/scsi/ide-scsi.c +3 -18
@@ -271,7 +271,7 @@ide_end_request (drive, rq, uptodate);return 0 ; } -ide_end_drive_cmd (drive,0 ,0 ); +ide_end_drive_cmd (drive, rq,0 ,0 );if (rq->errors >=ERROR_MAX ) { pc->scsi_cmd->result =DID_ERROR <<16 ;if (log)
@@ -401,7 +401,7 @@byte ireason;ide_startstop_t startstop; -if (ide_wait_stat (&startstop,drive,DRQ_STAT ,BUSY_STAT ,WAIT_READY )) { +if (ide_wait_stat (&startstop, drive, rq,DRQ_STAT ,BUSY_STAT ,WAIT_READY )) {printk (KERN_ERR "ide-scsi: Strange, packet command initiated yet DRQ isn't asserted\n" );return startstop; }
@@ -489,20 +489,6 @@static ide_drive_t *idescsi_drives[MAX_HWIFS *MAX_DRIVES ];static int idescsi_initialized =0 ; -static void idescsi_add_settings (ide_drive_t *drive) -{ -idescsi_scsi_t *scsi = drive->driver_data; - -/* -* drive setting name read/write ioctl ioctl data type min max mul_factor div_factor data pointer set function -*/ -ide_add_setting (drive,"bios_cyl" ,SETTING_RW ,-1 ,-1 ,TYPE_INT ,0 ,1023 ,1 ,1 , &drive->bios_cyl,NULL ); -ide_add_setting (drive,"bios_head" ,SETTING_RW ,-1 ,-1 ,TYPE_BYTE ,0 ,255 ,1 ,1 , &drive->bios_head,NULL ); -ide_add_setting (drive,"bios_sect" ,SETTING_RW ,-1 ,-1 ,TYPE_BYTE ,0 ,63 ,1 ,1 , &drive->bios_sect,NULL ); -ide_add_setting (drive,"transform" ,SETTING_RW ,-1 ,-1 ,TYPE_INT ,0 ,3 ,1 ,1 , &scsi->transform,NULL ); -ide_add_setting (drive,"log" ,SETTING_RW ,-1 ,-1 ,TYPE_INT ,0 ,1 ,1 ,1 , &scsi->log,NULL ); -} -/* * Driver initialization. */
@@ -521,8 +507,7 @@clear_bit (IDESCSI_SG_TRANSFORM , &scsi->transform);#if IDESCSI_DEBUG_LOG set_bit (IDESCSI_LOG_CMD , &scsi->log); -#endif /* IDESCSI_DEBUG_LOG */ -idescsi_add_settings (drive); +#endif }static int idescsi_cleanup (ide_drive_t *drive)
include/linux/ide.h +11 -54
117 lines not on this page · raw message
pdc202xx.c fails to compile in 2.5.15
pdc202xx.x fails to compile in 2.5.15. Error messages below.
pdc202xx.c:1453: unknown field exnablebits' specified in initializer pdc202xx.c:1453: warning: braces around scalar initializer pdc202xx.c:1453: warning: (near initialization for chipsets[3].init_dma') pdc202xx.c:1453: warning: braces around scalar initializer pdc202xx.c:1453: warning: (near initialization for `chipsets[3].init_dma') pdc202xx.c:1453: warning: initialization makes pointer from integer without a cast pdc202xx.c:1453: warning: excess elements in scalar initializer pdc202xx.c:1453: warning: (near initialization for chipsets[3].init_dma') pdc202xx.c:1453: warning: excess elements in scalar initializer pdc202xx.c:1453: warning: (near initialization for chipsets[3].init_dma') pdc202xx.c:1453: warning: braces around scalar initializer pdc202xx.c:1453: warning: (near initialization for `chipsets[3].init_dma') pdc202xx.c:1453: warning: initialization makes pointer from integer without a cast pdc202xx.c:1453: warning: excess elements in scalar initializer pdc202xx.c:1453: warning: (near initialization for chipsets[3].init_dma') pdc202xx.c:1453: warning: excess elements in scalar initializer pdc202xx.c:1453: warning: (near initialization for chipsets[3].init_dma') pdc202xx.c:1453: warning: excess elements in scalar initializer pdc202xx.c:1453: warning: (near initialization for `chipsets[3].init_dma') make[3]: *** [pdc202xx.o] Error 1
Signature · 1 line
Zlatko
Re: pdc202xx.c fails to compile in 2.5.15
In reply to Martin DaleckiFrom: Zlatko Calusic <[email protected]>
Date: Sun, May 12, 2002 at 09:19:22PM +0200
Quoted 4 lines
pdc202xx.x fails to compile in 2.5.15. Error messages below.
pdc202xx.c:1453: unknown field `exnablebits' specified in initializer
That's a simple typing error - replace exnable by enable.
Good luck,
Jurriaan
Signature · 3 lines
The man who thinks he is smarter than his wife is married to a very smart woman. Debian GNU/Linux 2.4.19p8 on Alpha 988 bogomips load:0.12 0.06 0.01
Re: pdc202xx.c fails to compile in 2.5.15
In reply to Martin DaleckiQuoted 6 lines · Zlatko Calusic
pdc202xx.x fails to compile in 2.5.15. Error messages below.
pdc202xx.c:1453: unknown field
exnablebits' specified in initializer pdc202xx.c:1453: warning: braces around scalar initializer pdc202xx.c:1453: warning: (near initialization forchipsets[3].init_dma') make[3]: *** [pdc202xx.o] Error 1
If you have PDC20265 like I have, you must also remove test on device class, as 20265 reports itself as generic mass storage (class 0x0180) and not as IDE (it is real IDE, not RAID, really).
Because of there are apparently devices on which you must check device class (2.5.14 talks about CY82C693 and IT8172G), I'll leave proper fix on Martin, but simple fix below work fine on my Asus A7V.
Petr Vandrovec [email protected]
ide/ide-pci.c +1 -1
@@ -701,7 +701,7 @@hpt374_device_order_fixup (dev, d); }else if (d->vendor ==PCI_VENDOR_ID_PROMISE && d->device ==PCI_DEVICE_ID_PROMISE_20268R )pdc20270_device_order_fixup (dev, d); -else if ((dev->class >>8 ) ==PCI_CLASS_STORAGE_IDE ) { +else if (1 || (dev->class >>8 ) ==PCI_CLASS_STORAGE_IDE ) {printk (KERN_INFO "ATA: %s (%04x:%04x) on PCI slot %s\n" , dev->name, vendor, device, dev->slot_name);setup_pci_device (dev, d);
Re: pdc202xx.c fails to compile in 2.5.15
Quoted 3 lines
If you have PDC20265 like I have, you must also remove test on device class, as 20265 reports itself as generic mass storage (class
0x0180) and not as IDE (it is real IDE, not RAID, really).
It reports itself that way so that the windows ide disk driver doesn't grab and it and dos/bios don't get odd ideas
Quoted 3 lines
Because of there are apparently devices on which you must check device class (2.5.14 talks about CY82C693 and IT8172G), I'll leave proper fix on Martin, but simple fix below work fine on my Asus A7V.
You need to do specific checks for the device in question. Removing the class check btw is something anyone reading this message should not do even in the same situation unless they know precisely what other mass storage class devices they have present. You can easily trash a raid array otherwise
Re: [PATCH] 2.5.15 IDE 60
In reply to Linus TorvaldsQuoted 7 lines · Martin Dalecki
Fri May 10 16:17:01 CEST 2002 ide-clean-60
Synchronize with 2.5.15
- Rewrite ioctl handling.
- Apply fix for hpt366 "hang on boot" by Andre.
No, it doesn't fix it for me.
Signature · 4 lines
Pierre ------------------------------------------------ Pierre Rousselet <[email protected]> ------------------------------------------------
Re: [PATCH] 2.5.15 IDE 60
You have to specify which of the 6 revisions of the chipset you have. Also in some cases which of the 13 sub-revisions, and the latter is determined by the sub-vender-device.
Quoted 24 lines · Pierre Rousselet
Quoted 7 lines · Martin Dalecki
Fri May 10 16:17:01 CEST 2002 ide-clean-60
Synchronize with 2.5.15
- Rewrite ioctl handling.
- Apply fix for hpt366 "hang on boot" by Andre.
No, it doesn't fix it for me.
Signature · 11 lines
Pierre ------------------------------------------------ Pierre Rousselet <[email protected]> ------------------------------------------------ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Andre Hedrick
LAD Storage Consulting Group
Re: [PATCH] 2.5.15 IDE 60
Quoted 3 lines · Andre Hedrick
You have to specify which of the 6 revisions of the chipset you have. Also in some cases which of the 13 sub-revisions, and the latter is determined by the sub-vender-device.
hde is ST310212A UDMA(66), hdg is SAMSUNG SV0322A UDMA(33) (motherboard BE6).
# lspci -v gives (2.5.14 PCI_NAMES not set) :
00:13.0 Unknown mass storage controller: Triones Technologies, Inc. HPT366 (rev 01)
Flags: bus master, medium devsel, latency 120, IRQ 11 I/O ports at cc00 [size=8] I/O ports at d000 [size=4] I/O ports at d400 [size=256] Expansion ROM at <unassigned> [disabled] [size=128K]
00:13.1 Unknown mass storage controller: Triones Technologies, Inc. HPT366 (rev 01)
Flags: bus master, medium devsel, latency 120, IRQ 11 I/O ports at d800 [size=8] I/O ports at dc00 [size=4] I/O ports at e000 [size=256]
# scanpci -v:
pci bus 0x0000 cardnum 0x13 function 0x00: vendor 0x1103 device 0x0004
Device unknown
STATUS 0x0200 COMMAND 0x0005 CLASS 0x01 0x80 0x00 REVISION 0x01 BIST 0x00 HEADER 0x80 LATENCY 0x78 CACHE 0x08 BASE0 0x0000cc01 addr 0x0000cc00 I/O BASE1 0x0000d001 addr 0x0000d000 I/O BASE4 0x0000d401 addr 0x0000d400 I/O MAX_LAT 0x08 MIN_GNT 0x08 INT_PIN 0x01 INT_LINE 0x0b BYTE_0 0x10c9a731 BYTE_1 0x00 BYTE_2 0x80736b0 BYTE_3 0xffffffff
pci bus 0x0000 cardnum 0x13 function 0x01: vendor 0x1103 device 0x0004
Device unknown
STATUS 0x0200 COMMAND 0x0007 CLASS 0x01 0x80 0x00 REVISION 0x01 BIST 0x00 HEADER 0x80 LATENCY 0x78 CACHE 0x08 BASE0 0x0000d801 addr 0x0000d800 I/O BASE1 0x0000dc01 addr 0x0000dc00 I/O BASE4 0x0000e001 addr 0x0000e000 I/O MAX_LAT 0x08 MIN_GNT 0x08 INT_PIN 0x02 INT_LINE 0x0b BYTE_0 0x10caa731 BYTE_1 0x00 BYTE_2 0x8073a28 BYTE_3 0xffffffff
# cat /proc/ide/hpt366 :
HighPoint HPT366/368/370Controller: 0
Chipset: HPT366
--------------- Primary Channel --------------- Secondary Channel --------------
Enabled: yes yes
--------------- drive0 --------- drive1 ------- drive0 ---------- drive1 -------
DMA capable: yes no no no Mode: UDMA off off off
Controller: 1
Chipset: HPT366
--------------- Primary Channel --------------- Secondary Channel --------------
Enabled: yes yes
--------------- drive0 --------- drive1 ------- drive0 ---------- drive1 -------
DMA capable: yes no no no Mode: UDMA off off off
Signature · 4 lines
Pierre ------------------------------------------------ Pierre Rousselet <[email protected]> ------------------------------------------------
Re: [PATCH] 2.5.15 IDE 60
I am sorry I can not do much for 2.5 at the moment. Please revert to 2.4.19-pre7 plus my mondo patch.
bp6:~ # uname -a
Linux bp6 2.4.19-pre7 #1 SMP Tue May 7 12:57:46 PDT 2002 i686 unknown
00:13.0 Unknown mass storage controller: Triones Technologies, Inc. HPT366 (rev 01)
Flags: bus master, medium devsel, latency 120, IRQ 18
I/O ports at d800 [size=8]
I/O ports at dc00 [size=4]
I/O ports at e000 [size=256]
Expansion ROM at ea000000 [disabled] [size=128K]00:13.1 Unknown mass storage controller: Triones Technologies, Inc. HPT366 (rev 01)
Flags: bus master, medium devsel, latency 120, IRQ 18
I/O ports at e400 [size=8]
I/O ports at e800 [size=4]
I/O ports at ec00 [size=256]HPT366: onboard version of chipset, pin1=1 pin2=2
HPT366: IDE controller on PCI bus 00 dev 98
PCI: Enabling device 00:13.0 (0005 -> 0007)
HPT366: chipset revision 1
HPT366: not 100% native mode: will probe irqs later
ide0: BM-DMA at 0xe000-0xe007, BIOS settings: hda:DMA, hdb:pio
HPT366: IDE controller on PCI bus 00 dev 99
HPT366: chipset revision 1
HPT366: not 100% native mode: will probe irqs later
ide1: BM-DMA at 0xec00-0xec07, BIOS settings: hdc:DMA, hdd:piohda: DupliDisk IDE RAID-1 Adapter( 1.19), ATA DISK drive
hdc: QUANTUM FIREBALLP KA13.6, ATA DISK drive
ide2: ports already in use, skipping probe
ide0 at 0xd800-0xd807,0xdc02 on irq 18
ide1 at 0xe400-0xe407,0xe802 on irq 18
hda: host protected area => 1
hda: setmax LBA 18041184, native 18039168
hda: 18039168 sectors (9236 MB) w/371KiB Cache, CHS=17896/16/63, UDMA(66)
hdc: host protected area => 1
hdc: 27068420 sectors (13859 MB) w/371KiB Cache, CHS=26853/16/63, UDMA(66) ide-floppy driver 0.99.newide
Partition check:
/dev/ide/host0/bus0/target0/lun0: p1 p2 p3 < p5 p6 p7 p8 > /dev/ide/host1/bus0/target0/lun0: unknown partition table
Floppy drive(s): fd0 is 1.44M
FDC 0 is a post-1991 82077
RAMDISK driver initialized: 16 RAM disks of 64000K size 1024 blocksize
loop: loaded (max 8 devices)
If it still fails it is a driver-chipset problem.
If it works in 2.4 but fails in 2.5 gawd only knows what is the issue.
Quoted 69 lines · Pierre Rousselet
Quoted 3 lines · Andre Hedrick
You have to specify which of the 6 revisions of the chipset you have. Also in some cases which of the 13 sub-revisions, and the latter is determined by the sub-vender-device.
hde is ST310212A UDMA(66), hdg is SAMSUNG SV0322A UDMA(33) (motherboard BE6).
# lspci -v gives (2.5.14 PCI_NAMES not set) :00:13.0 Unknown mass storage controller: Triones Technologies, Inc. HPT366 (rev 01)
Flags: bus master, medium devsel, latency 120, IRQ 11 I/O ports at cc00 [size=8] I/O ports at d000 [size=4] I/O ports at d400 [size=256] Expansion ROM at <unassigned> [disabled] [size=128K]00:13.1 Unknown mass storage controller: Triones Technologies, Inc. HPT366 (rev 01)
Flags: bus master, medium devsel, latency 120, IRQ 11 I/O ports at d800 [size=8] I/O ports at dc00 [size=4] I/O ports at e000 [size=256]# scanpci -v:pci bus
0x0000cardnum0x13function0x00: vendor0x1103device0x0004
Device unknownSTATUS 0x0200 COMMAND 0x0005 CLASS 0x01 0x80 0x00 REVISION 0x01 BIST 0x00 HEADER 0x80 LATENCY 0x78 CACHE 0x08 BASE0 0x0000cc01 addr 0x0000cc00 I/O BASE1 0x0000d001 addr 0x0000d000 I/O BASE4 0x0000d401 addr 0x0000d400 I/O MAX_LAT 0x08 MIN_GNT 0x08 INT_PIN 0x01 INT_LINE 0x0b BYTE_0 0x10c9a731 BYTE_1 0x00 BYTE_2 0x80736b0 BYTE_3 0xffffffffpci bus
0x0000cardnum0x13function0x01: vendor0x1103device0x0004
Device unknownSTATUS 0x0200 COMMAND 0x0007 CLASS 0x01 0x80 0x00 REVISION 0x01 BIST 0x00 HEADER 0x80 LATENCY 0x78 CACHE 0x08 BASE0 0x0000d801 addr 0x0000d800 I/O BASE1 0x0000dc01 addr 0x0000dc00 I/O BASE4 0x0000e001 addr 0x0000e000 I/O MAX_LAT 0x08 MIN_GNT 0x08 INT_PIN 0x02 INT_LINE 0x0b BYTE_0 0x10caa731 BYTE_1 0x00 BYTE_2 0x8073a28 BYTE_3 0xffffffff# cat /proc/ide/hpt366 : HighPoint HPT366/368/370Controller: 0
Chipset: HPT366
--------------- Primary Channel --------------- Secondary Channel
--------------
Enabled: yes yes
--------------- drive0 --------- drive1 ------- drive0 ---------- drive1
-------DMA capable: yes no no no Mode: UDMA off off offController: 1
Chipset: HPT366
--------------- Primary Channel --------------- Secondary Channel
--------------
Enabled: yes yes
--------------- drive0 --------- drive1 ------- drive0 ---------- drive1
-------
Quoted 9 lines
DMA capable: yes no no no Mode: UDMA off off offSignature · 4 lines
Pierre ------------------------------------------------ Pierre Rousselet <[email protected]> ------------------------------------------------
Andre Hedrick
LAD Storage Consulting Group
PATCH 1/1 2.5.15 IDE 61
In reply to Linus TorvaldsSat May 11 18:45:08 CEST 2002 ide-clean-61
- Fix typo in pdc202xx driver.
- Fix locking order in ioctl.
- Fix wrong time_after usage introduced in 60. Maybe the fact I always get is wrong is related to the fact that I'm using the mouse with the left hand!?
- Apply arch-clean-2 by Bartlomiej Zolnierkiewicz.
- Don't disable interrupts during ide_wait_stat(). I see no reason too.
- Push flags down from hwgroup to the ata_chaannel structure.
- Apply small fixes from Franz Sirl to make AEC6280 working properly again.
drivers/ide/ide.c +81 -70
@@ -317,7 +317,7 @@blkdev_dequeue_request (rq); else blk_queue_end_tag(&drive->queue, rq); -HWGROUP (drive)->rq =NULL ; + drive->rq =NULL ;end_that_request_last (rq); ret =0 ; }
@@ -635,7 +635,7 @@ }blkdev_dequeue_request (rq); -HWGROUP (drive)->rq =NULL ; + drive->rq =NULL ;end_that_request_last (rq); }
@@ -886,7 +886,6 @@ {u8 stat;int i; -unsigned long flags;/* bail early if we've exceeded max_failures */ if (drive->max_failures && (drive->failures > drive->max_failures)) {
@@ -896,24 +895,20 @@udelay (1 );/* spec allows drive 400ns to assert "BUSY" */ if ((stat =GET_STAT ()) &BUSY_STAT ) { -__save_flags (flags);/* local CPU only */ -ide__sti ();/* local CPU only */ timeout += jiffies;while ((stat =GET_STAT ()) &BUSY_STAT ) { -if (time_after (timeout, jiffies)) { -__restore_flags (flags);/* local CPU only */ +if (time_after (jiffies, timeout)) { *startstop =ide_error (drive, rq,"status timeout" , stat);return 1 ; } } -__restore_flags (flags);/* local CPU only */ } +/* -* Allow status to settle, then read it again. -* A few rare drives vastly violate the 400ns spec here, -* so we'll wait up to 10usec for a "good" status -* rather than expensively fail things immediately. -* This fix courtesy of Matthew Faupel & Niccolo Rigacci. +* Allow status to settle, then read it again. A few rare drives +* vastly violate the 400ns spec here, so we'll wait up to 10usec for a +* "good" status rather than expensively fail things immediately. This +* fix courtesy of Matthew Faupel & Niccolo Rigacci. */ for (i =0 ; i <10 ; i++) {udelay (1 );
@@ -1074,15 +1069,13 @@struct ata_channel *ch = drive->channel;ide_hwgroup_t *hwgroup = ch->hwgroup;unsigned long flags; -struct request *rq;spin_lock_irqsave (&ide_lock, flags); hwgroup->handler =NULL ;del_timer (&ch->timer); - rq = hwgroup->rq;spin_unlock_irqrestore (&ide_lock, flags); -return start_request (drive, rq); +return start_request (drive, drive->rq); }/*
@@ -1180,7 +1173,6 @@if (choice)return choice; - channel->hwgroup->rq =NULL ; sleep =longest_sleep (channel);if (sleep) {
@@ -1197,14 +1189,14 @@if (timer_pending (&channel->timer))printk (KERN_ERR "ide_set_handler: timer already active\n" );#endif -set_bit (IDE_SLEEP , &channel->hwgroup->flags); +set_bit (IDE_SLEEP , &channel->active);mod_timer (&channel->timer, sleep);/* we purposely leave hwgroup busy while sleeping */ }else {/* Ugly, but how can we sleep for the lock otherwise? perhaps * from tq_disk? */ ide_release_lock (&irq_lock);/* for atari only */ -clear_bit (IDE_BUSY , &channel->hwgroup->flags); +clear_bit (IDE_BUSY , &channel->active); }return NULL ;
@@ -1217,13 +1209,13 @@*/ static void queue_commands (struct ata_device *drive,int masked_irq) { -ide_hwgroup_t *hwgroup = drive->channel->hwgroup; +struct ata_channel *ch = drive->channel;ide_startstop_t startstop =-1 ;for (;;) {struct request *rq =NULL ; -if (!test_bit (IDE_BUSY , &hwgroup->flags)) +if (!test_bit (IDE_BUSY , &ch->active))printk (KERN_ERR "%s: error: not busy while queueing!\n" , drive->name);/* Abort early if we can't queue another command. for non
@@ -1232,13 +1224,13 @@*/ if (!ata_can_queue (drive)) {if (!ata_pending_commands (drive)) -clear_bit (IDE_BUSY , &hwgroup->flags); +clear_bit (IDE_BUSY , &ch->active);break ; } drive->sleep =0 ; -if (test_bit (IDE_DMA , &hwgroup->flags)) { +if (test_bit (IDE_DMA , &ch->active)) {printk ("ide_do_request: DMA in progress...\n" );break ; }
@@ -1256,8 +1248,8 @@if (!(rq =elv_next_request (&drive->queue))) {if (!ata_pending_commands (drive)) -clear_bit (IDE_BUSY , &hwgroup->flags); - hwgroup->rq =NULL ; +clear_bit (IDE_BUSY , &ch->active); + drive->rq =NULL ;break ; }
@@ -1268,7 +1260,7 @@if (!(rq->flags &REQ_CMD ) &&ata_pending_commands (drive))break ; - hwgroup->rq = rq; + drive->rq = rq;/* Some systems have trouble with IDE IRQs arriving while the * driver is still setting things up. So, here we disable the
@@ -1339,12 +1331,10 @@*/ static void ide_do_request (struct ata_channel *channel,int masked_irq) { -ide_hwgroup_t *hwgroup = channel->hwgroup; -ide_get_lock (&irq_lock, ata_irq_request, hwgroup);/* for atari only: POSSIBLY BROKEN HERE(?) */ __cli ();/* necessary paranoia: ensure IRQs are masked on local CPU */ -while (!test_and_set_bit (IDE_BUSY , &hwgroup->flags)) { +while (!test_and_set_bit (IDE_BUSY , &channel->active)) {struct ata_channel *ch;struct ata_device *drive;
@@ -1405,7 +1395,7 @@* un-busy drive etc (hwgroup->busy is cleared on return) and * make sure request is sane */ -HWGROUP (drive)->rq =NULL ; + drive->rq =NULL ; rq->errors =0 ;if (rq->bio) {
@@ -1446,8 +1436,8 @@* complain about anything. */ -if (test_and_clear_bit (IDE_SLEEP , &hwgroup->flags)) -clear_bit (IDE_BUSY , &hwgroup->flags); +if (test_and_clear_bit (IDE_SLEEP , &ch->active)) +clear_bit (IDE_BUSY , &ch->active); }else {struct ata_device *drive = ch->drive;if (!drive) {
@@ -1457,11 +1447,11 @@ide_startstop_t startstop;/* paranoia */ -if (!test_and_set_bit (IDE_BUSY , &hwgroup->flags)) +if (!test_and_set_bit (IDE_BUSY , &ch->active))printk ("%s: ide_timer_expiry: hwgroup was not busy??\n" , drive->name);if ((expiry = ch->expiry) !=NULL ) {/* continue */ -if ((wait =expiry (drive,HWGROUP (drive)->rq)) !=0 ) { +if ((wait =expiry (drive, drive->rq)) !=0 ) {/* reengage timer */ ch->timer.expires = jiffies + wait;add_timer (&ch->timer);
@@ -1484,25 +1474,25 @@#endif __cli ();/* local CPU only, as if we were handling an interrupt */ if (ch->poll_timeout !=0 ) { - startstop =handler (drive, ch->hwgroup->rq); + startstop =handler (drive, drive->rq); }else if (drive_is_ready (drive)) {if (drive->waiting_for_dma)udma_irq_lost (drive); (void )ide_ack_intr (ch);printk ("%s: lost interrupt\n" , drive->name); - startstop =handler (drive, ch->hwgroup->rq); + startstop =handler (drive, drive->rq); }else {if (drive->waiting_for_dma) { startstop = ide_stopped; -dma_timeout_retry (drive, ch->hwgroup->rq); +dma_timeout_retry (drive, drive->rq); }else - startstop =ide_error (drive, ch->hwgroup->rq,"irq timeout" ,GET_STAT ()); + startstop =ide_error (drive, drive->rq,"irq timeout" ,GET_STAT ()); }set_recovery_timer (ch);enable_irq (ch->irq);spin_lock_irq (&ide_lock);if (startstop == ide_stopped) -clear_bit (IDE_BUSY , &hwgroup->flags); +clear_bit (IDE_BUSY , &ch->active); } }
@@ -1627,7 +1617,7 @@ goto out_lock; }/* paranoia */ -if (!test_and_set_bit (IDE_BUSY , &hwgroup->flags)) +if (!test_and_set_bit (IDE_BUSY , &ch->active))printk (KERN_ERR "%s: %s: hwgroup was not busy!?\n" , drive->name, __FUNCTION__); hwgroup->handler =NULL ;del_timer (&ch->timer);
@@ -1637,7 +1627,7 @@ide__sti ();/* local CPU only */ /* service this interrupt, may set handler for next interrupt */ - startstop =handler (drive, hwgroup->rq); + startstop =handler (drive, drive->rq);spin_lock_irq (&ide_lock);/*
@@ -1650,7 +1640,7 @@set_recovery_timer (drive->channel);if (startstop == ide_stopped) {if (hwgroup->handler ==NULL ) {/* paranoia */ -clear_bit (IDE_BUSY , &hwgroup->flags); +clear_bit (IDE_BUSY , &ch->active);ide_do_request (ch, ch->irq); }else {printk ("%s: %s: huh? expected NULL handler on exit\n" , drive->name, __FUNCTION__);
@@ -1738,7 +1728,7 @@spin_lock_irqsave (&ide_lock, flags);if (blk_queue_empty (&drive->queue) || action == ide_preempt) {if (action == ide_preempt) -HWGROUP (drive)->rq =NULL ; + drive->rq =NULL ; }else {if (action == ide_wait || action == ide_end) queue_head = queue_head->prev;
@@ -2222,8 +2212,6 @@int ide_spin_wait_hwgroup (struct ata_device *drive) { -ide_hwgroup_t *hwgroup =HWGROUP (drive); -/* FIXME: Wait on a proper timer. Instead of playing games on the * spin_lock(). */
@@ -2232,7 +2220,7 @@spin_lock_irq (&ide_lock); -while (test_bit (IDE_BUSY , &hwgroup->flags)) { +while (test_bit (IDE_BUSY , &drive->channel->active)) {spin_unlock_irq (&ide_lock);if (time_after (jiffies, timeout)) {printk ("%s: channel busy\n" , drive->name);
@@ -2316,7 +2304,9 @@kdev_t dev; dev = inode->i_rdev; - major =major (dev); minor =minor (dev); + major =major (dev); + minor =minor (dev); +if ((drive =get_info_ptr (inode->i_rdev)) ==NULL )return -ENODEV ;
@@ -2376,6 +2366,7 @@if (put_user (val, (unsigned long *) arg))return -EFAULT ; +return 0 ; }
@@ -2384,12 +2375,12 @@if (arg <0 || arg >1 )return -EINVAL ; -if (ide_spin_wait_hwgroup (drive)) -return -EBUSY ; -if (drive->channel->no_unmask)return -EIO ; +if (ide_spin_wait_hwgroup (drive)) +return -EBUSY ; + drive->channel->unmask = arg;spin_unlock_irq (&ide_lock);
@@ -2426,11 +2417,20 @@if (!loc || (drive->type !=ATA_DISK && drive->type !=ATA_FLOPPY ))return -EINVAL ; -if (put_user (drive->bios_head, (byte *) &loc->heads))return -EFAULT ; -if (put_user (drive->bios_sect, (byte *) &loc->sectors))return -EFAULT ; -if (put_user (bios_cyl, (unsigned short *) &loc->cylinders))return -EFAULT ; + +if (put_user (drive->bios_head, (byte *) &loc->heads)) +return -EFAULT ; + +if (put_user (drive->bios_sect, (byte *) &loc->sectors)) +return -EFAULT ; + +if (put_user (bios_cyl, (unsigned short *) &loc->cylinders)) +return -EFAULT ; +if (put_user ((unsigned )drive->part[minor (inode->i_rdev)&PARTN_MASK ].start_sect, - (unsigned long *) &loc->start))return -EFAULT ; + (unsigned long *) &loc->start)) +return -EFAULT ; +return 0 ; }
@@ -2440,48 +2440,59 @@if (!loc || (drive->type !=ATA_DISK && drive->type !=ATA_FLOPPY ))return -EINVAL ; -if (put_user (drive->head, (u8 *) &loc->heads))return -EFAULT ; -if (put_user (drive->sect, (u8 *) &loc->sectors))return -EFAULT ; -if (put_user (drive->cyl, (unsigned int *) &loc->cylinders))return -EFAULT ; +if (put_user (drive->head, (u8 *) &loc->heads)) +return -EFAULT ; + +if (put_user (drive->sect, (u8 *) &loc->sectors)) +return -EFAULT ; + +if (put_user (drive->cyl, (unsigned int *) &loc->cylinders)) +return -EFAULT ; +if (put_user ((unsigned )drive->part[minor (inode->i_rdev)&PARTN_MASK ].start_sect, - (unsigned long *) &loc->start))return -EFAULT ; + (unsigned long *) &loc->start)) +return -EFAULT ; +return 0 ; }case BLKRRPART :/* Re-read partition tables */ -if (!capable (CAP_SYS_ADMIN )) -return -EACCES ;return ide_revalidate_disk (inode->i_rdev);case HDIO_GET_IDENTITY :if (minor (inode->i_rdev) &PARTN_MASK )return -EINVAL ; +if (drive->id ==NULL )return -ENOMSG ; +if (copy_to_user ((char *)arg, (char *)drive->id,sizeof (*drive->id)))return -EFAULT ; +return 0 ;case HDIO_GET_NICE : -return put_user (drive->dsc_overlap <<IDE_NICE_DSC_OVERLAP | - drive->atapi_overlap <<IDE_NICE_ATAPI_OVERLAP , +return put_user (drive->dsc_overlap <<IDE_NICE_DSC_OVERLAP | + drive->atapi_overlap <<IDE_NICE_ATAPI_OVERLAP , (long *) arg);case HDIO_DRIVE_CMD : -if (!capable (CAP_SYS_ADMIN ) || !capable (CAP_SYS_RAWIO )) +if (!capable (CAP_SYS_RAWIO ))return -EACCES ; +return ide_cmd_ioctl (drive, arg);case HDIO_SET_NICE : -if (!capable (CAP_SYS_ADMIN ))return -EACCES ;if (arg != (arg & ((1 <<IDE_NICE_DSC_OVERLAP ))))return -EPERM ; + drive->dsc_overlap = (arg >>IDE_NICE_DSC_OVERLAP ) &1 ;/* Only CD-ROM's and tapes support DSC overlap. */ if (drive->dsc_overlap && !(drive->type ==ATA_ROM || drive->type ==ATA_TAPE )) { drive->dsc_overlap =0 ;return -EPERM ; } +return 0 ;case BLKGETSIZE :
@@ -2505,25 +2516,24 @@return block_ioctl (inode->i_bdev, cmd, arg);case HDIO_GET_BUSSTATE : -if (!capable (CAP_SYS_ADMIN )) -return -EACCES ;if (put_user (drive->channel->bus_state, (long *)arg))return -EFAULT ; +return 0 ;case HDIO_SET_BUSSTATE : -if (!capable (CAP_SYS_ADMIN )) -return -EACCES ;if (drive->channel->busproc) drive->channel->busproc (drive, (int )arg); +return 0 ; -/* Now check whatever this particular ioctl has a special -* implementation. +/* Now check whatever this particular ioctl has a device type +* specific implementation. */ default :if (ata_ops (drive) &&ata_ops (drive)->ioctl)return ata_ops (drive)->ioctl (drive, inode, file, cmd, arg); +return -EINVAL ; } }
@@ -2545,6 +2555,7 @@ res =1 ;/* assume it was changed */ ata_put (ata_ops (drive)); } +return res; }
drivers/ide/ide-disk.c +9 -7
@@ -1058,6 +1058,7 @@if (put_user (val, (unsigned long *) arg))return -EFAULT ; +return 0 ; }
@@ -1081,6 +1082,7 @@if (put_user (val, (unsigned long *) arg))return -EFAULT ; +return 0 ; }
@@ -1100,7 +1102,7 @@ }case HDIO_GET_ACOUSTIC : { -u8 val = drive->acoustic; +unsigned long val = drive->acoustic;if (put_user (val, (u8 *) arg))return -EFAULT ;
@@ -1128,6 +1130,7 @@if (put_user (val, (u8 *) arg))return -EFAULT ; +return 0 ; }
@@ -1153,7 +1156,7 @@/* -* IDE subdriver functions, registered with ide.c +* Subdriver functions. */ static struct ata_operations idedisk_driver = { owner:THIS_MODULE ,
@@ -1178,11 +1181,9 @@while ((drive =ide_scan_devices (ATA_DISK ,"ide-disk" , &idedisk_driver, failed)) !=NULL ) {if (idedisk_cleanup (drive)) { -printk (KERN_ERR "%s: cleanup_module() called while still busy\n" , drive->name); - failed++; +printk (KERN_ERR "%s: cleanup_module() called while still busy\n" , drive->name); + ++failed; } -/* We must remove proc entries defined in this module. -Otherwise we oops while accessing these entries */ } }
@@ -1203,10 +1204,11 @@idedisk_cleanup (drive);continue ; } - failed--; + --failed; }revalidate_drives ();MOD_DEC_USE_COUNT ; +return 0 ; }
drivers/ide/ide-dma.c +2 -2
@@ -382,10 +382,10 @@#ifdef DEBUG printk ("%s: dma_timer_expiry: dma status == 0x%02x\n" , drive->name, dma_stat); -#endif /* DEBUG */ +#endif #if 0 -HWGROUP (drive)->expiry =NULL ;/* one free ride for now */ + drive->expiry =NULL ;/* one free ride for now */ #endif if (dma_stat &2 ) {/* ERROR */
drivers/ide/ide-pci.c +2 -2
@@ -122,7 +122,7 @@* Unless there is a bootable card that does not use the standard * ports 1f0/170 (the ide0/ide1 defaults). The (bootable) flag. */ -if (bootable) { +if (bootable ==ON_BOARD ) {for (h =0 ; h <MAX_HWIFS ; ++h) { hwif = &ide_hwifs[h];if (hwif->chipset == ide_unknown)
@@ -703,7 +703,7 @@hpt374_device_order_fixup (dev, d); }else if (d->vendor ==PCI_VENDOR_ID_PROMISE && d->device ==PCI_DEVICE_ID_PROMISE_20268R )pdc20270_device_order_fixup (dev, d); -else if ((dev->class >>8 ) ==PCI_CLASS_STORAGE_IDE ) { +else {printk (KERN_INFO "ATA: %s (%04x:%04x) on PCI slot %s\n" , dev->name, vendor, device, dev->slot_name);setup_pci_device (dev, d);
drivers/ide/ide-taskfile.c +1 -0
@@ -279,6 +279,7 @@if (stat &BUSY_STAT )return 0 ;/* drive busy: definitely not interrupting */ +return 1 ;/* drive ready: *might* be interrupting */ }
drivers/ide/pdc202xx.c +1 -1
@@ -1450,7 +1450,7 @@ init_chipset: pdc202xx_init_chipset, ata66_check: ata66_pdc202xx, init_channel: ide_init_pdc202xx, - exnablebits: {{0x50,0x02,0x02}, {0x50,0x04,0x04}}, + enablebits: {{0x50,0x02,0x02}, {0x50,0x04,0x04}}, bootable: OFF_BOARD, extra: 48, flags: ATA_F_IRQ | ATA_F_DMA
drivers/ide/sl82c105.c +1 -1
@@ -76,7 +76,7 @@if (ide_config_drive_speed (drive, xfer_mode) ==0 ) drv_ctrl =get_timing_sl82c105 (t); -if (drive->using_dma ==0 ) { +if (!drive->using_dma) {/* * If we are actually using MW DMA, then we can not * reprogram the interface drive control register.
drivers/ide/tcq.c +11 -10
@@ -95,15 +95,15 @@del_timer (&ch->timer); -if (test_bit (IDE_DMA , &hwgroup->flags)) +if (test_bit (IDE_DMA , &ch->active))udma_stop (drive);blk_queue_invalidate_tags (q); drive->using_tcq =0 ; drive->queue_depth =1 ; -clear_bit (IDE_BUSY , &hwgroup->flags); -clear_bit (IDE_DMA , &hwgroup->flags); +clear_bit (IDE_BUSY , &ch->active); +clear_bit (IDE_DMA , &ch->active); hwgroup->handler =NULL ;/*
@@ -152,6 +152,7 @@static void ata_tcq_irq_timeout (unsigned long data) {struct ata_device *drive = (struct ata_device *) data; +struct ata_channel *ch = drive->channel;ide_hwgroup_t *hwgroup =HWGROUP (drive);unsigned long flags;
@@ -159,7 +160,7 @@spin_lock_irqsave (&ide_lock, flags); -if (test_and_set_bit (IDE_BUSY , &hwgroup->flags)) +if (test_and_set_bit (IDE_BUSY , &ch->active))printk (KERN_ERR "ATA: %s: hwgroup not busy\n" , __FUNCTION__);if (hwgroup->handler ==NULL )printk (KERN_ERR "ATA: %s: missing isr!\n" , __FUNCTION__);
@@ -170,7 +171,7 @@* if pending commands, try service before giving up */ if (ata_pending_commands (drive) && (GET_STAT () &SERVICE_STAT )) -if (service (drive, hwgroup->rq) == ide_started) +if (service (drive, drive->rq) == ide_started)return ;if (drive)
@@ -241,7 +242,7 @@* Could be called with IDE_DMA in-progress from invalidate * handler, refuse to do anything. */ -if (test_bit (IDE_DMA , &HWGROUP (drive)->flags)) +if (test_bit (IDE_DMA , &drive->channel->active))return ide_stopped;/*
@@ -283,7 +284,7 @@* should not happen, a buggy device could introduce loop */ if ((feat =GET_FEAT ()) &NSEC_REL ) { -HWGROUP (drive)->rq =NULL ; + drive->rq =NULL ;printk ("%s: release in service\n" , drive->name);return ide_stopped; }
@@ -298,7 +299,7 @@return ide_stopped; } -HWGROUP (drive)->rq = rq; + drive->rq = rq;/* * we'll start a dma read or write, device will trigger
@@ -529,7 +530,7 @@struct ata_channel *ch = drive->channel;TCQ_PRINTK ("%s: setting up queued %d\n" , __FUNCTION__, rq->tag); -if (!test_bit (IDE_BUSY , &ch->hwgroup->flags)) +if (!test_bit (IDE_BUSY , &ch->active))printk ("queued_rw: IDE_BUSY not set\n" );if (tcq_wait_dataphase (drive))
@@ -584,7 +585,7 @@*/ if ((feat =GET_FEAT ()) &NSEC_REL ) { drive->immed_rel++; -HWGROUP (drive)->rq =NULL ; + drive->rq =NULL ;set_irq (drive, ide_dmaq_intr);TCQ_PRINTK ("REL in queued_start\n" );
include/asm-alpha/ide.h +0 -4
@@ -82,10 +82,6 @@#endif } -#define ide_ack_intr (hwif) (1) -#define ide_release_lock (lock) do {} while (0) -#define ide_get_lock (lock, hdlr, data) do {} while (0) -#endif /* __KERNEL__ */ #endif /* __ASMalpha_IDE_H */
include/asm-arm/ide.h +0 -4
@@ -21,10 +21,6 @@#include <asm/arch/ide.h> -#define ide_ack_intr (hwif) (1) -#define ide_release_lock (lock) do {} while (0) -#define ide_get_lock (lock, hdlr, data) do {} while (0) -/* * We always use the new IDE port registering, * so these are fixed here.
include/asm-cris/ide.h +0 -4
@@ -96,10 +96,6 @@#undef SUPPORT_SLOW_DATA_PORTS#define SUPPORT_SLOW_DATA_PORTS 0 -#define ide_ack_intr (hwif) (1) -#define ide_release_lock (lock) do {} while (0) -#define ide_get_lock (lock, hdlr, data) do {} while (0) -/* the drive addressing is done through a controller register on the Etrax CPU */ void OUT_BYTE (unsigned char data,ide_ioreg_t reg);unsigned char IN_BYTE (ide_ioreg_t reg);
include/asm-i386/ide.h +0 -4
@@ -86,10 +86,6 @@#endif } -#define ide_ack_intr (hwif) (1) -#define ide_release_lock (lock) do {} while (0) -#define ide_get_lock (lock, hdlr, data) do {} while (0) -#endif /* __KERNEL__ */ #endif /* __ASMi386_IDE_H */
include/asm-ia64/ide.h +0 -4
@@ -92,10 +92,6 @@#endif } -#define ide_ack_intr (hwif) (1) -#define ide_release_lock (lock) do {} while (0) -#define ide_get_lock (lock, hdlr, data) do {} while (0) -#endif /* __KERNEL__ */ #endif /* __ASM_IA64_IDE_H */
include/asm-m68k/ide.h +5 -6
@@ -145,10 +145,13 @@#endif /* CONFIG_ATARI || CONFIG_Q40 */ +#define ATA_ARCH_ACK_INTR + +#ifdef CONFIG_ATARI +#define ATA_ARCH_LOCK static __inline__void ide_release_lock (int *ide_lock) { -#ifdef CONFIG_ATARI if (MACH_IS_ATARI ) {if (*ide_lock ==0 ) {printk ("ide_release_lock: bug\n" );
@@ -157,12 +160,10 @@ *ide_lock =0 ;stdma_release (); } -#endif /* CONFIG_ATARI */ }static __inline__void ide_get_lock (int *ide_lock,void (*handler)(int ,void *,struct pt_regs *),void *data) { -#ifdef CONFIG_ATARI if (MACH_IS_ATARI ) {if (*ide_lock ==0 ) {if (in_interrupt () >0 )
@@ -171,10 +172,8 @@ *ide_lock = 1; } } -#endif /* CONFIG_ATARI */ } - -#define ide_ack_intr (hwif) ((hwif)->hw.ack_intr ? (hwif)->hw.ack_intr(hwif) : 1) +#endif /* CONFIG_ATARI */ /* * On the Atari, we sometimes can't enable interrupts:
include/asm-mips/ide.h +0 -4
@@ -68,10 +68,6 @@#undef SUPPORT_VLB_SYNC#define SUPPORT_VLB_SYNC 0 -#define ide_ack_intr (hwif) (1) -#define ide_release_lock (lock) do {} while (0) -#define ide_get_lock (lock, hdlr, data) do {} while (0) -#endif /* __KERNEL__ */ #endif /* __ASM_IDE_H */
include/asm-mips64/ide.h +0 -4
@@ -68,10 +68,6 @@#endif } -#define ide_ack_intr (hwif) (1) -#define ide_release_lock (lock) do {} while (0) -#define ide_get_lock (lock, hdlr, data) do {} while (0) -#endif /* __KERNEL__ */ #endif /* __ASM_IDE_H */
include/asm-parisc/ide.h +0 -4
@@ -81,10 +81,6 @@#endif } -#define ide_ack_intr (hwif) (1) -#define ide_release_lock (lock) do {} while (0) -#define ide_get_lock (lock, hdlr, data) do {} while (0) -#endif /* __KERNEL__ */ #endif /* __ASMi386_IDE_H */
include/asm-ppc/ide.h +1 -5
@@ -108,12 +108,8 @@ }#if (definedCONFIG_APUS || defined CONFIG_BLK_DEV_MPC8xx_IDE ) -#define ide_ack_intr (hwif) (hwif->hw.ack_intr ? hwif->hw.ack_intr(hwif) : 1) -#else -#define ide_ack_intr (hwif) (1) +#define ATA_ARCH_ACK_INTR #endif -#define ide_release_lock (lock) do {} while (0) -#define ide_get_lock (lock, hdlr, data) do {} while (0)#endif /* __KERNEL__ */
include/asm-ppc64/ide.h +0 -4
@@ -50,10 +50,6 @@ { } -#define ide_ack_intr (hwif) (1) -#define ide_release_lock (lock) do {} while (0) -#define ide_get_lock (lock, hdlr, data) do {} while (0) -#endif /* __KERNEL__ */ #endif /* __ASMPPC64_IDE_H */
include/asm-s390/ide.h +0 -8
@@ -18,14 +18,6 @@#define ide__sti () do {} while (0)/* -* The following are not needed for the non-m68k ports -*/ -#define ide_ack_intr (hwif) (1) -#define ide_fix_driveid (id) do {} while (0) -#define ide_release_lock (lock) do {} while (0) -#define ide_get_lock (lock, hdlr, data) do {} while (0) - -/* * We always use the new IDE port registering, * so these are fixed here. */
include/asm-s390x/ide.h +0 -4
@@ -17,10 +17,6 @@#define ide__sti () do {} while (0) -#define ide_ack_intr (hwif) (1) -#define ide_release_lock (lock) do {} while (0) -#define ide_get_lock (lock, hdlr, data) do {} while (0) -/* * We always use the new IDE port registering, * so these are fixed here.
include/asm-sh/ide.h +0 -4
@@ -107,10 +107,6 @@#endif } -#define ide_ack_intr (hwif) (1) -#define ide_release_lock (lock) do {} while (0) -#define ide_get_lock (lock, hdlr, data) do {} while (0) -#endif /* __KERNEL__ */ #endif /* __ASM_SH_IDE_H */
include/asm-sparc/ide.h +0 -5
@@ -165,11 +165,6 @@/* __flush_dcache_range((unsigned long)src, end); */ /* P3 see hme */ } -#define ide_ack_intr (hwif) (1) -/* #define ide_ack_intr(hwif) ((hwif)->hw.ack_intr ? (hwif)->hw.ack_intr(hwif) : 1) */ -#define ide_release_lock (lock) do {} while (0) -#define ide_get_lock (lock, hdlr, data) do {} while (0) -#endif /* __KERNEL__ */ #endif /* _SPARC_IDE_H */
include/asm-sparc64/ide.h +0 -4
@@ -181,10 +181,6 @@#endif } -#define ide_ack_intr (hwif) (1) -#define ide_release_lock (lock) do {} while (0) -#define ide_get_lock (lock, hdlr, data) do {} while (0) -#endif /* __KERNEL__ */ #endif /* _SPARC64_IDE_H */
include/asm-x86_64/ide.h +0 -4
@@ -86,10 +86,6 @@#endif } -#define ide_ack_intr (hwif) (1) -#define ide_release_lock (lock) do {} while (0) -#define ide_get_lock (lock, hdlr, data) do {} while (0) -#endif /* __KERNEL__ */ #endif /* __ASMi386_IDE_H */
include/linux/ide.h +49 -33
138 lines not on this page · raw message
PATCH 1/1 2.5.15 IDE 62
In reply to Linus TorvaldsMon May 13 12:38:11 CEST 2002 ide-clean-62
- Add missing locking around ide_do_request in do_ide_request().
- Check all other places where locks get used for matching pairs in ide.c.
- Streamline device detection reporting to always use ->slot_name.
drivers/ide/ide.c +34 -2
@@ -323,6 +323,7 @@ }spin_unlock_irqrestore (&ide_lock, flags); +return ret; }
@@ -341,6 +342,7 @@ide_hwgroup_t *hwgroup = ch->hwgroup;spin_lock_irqsave (&ide_lock, flags); +if (hwgroup->handler !=NULL ) {printk ("%s: ide_set_handler: handler not null; old=%p, new=%p, from %p\n" , drive->name, hwgroup->handler, handler,__builtin_return_address (0 ));
@@ -349,6 +351,7 @@ ch->expiry = expiry; ch->timer.expires = jiffies + timeout;add_timer (&ch->timer); +spin_unlock_irqrestore (&ide_lock, flags); }
@@ -1071,8 +1074,10 @@unsigned long flags;spin_lock_irqsave (&ide_lock, flags); + hwgroup->handler =NULL ;del_timer (&ch->timer); +spin_unlock_irqrestore (&ide_lock, flags);return start_request (drive, drive->rq);
@@ -1275,10 +1280,12 @@disable_irq_nosync (drive->channel->irq);spin_unlock (&ide_lock); +ide__sti ();/* allow other IRQs while we start this request */ startstop =start_request (drive, rq);spin_lock_irq (&ide_lock); +if (masked_irq && drive->channel->irq != masked_irq)enable_irq (drive->channel->irq);
@@ -1332,7 +1339,7 @@static void ide_do_request (struct ata_channel *channel,int masked_irq) {ide_get_lock (&irq_lock, ata_irq_request, hwgroup);/* for atari only: POSSIBLY BROKEN HERE(?) */ -__cli ();/* necessary paranoia: ensure IRQs are masked on local CPU */ +// __cli(); /* necessary paranoia: ensure IRQs are masked on local CPU */ while (!test_and_set_bit (IDE_BUSY , &channel->active)) {struct ata_channel *ch;
@@ -1362,11 +1369,16 @@queue_commands (drive, masked_irq); } + }void do_ide_request (request_queue_t *q) { +unsigned long flags; + +spin_lock_irqsave (&ide_lock, flags);ide_do_request (q->queuedata,0 ); +spin_unlock_irqrestore (&ide_lock, flags); }/*
@@ -1455,7 +1467,9 @@/* reengage timer */ ch->timer.expires = jiffies + wait;add_timer (&ch->timer); +spin_unlock_irqrestore (&ide_lock, flags); +return ; } }
@@ -1465,7 +1479,9 @@* the handler() function, which means we need to globally * mask the specific IRQ: */ +spin_unlock (&ide_lock); + ch = drive->channel;#if DISABLE_IRQ_NOSYNC disable_irq_nosync (ch->irq);
@@ -1490,7 +1506,9 @@ }set_recovery_timer (ch);enable_irq (ch->irq); +spin_lock_irq (&ide_lock); +if (startstop == ide_stopped)clear_bit (IDE_BUSY , &ch->active); }
@@ -1621,6 +1639,7 @@printk (KERN_ERR "%s: %s: hwgroup was not busy!?\n" , drive->name, __FUNCTION__); hwgroup->handler =NULL ;del_timer (&ch->timer); +spin_unlock (&ide_lock);if (ch->unmask)
@@ -1725,7 +1744,9 @@ rq->rq_dev =mk_kdev (major,(drive->select.b.unit)<<PARTN_BITS );if (action == ide_wait) rq->waiting = &wait; +spin_lock_irqsave (&ide_lock, flags); +if (blk_queue_empty (&drive->queue) || action == ide_preempt) {if (action == ide_preempt) drive->rq =NULL ;
@@ -1737,7 +1758,9 @@ } q->elevator.elevator_add_req_fn (q, rq, queue_head);ide_do_request (drive->channel,0 ); +spin_unlock_irqrestore (&ide_lock, flags); +if (action == ide_wait) {wait_for_completion (&wait);/* wait for it to be serviced */ return rq->errors ? -EIO :0 ;/* return -EIO if errors */
@@ -1767,12 +1790,15 @@spin_lock_irqsave (&ide_lock, flags);if (drive->busy || (drive->usage >1 )) { +spin_unlock_irqrestore (&ide_lock, flags); +return -EBUSY ; } drive->busy =1 ;MOD_INC_USE_COUNT ; +spin_unlock_irqrestore (&ide_lock, flags); res =wipe_partitions (i_rdev);
@@ -1789,6 +1815,7 @@ drive->busy =0 ;wake_up (&drive->wqueue);MOD_DEC_USE_COUNT ; +return res; }
@@ -1950,6 +1977,7 @@* All clear? Then blow away the buffer cache */ spin_unlock_irqrestore (&ide_lock, flags); +for (unit =0 ; unit <MAX_DRIVES ; ++unit) {struct ata_device * drive = &ch->drives[unit];
@@ -1964,6 +1992,7 @@ } } } +spin_lock_irqsave (&ide_lock, flags);/*
@@ -2221,11 +2250,14 @@spin_lock_irq (&ide_lock);while (test_bit (IDE_BUSY , &drive->channel->active)) { +spin_unlock_irq (&ide_lock); +if (time_after (jiffies, timeout)) {printk ("%s: channel busy\n" , drive->name);return -EBUSY ; } +spin_lock_irq (&ide_lock); }
@@ -3455,7 +3487,7 @@#if defined(CONFIG_BLK_DEV_IDE ) || defined(CONFIG_BLK_DEV_IDE_MODULE )# if defined(__mc68000__) || defined(CONFIG_APUS )if (ide_hwifs[0 ].io_ports[IDE_DATA_OFFSET ]) { -ide_get_lock (&irq_lock,NULL ,NULL );/* for atari only */ +// ide_get_lock(&irq_lock, NULL, NULL);/* for atari only */ disable_irq (ide_hwifs[0 ].irq);/* disable_irq_nosync ?? */ // disable_irq_nosync(ide_hwifs[0].irq); }
drivers/ide/ide-pci.c +16 -13
@@ -553,15 +553,14 @@ } } } - -printk ("ATA: %s: controller on PCI bus %02x dev %02x\n" , - dev->name, dev->bus->number, dev->devfn); +printk (KERN_INFO "ATA: %s: controller on PCI slot %s dev %02x\n" , + dev->name, dev->slot_name, dev->devfn);setup_pci_device (dev, d);if (!dev2)return ; d2 = d; -printk ("ATA: %s: controller on PCI bus %02x dev %02x\n" , - dev2->name, dev2->bus->number, dev2->devfn); +printk (KERN_INFO "ATA: %s: controller on PCI slot %s dev %02x\n" , + dev2->name, dev2->slot_name, dev2->devfn);setup_pci_device (dev2, d2); }
@@ -584,8 +583,8 @@ } } -printk ("%s: IDE controller on PCI bus %02x dev %02x\n" , - dev->name, dev->bus->number, dev->devfn); +printk (KERN_INFO "ATA: %s: controller on PCI slot %s dev %02x\n" , + dev->name, dev->slot_name, dev->devfn);setup_pci_device (dev, d);if (!dev2) {return ;
@@ -601,8 +600,8 @@ } } d2 = d; -printk ("%s: IDE controller on PCI bus %02x dev %02x\n" , - dev2->name, dev2->bus->number, dev2->devfn); +printk (KERN_INFO "ATA: %s: controller on PCI slot %s dev %02x\n" , + dev2->name, dev2->slot_name, dev2->devfn);setup_pci_device (dev2, d2); }
@@ -623,7 +622,7 @@switch (class_rev) {case 5 :case 4 : -case 3 :printk ("%s: IDE controller on PCI slot %s\n" , dev->name, dev->slot_name); +case 3 :printk (KERN_INFO "ATA: %s: controller on PCI slot %s\n" , dev->name, dev->slot_name);setup_pci_device (dev, d);return ;default :break ;
@@ -639,17 +638,17 @@pci_read_config_byte (dev2,PCI_INTERRUPT_PIN , &pin2);if ((pin1 != pin2) && (dev->irq == dev2->irq)) { d->bootable =ON_BOARD ; -printk ("%s: onboard version of chipset, pin1=%d pin2=%d\n" , dev->name, pin1, pin2); +printk (KERN_INFO "ATAL: %s: onboard version of chipset, pin1=%d pin2=%d\n" , dev->name, pin1, pin2); }break ; } } -printk ("%s: IDE controller on PCI slot %s\n" , dev->name, dev->slot_name); +printk (KERN_INFO "ATA: %s: controller on PCI slot %s\n" , dev->name, dev->slot_name);setup_pci_device (dev, d);if (!dev2)return ; d2 = d; -printk ("%s: IDE controller on PCI slot %s\n" , dev2->name, dev2->slot_name); +printk (KERN_INFO "ATA: %s: controller on PCI slot %s\n" , dev2->name, dev2->slot_name);setup_pci_device (dev2, d2); }
@@ -679,6 +678,10 @@ }if (!d) { +/* Only check the device calls, if it wasn't listed, since +* there are in esp. some pdc202xx chips which "work around" +* beeing grabbed by generic drivers. +*/ if ((dev->class >>8 ) ==PCI_CLASS_STORAGE_IDE ) {printk (KERN_INFO "ATA: unknown interface: %s, on PCI slot %s\n" , dev->name, dev->slot_name);
Re: [PATCH] 2.5.15 IDE 62
In reply to Linus TorvaldsQuoted 3 lines · Martin Dalecki
Mon May 13 12:38:11 CEST 2002 ide-clean-62
- Add missing locking around
ide_do_requestindo_ide_request().
This is broken, do_ide_request() is already called with the request lock held. tq_disk run -> generic_unplug_device (grab lock) -> __generic_unplug_device -> do_ide_request(). You just introduced a deadlock.
This code would have caused hangs or massive corruption immediately if ide_lock wasn't ready held there. Not to mention instant spin_unlock BUG() triggers in queue_command()
Signature · 1 line
Jens Axboe
Re: [PATCH] 2.5.15 IDE 62
In reply to Linus TorvaldsUz.ytkownik Jens Axboe napisa?:
Quoted 7 lines · Martin Dalecki
Quoted 4 lines
Mon May 13 12:38:11 CEST 2002 ide-clean-62
- Add missing locking around
ide_do_requestindo_ide_request().
Quoted 9 lines
This is broken,
do_ide_request()is already called with the request lock held.tq_diskrun ->generic_unplug_device(grab lock) ->__generic_unplug_device->do_ide_request(). You just introduced a deadlock.This code would have caused hangs or massive corruption immediately if
ide_lockwasn't ready held there. Not to mention instantspin_unlockBUG()triggers inqueue_command()
Oops. Indeed I see now that the ide_lock is exported to the upper layers above it in ide-probe.c
blk_init_queue(q, do_ide_request, &ide_lock);
But this is problematic in itself, since it means that we are basically serialiazing between *all* requests on all channels.
So I think we should have per channel locks on this level right? This is anyway our unit for serialization. (I'm just surprised that blk_init_queue() doesn't provide queue specific locking and relies on exported locks from the drivers...)
Re: [PATCH] 2.5.15 IDE 62
In reply to Linus TorvaldsQuoted 1 line · Martin Dalecki
Mon May 13 12:38:11 CEST 2002 ide-clean-62
Hello. Since include/linux/ide.h has a 'u8', a 'u16', and a 'u64' can you apply the following so that it doesn't rely in <asm/types.h> being included indirectly?
Signature · 14 lines
Tom Rini (TR1265) http://gate.crashing.org/~trini/ ===== include/linux/ide.h 1.60 vs edited ===== --- 1.60/include/linux/ide.h Thu May 9 11:43:58 2002 +++ edited/include/linux/ide.h Mon May 13 08:34:32 2002 @@ -17,6 +17,7 @@ #include <linux/bitops.h> #include <asm/byteorder.h> #include <asm/hdreg.h> +#include <asm/types.h> /* * This is the multiple IDE interface driver, as evolved from hd.c.
Re: [PATCH] 2.5.15 IDE 62
In reply to Linus TorvaldsQuoted 18 lines · Martin Dalecki
Uz.ytkownik Jens Axboe napisa?:
Quoted 7 lines · Martin Dalecki
Quoted 4 lines
Mon May 13 12:38:11 CEST 2002 ide-clean-62
- Add missing locking around
ide_do_requestindo_ide_request().Quoted 9 lines
This is broken,
do_ide_request()is already called with the request lock held.tq_diskrun ->generic_unplug_device(grab lock) ->__generic_unplug_device->do_ide_request(). You just introduced a deadlock.This code would have caused hangs or massive corruption immediately if
ide_lockwasn't ready held there. Not to mention instantspin_unlockBUG()triggers inqueue_command()
Quoted 8 lines
Oops. Indeed I see now that the
ide_lockis exported to the upper layers above it inide-probe.c
blk_init_queue(q, do_ide_request, &ide_lock);But this is problematic in itself, since it means that we are basically serialiazing between *all* requests on all channels.
Correct.
Quoted 5 lines
So I think we should have per channel locks on this level right? This is anyway our unit for serialization. (I'm just surprised that
blk_init_queue()doesn't provide queue specific locking and relies on exported locks from the drivers...)
Sure go ahead and fine grain it, I had no time to go that much into detail when ripping out io_request_lock. A drive->lock passed to blk_init_queue would do nicely.
But beware that ide locking is a lot nastier than you think. I saw other irq changes earlier, I just want to make sure that you are _absolutely_ certain that these changes are safe??
Signature · 1 line
Jens Axboe
Re: [PATCH] 2.5.15 IDE 62
Quoted 6 lines
Quoted 5 lines
So I think we should have per channel locks on this level right? This is anyway our unit for serialization. (I'm just surprised that
blk_init_queue()doesn't provide queue specific locking and relies on exported locks from the drivers...)
Quoted 7 lines
Sure go ahead and fine grain it, I had no time to go that much into detail when ripping out
io_request_lock. Adrive->lockpassed toblk_init_queuewould do nicely.But beware that ide locking is a lot nastier than you think. I saw other irq changes earlier, I just want to make sure that you are _absolutely_ certain that these changes are safe??
You'll probably need a per-host lock (but that one can be safely hidden in the host controller driver I beleive) since some hosts share some registers for their 2 channels (timings can be bitfields in a single register controlling 2 channels, I'm not too sure about legacy DMA).
Ben.
Re: [PATCH] 2.5.15 IDE 62
In reply to Jens AxboeUz.ytkownik [email protected] napisa?:
Quoted 15 lines
Quoted 6 lines
Quoted 5 lines
So I think we should have per channel locks on this level right? This is anyway our unit for serialization. (I'm just surprised that
blk_init_queue()doesn't provide queue specific locking and relies on exported locks from the drivers...)Quoted 7 lines
Sure go ahead and fine grain it, I had no time to go that much into detail when ripping out
io_request_lock. Adrive->lockpassed toblk_init_queuewould do nicely.But beware that ide locking is a lot nastier than you think. I saw other irq changes earlier, I just want to make sure that you are _absolutely_ certain that these changes are safe??
Quoted 5 lines
You'll probably need a per-host lock (but that one can be safely hidden in the host controller driver I beleive) since some hosts share some registers for their 2 channels (timings can be bitfields in a single register controlling 2 channels, I'm not too sure about legacy DMA).
Just to clarify it... From the host view it's not the chipset it's a channel we have to deal with. And there are typically two channels on a host. For the serialized parts, we have to possiblities:
1. Preserve the current behaviour of using additionally a global lock.
2. "Cheat" and reuse the lock from the primary channel during the initialization of the secondary channel.
Hmmm.... Thinking a bit about it I'm now conviced that 2. is more elegant then 1. And finally this will
just allow us to make the hwgroup_t go entierly away.
The only thing that worries me are the checks for hwgroupt_t's only remaining member -> handler use to determine whatever some IRQ is pending or not.
Re: [PATCH] 2.5.15 IDE 62
Quoted 8 lines
Just to clarify it... From the host view it's not the chipset it's a channel we have to deal with. And there are typically two channels on a host. For the serialized parts, we have to possiblities:
1. Preserve the current behaviour of using additionally a global lock.
Quoted 6 lines
2. "Cheat" and reuse the lock from the primary channel during the initialization of the secondary channel.
Hmmm.... Thinking a bit about it I'm now conviced that 2. is more elegant then 1. And finally this will
just allow us to make thehwgroup_tgo entierly away.
I would do things differently. From the common point of view, what we deal with is
controller
/ \
channel x, channel y, ....
That is an _arbitrary_ number of channels. So the host driver should just register individual "channels" to the IDE layer, each one has it's queue lock, period.
Now, if for any reason, the host specific code has to synchronize between several of it's channels when dealing with things like chipset configuration, it's up to that host driver to know about it and deal with it; which make perfect sense to be done with a third lock specific to protecting those specific registers that are shared and that is completely internal to the host chipset driver.
The only case I see where the host may have to additionally go and grab the other channel's locks (the queue lock or whatever you call it) is if the actual setting change on one channel has side effect on a currently transferring other channel.
But that is completely internal to the host, and yes, I agree that reusing the other channel's lock is probably the best solution.
But in cases where you just have 2 bitfields in the same register that need serialized access from both channels, a simple lock protecting only that register seems to be plenty enough.
What did I miss ?
Ben.
Re: [PATCH] 2.5.15 IDE 62
In reply to Martin DaleckiUz.ytkownik [email protected] napisa?:
Quoted 34 lines
Quoted 8 lines
Just to clarify it... From the host view it's not the chipset it's a channel we have to deal with. And there are typically two channels on a host. For the serialized parts, we have to possiblities:
1. Preserve the current behaviour of using additionally a global lock.
Quoted 6 lines
2. "Cheat" and reuse the lock from the primary channel during the initialization of the secondary channel.
Hmmm.... Thinking a bit about it I'm now conviced that 2. is more elegant then 1. And finally this will
just allow us to make thehwgroup_tgo entierly away.I would do things differently. From the common point of view, what we deal with is
controller / \channel x, channel y, ....
That is an _arbitrary_ number of channels. So the host driver
should just register individual "channels" to the IDE layer, each one has it's queue lock, period.Now, if for any reason, the host specific code has to synchronize between several of it's channels when dealing with things like chipset configuration, it's up to that host driver to know about it and deal with it; which make perfect sense to be done with a third lock specific to protecting those specific registers that are shared and that is completely internal to the host chipset driver.
Quoted 3 lines
The only case I see where the host may have to additionally go
and grab the other channel's locks (the queue lock or whatever
you call it) is if the actual setting change on one channel has side effect on a currently transferring other channel.
The problem is that not all setup register file access is localized to the particular host chip driver. Go look for rz1000 - it does not export any correposponding function. And we have therefore to deal with it on the generic level.
Quoted 8 lines
But that is completely internal to the host, and yes, I agree that reusing the other channel's lock is probably the best solution.
But in cases where you just have 2 bitfields in the same register that need serialized access from both channels, a simple lock protecting only that register seems to be plenty enough.
What did I miss ?
See above.
Re: [PATCH] 2.5.15 IDE 62
In reply to Martin DaleckiUz.ytkownik [email protected] napisa?:
Quoted 38 lines
Quoted 8 lines
Just to clarify it... From the host view it's not the chipset it's a channel we have to deal with. And there are typically two channels on a host. For the serialized parts, we have to possiblities:
1. Preserve the current behaviour of using additionally a global lock.
Quoted 6 lines
2. "Cheat" and reuse the lock from the primary channel during the initialization of the secondary channel.
Hmmm.... Thinking a bit about it I'm now conviced that 2. is more elegant then 1. And finally this will
just allow us to make thehwgroup_tgo entierly away.I would do things differently. From the common point of view, what we deal with is
controller / \channel x, channel y, ....
That is an _arbitrary_ number of channels. So the host driver
should just register individual "channels" to the IDE layer, each one has it's queue lock, period.Now, if for any reason, the host specific code has to synchronize between several of it's channels when dealing with things like chipset configuration, it's up to that host driver to know about it and deal with it; which make perfect sense to be done with a third lock specific to protecting those specific registers that are shared and that is completely internal to the host chipset driver.
The only case I see where the host may have to additionally go
and grab the other channel's locks (the queue lock or whatever
you call it) is if the actual setting change on one channel has side effect on a currently transferring other channel.
Quoted 8 lines
But that is completely internal to the host, and yes, I agree that reusing the other channel's lock is probably the best solution.
But in cases where you just have 2 bitfields in the same register that need serialized access from both channels, a simple lock protecting only that register seems to be plenty enough.
What did I miss ?
1. The fact that there are some cases where the initialization code doesn't necessarily go down to the host chip drivers right now.
2. Most of the current code...
BTW> The code will be much cleaner in the upcomming ide 65, since the allocation of the structures shared between two channels will be simple pushed down to the corresponding host chip drivers instead of the "match search" done after the channles have been initialized.
Since most of the host chip drivers are not reentrant anyway we will be able to save quite a lot of allocation code as well.
Re: [PATCH] 2.5.15 IDE 62
Quoted 2 lines
1. The fact that there are some cases where the initialization code doesn't necessarily go down to the host chip drivers right now.
Well, I'd rather see the init code be some kind of "lib" called by the host driver, but well...
Quoted 1 line
2. Most of the current code...
Sure ;) Note that the real point I missed is about broken controllers that can't grok dealing with simultaneous requests on both channels (like cmd640) in which case, you probably need the same request queue to serialize access to both of them. In practice, that means more or less dealing with both channels like the same way we do with slave vs. master.
My understanding though is that the block layer can't (yet ?) quite deal with a single request queue for several target devices, and it seems that the whole point of the old "busy" flag along with andre taskfile stuff was to perform some kind of fair arbitration between which channels/targets got a chance to process requests.
Quoted 4 lines
BTW> The code will be much cleaner in the upcomming ide 65, since the allocation of the structures shared between two channels will be simple pushed down to the corresponding host chip drivers instead of the "match search" done after the channles have been initialized.
Great ! We are slowly going toward a real host controller driver template finally ;)
Quoted 2 lines
Since most of the host chip drivers are not reentrant anyway we will be able to save quite a lot of allocation code as well.
Re: [PATCH] 2.5.15 IDE 62
In reply to Linus TorvaldsUz.ytkownik Jens Axboe napisa?:
Quoted 42 lines · Martin Dalecki
Quoted 21 lines
Uz.ytkownik Jens Axboe napisa?:
Quoted 8 lines · Martin Dalecki
Quoted 5 lines
Mon May 13 12:38:11 CEST 2002 ide-clean-62
- Add missing locking around
ide_do_requestindo_ide_request().Quoted 9 lines
This is broken,
do_ide_request()is already called with the request lock held.tq_diskrun ->generic_unplug_device(grab lock) ->__generic_unplug_device->do_ide_request(). You just introduced a deadlock.This code would have caused hangs or massive corruption immediately if
ide_lockwasn't ready held there. Not to mention instantspin_unlockBUG()triggers inqueue_command()Quoted 8 lines
Oops. Indeed I see now that the
ide_lockis exported to the upper layers above it inide-probe.c
blk_init_queue(q, do_ide_request, &ide_lock);But this is problematic in itself, since it means that we are basically serialiazing between *all* requests on all channels.
Correct.
Quoted 5 lines
So I think we should have per channel locks on this level right? This is anyway our unit for serialization. (I'm just surprised that
blk_init_queue()doesn't provide queue specific locking and relies on exported locks from the drivers...)
Quoted 7 lines
Sure go ahead and fine grain it, I had no time to go that much into detail when ripping out
io_request_lock. Adrive->lockpassed toblk_init_queuewould do nicely.But beware that ide locking is a lot nastier than you think. I saw other irq changes earlier, I just want to make sure that you are _absolutely_ certain that these changes are safe??
Well on the channel level they are safe modulo cmd640 and rz1000. We can handle them by serializing them on the global lock in do_ide_request. Like:
if (ch->drive[0].serialized|| ch->drive[1].serialized)
then
spin_lock(serialize_lock);
The other case are shared PCI irq's between two channel, but this case I can easly test on my HPT772 controller card.
You could have observed the hwgroup_t melting down... step by step.
Re: [PATCH] 2.5.15 IDE 62
[ Martin - just a heads up that I'm not applying 62, so don't make new IDE
patches relative to that ]
Quoted 8 lines · Martin Dalecki
Well on the channel level they are safe modulo cmd640 and rz1000. We can handle them by serializing them on the global lock in
do_ide_request. Like:if (ch->drive[0].serialized|| ch->drive[1].serialized)
then spin_lock(serialize_lock);
NO.
The whole point of having a per-queue lock pointer is that this should be initialized at queue creation time. Don't add more crud to the IDE locking, we want to get _rid_ of the locking that IDE has thought (traditionally incorrectly) that it could do better than the higher levels.
So when you create the queue, you should decide at THAT point whether you just want to pass in the same lock or not.
For a cmd640, you make sure that both queues get created with the same lock. And for non-broken chipsets, you use per-queue locks.
And then you make sure that nobody EVER uses any other lock than the queue lock.
Linus
Re: [PATCH] 2.5.15 IDE 62
Quoted 2 lines
And then you make sure that nobody EVER uses any other lock than the queue lock.
Except that some controllers are perfectly safe to use both channels at the same time, except when dealing with rare and sensible operations (like changing channel settings) where a common set of registers is shared between channels.
The controller driver in this case will want a lock per channel queue and an internal lock to protect access to these shared registers. But that lock can (and has to be) hidden in the controller driver.
Ben.
Re: [PATCH] 2.5.15 IDE 62
In reply to Martin DaleckiQuoted 16 lines · Linus Torvalds
Quoted 7 lines
Well on the channel level they are safe modulo cmd640 and rz1000. We can handle them by serializing them on the global lock in
do_ide_request. Like:if (ch->drive[0].serialized|| ch->drive[1].serialized)
then spin_lock(serialize_lock);NO.
The whole point of having a per-queue lock pointer is that this should be initialized at queue creation time. Don't add more crud to the IDE locking, we want to get _rid_ of the locking that IDE has thought (traditionally incorrectly) that it could do better than the higher levels.
Quoted 8 lines
So when you create the queue, you should decide at THAT point whether you just want to pass in the same lock or not.
For a cmd640, you make sure that both queues get created with the same lock. And for non-broken chipsets, you use per-queue locks.
And then you make sure that nobody EVER uses any other lock than the queue lock.
Completely agreed. And when we finally use the queue as the serialization point for "everything", then it all falls into place nicely.
Signature · 1 line
Jens Axboe
Re: [PATCH] 2.5.15 IDE 62
In reply to Martin DaleckiUz.ytkownik Jens Axboe napisa?:
Quoted 24 lines · Linus Torvalds
Quoted 23 lines
Quoted 8 lines
Well on the channel level they are safe modulo cmd640 and rz1000. We can handle them by serializing them on the global lock in
do_ide_request. Like:if (ch->drive[0].serialized|| ch->drive[1].serialized)
then
spin_lock(serialize_lock);NO.
The whole point of having a per-queue lock pointer is that this should be initialized at queue creation time. Don't add more crud to the IDE locking, we want to get _rid_ of the locking that IDE has thought (traditionally incorrectly) that it could do better than the higher levels.
So when you create the queue, you should decide at THAT point whether you just want to pass in the same lock or not.
For a cmd640, you make sure that both queues get created with the same lock. And for non-broken chipsets, you use per-queue locks.
Quoted 7 lines
Quoted 2 lines
And then you make sure that nobody EVER uses any other lock than the queue lock.
Completely agreed. And when we finally use the queue as the serialization point for "everything", then it all falls into place nicely.
Well actually I came to the same conclusion regarding the dealing with broken chipsets. However please note that:
1. queues are per device, since we have to deal with the fact that the code flow can be different whatever:
1.1. The drive is doing DMA transfers.
1.2. The drive is doing TCQ. (could and should be unifyed with 1.1.)
1.3. The drive is doing ATAPI.
2. Operations are per channel and not per queue.
Therefore the queue locking and basic serialization has to be on the channel level, with the "lock recycling trick" for the two interface chips, which can't distingish properly between primary and secondary channel.
OK?
Re: [PATCH] 2.5.15 IDE 62
In reply to Linus TorvaldsQuoted 3 lines
But beware that ide locking is a lot nastier than you think. I saw other irq changes earlier, I just want to make sure that you are _absolutely_ certain that these changes are safe??
Well, I'm at least warned now to double check with the current BIO stuff...