All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checkpatch: Add kmap and kmap_atomic to the deprecated list
@ 2022-08-13 22:00 ` ira.weiny
  0 siblings, 0 replies; 15+ messages in thread
From: ira.weiny @ 2022-08-13 22:00 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches
  Cc: Ira Weiny, Thomas Gleixner, Fabio M . De Francesco,
	Andrew Morton, linux-kernel, linux-snps-arc, linux-arm-kernel,
	linux-csky, loongarch, linux-mips, linuxppc-dev, linux-riscv,
	linux-sh, sparclinux, linux-um, x86, linux-xtensa, keyrings,
	linux-ide, linux-block, linux-crypto, linux-media, linux-edac,
	linux1394-devel, dri-devel, dm-devel, linux-raid, linux-mmc,
	linux-rdma, linux-mtd, netdev, nvdimm, linux-nvme, linux-scsi,
	virtualization, linux-fsdevel, kgdb-bugreport, iommu, bpf, kvm

From: Ira Weiny <ira.weiny@intel.com>

kmap() and kmap_atomic() are being deprecated in favor of
kmap_local_page().

There are two main problems with kmap(): (1) It comes with an overhead
as mapping space is restricted and protected by a global lock for
synchronization and (2) it also requires global TLB invalidation when
the kmap’s pool wraps and it might block when the mapping space is fully
utilized until a slot becomes available.

kmap_local_page() is safe from any context and is therefore redundant
with kmap_atomic() with the exception of any pagefault or preemption
disable requirements.  However, using kmap_atomic() for these side
effects makes the code less clear.  So any requirement for pagefault or
preemption disable should be made explicitly.

With kmap_local_page() the mappings are per thread, CPU local, can take
page faults, and can be called from any context (including interrupts).
It is faster than kmap() in kernels with HIGHMEM enabled. Furthermore,
the tasks can be preempted and, when they are scheduled to run again,
the kernel virtual addresses are restored.

Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>

---
Suggested by credits.
	Thomas: Idea to keep from growing more kmap/kmap_atomic calls.
	Fabio: Stole some of his boiler plate commit message.

Notes on tree-wide conversions:

I've cc'ed mailing lists for subsystems which currently contains either kmap()
or kmap_atomic() calls.  As some of you already know Fabio and I have been
working through converting kmap() calls to kmap_local_page().  But there is a
lot more work to be done.  Help from the community is always welcome,
especially with kmap_atomic() conversions.  To keep from stepping on each
others toes I've created a spreadsheet of the current calls[1].  Please let me
or Fabio know if you plan on tacking one of the conversions so we can mark it
off the list.

[1] https://docs.google.com/spreadsheets/d/1i_ckZ10p90bH_CkxD2bYNi05S2Qz84E2OFPv8zq__0w/edit#gid=1679714357

---
 scripts/checkpatch.pl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 79e759aac543..9ff219e0a9d5 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -807,6 +807,8 @@ our %deprecated_apis = (
 	"rcu_barrier_sched"			=> "rcu_barrier",
 	"get_state_synchronize_sched"		=> "get_state_synchronize_rcu",
 	"cond_synchronize_sched"		=> "cond_synchronize_rcu",
+	"kmap"					=> "kmap_local_page",
+	"kmap_atomic"				=> "kmap_local_page",
 );
 
 #Create a search pattern for all these strings to speed up a loop below

base-commit: 4a9350597aff50bbd0f4b80ccf49d2e02d1111f5
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH] checkpatch: Add kmap and kmap_atomic to the deprecated list
@ 2022-08-13 22:00 ` ira.weiny
  0 siblings, 0 replies; 15+ messages in thread
From: ira.weiny @ 2022-08-13 22:00 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches
  Cc: Ira Weiny, Thomas Gleixner, Fabio M . De Francesco,
	Andrew Morton, linux-kernel, linux-snps-arc, linux-arm-kernel,
	linux-csky, loongarch, linux-mips, linuxppc-dev, linux-riscv,
	linux-sh, sparclinux, linux-um, x86, linux-xtensa, keyrings,
	linux-ide, linux-block, linux-crypto, linux-media, linux-edac,
	linux1394-devel, dri-devel, dm-devel, linux-raid, linux-mmc,
	linux-rdma, linux-mtd, netdev, nvdimm, linux-nvme, linux-scsi,
	virtualization, linux-fsdevel, kgdb-bugreport, iommu, bpf, kvm

From: Ira Weiny <ira.weiny@intel.com>

kmap() and kmap_atomic() are being deprecated in favor of
kmap_local_page().

There are two main problems with kmap(): (1) It comes with an overhead
as mapping space is restricted and protected by a global lock for
synchronization and (2) it also requires global TLB invalidation when
the kmap’s pool wraps and it might block when the mapping space is fully
utilized until a slot becomes available.

kmap_local_page() is safe from any context and is therefore redundant
with kmap_atomic() with the exception of any pagefault or preemption
disable requirements.  However, using kmap_atomic() for these side
effects makes the code less clear.  So any requirement for pagefault or
preemption disable should be made explicitly.

With kmap_local_page() the mappings are per thread, CPU local, can take
page faults, and can be called from any context (including interrupts).
It is faster than kmap() in kernels with HIGHMEM enabled. Furthermore,
the tasks can be preempted and, when they are scheduled to run again,
the kernel virtual addresses are restored.

Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>

---
Suggested by credits.
	Thomas: Idea to keep from growing more kmap/kmap_atomic calls.
	Fabio: Stole some of his boiler plate commit message.

Notes on tree-wide conversions:

I've cc'ed mailing lists for subsystems which currently contains either kmap()
or kmap_atomic() calls.  As some of you already know Fabio and I have been
working through converting kmap() calls to kmap_local_page().  But there is a
lot more work to be done.  Help from the community is always welcome,
especially with kmap_atomic() conversions.  To keep from stepping on each
others toes I've created a spreadsheet of the current calls[1].  Please let me
or Fabio know if you plan on tacking one of the conversions so we can mark it
off the list.

[1] https://docs.google.com/spreadsheets/d/1i_ckZ10p90bH_CkxD2bYNi05S2Qz84E2OFPv8zq__0w/edit#gid=1679714357

---
 scripts/checkpatch.pl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 79e759aac543..9ff219e0a9d5 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -807,6 +807,8 @@ our %deprecated_apis = (
 	"rcu_barrier_sched"			=> "rcu_barrier",
 	"get_state_synchronize_sched"		=> "get_state_synchronize_rcu",
 	"cond_synchronize_sched"		=> "cond_synchronize_rcu",
+	"kmap"					=> "kmap_local_page",
+	"kmap_atomic"				=> "kmap_local_page",
 );
 
 #Create a search pattern for all these strings to speed up a loop below

base-commit: 4a9350597aff50bbd0f4b80ccf49d2e02d1111f5
-- 
2.35.3


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH] checkpatch: Add kmap and kmap_atomic to the deprecated list
@ 2022-08-13 22:00 ` ira.weiny
  0 siblings, 0 replies; 15+ messages in thread
From: ira.weiny @ 2022-08-13 22:00 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches
  Cc: Ira Weiny, Thomas Gleixner, Fabio M . De Francesco,
	Andrew Morton, linux-kernel, linux-snps-arc, linux-arm-kernel,
	linux-csky, loongarch, linux-mips, linuxppc-dev, linux-riscv,
	linux-sh, sparclinux, linux-um, x86, linux-xtensa, keyrings,
	linux-ide, linux-block, linux-crypto, linux-media, linux-edac,
	linux1394-devel, dri-devel, dm-devel, linux-raid, linux-mmc,
	linux-rdma, linux-mtd, netdev, nvdimm, linux-nvme, linux-scsi,
	virtualization, linux-fsdevel, kgdb-bugreport, iommu, bpf, kvm

From: Ira Weiny <ira.weiny@intel.com>

kmap() and kmap_atomic() are being deprecated in favor of
kmap_local_page().

There are two main problems with kmap(): (1) It comes with an overhead
as mapping space is restricted and protected by a global lock for
synchronization and (2) it also requires global TLB invalidation when
the kmap’s pool wraps and it might block when the mapping space is fully
utilized until a slot becomes available.

kmap_local_page() is safe from any context and is therefore redundant
with kmap_atomic() with the exception of any pagefault or preemption
disable requirements.  However, using kmap_atomic() for these side
effects makes the code less clear.  So any requirement for pagefault or
preemption disable should be made explicitly.

With kmap_local_page() the mappings are per thread, CPU local, can take
page faults, and can be called from any context (including interrupts).
It is faster than kmap() in kernels with HIGHMEM enabled. Furthermore,
the tasks can be preempted and, when they are scheduled to run again,
the kernel virtual addresses are restored.

Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>

---
Suggested by credits.
	Thomas: Idea to keep from growing more kmap/kmap_atomic calls.
	Fabio: Stole some of his boiler plate commit message.

Notes on tree-wide conversions:

I've cc'ed mailing lists for subsystems which currently contains either kmap()
or kmap_atomic() calls.  As some of you already know Fabio and I have been
working through converting kmap() calls to kmap_local_page().  But there is a
lot more work to be done.  Help from the community is always welcome,
especially with kmap_atomic() conversions.  To keep from stepping on each
others toes I've created a spreadsheet of the current calls[1].  Please let me
or Fabio know if you plan on tacking one of the conversions so we can mark it
off the list.

[1] https://docs.google.com/spreadsheets/d/1i_ckZ10p90bH_CkxD2bYNi05S2Qz84E2OFPv8zq__0w/edit#gid=1679714357

---
 scripts/checkpatch.pl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 79e759aac543..9ff219e0a9d5 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -807,6 +807,8 @@ our %deprecated_apis = (
 	"rcu_barrier_sched"			=> "rcu_barrier",
 	"get_state_synchronize_sched"		=> "get_state_synchronize_rcu",
 	"cond_synchronize_sched"		=> "cond_synchronize_rcu",
+	"kmap"					=> "kmap_local_page",
+	"kmap_atomic"				=> "kmap_local_page",
 );
 
 #Create a search pattern for all these strings to speed up a loop below

base-commit: 4a9350597aff50bbd0f4b80ccf49d2e02d1111f5
-- 
2.35.3


_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH] checkpatch: Add kmap and kmap_atomic to the deprecated list
@ 2022-08-13 22:00 ` ira.weiny
  0 siblings, 0 replies; 15+ messages in thread
From: ira.weiny @ 2022-08-13 22:00 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches
  Cc: nvdimm, kvm, linux-sh, kgdb-bugreport, dri-devel, linux-mips,
	linux-ide, dm-devel, keyrings, linux-mtd, sparclinux,
	linux-riscv, linux1394-devel, Ira Weiny, linux-scsi, linux-rdma,
	x86, linux-csky, iommu, linux-snps-arc, Fabio M . De Francesco,
	linux-media, linux-xtensa, linux-um, linux-block, linux-nvme,
	loongarch, Thomas Gleixner, virtualization, bpf,
	linux-arm-kernel, linux-edac, linux-raid, netdev, linux-mmc,
	linux-kernel, linux-crypto, linux-fsdevel, Andrew Morton,
	linuxppc-dev

From: Ira Weiny <ira.weiny@intel.com>

kmap() and kmap_atomic() are being deprecated in favor of
kmap_local_page().

There are two main problems with kmap(): (1) It comes with an overhead
as mapping space is restricted and protected by a global lock for
synchronization and (2) it also requires global TLB invalidation when
the kmap’s pool wraps and it might block when the mapping space is fully
utilized until a slot becomes available.

kmap_local_page() is safe from any context and is therefore redundant
with kmap_atomic() with the exception of any pagefault or preemption
disable requirements.  However, using kmap_atomic() for these side
effects makes the code less clear.  So any requirement for pagefault or
preemption disable should be made explicitly.

With kmap_local_page() the mappings are per thread, CPU local, can take
page faults, and can be called from any context (including interrupts).
It is faster than kmap() in kernels with HIGHMEM enabled. Furthermore,
the tasks can be preempted and, when they are scheduled to run again,
the kernel virtual addresses are restored.

Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>

---
Suggested by credits.
	Thomas: Idea to keep from growing more kmap/kmap_atomic calls.
	Fabio: Stole some of his boiler plate commit message.

Notes on tree-wide conversions:

I've cc'ed mailing lists for subsystems which currently contains either kmap()
or kmap_atomic() calls.  As some of you already know Fabio and I have been
working through converting kmap() calls to kmap_local_page().  But there is a
lot more work to be done.  Help from the community is always welcome,
especially with kmap_atomic() conversions.  To keep from stepping on each
others toes I've created a spreadsheet of the current calls[1].  Please let me
or Fabio know if you plan on tacking one of the conversions so we can mark it
off the list.

[1] https://docs.google.com/spreadsheets/d/1i_ckZ10p90bH_CkxD2bYNi05S2Qz84E2OFPv8zq__0w/edit#gid=1679714357

---
 scripts/checkpatch.pl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 79e759aac543..9ff219e0a9d5 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -807,6 +807,8 @@ our %deprecated_apis = (
 	"rcu_barrier_sched"			=> "rcu_barrier",
 	"get_state_synchronize_sched"		=> "get_state_synchronize_rcu",
 	"cond_synchronize_sched"		=> "cond_synchronize_rcu",
+	"kmap"					=> "kmap_local_page",
+	"kmap_atomic"				=> "kmap_local_page",
 );
 
 #Create a search pattern for all these strings to speed up a loop below

base-commit: 4a9350597aff50bbd0f4b80ccf49d2e02d1111f5
-- 
2.35.3

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH] checkpatch: Add kmap and kmap_atomic to the deprecated list
@ 2022-08-13 22:00 ` ira.weiny
  0 siblings, 0 replies; 15+ messages in thread
From: ira.weiny @ 2022-08-13 22:00 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches
  Cc: nvdimm, kvm, linux-sh, kgdb-bugreport, dri-devel, linux-mips,
	linux-ide, dm-devel, keyrings, linux-mtd, sparclinux,
	linux-riscv, linux1394-devel, Ira Weiny, linux-scsi, linux-rdma,
	x86, linux-csky, iommu, linux-snps-arc, Fabio M . De Francesco,
	linux-media, linux-xtensa, linux-um, linux-block, linux-nvme,
	loongarch, Thomas Gleixner, virtualization, bpf,
	linux-arm-kernel, linux-edac, linux-raid, netdev, linux-mmc,
	linux-kernel, linux-crypto, linux-fsdevel, Andrew Morton,
	linuxppc-dev

From: Ira Weiny <ira.weiny@intel.com>

kmap() and kmap_atomic() are being deprecated in favor of
kmap_local_page().

There are two main problems with kmap(): (1) It comes with an overhead
as mapping space is restricted and protected by a global lock for
synchronization and (2) it also requires global TLB invalidation when
the kmap’s pool wraps and it might block when the mapping space is fully
utilized until a slot becomes available.

kmap_local_page() is safe from any context and is therefore redundant
with kmap_atomic() with the exception of any pagefault or preemption
disable requirements.  However, using kmap_atomic() for these side
effects makes the code less clear.  So any requirement for pagefault or
preemption disable should be made explicitly.

With kmap_local_page() the mappings are per thread, CPU local, can take
page faults, and can be called from any context (including interrupts).
It is faster than kmap() in kernels with HIGHMEM enabled. Furthermore,
the tasks can be preempted and, when they are scheduled to run again,
the kernel virtual addresses are restored.

Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>

---
Suggested by credits.
	Thomas: Idea to keep from growing more kmap/kmap_atomic calls.
	Fabio: Stole some of his boiler plate commit message.

Notes on tree-wide conversions:

I've cc'ed mailing lists for subsystems which currently contains either kmap()
or kmap_atomic() calls.  As some of you already know Fabio and I have been
working through converting kmap() calls to kmap_local_page().  But there is a
lot more work to be done.  Help from the community is always welcome,
especially with kmap_atomic() conversions.  To keep from stepping on each
others toes I've created a spreadsheet of the current calls[1].  Please let me
or Fabio know if you plan on tacking one of the conversions so we can mark it
off the list.

[1] https://docs.google.com/spreadsheets/d/1i_ckZ10p90bH_CkxD2bYNi05S2Qz84E2OFPv8zq__0w/edit#gid=1679714357

---
 scripts/checkpatch.pl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 79e759aac543..9ff219e0a9d5 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -807,6 +807,8 @@ our %deprecated_apis = (
 	"rcu_barrier_sched"			=> "rcu_barrier",
 	"get_state_synchronize_sched"		=> "get_state_synchronize_rcu",
 	"cond_synchronize_sched"		=> "cond_synchronize_rcu",
+	"kmap"					=> "kmap_local_page",
+	"kmap_atomic"				=> "kmap_local_page",
 );
 
 #Create a search pattern for all these strings to speed up a loop below

base-commit: 4a9350597aff50bbd0f4b80ccf49d2e02d1111f5
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH] checkpatch: Add kmap and kmap_atomic to the deprecated list
@ 2022-08-13 22:00 ` ira.weiny
  0 siblings, 0 replies; 15+ messages in thread
From: ira.weiny @ 2022-08-13 22:00 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches
  Cc: Ira Weiny, Thomas Gleixner, Fabio M . De Francesco,
	Andrew Morton, linux-kernel, linux-snps-arc, linux-arm-kernel,
	linux-csky, loongarch, linux-mips, linuxppc-dev, linux-riscv,
	linux-sh, sparclinux, linux-um, x86, linux-xtensa, keyrings,
	linux-ide, linux-block, linux-crypto, linux-media, linux-edac,
	linux1394-devel, dri-devel, dm-devel, linux-raid, linux-mmc,
	linux-rdma, linux-mtd, netdev, nvdimm, linux-nvme, linux-scsi,
	virtualization, linux-fsdevel, kgdb-bugreport, iommu, bpf, kvm

From: Ira Weiny <ira.weiny@intel.com>

kmap() and kmap_atomic() are being deprecated in favor of
kmap_local_page().

There are two main problems with kmap(): (1) It comes with an overhead
as mapping space is restricted and protected by a global lock for
synchronization and (2) it also requires global TLB invalidation when
the kmap’s pool wraps and it might block when the mapping space is fully
utilized until a slot becomes available.

kmap_local_page() is safe from any context and is therefore redundant
with kmap_atomic() with the exception of any pagefault or preemption
disable requirements.  However, using kmap_atomic() for these side
effects makes the code less clear.  So any requirement for pagefault or
preemption disable should be made explicitly.

With kmap_local_page() the mappings are per thread, CPU local, can take
page faults, and can be called from any context (including interrupts).
It is faster than kmap() in kernels with HIGHMEM enabled. Furthermore,
the tasks can be preempted and, when they are scheduled to run again,
the kernel virtual addresses are restored.

Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>

---
Suggested by credits.
	Thomas: Idea to keep from growing more kmap/kmap_atomic calls.
	Fabio: Stole some of his boiler plate commit message.

Notes on tree-wide conversions:

I've cc'ed mailing lists for subsystems which currently contains either kmap()
or kmap_atomic() calls.  As some of you already know Fabio and I have been
working through converting kmap() calls to kmap_local_page().  But there is a
lot more work to be done.  Help from the community is always welcome,
especially with kmap_atomic() conversions.  To keep from stepping on each
others toes I've created a spreadsheet of the current calls[1].  Please let me
or Fabio know if you plan on tacking one of the conversions so we can mark it
off the list.

[1] https://docs.google.com/spreadsheets/d/1i_ckZ10p90bH_CkxD2bYNi05S2Qz84E2OFPv8zq__0w/edit#gid=1679714357

---
 scripts/checkpatch.pl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 79e759aac543..9ff219e0a9d5 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -807,6 +807,8 @@ our %deprecated_apis = (
 	"rcu_barrier_sched"			=> "rcu_barrier",
 	"get_state_synchronize_sched"		=> "get_state_synchronize_rcu",
 	"cond_synchronize_sched"		=> "cond_synchronize_rcu",
+	"kmap"					=> "kmap_local_page",
+	"kmap_atomic"				=> "kmap_local_page",
 );
 
 #Create a search pattern for all these strings to speed up a loop below

base-commit: 4a9350597aff50bbd0f4b80ccf49d2e02d1111f5
-- 
2.35.3


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH] checkpatch: Add kmap and kmap_atomic to the deprecated list
@ 2022-08-13 22:00 ` ira.weiny
  0 siblings, 0 replies; 15+ messages in thread
From: ira.weiny @ 2022-08-13 22:00 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches
  Cc: Ira Weiny, Thomas Gleixner, Fabio M . De Francesco,
	Andrew Morton, linux-kernel, linux-snps-arc, linux-arm-kernel,
	linux-csky, loongarch, linux-mips, linuxppc-dev, linux-riscv,
	linux-sh, sparclinux, linux-um, x86, linux-xtensa, keyrings,
	linux-ide, linux-block, linux-crypto, linux-media, linux-edac,
	linux1394-devel, dri-devel, dm-devel, linux-raid, linux-mmc,
	linux-rdma, linux-mtd, netdev, nvdimm, linux-nvme, linux-scsi,
	virtualization, linux-fsdevel, kgdb-bugreport, iommu, bpf, kvm

From: Ira Weiny <ira.weiny@intel.com>

kmap() and kmap_atomic() are being deprecated in favor of
kmap_local_page().

There are two main problems with kmap(): (1) It comes with an overhead
as mapping space is restricted and protected by a global lock for
synchronization and (2) it also requires global TLB invalidation when
the kmap’s pool wraps and it might block when the mapping space is fully
utilized until a slot becomes available.

kmap_local_page() is safe from any context and is therefore redundant
with kmap_atomic() with the exception of any pagefault or preemption
disable requirements.  However, using kmap_atomic() for these side
effects makes the code less clear.  So any requirement for pagefault or
preemption disable should be made explicitly.

With kmap_local_page() the mappings are per thread, CPU local, can take
page faults, and can be called from any context (including interrupts).
It is faster than kmap() in kernels with HIGHMEM enabled. Furthermore,
the tasks can be preempted and, when they are scheduled to run again,
the kernel virtual addresses are restored.

Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>

---
Suggested by credits.
	Thomas: Idea to keep from growing more kmap/kmap_atomic calls.
	Fabio: Stole some of his boiler plate commit message.

Notes on tree-wide conversions:

I've cc'ed mailing lists for subsystems which currently contains either kmap()
or kmap_atomic() calls.  As some of you already know Fabio and I have been
working through converting kmap() calls to kmap_local_page().  But there is a
lot more work to be done.  Help from the community is always welcome,
especially with kmap_atomic() conversions.  To keep from stepping on each
others toes I've created a spreadsheet of the current calls[1].  Please let me
or Fabio know if you plan on tacking one of the conversions so we can mark it
off the list.

[1] https://docs.google.com/spreadsheets/d/1i_ckZ10p90bH_CkxD2bYNi05S2Qz84E2OFPv8zq__0w/edit#gid=1679714357

---
 scripts/checkpatch.pl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 79e759aac543..9ff219e0a9d5 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -807,6 +807,8 @@ our %deprecated_apis = (
 	"rcu_barrier_sched"			=> "rcu_barrier",
 	"get_state_synchronize_sched"		=> "get_state_synchronize_rcu",
 	"cond_synchronize_sched"		=> "cond_synchronize_rcu",
+	"kmap"					=> "kmap_local_page",
+	"kmap_atomic"				=> "kmap_local_page",
 );
 
 #Create a search pattern for all these strings to speed up a loop below

base-commit: 4a9350597aff50bbd0f4b80ccf49d2e02d1111f5
-- 
2.35.3


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH] checkpatch: Add kmap and kmap_atomic to the deprecated list
@ 2022-08-13 22:00 ` ira.weiny
  0 siblings, 0 replies; 15+ messages in thread
From: ira.weiny @ 2022-08-13 22:00 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches
  Cc: nvdimm, kvm, linux-sh, kgdb-bugreport, dri-devel, linux-mips,
	linux-ide, dm-devel, keyrings, linux-mtd, sparclinux,
	linux-riscv, linux1394-devel, Ira Weiny, linux-scsi, linux-rdma,
	x86, linux-csky, iommu, linux-snps-arc, Fabio M . De Francesco,
	linux-media, linux-xtensa, linux-um, linux-block, linux-nvme,
	loongarch, Thomas Gleixner, virtualization, bpf,
	linux-arm-kernel, linux-edac, linux-raid, n

From: Ira Weiny <ira.weiny@intel.com>

kmap() and kmap_atomic() are being deprecated in favor of
kmap_local_page().

There are two main problems with kmap(): (1) It comes with an overhead
as mapping space is restricted and protected by a global lock for
synchronization and (2) it also requires global TLB invalidation when
the kmap’s pool wraps and it might block when the mapping space is fully
utilized until a slot becomes available.

kmap_local_page() is safe from any context and is therefore redundant
with kmap_atomic() with the exception of any pagefault or preemption
disable requirements.  However, using kmap_atomic() for these side
effects makes the code less clear.  So any requirement for pagefault or
preemption disable should be made explicitly.

With kmap_local_page() the mappings are per thread, CPU local, can take
page faults, and can be called from any context (including interrupts).
It is faster than kmap() in kernels with HIGHMEM enabled. Furthermore,
the tasks can be preempted and, when they are scheduled to run again,
the kernel virtual addresses are restored.

Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>

---
Suggested by credits.
	Thomas: Idea to keep from growing more kmap/kmap_atomic calls.
	Fabio: Stole some of his boiler plate commit message.

Notes on tree-wide conversions:

I've cc'ed mailing lists for subsystems which currently contains either kmap()
or kmap_atomic() calls.  As some of you already know Fabio and I have been
working through converting kmap() calls to kmap_local_page().  But there is a
lot more work to be done.  Help from the community is always welcome,
especially with kmap_atomic() conversions.  To keep from stepping on each
others toes I've created a spreadsheet of the current calls[1].  Please let me
or Fabio know if you plan on tacking one of the conversions so we can mark it
off the list.

[1] https://docs.google.com/spreadsheets/d/1i_ckZ10p90bH_CkxD2bYNi05S2Qz84E2OFPv8zq__0w/edit#gid=1679714357

---
 scripts/checkpatch.pl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 79e759aac543..9ff219e0a9d5 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -807,6 +807,8 @@ our %deprecated_apis = (
 	"rcu_barrier_sched"			=> "rcu_barrier",
 	"get_state_synchronize_sched"		=> "get_state_synchronize_rcu",
 	"cond_synchronize_sched"		=> "cond_synchronize_rcu",
+	"kmap"					=> "kmap_local_page",
+	"kmap_atomic"				=> "kmap_local_page",
 );
 
 #Create a search pattern for all these strings to speed up a loop below

base-commit: 4a9350597aff50bbd0f4b80ccf49d2e02d1111f5
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH] checkpatch: Add kmap and kmap_atomic to the deprecated list
  2022-08-13 22:00 ` ira.weiny
                     ` (4 preceding siblings ...)
  (?)
@ 2022-08-14  5:25   ` Chaitanya Kulkarni
  -1 siblings, 0 replies; 15+ messages in thread
From: Chaitanya Kulkarni @ 2022-08-14  5:25 UTC (permalink / raw)
  To: ira.weiny, Andy Whitcroft, Joe Perches
  Cc: nvdimm, kvm, linux-sh, kgdb-bugreport, dri-devel, linux-mips,
	linux-ide, dm-devel, keyrings, linux-mtd, sparclinux,
	linux-riscv, linux1394-devel, linux-scsi, linux-rdma, x86,
	linux-csky, iommu, linux-snps-arc, Fabio M . De Francesco,
	linux-media, linux-xtensa, linux-um, linux-block, linux-nvme,
	loongarch, Thomas Gleixner, virtualization, bpf,
	linux-arm-kernel, linux-edac, linux-raid, netdev, linux-mmc,
	linux-kernel, linux-crypto, linux-fsdevel, Andrew Morton,
	linuxppc-dev

On 8/13/22 15:00, ira.weiny@intel.com wrote:
> From: Ira Weiny <ira.weiny@intel.com>
> 
> kmap() and kmap_atomic() are being deprecated in favor of
> kmap_local_page().
> 
> There are two main problems with kmap(): (1) It comes with an overhead
> as mapping space is restricted and protected by a global lock for
> synchronization and (2) it also requires global TLB invalidation when
> the kmap’s pool wraps and it might block when the mapping space is fully
> utilized until a slot becomes available.
> 
> kmap_local_page() is safe from any context and is therefore redundant
> with kmap_atomic() with the exception of any pagefault or preemption
> disable requirements.  However, using kmap_atomic() for these side
> effects makes the code less clear.  So any requirement for pagefault or
> preemption disable should be made explicitly.
> 
> With kmap_local_page() the mappings are per thread, CPU local, can take
> page faults, and can be called from any context (including interrupts).
> It is faster than kmap() in kernels with HIGHMEM enabled. Furthermore,
> the tasks can be preempted and, when they are scheduled to run again,
> the kernel virtual addresses are restored.
> 
> Suggested-by: Thomas Gleixner <tglx@linutronix.de>
> Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> 
> ---
> Suggested by credits.
> 	Thomas: Idea to keep from growing more kmap/kmap_atomic calls.
> 	Fabio: Stole some of his boiler plate commit message.
> 
> Notes on tree-wide conversions:
> 
> I've cc'ed mailing lists for subsystems which currently contains either kmap()
> or kmap_atomic() calls.  As some of you already know Fabio and I have been
> working through converting kmap() calls to kmap_local_page().  But there is a
> lot more work to be done.  Help from the community is always welcome,
> especially with kmap_atomic() conversions.  To keep from stepping on each
> others toes I've created a spreadsheet of the current calls[1].  Please let me
> or Fabio know if you plan on tacking one of the conversions so we can mark it
> off the list.
> 
> [1] https://docs.google.com/spreadsheets/d/1i_ckZ10p90bH_CkxD2bYNi05S2Qz84E2OFPv8zq__0w/edit#gid=1679714357
> 

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] checkpatch: Add kmap and kmap_atomic to the deprecated list
@ 2022-08-14  5:25   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 15+ messages in thread
From: Chaitanya Kulkarni @ 2022-08-14  5:25 UTC (permalink / raw)
  To: ira.weiny, Andy Whitcroft, Joe Perches
  Cc: nvdimm, kvm, linux-sh, kgdb-bugreport, dri-devel, linux-mips,
	linux-ide, dm-devel, keyrings, linux-mtd, sparclinux,
	linux-riscv, linux1394-devel, linux-scsi, linux-rdma, x86,
	linux-csky, iommu, linux-snps-arc, Fabio M . De Francesco,
	linux-media, linux-xtensa, linux-um, linux-block, linux-nvme,
	loongarch, Thomas Gleixner, virtualization, bpf,
	linux-arm-kernel, linux-edac, linux-raid, netdev, linux-mmc,
	linux-kernel, linux-crypto, linux-fsdevel, Andrew Morton,
	linuxppc-dev

On 8/13/22 15:00, ira.weiny@intel.com wrote:
> From: Ira Weiny <ira.weiny@intel.com>
> 
> kmap() and kmap_atomic() are being deprecated in favor of
> kmap_local_page().
> 
> There are two main problems with kmap(): (1) It comes with an overhead
> as mapping space is restricted and protected by a global lock for
> synchronization and (2) it also requires global TLB invalidation when
> the kmap’s pool wraps and it might block when the mapping space is fully
> utilized until a slot becomes available.
> 
> kmap_local_page() is safe from any context and is therefore redundant
> with kmap_atomic() with the exception of any pagefault or preemption
> disable requirements.  However, using kmap_atomic() for these side
> effects makes the code less clear.  So any requirement for pagefault or
> preemption disable should be made explicitly.
> 
> With kmap_local_page() the mappings are per thread, CPU local, can take
> page faults, and can be called from any context (including interrupts).
> It is faster than kmap() in kernels with HIGHMEM enabled. Furthermore,
> the tasks can be preempted and, when they are scheduled to run again,
> the kernel virtual addresses are restored.
> 
> Suggested-by: Thomas Gleixner <tglx@linutronix.de>
> Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> 
> ---
> Suggested by credits.
> 	Thomas: Idea to keep from growing more kmap/kmap_atomic calls.
> 	Fabio: Stole some of his boiler plate commit message.
> 
> Notes on tree-wide conversions:
> 
> I've cc'ed mailing lists for subsystems which currently contains either kmap()
> or kmap_atomic() calls.  As some of you already know Fabio and I have been
> working through converting kmap() calls to kmap_local_page().  But there is a
> lot more work to be done.  Help from the community is always welcome,
> especially with kmap_atomic() conversions.  To keep from stepping on each
> others toes I've created a spreadsheet of the current calls[1].  Please let me
> or Fabio know if you plan on tacking one of the conversions so we can mark it
> off the list.
> 
> [1] https://docs.google.com/spreadsheets/d/1i_ckZ10p90bH_CkxD2bYNi05S2Qz84E2OFPv8zq__0w/edit#gid=1679714357
> 

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] checkpatch: Add kmap and kmap_atomic to the deprecated list
@ 2022-08-14  5:25   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 15+ messages in thread
From: Chaitanya Kulkarni @ 2022-08-14  5:25 UTC (permalink / raw)
  To: ira.weiny, Andy Whitcroft, Joe Perches
  Cc: nvdimm, kvm, linux-sh, kgdb-bugreport, dri-devel, virtualization,
	linux-ide, dm-devel, keyrings, linux-mtd, sparclinux,
	linux-riscv, linux1394-devel, linux-scsi, linux-rdma, x86,
	linux-csky@vger.kerne l.org, iommu, linux-snps-arc,
	Fabio M . De Francesco, linux-media, linux-xtensa, linux-um,
	linux-block, linux-nvme, loongarch, Thomas Gleixner,
	Andrew Morton, linux-arm-kernel, linux-edac, linux-raid, netdev,
	linux-mmc, linux-mips@vger.kernel. org, linux-kernel,
	linux-crypto, linux-fsdevel, bpf, linuxppc-dev

On 8/13/22 15:00, ira.weiny@intel.com wrote:
> From: Ira Weiny <ira.weiny@intel.com>
> 
> kmap() and kmap_atomic() are being deprecated in favor of
> kmap_local_page().
> 
> There are two main problems with kmap(): (1) It comes with an overhead
> as mapping space is restricted and protected by a global lock for
> synchronization and (2) it also requires global TLB invalidation when
> the kmap’s pool wraps and it might block when the mapping space is fully
> utilized until a slot becomes available.
> 
> kmap_local_page() is safe from any context and is therefore redundant
> with kmap_atomic() with the exception of any pagefault or preemption
> disable requirements.  However, using kmap_atomic() for these side
> effects makes the code less clear.  So any requirement for pagefault or
> preemption disable should be made explicitly.
> 
> With kmap_local_page() the mappings are per thread, CPU local, can take
> page faults, and can be called from any context (including interrupts).
> It is faster than kmap() in kernels with HIGHMEM enabled. Furthermore,
> the tasks can be preempted and, when they are scheduled to run again,
> the kernel virtual addresses are restored.
> 
> Suggested-by: Thomas Gleixner <tglx@linutronix.de>
> Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> 
> ---
> Suggested by credits.
> 	Thomas: Idea to keep from growing more kmap/kmap_atomic calls.
> 	Fabio: Stole some of his boiler plate commit message.
> 
> Notes on tree-wide conversions:
> 
> I've cc'ed mailing lists for subsystems which currently contains either kmap()
> or kmap_atomic() calls.  As some of you already know Fabio and I have been
> working through converting kmap() calls to kmap_local_page().  But there is a
> lot more work to be done.  Help from the community is always welcome,
> especially with kmap_atomic() conversions.  To keep from stepping on each
> others toes I've created a spreadsheet of the current calls[1].  Please let me
> or Fabio know if you plan on tacking one of the conversions so we can mark it
> off the list.
> 
> [1] https://docs.google.com/spreadsheets/d/1i_ckZ10p90bH_CkxD2bYNi05S2Qz84E2OFPv8zq__0w/edit#gid=1679714357
> 

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] checkpatch: Add kmap and kmap_atomic to the deprecated list
@ 2022-08-14  5:25   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 15+ messages in thread
From: Chaitanya Kulkarni @ 2022-08-14  5:25 UTC (permalink / raw)
  To: ira.weiny, Andy Whitcroft, Joe Perches
  Cc: nvdimm, kvm, linux-sh, kgdb-bugreport, dri-devel, linux-mips,
	linux-ide, dm-devel, keyrings, linux-mtd, sparclinux,
	linux-riscv, linux1394-devel, linux-scsi, linux-rdma, x86,
	linux-csky, iommu, linux-snps-arc, Fabio M . De Francesco,
	linux-media, linux-xtensa, linux-um, linux-block, linux-nvme,
	loongarch, Thomas Gleixner, virtualization, bpf,
	linux-arm-kernel, linux-edac, linux-raid, netdev, linux-mmc,
	linux-kernel, linux-crypto, linux-fsdevel, Andrew Morton,
	linuxppc-dev

On 8/13/22 15:00, ira.weiny@intel.com wrote:
> From: Ira Weiny <ira.weiny@intel.com>
> 
> kmap() and kmap_atomic() are being deprecated in favor of
> kmap_local_page().
> 
> There are two main problems with kmap(): (1) It comes with an overhead
> as mapping space is restricted and protected by a global lock for
> synchronization and (2) it also requires global TLB invalidation when
> the kmap’s pool wraps and it might block when the mapping space is fully
> utilized until a slot becomes available.
> 
> kmap_local_page() is safe from any context and is therefore redundant
> with kmap_atomic() with the exception of any pagefault or preemption
> disable requirements.  However, using kmap_atomic() for these side
> effects makes the code less clear.  So any requirement for pagefault or
> preemption disable should be made explicitly.
> 
> With kmap_local_page() the mappings are per thread, CPU local, can take
> page faults, and can be called from any context (including interrupts).
> It is faster than kmap() in kernels with HIGHMEM enabled. Furthermore,
> the tasks can be preempted and, when they are scheduled to run again,
> the kernel virtual addresses are restored.
> 
> Suggested-by: Thomas Gleixner <tglx@linutronix.de>
> Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> 
> ---
> Suggested by credits.
> 	Thomas: Idea to keep from growing more kmap/kmap_atomic calls.
> 	Fabio: Stole some of his boiler plate commit message.
> 
> Notes on tree-wide conversions:
> 
> I've cc'ed mailing lists for subsystems which currently contains either kmap()
> or kmap_atomic() calls.  As some of you already know Fabio and I have been
> working through converting kmap() calls to kmap_local_page().  But there is a
> lot more work to be done.  Help from the community is always welcome,
> especially with kmap_atomic() conversions.  To keep from stepping on each
> others toes I've created a spreadsheet of the current calls[1].  Please let me
> or Fabio know if you plan on tacking one of the conversions so we can mark it
> off the list.
> 
> [1] https://docs.google.com/spreadsheets/d/1i_ckZ10p90bH_CkxD2bYNi05S2Qz84E2OFPv8zq__0w/edit#gid=1679714357
> 

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] checkpatch: Add kmap and kmap_atomic to the deprecated list
@ 2022-08-14  5:25   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 15+ messages in thread
From: Chaitanya Kulkarni @ 2022-08-14  5:25 UTC (permalink / raw)
  To: ira.weiny, Andy Whitcroft, Joe Perches
  Cc: nvdimm, kvm, linux-sh, kgdb-bugreport, dri-devel, linux-mips,
	linux-ide, dm-devel, keyrings, linux-mtd, sparclinux,
	linux-riscv, linux1394-devel, linux-scsi, linux-rdma, x86,
	linux-csky, iommu, linux-snps-arc, Fabio M . De Francesco,
	linux-media, linux-xtensa, linux-um, linux-block, linux-nvme,
	loongarch, Thomas Gleixner, virtualization, bpf,
	linux-arm-kernel, linux-edac, linux-raid, netdev, linux-mmc,
	linux-kernel, linux-crypto, linux-fsdevel, Andrew Morton,
	linuxppc-dev

On 8/13/22 15:00, ira.weiny@intel.com wrote:
> From: Ira Weiny <ira.weiny@intel.com>
> 
> kmap() and kmap_atomic() are being deprecated in favor of
> kmap_local_page().
> 
> There are two main problems with kmap(): (1) It comes with an overhead
> as mapping space is restricted and protected by a global lock for
> synchronization and (2) it also requires global TLB invalidation when
> the kmap’s pool wraps and it might block when the mapping space is fully
> utilized until a slot becomes available.
> 
> kmap_local_page() is safe from any context and is therefore redundant
> with kmap_atomic() with the exception of any pagefault or preemption
> disable requirements.  However, using kmap_atomic() for these side
> effects makes the code less clear.  So any requirement for pagefault or
> preemption disable should be made explicitly.
> 
> With kmap_local_page() the mappings are per thread, CPU local, can take
> page faults, and can be called from any context (including interrupts).
> It is faster than kmap() in kernels with HIGHMEM enabled. Furthermore,
> the tasks can be preempted and, when they are scheduled to run again,
> the kernel virtual addresses are restored.
> 
> Suggested-by: Thomas Gleixner <tglx@linutronix.de>
> Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> 
> ---
> Suggested by credits.
> 	Thomas: Idea to keep from growing more kmap/kmap_atomic calls.
> 	Fabio: Stole some of his boiler plate commit message.
> 
> Notes on tree-wide conversions:
> 
> I've cc'ed mailing lists for subsystems which currently contains either kmap()
> or kmap_atomic() calls.  As some of you already know Fabio and I have been
> working through converting kmap() calls to kmap_local_page().  But there is a
> lot more work to be done.  Help from the community is always welcome,
> especially with kmap_atomic() conversions.  To keep from stepping on each
> others toes I've created a spreadsheet of the current calls[1].  Please let me
> or Fabio know if you plan on tacking one of the conversions so we can mark it
> off the list.
> 
> [1] https://docs.google.com/spreadsheets/d/1i_ckZ10p90bH_CkxD2bYNi05S2Qz84E2OFPv8zq__0w/edit#gid=1679714357
> 

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>


_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] checkpatch: Add kmap and kmap_atomic to the deprecated list
@ 2022-08-14  5:25   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 15+ messages in thread
From: Chaitanya Kulkarni @ 2022-08-14  5:25 UTC (permalink / raw)
  To: ira.weiny, Andy Whitcroft, Joe Perches
  Cc: nvdimm, kvm, linux-sh, kgdb-bugreport, dri-devel, linux-mips,
	linux-ide, dm-devel, keyrings, linux-mtd, sparclinux,
	linux-riscv, linux1394-devel, linux-scsi, linux-rdma, x86,
	linux-csky, iommu, linux-snps-arc, Fabio M . De Francesco,
	linux-media, linux-xtensa, linux-um, linux-block, linux-nvme,
	loongarch, Thomas Gleixner, virtualization, bpf,
	linux-arm-kernel, linux-edac, linux-raid, netdev, linux-mmc,
	linux-kernel, linux-crypto, linux-fsdevel, Andrew Morton,
	linuxppc-dev

On 8/13/22 15:00, ira.weiny@intel.com wrote:
> From: Ira Weiny <ira.weiny@intel.com>
> 
> kmap() and kmap_atomic() are being deprecated in favor of
> kmap_local_page().
> 
> There are two main problems with kmap(): (1) It comes with an overhead
> as mapping space is restricted and protected by a global lock for
> synchronization and (2) it also requires global TLB invalidation when
> the kmap’s pool wraps and it might block when the mapping space is fully
> utilized until a slot becomes available.
> 
> kmap_local_page() is safe from any context and is therefore redundant
> with kmap_atomic() with the exception of any pagefault or preemption
> disable requirements.  However, using kmap_atomic() for these side
> effects makes the code less clear.  So any requirement for pagefault or
> preemption disable should be made explicitly.
> 
> With kmap_local_page() the mappings are per thread, CPU local, can take
> page faults, and can be called from any context (including interrupts).
> It is faster than kmap() in kernels with HIGHMEM enabled. Furthermore,
> the tasks can be preempted and, when they are scheduled to run again,
> the kernel virtual addresses are restored.
> 
> Suggested-by: Thomas Gleixner <tglx@linutronix.de>
> Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> 
> ---
> Suggested by credits.
> 	Thomas: Idea to keep from growing more kmap/kmap_atomic calls.
> 	Fabio: Stole some of his boiler plate commit message.
> 
> Notes on tree-wide conversions:
> 
> I've cc'ed mailing lists for subsystems which currently contains either kmap()
> or kmap_atomic() calls.  As some of you already know Fabio and I have been
> working through converting kmap() calls to kmap_local_page().  But there is a
> lot more work to be done.  Help from the community is always welcome,
> especially with kmap_atomic() conversions.  To keep from stepping on each
> others toes I've created a spreadsheet of the current calls[1].  Please let me
> or Fabio know if you plan on tacking one of the conversions so we can mark it
> off the list.
> 
> [1] https://docs.google.com/spreadsheets/d/1i_ckZ10p90bH_CkxD2bYNi05S2Qz84E2OFPv8zq__0w/edit#gid=1679714357
> 

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] checkpatch: Add kmap and kmap_atomic to the deprecated list
@ 2022-08-14  5:25   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 15+ messages in thread
From: Chaitanya Kulkarni @ 2022-08-14  5:25 UTC (permalink / raw)
  To: ira.weiny, Andy Whitcroft, Joe Perches
  Cc: nvdimm, kvm, linux-sh, kgdb-bugreport, dri-devel, virtualization,
	linux-ide, dm-devel, keyrings, linux-mtd, sparclinux,
	linux-riscv, linux1394-devel, linux-scsi, linux-rdma, x86,
	linux-csky, iommu, linux-snps-arc, Fabio M . De Francesco,
	linux-media, linux-xtensa, linux-um, linux-block, linux-nvme,
	loongarch, Thomas Gleixner, Andrew Morton, linux-arm-kernel,
	linux-edac, linux-raid, netdev, linux-mmc, linux-mips,
	linux-kernel, linux-crypto, linux-fsdevel, bpf, linuxppc-dev

On 8/13/22 15:00, ira.weiny@intel.com wrote:
> From: Ira Weiny <ira.weiny@intel.com>
> 
> kmap() and kmap_atomic() are being deprecated in favor of
> kmap_local_page().
> 
> There are two main problems with kmap(): (1) It comes with an overhead
> as mapping space is restricted and protected by a global lock for
> synchronization and (2) it also requires global TLB invalidation when
> the kmap’s pool wraps and it might block when the mapping space is fully
> utilized until a slot becomes available.
> 
> kmap_local_page() is safe from any context and is therefore redundant
> with kmap_atomic() with the exception of any pagefault or preemption
> disable requirements.  However, using kmap_atomic() for these side
> effects makes the code less clear.  So any requirement for pagefault or
> preemption disable should be made explicitly.
> 
> With kmap_local_page() the mappings are per thread, CPU local, can take
> page faults, and can be called from any context (including interrupts).
> It is faster than kmap() in kernels with HIGHMEM enabled. Furthermore,
> the tasks can be preempted and, when they are scheduled to run again,
> the kernel virtual addresses are restored.
> 
> Suggested-by: Thomas Gleixner <tglx@linutronix.de>
> Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> 
> ---
> Suggested by credits.
> 	Thomas: Idea to keep from growing more kmap/kmap_atomic calls.
> 	Fabio: Stole some of his boiler plate commit message.
> 
> Notes on tree-wide conversions:
> 
> I've cc'ed mailing lists for subsystems which currently contains either kmap()
> or kmap_atomic() calls.  As some of you already know Fabio and I have been
> working through converting kmap() calls to kmap_local_page().  But there is a
> lot more work to be done.  Help from the community is always welcome,
> especially with kmap_atomic() conversions.  To keep from stepping on each
> others toes I've created a spreadsheet of the current calls[1].  Please let me
> or Fabio know if you plan on tacking one of the conversions so we can mark it
> off the list.
> 
> [1] https://docs.google.com/spreadsheets/d/1i_ckZ10p90bH_CkxD2bYNi05S2Qz84E2OFPv8zq__0w/edit#gid=1679714357
> 

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2022-08-15  7:19 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-13 22:00 [PATCH] checkpatch: Add kmap and kmap_atomic to the deprecated list ira.weiny
2022-08-13 22:00 ` ira.weiny
2022-08-13 22:00 ` ira.weiny
2022-08-13 22:00 ` ira.weiny
2022-08-13 22:00 ` ira.weiny
2022-08-13 22:00 ` ira.weiny
2022-08-13 22:00 ` ira.weiny
2022-08-13 22:00 ` ira.weiny
2022-08-14  5:25 ` Chaitanya Kulkarni
2022-08-14  5:25   ` Chaitanya Kulkarni
2022-08-14  5:25   ` Chaitanya Kulkarni
2022-08-14  5:25   ` Chaitanya Kulkarni
2022-08-14  5:25   ` Chaitanya Kulkarni
2022-08-14  5:25   ` Chaitanya Kulkarni
2022-08-14  5:25   ` Chaitanya Kulkarni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.