Skip to contentSkip to conversation

powerpc/64s: Mark 'dummy_copy_buffer' as used

PATCH In review Mathieu Malaterre 4 participants 5 messages Mar 12, 2019 – May 3, 2019 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/64s: Mark 'dummy_copy_buffer' as used

In commit 07d2a628bc00 ("powerpc/64s: Avoid cpabort in context switch when possible") a buffer 'dummy_copy_buffer' was introduced. gcc does not see this buffer being used in the inline assembly within function '__switch_to', explicitly marked this variable as being used.

Prefer using '__aligned' to get passed line over 80 characters warning in checkpatch.

This remove the following warning:

arch/powerpc/kernel/process.c:1156:17: error: 'dummy_copy_buffer' defined but not used [-Werror=unused-const-variable=]

---
 arch/powerpc/kernel/process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/process.c +1 -1
index 77e44275d025..5acf63d45802 100644
@@ -1153,7 +1153,7 @@ static inline void restore_sprs(struct thread_struct *old_thread,
 
 #ifdef CONFIG_PPC_BOOK3S_64
 #define CP_SIZE 128
-static const u8 dummy_copy_buffer[CP_SIZE] __attribute__((aligned(CP_SIZE)));
+static const u8 dummy_copy_buffer[CP_SIZE] __aligned(CP_SIZE) __used;
 #endif
 
 struct task_struct *__switch_to(struct task_struct *prev,
Signature · 1 line
2.20.1
#1 lore raw
Quoted 7 lines · Mathieu Malaterre

In commit 07d2a628bc00 ("powerpc/64s: Avoid cpabort in context switch when possible") a buffer 'dummy_copy_buffer' was introduced. gcc does not see this buffer being used in the inline assembly within function '__switch_to', explicitly marked this variable as being used.

Prefer using '__aligned' to get passed line over 80 characters warning in checkpatch.

Powerpc accepts 90 characters, use arch/powerpc/tools/checkpatch.sh

Quoted 4 lines

This remove the following warning:

arch/powerpc/kernel/process.c:1156:17: error: 'dummy_copy_buffer' defined but not used [-Werror=unused-const-variable=]

commit 2bf1071a8d50 ("powerpc/64s: Remove POWER9 DD1 support") has removed the fonction using 'dummy_copy_buffer' so you should remove it completely.

Christophe

Quoted 21 lines
---
  arch/powerpc/kernel/process.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/process.c +1 -1
index 77e44275d025..5acf63d45802 100644
@@ -1153,7 +1153,7 @@ static inline void restore_sprs(struct thread_struct *old_thread,
 
  #ifdef CONFIG_PPC_BOOK3S_64
  #define CP_SIZE 128
-static const u8 dummy_copy_buffer[CP_SIZE] __attribute__((aligned(CP_SIZE)));
+static const u8 dummy_copy_buffer[CP_SIZE] __aligned(CP_SIZE) __used;
  #endif
 
  struct task_struct *__switch_to(struct task_struct *prev,
#2 lore raw
Quoted 12 lines · Christophe Leroy
Quoted 7 lines · Mathieu Malaterre

In commit 07d2a628bc00 ("powerpc/64s: Avoid cpabort in context switch when possible") a buffer 'dummy_copy_buffer' was introduced. gcc does not see this buffer being used in the inline assembly within function '__switch_to', explicitly marked this variable as being used.

Prefer using '__aligned' to get passed line over 80 characters warning in checkpatch.

Powerpc accepts 90 characters, use arch/powerpc/tools/checkpatch.sh

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

This remove the following warning:

arch/powerpc/kernel/process.c:1156:17: error: 'dummy_copy_buffer' defined but not used [-Werror=unused-const-variable=]

commit 2bf1071a8d50 ("powerpc/64s: Remove POWER9 DD1 support") has removed the fonction using 'dummy_copy_buffer' so you should remove it completely.

Yes that would be better, thanks.

cheers

#3 lore raw

PATCH v2 1/1 powerpc/64s: Remove 'dummy_copy_buffer'

In reply to Mathieu Malaterre

In commit 2bf1071a8d50 ("powerpc/64s: Remove POWER9 DD1 support") the function __switch_to remove usage for 'dummy_copy_buffer'. Since it is not used anywhere else, remove it completely.

This remove the following warning:

arch/powerpc/kernel/process.c:1156:17: error: 'dummy_copy_buffer' defined but not used [-Werror=unused-const-variable=]

---
v2: complely remove dummy_copy_buffer instead of marking it as used (since not anymore)

 arch/powerpc/kernel/process.c | 5 -----
 1 file changed, 5 deletions(-)
arch/powerpc/kernel/process.c +0 -5
index 77e44275d025..b2f0daa2fcf1 100644
@@ -1151,11 +1151,6 @@ static inline void restore_sprs(struct thread_struct *old_thread,
 	thread_pkey_regs_restore(new_thread, old_thread);
 }
 
-#ifdef CONFIG_PPC_BOOK3S_64
-#define CP_SIZE 128
-static const u8 dummy_copy_buffer[CP_SIZE] __attribute__((aligned(CP_SIZE)));
-#endif
-
 struct task_struct *__switch_to(struct task_struct *prev,
 	struct task_struct *new)
 {
Signature · 1 line
2.20.1
#4 lore raw

Re: [PATCH v2] powerpc/64s: Remove 'dummy_copy_buffer'

Quoted 11 lines · Mathieu Malaterre

In commit 2bf1071a8d50 ("powerpc/64s: Remove POWER9 DD1 support") the function __switch_to remove usage for 'dummy_copy_buffer'. Since it is not used anywhere else, remove it completely.

This remove the following warning:

arch/powerpc/kernel/process.c:1156:17: error: 'dummy_copy_buffer' defined but not used [-Werror=unused-const-variable=]

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/a5ae043de7678f189303559782f60570

cheers