Skip to content

Remove isa_unchecked_dma and some more GFP_DMAs in the mid layer v5

Andi Kleen linux-scsi 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest21 patches 20 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/21Add the alloc/get_pages_mask callsinclude/linux/gfp.h+19 -30 replies
2/21Add blk_q_maskinclude/linux/blkdev.h+5 -03 replies
3/21Pass gfp to scsi_allocate_commanddrivers/scsi/scsi.c include/scsi/scsi_cmnd.h+32 -182 replies
4/21Add sense_buffer_isa to host templateDocumentation/scsi/scsi_mid_low_api.txt drivers/scsi/hosts.c drivers/scsi/scsi.c +1 more+16 -40 replies
5/21Remove unchecked_isa in BusLogicdrivers/scsi/BusLogic.c+59 -183 replies
6/21Remove unchecked_isa_dma in advansys.cdrivers/scsi/advansys.c+103 -593 replies
7/21Remove unchecked_isa_dma in gdthdrivers/scsi/gdth.c+62 -190 replies
8/21Remove unchecked_isa_dma in eata.cdrivers/scsi/eata.c+39 -150 replies
9/21Remove unchecked_isa_dma in aha1542drivers/scsi/aha1542.c+30 -100 replies
10/21Remove unchecked_isa_dma in aha152x/wd7000/sym53c416/u14-34f/NCR53c406adrivers/scsi/NCR53c406a.c drivers/scsi/aha152x.c drivers/scsi/sym53c416.c +3 more+124 -370 replies
11/21Remove GFP_DMA uses in st/osstdrivers/scsi/osst.c drivers/scsi/osst.h drivers/scsi/st.c +1 more+26 -370 replies
12/21Remove unchecked_isa_dma support for hostdatadrivers/scsi/hosts.c+0 -30 replies
13/21Use blk_q_mask/get_pages_mask in sg driverdrivers/scsi/sg.c include/scsi/sg.h+8 -299 replies
14/21Rely on block layer bouncing for ISA DMA devices scanningdrivers/scsi/scsi_scan.c+2 -40 replies
15/21Don't disable direct_io for unchecked_isa_dma in st.cdrivers/scsi/st.c+1 -10 replies
16/21Remove automatic block layer bouncing for unchecked_isa_dmadrivers/scsi/scsi_lib.c+0 -20 replies
17/21Remove GFP_DMA use in sr.cdrivers/scsi/sr.c drivers/scsi/sr_ioctl.c drivers/scsi/sr_vendor.c+7 -120 replies
18/21Remove unchecked_isa_dma from sysfsdrivers/scsi/scsi_sysfs.c+0 -20 replies
19/21Switch to a single SCSI command pooldrivers/scsi/scsi.c+31 -270 replies
20/21Finally kill unchecked_isa_dmaDocumentation/scsi/scsi_mid_low_api.txt drivers/scsi/hosts.c include/scsi/scsi_host.h+0 -100 replies
21/21Convert DMA buffers in ch.c to allocate via the block layerdrivers/scsi/ch.c+10 -60 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH] [0/21] Remove isa_unchecked_dma and some more GFP_DMAs in the mid layer v5

[repost of the earlier patch kit, ported to 2.6.28rc4. Was acked by axboe earlier]
[Can this be considered for .29 please? This is the older origial
patchkit which was relatively uncontroversal before the mid layer sense buffer and with blk_*alloc* changes removed.]

v2: various cleanups, use dma_alloc_coherent instead of naked GFP_DMA
add blk_* allocators to avoid bouncing in SCSI scan
v3: Remove cmnd/sense buffer bouncing in advansys.
Replace sense_buffer_mask with a single bit
v4: this is the original patchkit which was relatively uncontroversal
without any sense buffer changes.
Just forward ported to a 2.6.26-rc8 tree.
v5: Ported to 2.6.28rc4

Original description:

This patchkit fixes all existing drivers that used isa_unchecked_dma to not need that anymore. I have some upcoming infrastructure changes for DMA memory management and isa_unchecked_dma was in the way.

Enabling isa_unchecked_dma had several effects:
- All incoming scsi_cmnds were in GFP_DMA memory.
Only one driver relied on that actually (advansys), the others all accessed the scsi_cmnds only with the CPU.
- scsi hostdata is allocated with GFP_DMA
A lot of drivers relied on that. I converted them all to allocate hostdata in a separate buffer linked to rom the scsi host structure.
- Enabling block layer bouncing for all data. That's the most important one. I changed all drivers to do that directly instead of relying on the mid layer for it.
- sense_buffer is allocated with GFP_DMA. That was also commonly required and not easy to fix so I created a separate host template field that enables sense_buffer bouncing.

Also while I was it I removed also a lot of GFP_DMAs in the frontend drivers which are not needed anymore because the block layer does the bouncing for all data anyways. Or rather we ask the block layer now to bounce.

The main problem of the patchkit is that is that I wasn't able to test the drivers because I don't have any of the hardware. All changes (except perhaps advansys) were relatively simple and straight forward so I don't expect many problems though.

If anybody has any of these ISA SCSI adapters and would be willing to test them with these patches that would be appreciated.
I suspect actually that some of the ISA drivers are actually already bitrotted independently of these changes. Hopefully they won't make anything worse though.

Patches against 2.6.28rc4

Also available as a git tree at

The following changes since commit 9bf1a2445f3c569098b8de7097ca324e65abecc2:
Linus Torvalds (1):

        Linux 2.6.28-rc5

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 scsi-dma

Andi Kleen (21):
Add the alloc/get_pages_mask calls
Add blk_q_mask
Pass gfp to scsi_allocate_command
Add sense_buffer_isa to host template
Remove unchecked_isa in BusLogic
Remove unchecked_isa_dma in advansys.c
Remove unchecked_isa_dma in gdth
Remove unchecked_isa_dma in eata.c
Remove unchecked_isa_dma in aha1542
Remove unchecked_isa_dma in aha152x/wd7000/sym53c416/u14-34f/NCR53c406a Remove GFP_DMA uses in st/osst
Remove unchecked_isa_dma support for hostdata
Use blk_q_mask/get_pages_mask in sg driver
Rely on block layer bouncing for ISA DMA devices scanning Don't disable direct_io for unchecked_isa_dma in st.c Remove automatic block layer bouncing for unchecked_isa_dma Remove GFP_DMA use in sr.c
Remove unchecked_isa_dma from sysfs
Switch to a single SCSI command pool
Finally kill unchecked_isa_dma
Convert DMA buffers in ch.c to allocate via the block layer

 Documentation/scsi/scsi_mid_low_api.txt |    4 +-
 drivers/scsi/BusLogic.c                 |   77 +++++++++++----
 drivers/scsi/NCR53c406a.c               |    8 ++-
 drivers/scsi/advansys.c                 |  162 ++++++++++++++++++++-----------
 drivers/scsi/aha152x.c                  |   29 +++++-
 drivers/scsi/aha1542.c                  |   40 ++++++--
 drivers/scsi/ch.c                       |   16 ++-
 drivers/scsi/eata.c                     |   54 ++++++++---
 drivers/scsi/gdth.c                     |   81 ++++++++++++----
 drivers/scsi/hosts.c                    |    5 +-
 drivers/scsi/osst.c                     |   24 ++---
 drivers/scsi/osst.h                     |    2 -
 drivers/scsi/scsi.c                     |   93 +++++++++++-------
 drivers/scsi/scsi_lib.c                 |    2 -
 drivers/scsi/scsi_scan.c                |    6 +-
 drivers/scsi/scsi_sysfs.c               |    2 -
 drivers/scsi/sg.c                       |   36 ++------
 drivers/scsi/sr.c                       |    2 +-
 drivers/scsi/sr_ioctl.c                 |   13 +--
 drivers/scsi/sr_vendor.c                |    4 +-
 drivers/scsi/st.c                       |   37 +++----
 drivers/scsi/st.h                       |    2 -
 drivers/scsi/sym53c416.c                |    9 ++-
 drivers/scsi/u14-34f.c                  |   54 ++++++++---
 drivers/scsi/ultrastor.c                |   13 ++-
 drivers/scsi/wd7000.c                   |   48 ++++++---
 include/linux/blkdev.h                  |    5 +
 include/linux/gfp.h                     |   22 ++++-
 include/scsi/scsi_cmnd.h                |    5 +-
 include/scsi/scsi_host.h                |   14 ++-
 include/scsi/sg.h                       |    1 -
 31 files changed, 564 insertions(+), 306 deletions(-)

-Andi