Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

plan: kernel patch to be back ported #35

Open
adamliyi opened this issue May 14, 2021 · 5 comments
Open

plan: kernel patch to be back ported #35

adamliyi opened this issue May 14, 2021 · 5 comments
Labels
backport kernel patches to be backported to ampere LTS kernel patch

Comments

@adamliyi
Copy link
Collaborator

adamliyi commented May 14, 2021

Patch Issue 5.4 Status 5.10 Status Comment
"iommu/arm-smmu-v3: Don't reserve implementation defined register space" see issue: #30 backported to 5.4 (87957b2) Already in 5.10 Done
[PATCH] [WORKAROUND]: i2c: designware: Issue abort if the bus is stuck with xmit 87088 CC. Done
pernuma cma torvalds/linux@b7176c2 TBD Already in 5.10 https://lore.kernel.org/linux-iommu/[email protected]/
arm pmu cmn Fix kernel crash during handling CMN interrupt
@adamliyi
Copy link
Collaborator Author

adamliyi commented Jul 7, 2021

perf kvm: Add kvm-stat for arm64: torvalds/linux@1218838#diff-66fa609b54d372aa9f53bec707732f0170dd243c9f0b726be4610367eee07efd . since upstream 5.11

Update: ported to 5.4 and 5.10 kernel, see #84

@adamliyi
Copy link
Collaborator Author

"Guest halt polling": https://www.kernel.org/doc/html/latest/virt/guest-halt-polling.html
Currently, the upstream kernel "guest halt polling" only works for x86, there are patch serials on openeular kernel to enable it on arm64. We need to identify the patch set, backport and test:

https://github.com/openeuler-mirror/kernel:

6ccfaee225f119f3511b431f80ce1d7d66b15551: config: enable CONFIG_CPU_IDLE_GOV_HALTPOLL and CONFIG_HALTPOLL_CPUIDLE for arm

ccdbd7cd609158dd6e820b4f4cb4e67d189413e5: ARM: cpuidle: Add support for cpuidle-haltpoll driver for ARM

0bcb3df2de57ad65d13820ba31ac68fbe1fa4653:cpuidle: haltpoll: Only check boot_option_idle_override in x86

0552e4d5b0f1add075312ab2bbb2ca02bbf1790: arm64: Add some definitions of kvm_para*

0ae410d94910213567da10caa498ff1b1aa32887:cpuidle-haltpoll: Use arch_cpu_idle() to replace default_idle()

25c2eb277e4206df7be74ec2633a95f2f201bf15: arm64: Optimize ttwu IPI

@adamliyi
Copy link
Collaborator Author

adamliyi commented Aug 16, 2021

pci write combine, issue: (67567, 81694, 73179) - released patches for 5.4/5.10 kernel in CC.

@adamliyi
Copy link
Collaborator Author

Review bellow patches (already in ampere centos-8 kernel)

  1. NOUPSTREAM: perf: dsu: Sync the accepted changes from upstream
  2. ACPI/AEST: Initial AEST driver
  3. trace, ras: add ARM RAS extension trace event
  4. NOUPSTREAM: arm64/ras: Treat single-bit ECC error in the MMU TC RAM as fatal
  5. NOUPSTREAM: firmware: Support Ampere Altra CPUECTLR_EL1 config driver
  6. NOUPSTREAM: altra_cpuectlr: Only config the prefetcher bits

@adamliyi adamliyi changed the title kernel patch to be back ported plan: kernel patch to be back ported Sep 13, 2021
@adamliyi adamliyi added patch backport kernel patches to be backported to ampere LTS kernel labels Sep 13, 2021
@adamliyi
Copy link
Collaborator Author

adamliyi commented Oct 18, 2021

561cca1c2ce7 NOUPSTREAM: arm64: mm: Add missing memblock_allow_resize call <------- not necessary, the upstream patch (torvalds/linux@24cc61d) is already in LTS 5.4/5.10 kernel
a2503bad2368 (tag: amp-centos-8.0-20211001) fixup! hwmon: (xgene) restrict power measurements to root access
f1b8f22b8f18 hwmon: (altra) restrict energy measurements to root access
e6db9aabad80 hwmon: (xgene) restrict power measurements to root access

bobolmw pushed a commit to bobolmw/ampere-lts-kernel that referenced this issue Jan 24, 2022
hulk inclusion
category: feature
bugzilla: 51921
CVE: NA

---------------------------

After commit d556e1b ("livepatch: Remove module_disable_ro() usage")
and commit 0d9fbf7 ("module: Remove module_disable_ro()") and
commit e6eff43 ("module: Make module_enable_ro() static again") merged,
the module_disable_ro is removed and module_enable_ro is make static.

It's ok for x86/ppc platform because the livepatch module relocation is
done by text poke func which internally modify the text addr by remap
to high virtaddr which has write permission.

However for arm/arm64 platform, it's apply_relocate[_add] still directly
modify the text code so we should change the module text permission before
relocation. Otherwise it will lead to following problem:

  Unable to handle kernel write to read-only memory at virtual address ffff800008a95288
  Mem abort info:
  ESR = 0x9600004f
  EC = 0x25: DABT (current EL), IL = 32 bits
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
  Data abort info:
  ISV = 0, ISS = 0x0000004f
  CM = 0, WnR = 1
  swapper pgtable: 4k pages, 48-bit VAs, pgdp=000000004133c000
  [ffff800008a95288] pgd=00000000bdfff003, p4d=00000000bdfff003, pud=00000000bdffe003,
		     pmd=0000000080ce7003, pte=0040000080d5d783
  Internal error: Oops: 9600004f [AmpereComputing#1] PREEMPT SMP
  Modules linked in: livepatch_testmod_drv(OK+) testmod_drv(O)
  CPU: 0 PID: 139 Comm: insmod Tainted: G           O  K   5.10.0-01131-gf6b4602e09b2-dirty AmpereComputing#35
  Hardware name: linux,dummy-virt (DT)
  pstate: 80000005 (Nzcv daif -PAN -UAO -TCO BTYPE=--)
  pc : reloc_insn_imm+0x54/0x78
  lr : reloc_insn_imm+0x50/0x78
  sp : ffff800011cf3910
  ...
  Call trace:
   reloc_insn_imm+0x54/0x78
   apply_relocate_add+0x464/0x680
   klp_apply_section_relocs+0x11c/0x148
   klp_enable_patch+0x338/0x998
   patch_init+0x338/0x1000 [livepatch_testmod_drv]
   do_one_initcall+0x60/0x1d8
   do_init_module+0x58/0x1e0
   load_module+0x1fb4/0x2688
   __do_sys_finit_module+0xc0/0x128
   __arm64_sys_finit_module+0x20/0x30
   do_el0_svc+0x84/0x1b0
   el0_svc+0x14/0x20
   el0_sync_handler+0x90/0xc8
   el0_sync+0x158/0x180
   Code: 2a0503e0 9ad42a73 97d6a499 91000673 (b90002a0)
   ---[ end trace 67dd2ef1203ed335 ]---

Though the permission change is not necessary to x86/ppc platform, consider
that the jump_label_register api may modify the text code either, we just
put the change handle here instead of putting it in arch-specific relocate.

Besides, the jump_label_module_nb callback called in jump_label_register
also maybe need motify the module code either, it sort and swap the jump
entries if necessary. So just disable ro before jump_label handling and
restore it back.

Signed-off-by: Dong Kai <[email protected]>

Signed-off-by: Ye Weihua <[email protected]>
Reviewed-by: Yang Jihong <[email protected]>
Signed-off-by: Zheng Zengkai <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport kernel patches to be backported to ampere LTS kernel patch
Projects
None yet
Development

No branches or pull requests

1 participant