James Bottomley wrote: > On Sat, 2004-10-16 at 01:51, Douglas Gilbert wrote: > >>So this problem seems related to highmem. >> >>The attachment is against the current scsi_debug driver >>(at least in lk 2.6.9-rc4). It uses dma_map_sg() and friends >>together with phys_to_virt() which comes highly recommended: >>"in almost all conceivable cases a device driver should not be >>using this function" :-) Could you try the patch. >> >>Perhaps others my be able to answer this: is setting >>scsi_host_template::dma_boundary (to some figure other >>than 0xffffffff) going to help in this case? > > > No, the problem is with highmem as you correctly point out, but the > issue is that your driver cannot see beyond it. On x86, highmem begins > at about 900Mb. The kernel has no page tables for any memory beyond > this. In order to see the memory you need to kmap it (i.e. ask the > kernel to create a temporary page table for it); so the virtual address > sg uses should be got by kmapping the pages in the sg list: > > kaddr = kmap(sg[i].page) + sg[i].offset > > If you make sure clustering is disabled, you should never get multiple > pages in the initial sg list. done > When you've finished you need to release the mapping with kunmap(). ouch, that requires a re-org > There are also atomic versions of these depending on where you are. hopefully not required The above required a fair few changes to scsi_debug. Attached is a patch that rolls "kmap" changes with patches I have sent recently for scsi_debug. Attachment is gzipped (due to size) and applies against lk 2.6.8.1 -> lk 2.6.9-rc4 . Nishanth, could you test this with highmem? Changelog: - use kmap/kunmap to handle normal and highmem cases - disable clustering - previously could only handle 'use_sg > 1' for read and write commands - VERIFY (SBC) and REWIND (SSC) command support (dummies) - 'dsense' parameter (sysfs + load time) for descriptor sense format - allow negative 'every_nth' to fail continually after |every_nth| commands (or until sysfs intervention) - clean up debug messages sent to the log (when opts=1) - correct ordering of log messages - set scsi_cmnd::resid when underflow on DMA_FROM_DEVICE operations - clean up std inquiry response; add version descriptors - reject mode sense subpage commands since no subpages currently supported (i.e. better command filtering) Doug Gilbert