aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorZhao Liu <zhao1.liu@intel.com>2022-09-28 17:56:40 +0800
committerWei Liu <wei.liu@kernel.org>2022-10-03 08:49:48 +0000
commit154fb14df7a3c81dea82eca7c0c46590f5ffc3d2 (patch)
treea57c921e7b6e722fb7e878ada1fccd220ca4213c /tools/perf
parentdrm/hyperv: Add ratelimit on error message (diff)
downloadlinux-154fb14df7a3c81dea82eca7c0c46590f5ffc3d2.tar.gz
linux-154fb14df7a3c81dea82eca7c0c46590f5ffc3d2.zip
x86/hyperv: Replace kmap() with kmap_local_page()
kmap() is being deprecated in favor of kmap_local_page()[1]. 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. 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 and are still valid. In the fuction hyperv_init() of hyperv/hv_init.c, the mapping is used in a single thread and is short live. So, in this case, it's safe to simply use kmap_local_page() to create mapping, and this avoids the wasted cost of kmap() for global synchronization. In addtion, the fuction hyperv_init() checks if kmap() fails by BUG_ON(). From the original discussion[2], the BUG_ON() here is just used to explicitly panic NULL pointer. So still keep the BUG_ON() in place to check if kmap_local_page() fails. Based on this consideration, memcpy_to_page() is not selected here but only kmap_local_page() is used. Therefore, replace kmap() with kmap_local_page() in hyperv/hv_init.c. [1]: https://lore.kernel.org/all/20220813220034.806698-1-ira.weiny@intel.com [2]: https://lore.kernel.org/lkml/20200915103710.cqmdvzh5lys4wsqo@liuwe-devbox-debian-v2/ Suggested-by: Dave Hansen <dave.hansen@intel.com> Suggested-by: Ira Weiny <ira.weiny@intel.com> Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com> Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Link: https://lore.kernel.org/r/20220928095640.626350-1-zhao1.liu@linux.intel.com Signed-off-by: Wei Liu <wei.liu@kernel.org>
Diffstat (limited to 'tools/perf')
0 files changed, 0 insertions, 0 deletions
rtions'>+1 2017-05-19KVM: x86: zero base3 of unusable segmentsRadim Krčmář1-0/+2 2017-05-19KVM: X86: Fix read out-of-bounds vulnerability in kvm pio emulationWanpeng Li1-9/+15 2017-05-19KVM: x86: Fix potential preemption when get the current kvmclock timestampWanpeng Li1-1/+9 2017-05-19blktrace: fix integer parseShaohua Li1-2/+2 2017-05-19i2c: designware: don't infer timings described by ACPI from clock rateArd Biesheuvel1-8/+10 2017-05-19arm64: dts: rockchip: fix include referenceArnd Bergmann1-1/+1 2017-05-19watchdog: bcm281xx: Fix use of uninitialized spinlock.Eric Anholt1-1/+2 2017-05-19watchdog: zx2967: remove redundant dev_err call in zx2967_wdt_probe()Wei Yongjun1-3/+1 2017-05-19iTCO_wdt: all versions count down twicePaolo Bonzini2-13/+11 2017-05-19firmware: ti_sci: fix strncat length checkArnd Bergmann1-1/+2 2017-05-19ARM: remove duplicate 'const' annotations'Arnd Bergmann6-6/+6 2017-05-19arm64: defconfig: enable options needed for QCom DB410c boardRob Herring1-0/+7 2017-05-18arm64: defconfig: sync with savedefconfigRob Herring1-61/+42