Skip to contentSkip to conversation

asmlinkage, kvm: Make kvm_rebooting visible

PATCH In review Andi Kleen 5 participants 31 messages Feb 8, 2014 – Feb 14, 2014

Subsystems (8)
x86 KVM Library code Tracing +4 more subsystems
lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/14 asmlinkage, kvm: Make kvm_rebooting visible

kvm_rebooting is referenced from assembler code, thus needs to be visible.

---
 virt/kvm/kvm_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
virt/kvm/kvm_main.c +1 -1
index 03a0381..b5ec7fb 100644
@@ -102,7 +102,7 @@ static void kvm_release_pfn_dirty(pfn_t pfn);
 static void mark_page_dirty_in_slot(struct kvm *kvm,
 				    struct kvm_memory_slot *memslot, gfn_t gfn);
 
-bool kvm_rebooting;
+__visible bool kvm_rebooting;
 EXPORT_SYMBOL_GPL(kvm_rebooting);
 
 static bool largepages_enabled = true;
Signature · 1 line
1.8.5.2
author
#1 lore raw

PATCH 2/14 asmlinkage: Make __iowrite32_copy visible

This is a assembler function on x86, so it should be visible.

---
 include/linux/io.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/io.h +1 -1
index f4f42fa..8a18e75 100644
@@ -24,7 +24,7 @@
 
 struct device;
 
-void __iowrite32_copy(void __iomem *to, const void *from, size_t count);
+__visible void __iowrite32_copy(void __iomem *to, const void *from, size_t count);
 void __iowrite64_copy(void __iomem *to, const void *from, size_t count);
 
 #ifdef CONFIG_MMU
Signature · 1 line
1.8.5.2
#2 lore raw

[tip:x86/asmlinkage] asmlinkage: Make __iowrite32_copy visible

asmlinkage: Make __iowrite32_copy visible
Commit-ID:  d47d5c8194579bce1d62f88e26fea91d7c553e42
Gitweb:     http://git.kernel.org/tip/d47d5c8194579bce1d62f88e26fea91d7c553e42
Author:     Andi Kleen <[email protected]>
AuthorDate: Sat, 8 Feb 2014 08:51:58 +0100
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Thu, 13 Feb 2014 18:12:04 -0800

asmlinkage: Make __iowrite32_copy visible

This is a assembler function on x86, so it should be visible.

---
 include/linux/io.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/io.h +1 -1
index f4f42fa..8a18e75 100644
@@ -24,7 +24,7 @@
 
 struct device;
 
-void __iowrite32_copy(void __iomem *to, const void *from, size_t count);
+__visible void __iowrite32_copy(void __iomem *to, const void *from, size_t count);
 void __iowrite64_copy(void __iomem *to, const void *from, size_t count);
 
 #ifdef CONFIG_MMU
author
#3 lore raw

PATCH 3/14 asmlinkage: Make jiffies visible

In reply to Andi Kleen

Jiffies is referenced by the linker script, so it has to be visible.

Handled both the generic and the x86 version.

---
 arch/x86/kernel/time.c | 2 +-
 kernel/timer.c         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/time.c +1 -1
index 24d3c91..6ec91c0 100644
@@ -23,7 +23,7 @@
 #include <asm/time.h>
 
 #ifdef CONFIG_X86_64
-DEFINE_VVAR(volatile unsigned long, jiffies) = INITIAL_JIFFIES;
+__visible DEFINE_VVAR(volatile unsigned long, jiffies) = INITIAL_JIFFIES;
 #endif
 
 unsigned long profile_pc(struct pt_regs *regs)
kernel/timer.c +1 -1
index accfd24..d78de04 100644
@@ -52,7 +52,7 @@
 #define CREATE_TRACE_POINTS
 #include <trace/events/timer.h>
 
-u64 jiffies_64 __cacheline_aligned_in_smp = INITIAL_JIFFIES;
+__visible u64 jiffies_64 __cacheline_aligned_in_smp = INITIAL_JIFFIES;
 
 EXPORT_SYMBOL(jiffies_64);
 
Signature · 1 line
1.8.5.2
#4 lore raw

[tip:x86/asmlinkage] asmlinkage: Make jiffies visible

asmlinkage: Make jiffies visible
Commit-ID:  40747ffa5aa8d5b99ca46c696234b9194b59e0ac
Gitweb:     http://git.kernel.org/tip/40747ffa5aa8d5b99ca46c696234b9194b59e0ac
Author:     Andi Kleen <[email protected]>
AuthorDate: Sat, 8 Feb 2014 08:51:59 +0100
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Thu, 13 Feb 2014 18:12:09 -0800

asmlinkage: Make jiffies visible

Jiffies is referenced by the linker script, so it has to be visible.

Handled both the generic and the x86 version.

---
 arch/x86/kernel/time.c | 2 +-
 kernel/timer.c         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/time.c +1 -1
index 24d3c91..6ec91c0 100644
@@ -23,7 +23,7 @@
 #include <asm/time.h>
 
 #ifdef CONFIG_X86_64
-DEFINE_VVAR(volatile unsigned long, jiffies) = INITIAL_JIFFIES;
+__visible DEFINE_VVAR(volatile unsigned long, jiffies) = INITIAL_JIFFIES;
 #endif
 
 unsigned long profile_pc(struct pt_regs *regs)
kernel/timer.c +1 -1
index accfd24..d78de04 100644
@@ -52,7 +52,7 @@
 #define CREATE_TRACE_POINTS
 #include <trace/events/timer.h>
 
-u64 jiffies_64 __cacheline_aligned_in_smp = INITIAL_JIFFIES;
+__visible u64 jiffies_64 __cacheline_aligned_in_smp = INITIAL_JIFFIES;
 
 EXPORT_SYMBOL(jiffies_64);
 
author
#5 lore raw

PATCH 4/14 asmlinkage, pnp: Make variables used from assembler code visible

In reply to Andi Kleen

Mark variables referenced from assembler files visible.

This fixes compile problems with LTO

---
 drivers/pnp/pnpbios/bioscalls.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/pnp/pnpbios/bioscalls.c +5 -4
index 769d265..deb7f4b 100644
@@ -21,7 +21,7 @@
 
 #include "pnpbios.h"
 
-static struct {
+__visible struct {
 	u16 offset;
 	u16 segment;
 } pnp_bios_callpoint;
@@ -41,6 +41,7 @@ asmlinkage void pnp_bios_callfunc(void);
 
 __asm__(".text			\n"
 	__ALIGN_STR "\n"
+	".globl pnp_bios_callfunc\n"
 	"pnp_bios_callfunc:\n"
 	"	pushl %edx	\n"
 	"	pushl %ecx	\n"
@@ -66,9 +67,9 @@ static struct desc_struct bad_bios_desc = GDT_ENTRY_INIT(0x4092,
  * after PnP BIOS oopses.
  */
 
-u32 pnp_bios_fault_esp;
-u32 pnp_bios_fault_eip;
-u32 pnp_bios_is_utter_crap = 0;
+__visible u32 pnp_bios_fault_esp;
+__visible u32 pnp_bios_fault_eip;
+__visible u32 pnp_bios_is_utter_crap = 0;
 
 static spinlock_t pnp_bios_lock;
 
Signature · 1 line
1.8.5.2
#6 lore raw

[tip:x86/asmlinkage] asmlinkage, pnp: Make variables used from assembler code visible

asmlinkage, pnp: Make variables used from assembler code visible
Commit-ID:  a99aa42d0253f033cbb85096d3f2bd82201321e6
Gitweb:     http://git.kernel.org/tip/a99aa42d0253f033cbb85096d3f2bd82201321e6
Author:     Andi Kleen <[email protected]>
AuthorDate: Sat, 8 Feb 2014 08:52:00 +0100
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Thu, 13 Feb 2014 18:12:27 -0800

asmlinkage, pnp: Make variables used from assembler code visible

Mark variables referenced from assembler files visible.

This fixes compile problems with LTO.

---
 drivers/pnp/pnpbios/bioscalls.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/pnp/pnpbios/bioscalls.c +5 -4
index 769d265..deb7f4b 100644
@@ -21,7 +21,7 @@
 
 #include "pnpbios.h"
 
-static struct {
+__visible struct {
 	u16 offset;
 	u16 segment;
 } pnp_bios_callpoint;
@@ -41,6 +41,7 @@ asmlinkage void pnp_bios_callfunc(void);
 
 __asm__(".text			\n"
 	__ALIGN_STR "\n"
+	".globl pnp_bios_callfunc\n"
 	"pnp_bios_callfunc:\n"
 	"	pushl %edx	\n"
 	"	pushl %ecx	\n"
@@ -66,9 +67,9 @@ static struct desc_struct bad_bios_desc = GDT_ENTRY_INIT(0x4092,
  * after PnP BIOS oopses.
  */
 
-u32 pnp_bios_fault_esp;
-u32 pnp_bios_fault_eip;
-u32 pnp_bios_is_utter_crap = 0;
+__visible u32 pnp_bios_fault_esp;
+__visible u32 pnp_bios_fault_eip;
+__visible u32 pnp_bios_is_utter_crap = 0;
 
 static spinlock_t pnp_bios_lock;
 
author
#7 lore raw

PATCH 5/14 asmlinkage: Make lockdep_sys_exit asmlinkage

In reply to Andi Kleen

lockdep_sys_exit can be called from assembler code, so make it asmlinkage

---
 include/linux/lockdep.h  | 2 +-
 kernel/locking/lockdep.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
include/linux/lockdep.h +1 -1
index 92b1bfc..7df9aa6 100644
@@ -265,7 +265,7 @@ extern void lockdep_info(void);
 extern void lockdep_reset(void);
 extern void lockdep_reset_lock(struct lockdep_map *lock);
 extern void lockdep_free_key_range(void *start, unsigned long size);
-extern void lockdep_sys_exit(void);
+extern asmlinkage void lockdep_sys_exit(void);
 
 extern void lockdep_off(void);
 extern void lockdep_on(void);
kernel/locking/lockdep.c +1 -1
index eb8a547..c8b6753c 100644
@@ -4191,7 +4191,7 @@ void debug_show_held_locks(struct task_struct *task)
 }
 EXPORT_SYMBOL_GPL(debug_show_held_locks);
 
-void lockdep_sys_exit(void)
+asmlinkage void lockdep_sys_exit(void)
 {
 	struct task_struct *curr = current;
 
Signature · 1 line
1.8.5.2
#8 lore raw

[tip:x86/asmlinkage] asmlinkage: Make lockdep_sys_exit asmlinkage

asmlinkage: Make lockdep_sys_exit asmlinkage
Commit-ID:  63f9a7fde715352e0769302527670542a664b981
Gitweb:     http://git.kernel.org/tip/63f9a7fde715352e0769302527670542a664b981
Author:     Andi Kleen <[email protected]>
AuthorDate: Sat, 8 Feb 2014 08:52:01 +0100
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Thu, 13 Feb 2014 18:12:54 -0800

asmlinkage: Make lockdep_sys_exit asmlinkage

lockdep_sys_exit can be called from assembler code, so make it asmlinkage.

---
 include/linux/lockdep.h  | 2 +-
 kernel/locking/lockdep.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
include/linux/lockdep.h +1 -1
index 92b1bfc..7df9aa6 100644
@@ -265,7 +265,7 @@ extern void lockdep_info(void);
 extern void lockdep_reset(void);
 extern void lockdep_reset_lock(struct lockdep_map *lock);
 extern void lockdep_free_key_range(void *start, unsigned long size);
-extern void lockdep_sys_exit(void);
+extern asmlinkage void lockdep_sys_exit(void);
 
 extern void lockdep_off(void);
 extern void lockdep_on(void);
kernel/locking/lockdep.c +1 -1
index eb8a547..c8b6753c 100644
@@ -4191,7 +4191,7 @@ void debug_show_held_locks(struct task_struct *task)
 }
 EXPORT_SYMBOL_GPL(debug_show_held_locks);
 
-void lockdep_sys_exit(void)
+asmlinkage void lockdep_sys_exit(void)
 {
 	struct task_struct *curr = current;
 
author
#9 lore raw

PATCH 6/14 asmlinkage: Make trace_hardirq visible

In reply to Andi Kleen

Can be called from assembler code.

---
 kernel/locking/lockdep.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/locking/lockdep.c +2 -2
index c8b6753c..aa3bf15 100644
@@ -2557,7 +2557,7 @@ static void __trace_hardirqs_on_caller(unsigned long ip)
 	debug_atomic_inc(hardirqs_on_events);
 }
 
-void trace_hardirqs_on_caller(unsigned long ip)
+__visible void trace_hardirqs_on_caller(unsigned long ip)
 {
 	time_hardirqs_on(CALLER_ADDR0, ip);
 
@@ -2610,7 +2610,7 @@ EXPORT_SYMBOL(trace_hardirqs_on);
 /*
  * Hardirqs were disabled:
  */
-void trace_hardirqs_off_caller(unsigned long ip)
+__visible void trace_hardirqs_off_caller(unsigned long ip)
 {
 	struct task_struct *curr = current;
 
Signature · 1 line
1.8.5.2
maintainer
#10 lore raw

Re: [PATCH 06/14] asmlinkage: Make trace_hardirq visible

Quoted 1 line · Andi Kleen

Can be called from assembler code.

This lacks context; what does __visible do and why does it matter for asm.

Quoted 32 lines
---
 kernel/locking/lockdep.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/locking/lockdep.c +2 -2
index c8b6753c..aa3bf15 100644
@@ -2557,7 +2557,7 @@ static void __trace_hardirqs_on_caller(unsigned long ip)
 	debug_atomic_inc(hardirqs_on_events);
 }
 
-void trace_hardirqs_on_caller(unsigned long ip)
+__visible void trace_hardirqs_on_caller(unsigned long ip)
 {
 	time_hardirqs_on(CALLER_ADDR0, ip);
 
@@ -2610,7 +2610,7 @@ EXPORT_SYMBOL(trace_hardirqs_on);
 /*
  * Hardirqs were disabled:
  */
-void trace_hardirqs_off_caller(unsigned long ip)
+__visible void trace_hardirqs_off_caller(unsigned long ip)
 {
 	struct task_struct *curr = current;
 
Signature · 1 line
1.8.5.2
#11 lore raw

[tip:x86/asmlinkage] asmlinkage: Make trace_hardirq visible

In reply to Andi Kleen
asmlinkage: Make trace_hardirq visible
Commit-ID:  b35f8305339f1ba3070fe606c6ef0d86ef093dee
Gitweb:     http://git.kernel.org/tip/b35f8305339f1ba3070fe606c6ef0d86ef093dee
Author:     Andi Kleen <[email protected]>
AuthorDate: Sat, 8 Feb 2014 08:52:02 +0100
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Thu, 13 Feb 2014 18:13:07 -0800

asmlinkage: Make trace_hardirq visible

Can be called from assembler code.

---
 kernel/locking/lockdep.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/locking/lockdep.c +2 -2
index c8b6753c..aa3bf15 100644
@@ -2557,7 +2557,7 @@ static void __trace_hardirqs_on_caller(unsigned long ip)
 	debug_atomic_inc(hardirqs_on_events);
 }
 
-void trace_hardirqs_on_caller(unsigned long ip)
+__visible void trace_hardirqs_on_caller(unsigned long ip)
 {
 	time_hardirqs_on(CALLER_ADDR0, ip);
 
@@ -2610,7 +2610,7 @@ EXPORT_SYMBOL(trace_hardirqs_on);
 /*
  * Hardirqs were disabled:
  */
-void trace_hardirqs_off_caller(unsigned long ip)
+__visible void trace_hardirqs_off_caller(unsigned long ip)
 {
 	struct task_struct *curr = current;
 
author
#12 lore raw

PATCH 7/14 asmlinkage, mutex: Mark __visible

In reply to Andi Kleen

Various kernel/mutex.c functions can be called from inline assembler, so they should be all global and __visible

---
 kernel/locking/mutex.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
kernel/locking/mutex.c +5 -5
index 4dd6e4c..adbc0d0 100644
@@ -67,8 +67,7 @@ EXPORT_SYMBOL(__mutex_init);
  * We also put the fastpath first in the kernel image, to make sure the
  * branch is predicted by the CPU as default-untaken.
  */
-static __used noinline void __sched
-__mutex_lock_slowpath(atomic_t *lock_count);
+__visible void __sched __mutex_lock_slowpath(atomic_t *lock_count);
 
 /**
  * mutex_lock - acquire the mutex
@@ -225,7 +224,8 @@ static inline int mutex_can_spin_on_owner(struct mutex *lock)
 }
 #endif
 
-static __used noinline void __sched __mutex_unlock_slowpath(atomic_t *lock_count);
+__visible __used noinline
+void __sched __mutex_unlock_slowpath(atomic_t *lock_count);
 
 /**
  * mutex_unlock - release the mutex
@@ -746,7 +746,7 @@ __mutex_unlock_common_slowpath(atomic_t *lock_count, int nested)
 /*
  * Release the lock, slowpath:
  */
-static __used noinline void
+__visible void
 __mutex_unlock_slowpath(atomic_t *lock_count)
 {
 	__mutex_unlock_common_slowpath(lock_count, 1);
@@ -803,7 +803,7 @@ int __sched mutex_lock_killable(struct mutex *lock)
 }
 EXPORT_SYMBOL(mutex_lock_killable);
 
-static __used noinline void __sched
+__visible void __sched
 __mutex_lock_slowpath(atomic_t *lock_count)
 {
 	struct mutex *lock = container_of(lock_count, struct mutex, count);
Signature · 1 line
1.8.5.2
#13 lore raw

[tip:x86/asmlinkage] asmlinkage, mutex: Mark __visible

asmlinkage, mutex: Mark __visible
Commit-ID:  22d9fd3411c693ccae5f5c2280fb1f9bb106ad4f
Gitweb:     http://git.kernel.org/tip/22d9fd3411c693ccae5f5c2280fb1f9bb106ad4f
Author:     Andi Kleen <[email protected]>
AuthorDate: Sat, 8 Feb 2014 08:52:03 +0100
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Thu, 13 Feb 2014 18:13:19 -0800

asmlinkage, mutex: Mark __visible

Various kernel/mutex.c functions can be called from inline assembler, so they should be all global and __visible.

---
 kernel/locking/mutex.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
kernel/locking/mutex.c +5 -5
index 4dd6e4c..adbc0d0 100644
@@ -67,8 +67,7 @@ EXPORT_SYMBOL(__mutex_init);
  * We also put the fastpath first in the kernel image, to make sure the
  * branch is predicted by the CPU as default-untaken.
  */
-static __used noinline void __sched
-__mutex_lock_slowpath(atomic_t *lock_count);
+__visible void __sched __mutex_lock_slowpath(atomic_t *lock_count);
 
 /**
  * mutex_lock - acquire the mutex
@@ -225,7 +224,8 @@ static inline int mutex_can_spin_on_owner(struct mutex *lock)
 }
 #endif
 
-static __used noinline void __sched __mutex_unlock_slowpath(atomic_t *lock_count);
+__visible __used noinline
+void __sched __mutex_unlock_slowpath(atomic_t *lock_count);
 
 /**
  * mutex_unlock - release the mutex
@@ -746,7 +746,7 @@ __mutex_unlock_common_slowpath(atomic_t *lock_count, int nested)
 /*
  * Release the lock, slowpath:
  */
-static __used noinline void
+__visible void
 __mutex_unlock_slowpath(atomic_t *lock_count)
 {
 	__mutex_unlock_common_slowpath(lock_count, 1);
@@ -803,7 +803,7 @@ int __sched mutex_lock_killable(struct mutex *lock)
 }
 EXPORT_SYMBOL(mutex_lock_killable);
 
-static __used noinline void __sched
+__visible void __sched
 __mutex_lock_slowpath(atomic_t *lock_count)
 {
 	struct mutex *lock = container_of(lock_count, struct mutex, count);
author
#14 lore raw

PATCH 8/14 asmlinkage: Make main_extable_sort_needed visible

In reply to Andi Kleen

main_extable_sort_needed is used by the build system and needs to be a normal ELF symbol. Make it visible so that LTO does not remove or mangle it.

---
 kernel/extable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/extable.c +1 -1
index 763faf0..d8a6446 100644
@@ -36,7 +36,7 @@ extern struct exception_table_entry __start___ex_table[];
 extern struct exception_table_entry __stop___ex_table[];
 
 /* Cleared by build time tools if the table is already sorted. */
-u32 __initdata main_extable_sort_needed = 1;
+u32 __initdata __visible main_extable_sort_needed = 1;
 
 /* Sort the kernel's built-in exception table */
 void __init sort_main_extable(void)
Signature · 1 line
1.8.5.2
#15 lore raw

[tip:x86/asmlinkage] asmlinkage: Make main_extable_sort_needed visible

asmlinkage: Make main_extable_sort_needed visible
Commit-ID:  00b7103078596a243c16239004e0dc9416910f13
Gitweb:     http://git.kernel.org/tip/00b7103078596a243c16239004e0dc9416910f13
Author:     Andi Kleen <[email protected]>
AuthorDate: Sat, 8 Feb 2014 08:52:04 +0100
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Thu, 13 Feb 2014 18:13:22 -0800

asmlinkage: Make main_extable_sort_needed visible

main_extable_sort_needed is used by the build system and needs to be a normal ELF symbol. Make it visible so that LTO does not remove or mangle it.

---
 kernel/extable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/extable.c +1 -1
index 763faf0..d8a6446 100644
@@ -36,7 +36,7 @@ extern struct exception_table_entry __start___ex_table[];
 extern struct exception_table_entry __stop___ex_table[];
 
 /* Cleared by build time tools if the table is already sorted. */
-u32 __initdata main_extable_sort_needed = 1;
+u32 __initdata __visible main_extable_sort_needed = 1;
 
 /* Sort the kernel's built-in exception table */
 void __init sort_main_extable(void)
author
#16 lore raw

PATCH 9/14 asmlinkage: Mark rwsem functions that can be called from assembler asmlinkage

In reply to Andi Kleen
---
 kernel/locking/rwsem-xadd.c | 4 ++++
 1 file changed, 4 insertions(+)
kernel/locking/rwsem-xadd.c +4 -0
index 19c5fa9..1d66e08 100644
@@ -143,6 +143,7 @@ __rwsem_do_wake(struct rw_semaphore *sem, enum rwsem_wake_type wake_type)
 /*
  * wait for the read lock to be granted
  */
+__visible
 struct rw_semaphore __sched *rwsem_down_read_failed(struct rw_semaphore *sem)
 {
 	long count, adjustment = -RWSEM_ACTIVE_READ_BIAS;
@@ -190,6 +191,7 @@ struct rw_semaphore __sched *rwsem_down_read_failed(struct rw_semaphore *sem)
 /*
  * wait until we successfully acquire the write lock
  */
+__visible
 struct rw_semaphore __sched *rwsem_down_write_failed(struct rw_semaphore *sem)
 {
 	long count, adjustment = -RWSEM_ACTIVE_WRITE_BIAS;
@@ -252,6 +254,7 @@ struct rw_semaphore __sched *rwsem_down_write_failed(struct rw_semaphore *sem)
  * handle waking up a waiter on the semaphore
  * - up_read/up_write has decremented the active part of count if we come here
  */
+__visible
 struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem)
 {
 	unsigned long flags;
@@ -272,6 +275,7 @@ struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem)
  * - caller incremented waiting part of count and discovered it still negative
  * - just wake up any readers at the front of the queue
  */
+__visible
 struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem)
 {
 	unsigned long flags;
Signature · 1 line
1.8.5.2
#17 lore raw

[tip:x86/asmlinkage] asmlinkage: Mark rwsem functions that can be called from assembler asmlinkage

asmlinkage: Mark rwsem functions that can be called from assembler asmlinkage
Commit-ID:  3ebae4f3a2e746ae17f25c741e249294e7d6d7c2
Gitweb:     http://git.kernel.org/tip/3ebae4f3a2e746ae17f25c741e249294e7d6d7c2
Author:     Andi Kleen <[email protected]>
AuthorDate: Sat, 8 Feb 2014 08:52:05 +0100
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Thu, 13 Feb 2014 18:13:37 -0800

asmlinkage: Mark rwsem functions that can be called from assembler asmlinkage

Mark the rwsem functions that can be called from assembler asmlinkage.

---
 kernel/locking/rwsem-xadd.c | 4 ++++
 1 file changed, 4 insertions(+)
kernel/locking/rwsem-xadd.c +4 -0
index 19c5fa9..1d66e08 100644
@@ -143,6 +143,7 @@ __rwsem_do_wake(struct rw_semaphore *sem, enum rwsem_wake_type wake_type)
 /*
  * wait for the read lock to be granted
  */
+__visible
 struct rw_semaphore __sched *rwsem_down_read_failed(struct rw_semaphore *sem)
 {
 	long count, adjustment = -RWSEM_ACTIVE_READ_BIAS;
@@ -190,6 +191,7 @@ struct rw_semaphore __sched *rwsem_down_read_failed(struct rw_semaphore *sem)
 /*
  * wait until we successfully acquire the write lock
  */
+__visible
 struct rw_semaphore __sched *rwsem_down_write_failed(struct rw_semaphore *sem)
 {
 	long count, adjustment = -RWSEM_ACTIVE_WRITE_BIAS;
@@ -252,6 +254,7 @@ struct rw_semaphore __sched *rwsem_down_write_failed(struct rw_semaphore *sem)
  * handle waking up a waiter on the semaphore
  * - up_read/up_write has decremented the active part of count if we come here
  */
+__visible
 struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem)
 {
 	unsigned long flags;
@@ -272,6 +275,7 @@ struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem)
  * - caller incremented waiting part of count and discovered it still negative
  * - just wake up any readers at the front of the queue
  */
+__visible
 struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem)
 {
 	unsigned long flags;
author
#18 lore raw

PATCH 10/14 asmlinkage Make __stack_chk_failed and memcmp visible

In reply to Andi Kleen

In LTO symbols implicitely referenced by the compiler need to be visible. Earlier these symbols were visible implicitely from being exported, but we disabled implicit visibility fo
EXPORTs when modules are disabled to improve code size. So
now these symbols have to be marked visible explicitely.

Do this for __stack_chk_fail (with stack protector) and memcmp.

---
 kernel/panic.c | 2 +-
 lib/string.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
kernel/panic.c +1 -1
index 6d63003..3eb0ffb 100644
@@ -459,7 +459,7 @@ EXPORT_SYMBOL(warn_slowpath_null);
  * Called when gcc's -fstack-protector feature is used, and
  * gcc detects corruption of the on-stack canary value
  */
-void __stack_chk_fail(void)
+__visible void __stack_chk_fail(void)
 {
 	panic("stack-protector: Kernel stack is corrupted in: %p\n",
 		__builtin_return_address(0));
lib/string.c +1 -1
index e5878de..9b1f906 100644
@@ -648,7 +648,7 @@ EXPORT_SYMBOL(memmove);
  * @count: The size of the area.
  */
 #undef memcmp
-int memcmp(const void *cs, const void *ct, size_t count)
+__visible int memcmp(const void *cs, const void *ct, size_t count)
 {
 	const unsigned char *su1, *su2;
 	int res = 0;
Signature · 1 line
1.8.5.2
#19 lore raw

[tip:x86/asmlinkage] asmlinkage Make __stack_chk_failed and memcmp visible

asmlinkage Make __stack_chk_failed and memcmp visible
Commit-ID:  a7330c997d0f74d909a7d3553b1d550d8be2b61a
Gitweb:     http://git.kernel.org/tip/a7330c997d0f74d909a7d3553b1d550d8be2b61a
Author:     Andi Kleen <[email protected]>
AuthorDate: Sat, 8 Feb 2014 08:52:06 +0100
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Thu, 13 Feb 2014 18:13:43 -0800

asmlinkage Make __stack_chk_failed and memcmp visible

In LTO symbols implicitely referenced by the compiler need to be visible. Earlier these symbols were visible implicitely from being exported, but we disabled implicit visibility fo
EXPORTs when modules are disabled to improve code size. So
now these symbols have to be marked visible explicitely.

Do this for __stack_chk_fail (with stack protector) and memcmp.

---
 kernel/panic.c | 2 +-
 lib/string.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
kernel/panic.c +1 -1
index 6d63003..3eb0ffb 100644
@@ -459,7 +459,7 @@ EXPORT_SYMBOL(warn_slowpath_null);
  * Called when gcc's -fstack-protector feature is used, and
  * gcc detects corruption of the on-stack canary value
  */
-void __stack_chk_fail(void)
+__visible void __stack_chk_fail(void)
 {
 	panic("stack-protector: Kernel stack is corrupted in: %p\n",
 		__builtin_return_address(0));
lib/string.c +1 -1
index e5878de..9b1f906 100644
@@ -648,7 +648,7 @@ EXPORT_SYMBOL(memmove);
  * @count: The size of the area.
  */
 #undef memcmp
-int memcmp(const void *cs, const void *ct, size_t count)
+__visible int memcmp(const void *cs, const void *ct, size_t count)
 {
 	const unsigned char *su1, *su2;
 	int res = 0;
author
#20 lore raw

PATCH 11/14 asmlinkage, x86: Fix 32bit memcpy for LTO

In reply to Andi Kleen

These functions can be called implicitely from gcc, and thus need to be visible.

---
 arch/x86/lib/memcpy_32.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/lib/memcpy_32.c +3 -3
index e78761d..a404b4b 100644
@@ -4,7 +4,7 @@
 #undef memcpy
 #undef memset
 
-void *memcpy(void *to, const void *from, size_t n)
+__visible void *memcpy(void *to, const void *from, size_t n)
 {
 #ifdef CONFIG_X86_USE_3DNOW
 	return __memcpy3d(to, from, n);
@@ -14,13 +14,13 @@ void *memcpy(void *to, const void *from, size_t n)
 }
 EXPORT_SYMBOL(memcpy);
 
-void *memset(void *s, int c, size_t count)
+__visible void *memset(void *s, int c, size_t count)
 {
 	return __memset(s, c, count);
 }
 EXPORT_SYMBOL(memset);
 
-void *memmove(void *dest, const void *src, size_t n)
+__visible void *memmove(void *dest, const void *src, size_t n)
 {
 	int d0,d1,d2,d3,d4,d5;
 	char *ret = dest;
Signature · 1 line
1.8.5.2
#21 lore raw

[tip:x86/asmlinkage] asmlinkage, x86: Fix 32bit memcpy for LTO

asmlinkage, x86: Fix 32bit memcpy for LTO
Commit-ID:  a9143296dd612dceb0765229ccfb13fd642e2840
Gitweb:     http://git.kernel.org/tip/a9143296dd612dceb0765229ccfb13fd642e2840
Author:     Andi Kleen <[email protected]>
AuthorDate: Sat, 8 Feb 2014 08:52:07 +0100
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Thu, 13 Feb 2014 18:14:46 -0800

asmlinkage, x86: Fix 32bit memcpy for LTO

These functions can be called implicitely from gcc, and thus need to be visible.

---
 arch/x86/lib/memcpy_32.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/lib/memcpy_32.c +3 -3
index e78761d..a404b4b 100644
@@ -4,7 +4,7 @@
 #undef memcpy
 #undef memset
 
-void *memcpy(void *to, const void *from, size_t n)
+__visible void *memcpy(void *to, const void *from, size_t n)
 {
 #ifdef CONFIG_X86_USE_3DNOW
 	return __memcpy3d(to, from, n);
@@ -14,13 +14,13 @@ void *memcpy(void *to, const void *from, size_t n)
 }
 EXPORT_SYMBOL(memcpy);
 
-void *memset(void *s, int c, size_t count)
+__visible void *memset(void *s, int c, size_t count)
 {
 	return __memset(s, c, count);
 }
 EXPORT_SYMBOL(memset);
 
-void *memmove(void *dest, const void *src, size_t n)
+__visible void *memmove(void *dest, const void *src, size_t n)
 {
 	int d0,d1,d2,d3,d4,d5;
 	char *ret = dest;
author
#22 lore raw

PATCH 12/14 asmlinkage: Make trace_hardirqs_on/off_caller visible

In reply to Andi Kleen

These functions are called from assembler, and thus need to be __visible

Cc Steven Rostedt <[email protected]>
---
 kernel/trace/trace_irqsoff.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/trace_irqsoff.c +2 -2
index 2aefbee..887ef88 100644
@@ -498,14 +498,14 @@ void trace_hardirqs_off(void)
 }
 EXPORT_SYMBOL(trace_hardirqs_off);
 
-void trace_hardirqs_on_caller(unsigned long caller_addr)
+__visible void trace_hardirqs_on_caller(unsigned long caller_addr)
 {
 	if (!preempt_trace() && irq_trace())
 		stop_critical_timing(CALLER_ADDR0, caller_addr);
 }
 EXPORT_SYMBOL(trace_hardirqs_on_caller);
 
-void trace_hardirqs_off_caller(unsigned long caller_addr)
+__visible void trace_hardirqs_off_caller(unsigned long caller_addr)
 {
 	if (!preempt_trace() && irq_trace())
 		start_critical_timing(CALLER_ADDR0, caller_addr);
Signature · 1 line
1.8.5.2
#23 lore raw

[tip:x86/asmlinkage] asmlinkage: Make trace_hardirqs_on/ off_caller visible

asmlinkage: Make trace_hardirqs_on/off_caller visible
Commit-ID:  285c00adf651c9b1d6c73d5eee482d2a617a64c1
Gitweb:     http://git.kernel.org/tip/285c00adf651c9b1d6c73d5eee482d2a617a64c1
Author:     Andi Kleen <[email protected]>
AuthorDate: Sat, 8 Feb 2014 08:52:08 +0100
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Thu, 13 Feb 2014 18:14:54 -0800

asmlinkage: Make trace_hardirqs_on/off_caller visible

These functions are called from assembler, and thus need to be __visible.

---
 kernel/trace/trace_irqsoff.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/trace_irqsoff.c +2 -2
index 2aefbee..887ef88 100644
@@ -498,14 +498,14 @@ void trace_hardirqs_off(void)
 }
 EXPORT_SYMBOL(trace_hardirqs_off);
 
-void trace_hardirqs_on_caller(unsigned long caller_addr)
+__visible void trace_hardirqs_on_caller(unsigned long caller_addr)
 {
 	if (!preempt_trace() && irq_trace())
 		stop_critical_timing(CALLER_ADDR0, caller_addr);
 }
 EXPORT_SYMBOL(trace_hardirqs_on_caller);
 
-void trace_hardirqs_off_caller(unsigned long caller_addr)
+__visible void trace_hardirqs_off_caller(unsigned long caller_addr)
 {
 	if (!preempt_trace() && irq_trace())
 		start_critical_timing(CALLER_ADDR0, caller_addr);
author
#24 lore raw

PATCH 13/14 initconst: Fix initconst mistake in dcdbas

In reply to Andi Kleen

const must be __initconst

---
 drivers/firmware/dcdbas.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/dcdbas.c +1 -1
index 1b5e8e4..7160c43 100644
@@ -584,7 +584,7 @@ static struct platform_driver dcdbas_driver = {
 	.remove		= dcdbas_remove,
 };
 
-static const struct platform_device_info dcdbas_dev_info __initdata = {
+static const struct platform_device_info dcdbas_dev_info __initconst = {
 	.name		= DRIVER_NAME,
 	.id		= -1,
 	.dma_mask	= DMA_BIT_MASK(32),
Signature · 1 line
1.8.5.2
#25 lore raw

[tip:x86/asmlinkage] initconst: Fix initconst mistake in dcdbas

initconst: Fix initconst mistake in dcdbas
Commit-ID:  3be5588ad5c2628c8aa4a578bcbb114fa2b49260
Gitweb:     http://git.kernel.org/tip/3be5588ad5c2628c8aa4a578bcbb114fa2b49260
Author:     Andi Kleen <[email protected]>
AuthorDate: Sat, 8 Feb 2014 08:52:09 +0100
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Thu, 13 Feb 2014 18:14:54 -0800

initconst: Fix initconst mistake in dcdbas

const must be __initconst.

---
 drivers/firmware/dcdbas.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/dcdbas.c +1 -1
index 1b5e8e4..7160c43 100644
@@ -584,7 +584,7 @@ static struct platform_driver dcdbas_driver = {
 	.remove		= dcdbas_remove,
 };
 
-static const struct platform_device_info dcdbas_dev_info __initdata = {
+static const struct platform_device_info dcdbas_dev_info __initconst = {
 	.name		= DRIVER_NAME,
 	.id		= -1,
 	.dma_mask	= DMA_BIT_MASK(32),
author
#26 lore raw

PATCH 14/14 initconst, x86: Fix initconst mistake in ts5500 code

In reply to Andi Kleen

const data must be initconst.

---
 arch/x86/platform/ts5500/ts5500.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/platform/ts5500/ts5500.c +1 -1
index 39febb2..9471b94 100644
@@ -88,7 +88,7 @@ struct ts5500_sbc {
 static const struct {
 	const char * const string;
 	const ssize_t offset;
-} ts5500_signatures[] __initdata = {
+} ts5500_signatures[] __initconst = {
 	{ "TS-5x00 AMD Elan", 0xb14 },
 };
 
Signature · 1 line
1.8.5.2
#27 lore raw

[tip:x86/asmlinkage] initconst, x86: Fix initconst mistake in ts5500 code

initconst, x86: Fix initconst mistake in ts5500 code
Commit-ID:  634676c203f130c8efa138296c2efba219821346
Gitweb:     http://git.kernel.org/tip/634676c203f130c8efa138296c2efba219821346
Author:     Andi Kleen <[email protected]>
AuthorDate: Sat, 8 Feb 2014 08:52:10 +0100
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Thu, 13 Feb 2014 18:14:54 -0800

initconst, x86: Fix initconst mistake in ts5500 code

const data must be initconst.

---
 arch/x86/platform/ts5500/ts5500.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/platform/ts5500/ts5500.c +1 -1
index 39febb2..9471b94 100644
@@ -88,7 +88,7 @@ struct ts5500_sbc {
 static const struct {
 	const char * const string;
 	const ssize_t offset;
-} ts5500_signatures[] __initdata = {
+} ts5500_signatures[] __initconst = {
 	{ "TS-5x00 AMD Elan", 0xb14 },
 };
 
maintainer Acked-by on v1 1/14
#28 lore raw
In reply to Andi Kleen

Il 08/02/2014 08:51, Andi Kleen ha scritto:

Quoted 17 lines

kvm_rebooting is referenced from assembler code, thus needs to be visible.

---
 virt/kvm/kvm_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
virt/kvm/kvm_main.c +0 -0
index 03a0381..b5ec7fb 100644

virt/kvm/kvm_main.c static void kvm_release_pfn_dirty(pfn_t pfn); · line 108

Quoted 8 lines
virt/kvm/kvm_main.c +1 -1
@@ -102,7 +102,7 @@ static void kvm_release_pfn_dirty(pfn_t pfn);
 static void mark_page_dirty_in_slot(struct kvm *kvm,
 				    struct kvm_memory_slot *memslot, gfn_t gfn);
 
-bool kvm_rebooting;
+__visible bool kvm_rebooting;
 EXPORT_SYMBOL_GPL(kvm_rebooting);
 
 static bool largepages_enabled = true;
maintainer
#29 lore raw
In reply to Andi Kleen
Quoted 2 lines · On Sat, 8 Feb 2014 08:51:57 +0100 Andi Kleen <[email protected]> wrote:

kvm_rebooting is referenced from assembler code, thus needs to be visible.

So I read the gcc page and looked at the __visible definition but I still don't really get it. What goes wrong if the __visible isn't present on these referenced-from-asm identifiers?

Quoted 2 lines

Grumble. Email addresses go into commits with display names and <>. At least, 89.3% of them do. Some sucker has to go through these and fix them up. I'd prefer it not be me ;)

Quoted 14 lines

...

virt/kvm/kvm_main.c +1 -1
@@ -102,7 +102,7 @@ static void kvm_release_pfn_dirty(pfn_t pfn);
 static void mark_page_dirty_in_slot(struct kvm *kvm,
 				    struct kvm_memory_slot *memslot, gfn_t gfn);
 
-bool kvm_rebooting;
+__visible bool kvm_rebooting;
 EXPORT_SYMBOL_GPL(kvm_rebooting);
 
 static bool largepages_enabled = true;
#30 lore raw
In reply to Andi Kleen
asmlinkage, kvm: Make kvm_rebooting visible
Commit-ID:  52480137d82062bb8d0fb778cb9934667958e367
Gitweb:     http://git.kernel.org/tip/52480137d82062bb8d0fb778cb9934667958e367
Author:     Andi Kleen <[email protected]>
AuthorDate: Sat, 8 Feb 2014 08:51:57 +0100
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Thu, 13 Feb 2014 18:11:56 -0800

asmlinkage, kvm: Make kvm_rebooting visible

kvm_rebooting is referenced from assembler code, thus needs to be visible.

---
 virt/kvm/kvm_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
virt/kvm/kvm_main.c +1 -1
index 03a0381..b5ec7fb 100644
@@ -102,7 +102,7 @@ static void kvm_release_pfn_dirty(pfn_t pfn);
 static void mark_page_dirty_in_slot(struct kvm *kvm,
 				    struct kvm_memory_slot *memslot, gfn_t gfn);
 
-bool kvm_rebooting;
+__visible bool kvm_rebooting;
 EXPORT_SYMBOL_GPL(kvm_rebooting);
 
 static bool largepages_enabled = true;