On Tue, 9 Feb 1999, Joerg Schilling wrote:
> >From [EMAIL PROTECTED] Mon Feb 8 18:40:41 1999
>
> >As far as I understood it (Heiko, please correct me, if this isn't =
> >correct),
> >the sg_2_0_35.patch allocates one distinct buffer per SCSI-Device in =
> >steps
> >of exactly 32K, 64K, 128K and for more it allocates the amount needed.
>
> >Every device has it's own buffer and tries to use it for the next =
> >allocation
> >if the size is big enough, otherwise the buffer is thrown away and a
> >suitable bigger buffer is allocated.
>
> The problem is that in order to do SCSI bus scanning cdrecord needs to
> open all devices and the current algorithm does not free any of them in this
> case.
>
> >The intention was to part the allocation for the devices in contrast to =
> >the
> >earlier SG_BIG_BUF-Implementation where every device shared one buffer, =
> >thus
> >leading to problems with programs writing/reading concurrently on =
> >different
> >devices. But we would like to be able to burn CDs and read another in =
> >the
> >2nd CD-Device at one time.
>
> >My error arises, because cdrecord opens ALL found SCSI-Devices, doing =
> >the
> >necessary inquiry and then close ALL devices again, thus needing 32K =
> >for
> >each found device. On the other hand, I don't know if 192K is really to =
> >much
> >memory to allocate with kmalloc() on my system? Anybody any =
> >information?
>
> The problem is that you need physically continuous memory for this operation
> and this may fail.
You donnot need that and it is absolutely not recommended on any O/S.
If you want something that does not make problems.
1 - Allow people that are using PCI controllers to enable memory
allocation without the limit of 16 MB.
2 - Allow people who use a scatter/gather capable controller/driver pair
to use a scattered array of PAGES instead of a contiguous buffer.
Basically, under Linux:
1 - Allocate a chunk of memory that will be used as a scatter list.
2 - Allocate 1 PAGE chunks and makes the scatter entries point to
these pages.
3 - Call the low-level driver using this scatterlist.
Example:
--------
- Scatterlist of 64 entries = about 64x12 = 768 bytes on a i386 <
PAGE_SIZE.
- Max buffer size = 64xPAGE_SIZE = 256K.
This will be a lot more easy to deal with memory allocation this way, but
you will have to handle the scattered buffer by hand.
If you are courageous, you can play with vmalloc() and reverse the primary
kernel virtual address for virt_to_bus() to work for the low-level driver,
and your buffer will be also virtually contiguous.
The fact that Linux requires addresses presented to low-level drivers to
match the primary kernel mapping complexifies significantly buffer
management for upper layers that have to deal manually with
scatter/gather. Anyway, you donnot want to allocate large physically
contiguous memory area on any system at run-time, if you need to succeed
most of the time such an allocation.
Regards,
G�rard.
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]