Skip to contentSkip to conversation

arm64: asm-offsets: clenups

PATCH Applied Mark Rutland 3 participants 10 messages Oct 7, 2024 – Oct 17, 2024 arm64

lore
Share & tools
lore

Mark Rutland

author reviewer
#0 lore raw

cover arm64: asm-offsets: clenups

This series removes a number of unused asm-offsets entries. This is purely a cleanup.

This is arragned as a series of patches rather than one big patch for easier bisection and/or backporting, and so that each removal can be explained independently.

There should be no functional change as a result of this series.

Mark.

Mark Rutland (7):
arm64: asm-offsets: remove TSK_ACTIVE_MM
arm64: asm-offsets: remove VMA_VM_*
arm64: asm-offsets: remove COMPAT_{RT_,SIGFRAME_REGS_OFFSET
arm64: asm-offsets: remove MM_CONTEXT_ID
arm64: asm-offsets: remove VM_EXEC and PAGE_SZ
arm64: asm-offsets: remove DMA_{TO,FROM}_DEVICE
arm64: asm-offsets: remove PREEMPT_DISABLE_OFFSET

 arch/arm64/include/asm/assembler.h |  7 -------
 arch/arm64/kernel/asm-offsets.c    | 24 ------------------------
 2 files changed, 31 deletions(-)
Signature · 1 line
2.30.2
author reviewer
#1 lore raw

PATCH 1/7 arm64: asm-offsets: remove TSK_ACTIVE_MM

The TSK_ACTIVE_MM definition isn't used anywhere.

Remove it.

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/kernel/asm-offsets.c | 2 --
 1 file changed, 2 deletions(-)
arch/arm64/kernel/asm-offsets.c +0 -2
index 27de1dddb0abe..42fd36027545b 100644
@@ -28,8 +28,6 @@
 
 int main(void)
 {
-  DEFINE(TSK_ACTIVE_MM,		offsetof(struct task_struct, active_mm));
-  BLANK();
   DEFINE(TSK_TI_CPU,		offsetof(struct task_struct, thread_info.cpu));
   DEFINE(TSK_TI_FLAGS,		offsetof(struct task_struct, thread_info.flags));
   DEFINE(TSK_TI_PREEMPT,	offsetof(struct task_struct, thread_info.preempt_count));
Signature · 1 line
2.30.2
author reviewer
#2 lore raw

PATCH 2/7 arm64: asm-offsets: remove VMA_VM_*

In reply to Mark Rutland

The VMA_VM_MM definition is only used by the vma_vm_mm macro, which itself is unused. The VMA_VM_FLAGS definition isn't used anywhere.

Remove them all.

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/include/asm/assembler.h | 7 -------
 arch/arm64/kernel/asm-offsets.c    | 3 ---
 2 files changed, 10 deletions(-)
arch/arm64/include/asm/assembler.h +0 -7
index bc0b0d75acef7..3d8d534a7a77c 100644
@@ -248,13 +248,6 @@ alternative_endif
 	ldr	\dst, [\dst, \tmp]
 	.endm
 
-/*
- * vma_vm_mm - get mm pointer from vma pointer (vma->vm_mm)
- */
-	.macro	vma_vm_mm, rd, rn
-	ldr	\rd, [\rn, #VMA_VM_MM]
-	.endm
-
 /*
  * read_ctr - read CTR_EL0. If the system has mismatched register fields,
  * provide the system wide safe value from arm64_ftr_reg_ctrel0.sys_val
arch/arm64/kernel/asm-offsets.c +0 -3
index 42fd36027545b..5f8b83915fac6 100644
@@ -104,9 +104,6 @@ int main(void)
 #endif
   DEFINE(MM_CONTEXT_ID,		offsetof(struct mm_struct, context.id.counter));
   BLANK();
-  DEFINE(VMA_VM_MM,		offsetof(struct vm_area_struct, vm_mm));
-  DEFINE(VMA_VM_FLAGS,		offsetof(struct vm_area_struct, vm_flags));
-  BLANK();
   DEFINE(VM_EXEC,	       	VM_EXEC);
   BLANK();
   DEFINE(PAGE_SZ,	       	PAGE_SIZE);
Signature · 1 line
2.30.2
author reviewer
#3 lore raw

PATCH 3/7 arm64: asm-offsets: remove COMPAT_{RT_,SIGFRAME_REGS_OFFSET

In reply to Mark Rutland

The COMPAT_SIGFRAME_REGS_OFFSET and COMPAT_RT_SIGFRAME_REGS_OFFSET defintions aren't used anywhere.

They were added in commit:

f14d8025d263f3c8 ("arm64: compat: Generate asm offsets for signals")

... and subsequently their only user was removed in commit:

2d071968a4052e58 ("arm64: compat: Remove 32-bit sigreturn code from the vDSO")

... leaving them unused.

Remove them.

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/kernel/asm-offsets.c | 6 ------
 1 file changed, 6 deletions(-)
arch/arm64/kernel/asm-offsets.c +0 -6
index 5f8b83915fac6..520914b901a28 100644
@@ -20,7 +20,6 @@
 #include <asm/fixmap.h>
 #include <asm/thread_info.h>
 #include <asm/memory.h>
-#include <asm/signal32.h>
 #include <asm/smp_plat.h>
 #include <asm/suspend.h>
 #include <linux/kbuild.h>
@@ -96,11 +95,6 @@ int main(void)
 #endif
   DEFINE(FREGS_SIZE,		sizeof(struct ftrace_regs));
   BLANK();
-#endif
-#ifdef CONFIG_COMPAT
-  DEFINE(COMPAT_SIGFRAME_REGS_OFFSET,		offsetof(struct compat_sigframe, uc.uc_mcontext.arm_r0));
-  DEFINE(COMPAT_RT_SIGFRAME_REGS_OFFSET,	offsetof(struct compat_rt_sigframe, sig.uc.uc_mcontext.arm_r0));
-  BLANK();
 #endif
   DEFINE(MM_CONTEXT_ID,		offsetof(struct mm_struct, context.id.counter));
   BLANK();
Signature · 1 line
2.30.2
author reviewer
#4 lore raw

PATCH 4/7 arm64: asm-offsets: remove MM_CONTEXT_ID

In reply to Mark Rutland

The only user of the MM_CONTEXT_ID defintion was removed in commit:

25b92693a1b67a47 ("arm64: mm: convert cpu_do_switch_mm() to C")

Remove MM_CONTEXT_ID.

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/kernel/asm-offsets.c | 2 --
 1 file changed, 2 deletions(-)
arch/arm64/kernel/asm-offsets.c +0 -2
index 520914b901a28..e6a6b5160f75e 100644
@@ -96,8 +96,6 @@ int main(void)
   DEFINE(FREGS_SIZE,		sizeof(struct ftrace_regs));
   BLANK();
 #endif
-  DEFINE(MM_CONTEXT_ID,		offsetof(struct mm_struct, context.id.counter));
-  BLANK();
   DEFINE(VM_EXEC,	       	VM_EXEC);
   BLANK();
   DEFINE(PAGE_SZ,	       	PAGE_SIZE);
Signature · 1 line
2.30.2
author reviewer
#5 lore raw

PATCH 5/7 arm64: asm-offsets: remove VM_EXEC and PAGE_SZ

In reply to Mark Rutland

The VM_EXEC definition duplicates the common VM_EXEC definition from <linux/mm.h>. The common definition cannot safely be included by assembly code but currently we don't need to use VM_EXEC in assembly.

The PAGE_SZ definition duplicates arm64's definition of PAGE_SIZE from <asm/page-def.h> which can safely be included from assembly code and should be used directly.

Remove the duplicate definitions.

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/kernel/asm-offsets.c | 4 ----
 1 file changed, 4 deletions(-)
arch/arm64/kernel/asm-offsets.c +0 -4
index e6a6b5160f75e..7c7c8d98256f9 100644
@@ -96,10 +96,6 @@ int main(void)
   DEFINE(FREGS_SIZE,		sizeof(struct ftrace_regs));
   BLANK();
 #endif
-  DEFINE(VM_EXEC,	       	VM_EXEC);
-  BLANK();
-  DEFINE(PAGE_SZ,	       	PAGE_SIZE);
-  BLANK();
   DEFINE(DMA_TO_DEVICE,		DMA_TO_DEVICE);
   DEFINE(DMA_FROM_DEVICE,	DMA_FROM_DEVICE);
   BLANK();
Signature · 1 line
2.30.2
author reviewer
#6 lore raw

PATCH 6/7 arm64: asm-offsets: remove DMA_{TO,FROM}_DEVICE

In reply to Mark Rutland

The DMA_TO_DEVICE and DMA_FROM_DEVICE defintitons in asm-offsets duplicate the common defintions from <linux/dma-direction.h> (which used to live in <linux/dma-mapping.h>), and haven't been used from asseembly code since commit:

7eacf1858bc86fe9 ("arm64: mm: Remove assembly DMA cache maintenance wrappers")

Remove them both.

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/kernel/asm-offsets.c | 4 ----
 1 file changed, 4 deletions(-)
arch/arm64/kernel/asm-offsets.c +0 -4
index 7c7c8d98256f9..e5ffdc0163aad 100644
@@ -12,7 +12,6 @@
 #include <linux/ftrace.h>
 #include <linux/kexec.h>
 #include <linux/mm.h>
-#include <linux/dma-mapping.h>
 #include <linux/kvm_host.h>
 #include <linux/preempt.h>
 #include <linux/suspend.h>
@@ -96,9 +95,6 @@ int main(void)
   DEFINE(FREGS_SIZE,		sizeof(struct ftrace_regs));
   BLANK();
 #endif
-  DEFINE(DMA_TO_DEVICE,		DMA_TO_DEVICE);
-  DEFINE(DMA_FROM_DEVICE,	DMA_FROM_DEVICE);
-  BLANK();
   DEFINE(PREEMPT_DISABLE_OFFSET, PREEMPT_DISABLE_OFFSET);
   BLANK();
   DEFINE(CPU_BOOT_TASK,		offsetof(struct secondary_data, task));
Signature · 1 line
2.30.2
author reviewer
#7 lore raw

PATCH 7/7 arm64: asm-offsets: remove PREEMPT_DISABLE_OFFSET

In reply to Mark Rutland

The PREEMPT_DISABLE_OFFSET definition was added in commit:

24534b3511828c66 ("arm64: assembler: add macros to conditionally yield the NEON under PREEMPT")

... but hasn't been used since commit:

3931261ecf46151a ("arm64: fpsimd: Bring cond_yield asm macro in line with new rules")

Remove PREEMPT_DISABLE_OFFSET.

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/kernel/asm-offsets.c | 3 ---
 1 file changed, 3 deletions(-)
arch/arm64/kernel/asm-offsets.c +0 -3
index e5ffdc0163aad..cb2e9567dca94 100644
@@ -13,7 +13,6 @@
 #include <linux/kexec.h>
 #include <linux/mm.h>
 #include <linux/kvm_host.h>
-#include <linux/preempt.h>
 #include <linux/suspend.h>
 #include <asm/cpufeature.h>
 #include <asm/fixmap.h>
@@ -95,8 +94,6 @@ int main(void)
   DEFINE(FREGS_SIZE,		sizeof(struct ftrace_regs));
   BLANK();
 #endif
-  DEFINE(PREEMPT_DISABLE_OFFSET, PREEMPT_DISABLE_OFFSET);
-  BLANK();
   DEFINE(CPU_BOOT_TASK,		offsetof(struct secondary_data, task));
   BLANK();
   DEFINE(FTR_OVR_VAL_OFFSET,	offsetof(struct arm64_ftr_override, val));
Signature · 1 line
2.30.2
maintainer Applied
#8 lore raw
In reply to Mark Rutland
Quoted 8 lines · Mark Rutland

This series removes a number of unused asm-offsets entries. This is purely a cleanup.

This is arragned as a series of patches rather than one big patch for easier bisection and/or backporting, and so that each removal can be explained independently.

[...]

Applied to arm64 (for-next/asm-offsets), thanks!

[1/7] arm64: asm-offsets: remove TSK_ACTIVE_MM

      https://git.kernel.org/arm64/c/ab23df141f53
[2/7] arm64: asm-offsets: remove VMA_VM_*
      https://git.kernel.org/arm64/c/7bd8870af8dd
[3/7] arm64: asm-offsets: remove COMPAT_{RT_,SIGFRAME_REGS_OFFSET
      https://git.kernel.org/arm64/c/4c92c121c402
[4/7] arm64: asm-offsets: remove MM_CONTEXT_ID
      https://git.kernel.org/arm64/c/1abc7c1e5933
[5/7] arm64: asm-offsets: remove VM_EXEC and PAGE_SZ
      https://git.kernel.org/arm64/c/4ce689b4480a
[6/7] arm64: asm-offsets: remove DMA_{TO,FROM}_DEVICE
      https://git.kernel.org/arm64/c/b129125e1f96
[7/7] arm64: asm-offsets: remove PREEMPT_DISABLE_OFFSET
      https://git.kernel.org/arm64/c/7bb32dc788dd
Signature · 1 line
Catalin
Reviewed-by on the v1 series
#9 lore raw
In reply to Mark Rutland
Quoted 11 lines · Mark Rutland

This series removes a number of unused asm-offsets entries. This is purely a cleanup.

This is arragned as a series of patches rather than one big patch for easier bisection and/or backporting, and so that each removal can be explained independently.

There should be no functional change as a result of this series.

Mark.

Quoted 8 lines

Mark Rutland (7):
arm64: asm-offsets: remove TSK_ACTIVE_MM
arm64: asm-offsets: remove VMA_VM_*
arm64: asm-offsets: remove COMPAT_{RT_,SIGFRAME_REGS_OFFSET
arm64: asm-offsets: remove MM_CONTEXT_ID
arm64: asm-offsets: remove VM_EXEC and PAGE_SZ
arm64: asm-offsets: remove DMA_{TO,FROM}_DEVICE
arm64: asm-offsets: remove PREEMPT_DISABLE_OFFSET

I see Catalin has already merged these, but for what it's worth, the series looks good to me. And it means I can remove a patch from my boot-time page size series.

Quoted 5 lines
 arch/arm64/include/asm/assembler.h |  7 -------
 arch/arm64/kernel/asm-offsets.c    | 24 ------------------------
 2 files changed, 31 deletions(-)