Skip to content

mmc: Replace kmap_atomic() with kmap_local_page()

Adrian Hunter linux-mmc 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest14 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/14mmc: sdhci: Remove local_irq_{save,restore}() around k[un]map_atomic()drivers/mmc/host/sdhci.c+6 -100 replies
2/14mmc: sdhci: Remove local_irq_{save,restore}() around sg_miter_{next,stop}()drivers/mmc/host/sdhci.c+0 -100 replies
3/14mmc: sdhci: Replace kmap_atomic() with kmap_local_page()drivers/mmc/host/sdhci.c+2 -22 replies
4/14mmc: bcm2835: Remove local_irq_{save,restore}() around k[un]map_atomic()drivers/mmc/host/bcm2835.c+0 -30 replies
5/14mmc: bcm2835: Remove local_irq_{save,restore}() around sg_miter_{next,stop}()drivers/mmc/host/bcm2835.c+0 -50 replies
6/14mmc: bcm2835: Replace kmap_atomic() with kmap_local_page()drivers/mmc/host/bcm2835.c+2 -20 replies
7/14mmc: mmc_test: Remove local_irq_{save,restore}() around sg_copy_{from,to}_buffer()drivers/mmc/core/mmc_test.c+0 -50 replies
8/14mmc: tifm_sd: Remove local_irq_{save,restore}() around tifm_sd_transfer_data()drivers/mmc/host/tifm_sd.c+0 -30 replies
9/14mmc: tifm_sd: Remove local_irq_{save,restore}() around tifm_sd_bounce_block()drivers/mmc/host/tifm_sd.c+2 -70 replies
10/14mmc: tifm_sd: Replace kmap_atomic() with kmap_local_page()drivers/mmc/host/tifm_sd.c+8 -80 replies
11/14mmc: tmio_mmc_core: Remove local_irq_{save,restore}() around k[un]map_atomic()drivers/mmc/host/renesas_sdhi_sys_dmac.c drivers/mmc/host/tmio_mmc.h drivers/mmc/host/tmio_mmc_core.c+8 -142 replies
12/14mmc: tmio_mmc_core: Replace kmap_atomic() with kmap_local_page()drivers/mmc/host/tmio_mmc.h+2 -21 reply
13/14mmc: au1xmmc: Replace kmap_atomic() with kmap_local_page()drivers/mmc/host/au1xmmc.c+4 -40 replies
14/14mmc: wbsd: Replace kmap_atomic() with kmap_local_page()drivers/mmc/host/wbsd.c+5 -50 replies

Reviews trailers per patch

2 of 14 patches have a Reviewed-by or Acked-by.

PatchWolfram Sang
1/14
2/14
3/14
4/14
5/14
6/14
7/14
8/14
9/14
10/14
11/14R-b
12/14R-b
13/14
14/14

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/14] mmc: Replace kmap_atomic() with kmap_local_page()

Hi

Here are patches primarily aimed at replacing kmap_atomic() with kmap_local_page().

kmap_local_page() is equivalent to kmap_atomic() except that it does not disable page faults or preemption. Where possible kmap_local_page() is preferred to kmap_atomic() - refer kernel highmem documentation.

In these cases, there is no need to disable page faults or preemption, so kmap_atomic() is replaced with kmap_local_page(), and, correspondingly, kunmap_atomic() with kunmap_local().

That work raised the question of why local_irq_{save,restore}() was being used with k[un]map_atomic(). It turns out to be for legacy reasons that have gone away.

A long time ago the kmap_atomic API required a slot to be provided which risked the possibility that other code might use the same slot at the same time. Disabling interrupts prevented the possibility of an interrupt handler doing that. However, that went away with
commit 3e4d3af501cc ("mm: stack based kmap_atomic()").

The work is mostly divided into separate patches, to enable separate review for driver reviewers and to enable separate reverts if necessary.

Adrian Hunter (14):
mmc: sdhci: Remove local_irq_{save,restore}() around k[un]map_atomic()
mmc: sdhci: Remove local_irq_{save,restore}() around sg_miter_{next,stop}()
mmc: sdhci: Replace kmap_atomic() with kmap_local_page()
mmc: bcm2835: Remove local_irq_{save,restore}() around k[un]map_atomic()
mmc: bcm2835: Remove local_irq_{save,restore}() around sg_miter_{next,stop}()
mmc: bcm2835: Replace kmap_atomic() with kmap_local_page()
mmc: mmc_test: Remove local_irq_{save,restore}() around sg_copy_{from,to}_buffer()
mmc: tifm_sd: Remove local_irq_{save,restore}() around tifm_sd_transfer_data()
mmc: tifm_sd: Remove local_irq_{save,restore}() around tifm_sd_bounce_block()
mmc: tifm_sd: Replace kmap_atomic() with kmap_local_page()
mmc: tmio_mmc_core: Remove local_irq_{save,restore}() around k[un]map_atomic()
mmc: tmio_mmc_core: Replace kmap_atomic() with kmap_local_page()
mmc: au1xmmc: Replace kmap_atomic() with kmap_local_page()
mmc: wbsd: Replace kmap_atomic() with kmap_local_page()

 drivers/mmc/core/mmc_test.c              |  5 -----
 drivers/mmc/host/au1xmmc.c               |  8 ++++----
 drivers/mmc/host/bcm2835.c               | 12 ++----------
 drivers/mmc/host/renesas_sdhi_sys_dmac.c |  5 ++---
 drivers/mmc/host/sdhci.c                 | 30 ++++++++----------------------
 drivers/mmc/host/tifm_sd.c               | 28 ++++++++++------------------
 drivers/mmc/host/tmio_mmc.h              | 11 ++++-------
 drivers/mmc/host/tmio_mmc_core.c         | 10 ++++------
 drivers/mmc/host/wbsd.c                  | 10 +++++-----
 9 files changed, 39 insertions(+), 80 deletions(-)

Regards
Adrian