pti_clone_pgtable() increases addr by PUD_SIZE for pud_none(*pud) case.
This is not accurate because addr may not be PUD_SIZE aligned.
In our x86_64 kernel, pti_clone_pgtable() fails to clone 7 PMDs because
of this issuse, including PMD for the irq entry table. For a memcache
like workload, this introduces about 4.5x more iTLB-load and about 2.5x
more iTLB-load-misses on a Skylake CPU.
This patch fixes this issue by adding PMD_SIZE to addr for pud_none()
case.
Cc: stable(a)vger.kernel.org # v4.19+
Fixes: 16a3fe634f6a ("x86/mm/pti: Clone kernel-image on PTE level for 32 bit")
Signed-off-by: Song Liu <songliubraving(a)fb.com>
Cc: Joerg Roedel <jroedel(a)suse.de>
Cc: Thomas Gleixner <tglx(a)linutronix.de>
Cc: Dave Hansen <dave.hansen(a)linux.intel.com>
Cc: Andy Lutomirski <luto(a)kernel.org>
Cc: Peter Zijlstra <peterz(a)infradead.org>
---
arch/x86/mm/pti.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c
index b196524759ec..5a67c3015f59 100644
--- a/arch/x86/mm/pti.c
+++ b/arch/x86/mm/pti.c
@@ -330,7 +330,7 @@ pti_clone_pgtable(unsigned long start, unsigned long end,
pud = pud_offset(p4d, addr);
if (pud_none(*pud)) {
- addr += PUD_SIZE;
+ addr += PMD_SIZE;
continue;
}
--
2.17.1
From: Alastair D'Silva <alastair(a)d-silva.org>
Heads Up: This patch cannot be submitted to Linus's tree, as the affected
assembler functions have already been converted to C.
When calling flush_(inval_)dcache_range with a size >4GB, we were masking
off the upper 32 bits, so we would incorrectly flush a range smaller
than intended.
This patch replaces the 32 bit shifts with 64 bit ones, so that
the full size is accounted for.
Signed-off-by: Alastair D'Silva <alastair(a)d-silva.org>
---
arch/powerpc/kernel/misc_64.S | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index 1ad4089dd110..d4d096f80f4b 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -130,7 +130,7 @@ _GLOBAL_TOC(flush_dcache_range)
subf r8,r6,r4 /* compute length */
add r8,r8,r5 /* ensure we get enough */
lwz r9,DCACHEL1LOGBLOCKSIZE(r10) /* Get log-2 of dcache block size */
- srw. r8,r8,r9 /* compute line count */
+ srd. r8,r8,r9 /* compute line count */
beqlr /* nothing to do? */
mtctr r8
0: dcbst 0,r6
@@ -148,7 +148,7 @@ _GLOBAL(flush_inval_dcache_range)
subf r8,r6,r4 /* compute length */
add r8,r8,r5 /* ensure we get enough */
lwz r9,DCACHEL1LOGBLOCKSIZE(r10)/* Get log-2 of dcache block size */
- srw. r8,r8,r9 /* compute line count */
+ srd. r8,r8,r9 /* compute line count */
beqlr /* nothing to do? */
sync
isync
--
2.21.0
Hi,
please consider applying the following two patches from v4.9.y to v4.4.y.
fe5844365ec6 ("Backport minimal compiler_attributes.h to support GCC 9")
2c34c215c102 ("include/linux/module.h: copy __init/__exit attrs to init/cleanup_module")
(upstream commit a6e60d84989f)
... to enable compiling v4.4.y with gcc 9.x.
This already works for the most part, but alpha:allmodconfig and
arm:allmodconfig fail to compile. The above two patches fix the problem.
Thanks,
Guenter
The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
>From b6143d10d23ebb4a77af311e8b8b7f019d0163e6 Mon Sep 17 00:00:00 2001
From: Will Deacon <will(a)kernel.org>
Date: Fri, 16 Aug 2019 14:57:43 +0100
Subject: [PATCH] arm64: ftrace: Ensure module ftrace trampoline is coherent
with I-side
The initial support for dynamic ftrace trampolines in modules made use
of an indirect branch which loaded its target from the beginning of
a special section (e71a4e1bebaf7 ("arm64: ftrace: add support for far
branches to dynamic ftrace")). Since no instructions were being patched,
no cache maintenance was needed. However, later in be0f272bfc83 ("arm64:
ftrace: emit ftrace-mod.o contents through code") this code was reworked
to output the trampoline instructions directly into the PLT entry but,
unfortunately, the necessary cache maintenance was overlooked.
Add a call to __flush_icache_range() after writing the new trampoline
instructions but before patching in the branch to the trampoline.
Cc: Ard Biesheuvel <ard.biesheuvel(a)linaro.org>
Cc: James Morse <james.morse(a)arm.com>
Cc: <stable(a)vger.kernel.org>
Fixes: be0f272bfc83 ("arm64: ftrace: emit ftrace-mod.o contents through code")
Signed-off-by: Will Deacon <will(a)kernel.org>
Signed-off-by: Catalin Marinas <catalin.marinas(a)arm.com>
diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c
index 1285c7b2947f..171773257974 100644
--- a/arch/arm64/kernel/ftrace.c
+++ b/arch/arm64/kernel/ftrace.c
@@ -73,7 +73,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
if (offset < -SZ_128M || offset >= SZ_128M) {
#ifdef CONFIG_ARM64_MODULE_PLTS
- struct plt_entry trampoline;
+ struct plt_entry trampoline, *dst;
struct module *mod;
/*
@@ -106,23 +106,27 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
* to check if the actual opcodes are in fact identical,
* regardless of the offset in memory so use memcmp() instead.
*/
- trampoline = get_plt_entry(addr, mod->arch.ftrace_trampoline);
- if (memcmp(mod->arch.ftrace_trampoline, &trampoline,
- sizeof(trampoline))) {
- if (plt_entry_is_initialized(mod->arch.ftrace_trampoline)) {
+ dst = mod->arch.ftrace_trampoline;
+ trampoline = get_plt_entry(addr, dst);
+ if (memcmp(dst, &trampoline, sizeof(trampoline))) {
+ if (plt_entry_is_initialized(dst)) {
pr_err("ftrace: far branches to multiple entry points unsupported inside a single module\n");
return -EINVAL;
}
/* point the trampoline to our ftrace entry point */
module_disable_ro(mod);
- *mod->arch.ftrace_trampoline = trampoline;
+ *dst = trampoline;
module_enable_ro(mod, true);
- /* update trampoline before patching in the branch */
- smp_wmb();
+ /*
+ * Ensure updated trampoline is visible to instruction
+ * fetch before we patch in the branch.
+ */
+ __flush_icache_range((unsigned long)&dst[0],
+ (unsigned long)&dst[1]);
}
- addr = (unsigned long)(void *)mod->arch.ftrace_trampoline;
+ addr = (unsigned long)dst;
#else /* CONFIG_ARM64_MODULE_PLTS */
return -EINVAL;
#endif /* CONFIG_ARM64_MODULE_PLTS */
The patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
>From 849adec41203ac5837c40c2d7e08490ffdef3c2c Mon Sep 17 00:00:00 2001
From: Will Deacon <will(a)kernel.org>
Date: Mon, 29 Jul 2019 11:06:17 +0100
Subject: [PATCH] arm64: compat: Allow single-byte watchpoints on all addresses
Commit d968d2b801d8 ("ARM: 7497/1: hw_breakpoint: allow single-byte
watchpoints on all addresses") changed the validation requirements for
hardware watchpoints on arch/arm/. Update our compat layer to implement
the same relaxation.
Cc: <stable(a)vger.kernel.org>
Signed-off-by: Will Deacon <will(a)kernel.org>
diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c
index dceb84520948..67b3bae50b92 100644
--- a/arch/arm64/kernel/hw_breakpoint.c
+++ b/arch/arm64/kernel/hw_breakpoint.c
@@ -536,13 +536,14 @@ int hw_breakpoint_arch_parse(struct perf_event *bp,
/* Aligned */
break;
case 1:
- /* Allow single byte watchpoint. */
- if (hw->ctrl.len == ARM_BREAKPOINT_LEN_1)
- break;
case 2:
/* Allow halfword watchpoints and breakpoints. */
if (hw->ctrl.len == ARM_BREAKPOINT_LEN_2)
break;
+ case 3:
+ /* Allow single byte watchpoint. */
+ if (hw->ctrl.len == ARM_BREAKPOINT_LEN_1)
+ break;
default:
return -EINVAL;
}
Hi
In Debian bug https://bugs.debian.org/934331 ran into issues which
match the upstream commit bcb44433bba5 ("dm: disable DISCARD if the
underlying storage no longer supports it").
This commit was CC'ed to stable, but only got applied in v5.0.8 (and
later on backported by Ben Hutchings to v3.16.72).
Mike, I have not checked how easily that would be for older stable
versions, but can the backport be considered for versions down to 4.9?
Apparently Ben did succeed with some changes needed. To 4.19 it should
apply with a small conflict in drivers/md/dm-core.h AFAICS.
Regards,
Salvatore
I searched through https://github.com/Xilinx/linux-xlnx/tree/xlnx_rebase_v4.9
for commits that got backported from mainline, and categorized them
to see if we want them in an LTS kernel.
Most of the contents are specific to xilinx hardware, but some changes are for
generic drivers.
These commits look like we should have them in the LTS kernel, and
they apply cleanly:
d86c5a676e5b ("usb: dwc3: gadget: always try to prepare on
started_list first")
63b7c83ebea0 ("microblaze: Fix return value from xilinx_timer_init")
7181e5590e5b ("microblaze: Add missing syscalls")
8ee80500ad78 ("microblaze: Add missing release version code v9.6 and v10")
3400606d8ffd ("microblaze: Add new fpga families")
26b54be568ad ("PCI: xilinx-nwl: Remove mask for messages not
supported by AXI")
acf6ef1d6c96 ("i2c: mux: pca954x: Export OF device ID table as
module aliases")
dbe4d69d252e ("i2c: mux: pca954x: Add missing pca9546 definition to
chip_desc")
360a3a90c626 ("[media] uvcvideo: Fix empty packet statistic")
a753499d4360 ("microblaze: mm: Flush TLB to ensure correct mapping
when higmem ON")
faf154cd49ba ("microblaze: Separate GP registers from MSR handling")
14ef905bb2ee ("microblaze: Fix MSR flags when returning from exception")
8064c616984e ("i2c: cadance: fix ctrl/addr reg write order")
48767fd8982d ("spi: cadence: change sequence of calling runtime_enable")
802740890c42 ("spi: cadence: Add support for context loss")
e11de4de28c0 ("gpio: zynq: Add support for suspend resume")
a5685781dfe9 ("cpufreq: dt: Add zynqmp to the cpufreq dt platdev")
5c8f124893c4 ("mfd: Kconfig: Add missing Kconfig dependency for TPS65086")
d15c56cad0e6 ("arm64: dts: xilinx: fix PCI bus dtc warnings")
17e76f95a4be ("arm64: zynqmp: Add dcc console for zynqmp")
8c50b1e435d1 ("arm64: zynqmp: Add CCI-400 node")
e199f2cc1e55 ("arm64: zynqmp: Correct IRQ nr for the SMMU")
db202f4d5c24 ("watchdog: cadence_wdt: Enable access to module parameters")
3df3e41c3152 ("video: fbdev: Enable Xilinx FB for ZynqMP")
1d67243a8e77 ("tty: xilinx_uartps: move to arch_initcall for earlier console")
3c48d62de237 ("dmaengine: zynqmp_dma: Fix warning variable 'val' set
but not used")
8d90035e379c ("dmaengine: zynqmp_dma: Fix issues with overflow interrupt")
23059408b6a3 ("dmaengine: xilinx_dma: Fix race condition in the
driver for multiple descriptor scenario")
48c62fb051af ("dmaengine: xilinx_dma: properly configure the SG mode
bit in the driver for cdma")
4b597c634a2a ("dmaengine: xilinx_dma: Fix warning variable prev set
but not used")
1fd4c45d6cd3 ("usb: gadget: udc-xilinx: remove redundant pointer udc")
These look useful, but require a backport to apply:
06aa09081d44 ("gpio: zynq: Provided workaround for GPIO")
6e037fb77086 ("ata: ceva: Correct the AXI bus configuration for SATA ports")
f8251f1dfda9 ("i2c: mux: pca954x: Add missing pca9542 definition to chip_desc")
25cd9721c2b1 ("usb: gadget: f_hid: fix: Don't access hidg->req without
spinlock held")
51218298a25e ("alarmtimer: Ensure RTC module is not unloaded")
These seem harmless but not necessary for stable backports, they could easily
get applied if there is a reason for them:
99c494077e2d ("idr: add ida_is_empty")
f59d4418c420 ("[media] media: adv7604: fix bindings inconsistency for
default-input")
6ab1a322dcaf ("[media] vivid: Enable 4k resolution for webcam capture device")
10eeb5e645b5 ("net: xilinx: constify net_device_ops structure")
e0d4fa5f7a50 ("microblaze: Update defconfigs")
17f4977ccd2b ("microblaze: Enabling CONFIGS related to MTD")
e16f1ad442e2 ("microblaze: Enabling CONFIG_BRIDGE in mmu_defconfig")
3638bd4a066c ("gpio: zynq: Clarify quirk and provide helper function")
9a181e1093af ("PCI: xilinx-nwl: Modify IRQ chip for legacy interrupts")
fdc71ce97c13 ("PCI: xilinx: Make of_device_ids const")
011e29e7d93d ("watchdog: cadence_wdt: make of_device_ids const.")
ce0d37614083 ("iio: adc: xadc: Fix coding style violations")
ef2b56df5a8a ("char: xilinx_hwicap: Fix kernel doc warnings")
4cb4142ba02c ("pinctrl: zynq: Fix kernel doc warnings")
6c2c9bd27cc5 ("pinctrl: zynq: Fix warnings in the driver")
6ae5104cbaa5 ("gpio: zynq: Fix kernel doc warnings")
2717cfcaf564 ("gpio: zynq: Fix warnings in the driver")
b09034892210 ("arm: zynq: Add adv7511 on i2c bus for zc70x")
e5e6f6872c7a ("arm: zynq: Add device-type property for zynq ethernet phy nodes")
3c220bf42090 ("arm: zynq: Label whole PL part as fpga_full region")
1188c024f216 ("arm: zynq: Use C pre-processor for includes in dts")
21ad06cc9e63 ("arm: zynq: Remove earlycon from bootargs")
26db4d8bc7cb ("arm64: zynqmp: Remove leading 0s from mtd table for spi flashes")
63301178e9a9 ("arm64: zynqmp: Move nodes which have no reg property out of bus")
400e188fa895 ("arm64: zynqmp: Add references to cpu nodes")
1e4e25c8ae8f ("arm64: zynqmp: Add idle state for ZynqMP")
e31b7bb8e21e ("arm64: zynqmp: Add operating points")
4a6514d523b5 ("arm64: zynqmp: Adding prefetchable memory space to pcie node")
7fb7820c579b ("arm64: zynqmp: Add support for RTC")
27af3993f77d ("arm64: zynqmp: Add new uartps compatible string")
2f9ed1999a41 ("arm64: zynqmp: Set status disabled in dtsi")
932bd0d8dbe8 ("arm64: zynqmp: Add fpd/lpd dmas")
e881e58709a7 ("arm64: zynqmp: Use C pre-processor for includes")
05e0bd10a9ee ("arm64: zynqmp: Added clocks to DT for ep108")
142574873e2b ("arm64: zynqmp: Enable can1 for ep108")
0286f3ea26a4 ("arm64: zynqmp: Add missing mmc aliases in ep108")
b6bc41645547 ("watchdog: of_xilinx_wdt: Add support for reading freq via CCF")
6f671c6b6288 ("watchdog: of_xilinx_wdt: Add suspend/resume support")
c7a03599b58f ("dmaengine: xilinx_dma: Differentiate probe based on the ip type")
025ba1841e5d ("ARM: dts: zynq: Add mmc alias for zc702/zc706/zed/zybo")
e7abd89466df ("arm64: dts: zynqmp: Add DDRC node")
c2df3de0d07e ("gpio: zynq: properly support runtime PM for GPIO used
as interrupts")
d2920ef5d094 ("dt-bindings: spi: Add device tree binding documentation
for Zynq QSPI controller")
67dca5e580f1 ("spi: spi-mem: Add support for Zynq QSPI controller")
And finally, these were backported into the xilinx tree, but are clearly not
material for an lts kernel.
0f57dc6ae1ff ("remoteproc: Keep local copy of firmware name")
2aefbef04149 ("remoteproc: Add a sysfs interface for firmware and state")
2bfc311a57f5 ("remoteproc: Drop wait in __rproc_boot()")
dbf499cf720a ("usb: gadget: f_hid add super speed support")
39a842e22c1b ("of/overlay: add of overlay notifications")
9dce0287a60d ("fpga: add method to get fpga manager from device")
40e83578fd1e ("doc: fpga-mgr: add fpga image info to api")
a33ddf80b67a ("fpga: add bindings document for fpga region")
1df2865f8dd9 ("fpga-mgr: add fpga image information struct")
12e2508213ac ("add sysfs document for fpga bridge class")
21aeda950c5f ("fpga: add fpga bridge framework")
0fa20cdfcc1f ("fpga: fpga-region: device tree control for FPGA")
1930c2865108 ("fpga zynq: Add missing \n to messages")
80baf649c277 ("fpga zynq: Remove priv->dev")
340c0c53ea30 ("fpga zynq: Fix incorrect ISR state on bootup")
7fe91fccc49f ("ARM: zynq: Remove skeleton.dtsi")
da457d57594b ("ARM: zynq: Fix W=1 dtc 1.4 warnings")
5935a2b3a57c ("serial: xuartps: Enable uart loopback mode")
6f05afcbb031 ("scripts/dtc: Update to upstream version 0931cea3ba20")
608d792192d7 ("remoteproc: Add RPROC_DELETED state")
7a20c64ddb3d ("remoteproc: Reduce asynchronous request_firmware to
auto-boot only")
f2114795f721 ("i2c: mux: pca954x: Add interrupt controller support")
ae3696c167cc ("net: macb: fix phy interrupt parsing")
52276df0b1ce ("[media] uvcvideo: Don't record timespec_sub")
89d123106a97 ("scripts/dtc: Update to upstream version v1.4.4-8-g756ffc4f52f6")
d62100f1aac2 ("serial: xilinx_uartps: Add pm runtime support")
81e33b51ed69 ("serial: xuartps: Cleanup the clock enable")
ecfc5771ef06 ("serial: xuartps: Enable clocks in the pm disable case also")
d653c43aefed ("serial: xilinx_uartps: Fix the error path")
094094a9373f ("serial: uartps: Fix kernel doc warnings")
f3a7f6f67fc7 ("watchdog: cadence_wdt: Show information when driver is probed")
00a0af9a6b04 ("video: fbdev: Fix multiple style issues in xilinxfb")
9053f4b9855c ("devicetree: bindings: Add sata port phy config
parameters in ahci-ceva")
fe8365bbf8ac ("ata: ceva: Move sata port phy oob settings to device-tree")
e8fc8b858cd8 ("ata: ceva: Add gen 3 mode support in driver")
ff0d63778ca0 ("ata: ceva: Disable Device Sleep capability")
05e890d84386 ("ata: ceva: Make RxWaterMark value as module parameter")
3bc867de85b5 ("ata: ceva: Add CCI support for SATA if CCI is enabled")
26bf3b6658a2 ("ata: ceva: Correct the suspend and resume logic for SATA")
f0a559aae57c ("ata: ceva: Add SMMU support for SATA IP")
b2b60bcc7d09 ("media: imx274: device tree binding file")
64c6f7da8c2c ("dmaengine: zynqmp_dma: Add runtime pm support")
30df4574e432 ("dmaengine: zynqmp_dma: Fix kernel doc-format")
49a83f002731 ("net: emaclite: Fix block comments style")
da7bf20e7758 ("tty: serial: uartlite: Add structure for private data")
14288befeb57 ("tty: serial: uartlite: Add clock adaptation")
a3a10614ca0f ("tty: serial: uartlite: Add support for suspend and resume")