2014-02-27 11:11:09

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 01/46] kernel: Move prototype declaration to header file include/linux/thread_info.h

Move prototype declaration to header file include/linux/thread_info.h
from arch/mn10300/include/asm/thread_info.h and
arch/tile/include/asm/thread_info.h because it is used by more than one
file.
Also, include the header file in kernel/fork.c,
arch/mn10300/kernel/kgdb.c and arch/tile/kernel/process.c.

This also eliminates the following warning in kernel/fork.c:
kernel/fork.c:136:13: warning: no previous prototype for ‘arch_release_thread_info’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
arch/mn10300/include/asm/thread_info.h | 3 ---
arch/mn10300/kernel/kgdb.c | 1 +
arch/tile/include/asm/thread_info.h | 2 --
arch/tile/kernel/process.c | 1 +
include/linux/thread_info.h | 2 ++
kernel/fork.c | 1 +
6 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/mn10300/include/asm/thread_info.h b/arch/mn10300/include/asm/thread_info.h
index bf280ea..3a4efbe 100644
--- a/arch/mn10300/include/asm/thread_info.h
+++ b/arch/mn10300/include/asm/thread_info.h
@@ -120,9 +120,6 @@ static inline unsigned long current_stack_pointer(void)
return sp;
}

-#ifndef CONFIG_KGDB
-void arch_release_thread_info(struct thread_info *ti);
-#endif
#define get_thread_info(ti) get_task_struct((ti)->task)
#define put_thread_info(ti) put_task_struct((ti)->task)

diff --git a/arch/mn10300/kernel/kgdb.c b/arch/mn10300/kernel/kgdb.c
index 9977082..1f4ed5d 100644
--- a/arch/mn10300/kernel/kgdb.c
+++ b/arch/mn10300/kernel/kgdb.c
@@ -13,6 +13,7 @@
#include <linux/ptrace.h>
#include <linux/kgdb.h>
#include <linux/uaccess.h>
+#include <linux/thread_info.h>
#include <unit/leds.h>
#include <unit/serial.h>
#include <asm/debugger.h>
diff --git a/arch/tile/include/asm/thread_info.h b/arch/tile/include/asm/thread_info.h
index 729aa10..5f204bd 100644
--- a/arch/tile/include/asm/thread_info.h
+++ b/arch/tile/include/asm/thread_info.h
@@ -83,8 +83,6 @@ struct thread_info {

#ifndef __ASSEMBLY__

-void arch_release_thread_info(struct thread_info *info);
-
/* How to get the thread information struct from C. */
register unsigned long stack_pointer __asm__("sp");

diff --git a/arch/tile/kernel/process.c b/arch/tile/kernel/process.c
index 16ed589..5f44885 100644
--- a/arch/tile/kernel/process.c
+++ b/arch/tile/kernel/process.c
@@ -27,6 +27,7 @@
#include <linux/kernel.h>
#include <linux/tracehook.h>
#include <linux/signal.h>
+#include <linux/thread_info.h>
#include <asm/stack.h>
#include <asm/switch_to.h>
#include <asm/homecache.h>
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index fddbe20..b03a087 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -118,6 +118,8 @@ static inline __deprecated void set_need_resched(void)
*/
}

+void arch_release_thread_info(struct thread_info *ti);
+
#define tif_need_resched() test_thread_flag(TIF_NEED_RESCHED)

#if defined TIF_RESTORE_SIGMASK && !defined HAVE_SET_RESTORE_SIGMASK
diff --git a/kernel/fork.c b/kernel/fork.c
index a17621c..962046c 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -71,6 +71,7 @@
#include <linux/signalfd.h>
#include <linux/uprobes.h>
#include <linux/aio.h>
+#include <linux/thread_info.h>

#include <asm/pgtable.h>
#include <asm/pgalloc.h>
--
1.7.9.5


2014-02-27 11:11:16

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 02/46] kernel: Add prototype definition to include/linux/kernel.h

Add prototype declaration to header file include/linux/kernel.h because
it is used by more than one file.

This also eliminates the following warning in kernel/panic.c:
kernel/panic.c:55:13: warning: no previous prototype for ‘panic_smp_self_stop’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
arch/tile/kernel/smp.c | 1 +
include/linux/kernel.h | 2 ++
kernel/panic.c | 1 +
3 files changed, 4 insertions(+)

diff --git a/arch/tile/kernel/smp.c b/arch/tile/kernel/smp.c
index 01e8ab2..8b645fd 100644
--- a/arch/tile/kernel/smp.c
+++ b/arch/tile/kernel/smp.c
@@ -19,6 +19,7 @@
#include <linux/io.h>
#include <linux/irq.h>
#include <linux/module.h>
+#include <linux/kernel.h>
#include <asm/cacheflush.h>
#include <asm/homecache.h>

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 196d1ea..c7cee7d 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -154,6 +154,8 @@ struct completion;
struct pt_regs;
struct user;

+void __weak panic_smp_self_stop(void);
+
#ifdef CONFIG_PREEMPT_VOLUNTARY
extern int _cond_resched(void);
# define might_resched() _cond_resched()
diff --git a/kernel/panic.c b/kernel/panic.c
index 6d63003..14e08c2 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -23,6 +23,7 @@
#include <linux/sysrq.h>
#include <linux/init.h>
#include <linux/nmi.h>
+#include <linux/kernel.h>

#define PANIC_TIMER_STEP 100
#define PANIC_BLINK_SPD 18
--
1.7.9.5

2014-02-27 11:12:51

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 03/46] kernel: Move prototype declaration to header file include/linux/cpu.h

Add prototype declaration to header file include/linux/cpu.h because
they are used by more than one file.

This eliminates the following warning in kernel/cpu.c:
kernel/cpu.c:512:13: warning: no previous prototype for ‘arch_enable_nonboot_cpus_begin’ [-Wmissing-prototypes]
kernel/cpu.c:516:13: warning: no previous prototype for ‘arch_enable_nonboot_cpus_end’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
arch/x86/kernel/smpboot.c | 1 +
include/linux/cpu.h | 2 ++
2 files changed, 3 insertions(+)

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index a32da80..e428764 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -49,6 +49,7 @@
#include <linux/bootmem.h>
#include <linux/err.h>
#include <linux/nmi.h>
+#include <linux/cpu.h>
#include <linux/tboot.h>
#include <linux/stackprotector.h>
#include <linux/gfp.h>
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 03e235ad..9f633b0 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -38,6 +38,8 @@ extern void cpu_remove_dev_attr(struct device_attribute *attr);

extern int cpu_add_dev_attr_group(struct attribute_group *attrs);
extern void cpu_remove_dev_attr_group(struct attribute_group *attrs);
+void arch_enable_nonboot_cpus_begin(void);
+void arch_enable_nonboot_cpus_end(void);

#ifdef CONFIG_HOTPLUG_CPU
extern void unregister_cpu(struct cpu *cpu);
--
1.7.9.5

2014-02-27 11:14:57

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 04/46] kernel: Mark function as static in kernel/resource.c

Mark function as static in kernel/resource.c because it is not used
outside this file.

This eliminates the following warning in kernel/resource.c:
kernel/resource.c:518:5: warning: no previous prototype for ‘reallocate_resource’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/resource.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/resource.c b/kernel/resource.c
index 3f285dc..ede7db2 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -515,9 +515,9 @@ static int find_resource(struct resource *root, struct resource *new,
* @newsize: new size of the resource descriptor
* @constraint: the size and alignment constraints to be met.
*/
-int reallocate_resource(struct resource *root, struct resource *old,
- resource_size_t newsize,
- struct resource_constraint *constraint)
+static int reallocate_resource(struct resource *root, struct resource *old,
+ resource_size_t newsize,
+ struct resource_constraint *constraint)
{
int err=0;
struct resource new = *old;
--
1.7.9.5

2014-02-27 11:30:19

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 06/46] kernel: Include appropriate header file in kernel/debug/kdb/kdb_keyboard.c

Include appropriate header file kernel/debug/kdb/kdb_private.h in
kernel/debug/kdb/kdb_keyboard.c because it contains prototype definition
of functions defined in kernel/debug/kdb/kdb_keyboard.c.

This eliminates the following warning in
kernel/debug/kdb/kdb_keyboard.c:
kernel/debug/kdb/kdb_keyboard.c:199:6: warning: no previous prototype for ‘kdb_kbd_cleanup_state’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/debug/kdb/kdb_keyboard.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/kernel/debug/kdb/kdb_keyboard.c b/kernel/debug/kdb/kdb_keyboard.c
index 118527a..f1405da 100644
--- a/kernel/debug/kdb/kdb_keyboard.c
+++ b/kernel/debug/kdb/kdb_keyboard.c
@@ -14,6 +14,8 @@
#include <linux/module.h>
#include <linux/io.h>

+#include "kdb_private.h"
+
/* Keyboard Controller Registers on normal PCs. */

#define KBD_STATUS_REG 0x64 /* Status register (R) */
--
1.7.9.5

2014-02-27 11:31:28

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 05/46] kernel: Include appropriate header file in kernel/signal.c

Include appropriate header file kernel/debug/kdb/kdb_private.h in
kernel/signal.c because it contains prototype definitions of functions
declared in kernel/signal.c.

Also, include include/linux/kdb.h in
include/linux/kdb_private.h to remove the following errors:
kernel/debug/kdb/kdb_private.h:172:2: error: unknown type name ‘kdb_func_t’
kernel/debug/kdb/kdb_private.h:178:2: error: unknown type name ‘kdb_repeat_t’
kernel/debug/kdb/kdb_private.h:196:5: error: expected ‘)’ before ‘int’
Inclusion of kdb.h is necessary because it typedefs the above keywords.

This eliminates the following warning in kernel/signal.c:
kernel/signal.c:3640:1: warning: no previous prototype for ‘kdb_send_sig_info’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/debug/kdb/kdb_private.h | 1 +
kernel/signal.c | 1 +
2 files changed, 2 insertions(+)

diff --git a/kernel/debug/kdb/kdb_private.h b/kernel/debug/kdb/kdb_private.h
index 7afd3c8..e7f2c35 100644
--- a/kernel/debug/kdb/kdb_private.h
+++ b/kernel/debug/kdb/kdb_private.h
@@ -13,6 +13,7 @@
*/

#include <linux/kgdb.h>
+#include <linux/kdb.h>
#include "../debug_core.h"

/* Kernel Debugger Command codes. Must not overlap with error codes. */
diff --git a/kernel/signal.c b/kernel/signal.c
index 52f881d..aa1cc60 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -42,6 +42,7 @@
#include <asm/siginfo.h>
#include <asm/cacheflush.h>
#include "audit.h" /* audit_signal_info() */
+#include "debug/kdb/kdb_private.h"

/*
* SLAB caches for signal bits.
--
1.7.9.5

2014-02-27 11:35:07

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 08/46] kernel: MOve prototype declaration to header file include/linux/perf_event.h

Add prototype declaration of function to header file
include/linux/perf_event.h because it is used by more than one file.

This eliminates the following warning in kernel/events/core.c:
kernel/events/core.c:3743:13: warning: no previous prototype for ‘arch_perf_update_userpage’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
include/linux/perf_event.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index e56b07f..b9e1673 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -526,6 +526,8 @@ struct perf_output_handle {
int page;
};

+void arch_perf_update_userpage(struct perf_event_mmap_page *userpg, u64 now);
+
#ifdef CONFIG_PERF_EVENTS

extern int perf_pmu_register(struct pmu *pmu, const char *name, int type);
--
1.7.9.5

2014-02-27 11:35:14

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 09/46] kernel: Move prototype declaration to header file include/linux/hw_breakpoint.h

Add prototype declaration of function to header file
include/linux/hw_breakpoint.h because it is used by more than one file.

This eliminates the following warning in kernel/events/hw_breakpoint.c:
kernel/events/hw_breakpoint.c:231:13: warning: no previous prototype for ‘arch_unregister_hw_breakpoint’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
include/linux/hw_breakpoint.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/include/linux/hw_breakpoint.h b/include/linux/hw_breakpoint.h
index 0464c85..9ff0155 100644
--- a/include/linux/hw_breakpoint.h
+++ b/include/linux/hw_breakpoint.h
@@ -67,6 +67,8 @@ register_wide_hw_breakpoint(struct perf_event_attr *attr,
perf_overflow_handler_t triggered,
void *context);

+void arch_unregister_hw_breakpoint(struct perf_event *bp);
+
extern int register_perf_hw_breakpoint(struct perf_event *bp);
extern int __register_perf_hw_breakpoint(struct perf_event *bp);
extern void unregister_hw_breakpoint(struct perf_event *bp);
--
1.7.9.5

2014-02-27 11:38:50

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 10/46] kernel: Mark function as static in events/hw_breakpoint.c

Mark functions as static in kernel/events/hw_breakpoint.c because it is
not used outside this file.

This eliminates the following warning in kernel/events/hw_breakpoint.c:
kernel/events/hw_breakpoint.c:83:12: warning: no previous prototype for ‘hw_breakpoint_weight’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/events/hw_breakpoint.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c
index 1559fb0..c044eaf 100644
--- a/kernel/events/hw_breakpoint.c
+++ b/kernel/events/hw_breakpoint.c
@@ -80,7 +80,7 @@ struct bp_busy_slots {
/* Serialize accesses to the above constraints */
static DEFINE_MUTEX(nr_bp_mutex);

-__weak int hw_breakpoint_weight(struct perf_event *bp)
+static int hw_breakpoint_weight(struct perf_event *bp)
{
return 1;
}
--
1.7.9.5

2014-02-27 11:39:12

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 11/46] kernel: Add prototype declaration in kernel/gcov/base.c

Add prototype declarations of functions in kernel/gcov/base.c. These
functions are required by GCC builtins and hence can not be removed
despite of their unreferenced appearance in kernel source.

This eliminates the following warning in kernel/gcov/base.c:
kernel/gcov/base.c:30:6: warning: no previous prototype for ‘__gcov_init’ [-Wmissing-prototypes]
kernel/gcov/base.c:58:6: warning: no previous prototype for ‘__gcov_flush’ [-Wmissing-prototypes]
kernel/gcov/base.c:64:6: warning: no previous prototype for ‘__gcov_merge_add’ [-Wmissing-prototypes]
kernel/gcov/base.c:70:6: warning: no previous prototype for ‘__gcov_merge_single’ [-Wmissing-prototypes]
kernel/gcov/base.c:76:6: warning: no previous prototype for‘__gcov_merge_delta’ [-Wmissing-prototypes]
kernel/gcov/base.c:82:6: warning: no previous prototype for ‘__gcov_merge_ior’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
---
kernel/gcov/base.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/kernel/gcov/base.c b/kernel/gcov/base.c
index f45b75b..c0cb53a 100644
--- a/kernel/gcov/base.c
+++ b/kernel/gcov/base.c
@@ -27,6 +27,7 @@ static DEFINE_MUTEX(gcov_lock);
* __gcov_init is called by gcc-generated constructor code for each object
* file compiled with -fprofile-arcs.
*/
+void __gcov_init(struct gcov_info *info);
void __gcov_init(struct gcov_info *info)
{
static unsigned int gcov_version;
@@ -55,30 +56,35 @@ EXPORT_SYMBOL(__gcov_init);
* These functions may be referenced by gcc-generated profiling code but serve
* no function for kernel profiling.
*/
+void __gcov_flush(void);
void __gcov_flush(void)
{
/* Unused. */
}
EXPORT_SYMBOL(__gcov_flush);

+void __gcov_merge_add(gcov_type *counters, unsigned int n_counters);
void __gcov_merge_add(gcov_type *counters, unsigned int n_counters)
{
/* Unused. */
}
EXPORT_SYMBOL(__gcov_merge_add);

+void __gcov_merge_single(gcov_type *counters, unsigned int n_counters);
void __gcov_merge_single(gcov_type *counters, unsigned int n_counters)
{
/* Unused. */
}
EXPORT_SYMBOL(__gcov_merge_single);

+void __gcov_merge_delta(gcov_type *counters, unsigned int n_counters);
void __gcov_merge_delta(gcov_type *counters, unsigned int n_counters)
{
/* Unused. */
}
EXPORT_SYMBOL(__gcov_merge_delta);

+void __gcov_merge_ior(gcov_type *counters, unsigned int n_counters);
void __gcov_merge_ior(gcov_type *counters, unsigned int n_counters)
{
/* Unused. */
--
1.7.9.5

2014-02-27 11:40:23

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 12/46] kernel: Include appropriate header file in kernel/irq/irqdomain.c

Include appropriate header file include/linux/of_irq.h in
kernel/irq/irqdomain.c because it contains prototype definition of
function define in kernel/irq/irqdomain.c.

This eliminates the following warning in kernel/irq/irqdomain.c:
kernel/irq/irqdomain.c:468:14: warning: no previous prototype for ‘irq_create_of_mapping’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/irq/irqdomain.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index cf68bb3..f140337 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -10,6 +10,7 @@
#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/of_address.h>
+#include <linux/of_irq.h>
#include <linux/topology.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
--
1.7.9.5

2014-02-27 11:41:30

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 07/46] kernel: Mark functions as static and remove unused function in events/core.c

Mark functions as static in kernel/events/core.c because they are not
used outside this file. Also, remove unused function in
kernel/events/core.c.

This eliminates the following warning in kernel/events/core.c:
kernel/events/core.c:182:6: warning: no previous prototype for ‘update_perf_cpu_limits’ [-Wmissing-prototypes]
kernel/events/core.c:470:6: warning: no previous prototype for ‘perf_cgroup_switch’ [-Wmissing-prototypes]
kernel/events/core.c:781:6: warning: no previous prototype for ‘perf_cpu_hrtimer_cancel’ [-Wmissing-prototypes]
kernel/events/core.c:6574:13: warning: no previous prototype for ‘perf_init_event’ [-Wmissing-prototypes]
kernel/events/core.c:7707:5: warning: no previous prototype for ‘perf_event_init_context’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/events/core.c | 36 ++++--------------------------------
1 file changed, 4 insertions(+), 32 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 56003c6..672e51f 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -179,7 +179,7 @@ static int perf_sample_period_ns __read_mostly = DEFAULT_SAMPLE_PERIOD_NS;
static int perf_sample_allowed_ns __read_mostly =
DEFAULT_SAMPLE_PERIOD_NS * DEFAULT_CPU_TIME_MAX_PERCENT / 100;

-void update_perf_cpu_limits(void)
+static void update_perf_cpu_limits(void)
{
u64 tmp = perf_sample_period_ns;

@@ -467,7 +467,7 @@ perf_cgroup_set_timestamp(struct task_struct *task,
* mode SWOUT : schedule out everything
* mode SWIN : schedule in based on cgroup for next
*/
-void perf_cgroup_switch(struct task_struct *task, int mode)
+static void perf_cgroup_switch(struct task_struct *task, int mode)
{
struct perf_cpu_context *cpuctx;
struct pmu *pmu;
@@ -777,34 +777,6 @@ static enum hrtimer_restart perf_cpu_hrtimer_handler(struct hrtimer *hr)
return ret;
}

-/* CPU is going down */
-void perf_cpu_hrtimer_cancel(int cpu)
-{
- struct perf_cpu_context *cpuctx;
- struct pmu *pmu;
- unsigned long flags;
-
- if (WARN_ON(cpu != smp_processor_id()))
- return;
-
- local_irq_save(flags);
-
- rcu_read_lock();
-
- list_for_each_entry_rcu(pmu, &pmus, entry) {
- cpuctx = this_cpu_ptr(pmu->pmu_cpu_context);
-
- if (pmu->task_ctx_nr == perf_sw_context)
- continue;
-
- hrtimer_cancel(&cpuctx->hrtimer);
- }
-
- rcu_read_unlock();
-
- local_irq_restore(flags);
-}
-
static void __perf_cpu_hrtimer_init(struct perf_cpu_context *cpuctx, int cpu)
{
struct hrtimer *hr = &cpuctx->hrtimer;
@@ -6571,7 +6543,7 @@ void perf_pmu_unregister(struct pmu *pmu)
free_pmu_context(pmu);
}

-struct pmu *perf_init_event(struct perf_event *event)
+static struct pmu *perf_init_event(struct perf_event *event)
{
struct pmu *pmu = NULL;
int idx;
@@ -7704,7 +7676,7 @@ inherit_task_group(struct perf_event *event, struct task_struct *parent,
/*
* Initialize the perf_event context in task_struct
*/
-int perf_event_init_context(struct task_struct *child, int ctxn)
+static int perf_event_init_context(struct task_struct *child, int ctxn)
{
struct perf_event_context *child_ctx, *parent_ctx;
struct perf_event_context *cloned_ctx;
--
1.7.9.5

2014-02-27 11:44:09

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 13/46] kernel: Move prototype declaration to header file kernel/locking/lockdep_internals.h

Move prototype declaration of functions to header file
kernel/locking/lockdep_internals.h because they are used by more than
one file.

This eliminates the following warning in kernel/locking/lockdep.c:
kernel/locking/lockdep.c:2560:6: warning: no previous prototype for ‘trace_hardirqs_on_caller’ [-Wmissing-prototypes]
kernel/locking/lockdep.c:2613:6: warning: no previous prototype for ‘trace_hardirqs_off_caller’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/locking/lockdep_internals.h | 3 +++
1 file changed, 3 insertions(+)

diff --git a/kernel/locking/lockdep_internals.h b/kernel/locking/lockdep_internals.h
index 4f560cf..81390ab 100644
--- a/kernel/locking/lockdep_internals.h
+++ b/kernel/locking/lockdep_internals.h
@@ -70,6 +70,9 @@ enum {
extern struct list_head all_lock_classes;
extern struct lock_chain lock_chains[];

+void trace_hardirqs_on_caller(unsigned long ip);
+void trace_hardirqs_off_caller(unsigned long ip);
+
#define LOCK_USAGE_CHARS (1+LOCK_USAGE_STATES/2)

extern void get_usage_chars(struct lock_class *class,
--
1.7.9.5

2014-02-27 11:46:06

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 15/46] kernel: Include appropriate header file in kernel/power/wakelock.c

Include appropriate header file kernel/power/power.h in
kernel/power/wakelock.c because it has prototype declaration of function
defined in kernel/power/wakelock.c.

This eliminates the following warning in kernel/power/wakelock.c:
kernel/power/wakelock.c:34:9: warning: no previous prototype for ‘pm_show_wakelocks’ [-Wmissing-prototypes]
kernel/power/wakelock.c:184:5: warning: no previous prototype for ‘pm_wake_lock’ [-Wmissing-prototypes]
kernel/power/wakelock.c:232:5: warning: no previous prototype for ‘pm_wake_unlock’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/power/wakelock.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/kernel/power/wakelock.c b/kernel/power/wakelock.c
index 8f50de3..019069c 100644
--- a/kernel/power/wakelock.c
+++ b/kernel/power/wakelock.c
@@ -18,6 +18,8 @@
#include <linux/rbtree.h>
#include <linux/slab.h>

+#include "power.h"
+
static DEFINE_MUTEX(wakelocks_lock);

struct wakelock {
--
1.7.9.5

2014-02-27 11:46:15

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 14/46] kernel: Move prototype declaration to header file kernel/power/power.h

Move prototype declaration of function to header file
kernel/power/power.h
because it is used by more than one file.

This eliminates the following warning in kernel/power/snapshot.c:
kernel/power/snapshot.c:1588:16: warning: no previous prototype for ‘swsusp_save’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/power/power.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/kernel/power/power.h b/kernel/power/power.h
index 7d4b7ff..1ca7531 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -49,6 +49,8 @@ static inline char *check_image_kernel(struct swsusp_info *info)
*/
#define SPARE_PAGES ((1024 * 1024) >> PAGE_SHIFT)

+asmlinkage int swsusp_save(void);
+
/* kernel/power/hibernate.c */
extern bool freezer_test_done;

--
1.7.9.5

2014-02-27 11:47:13

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 16/46] kernel: Mark function as static in kernel/rcu/torture.c

Mark functions as static in kernel/rcu/torture.c because they are not
used outside this file.

This eliminates the following warning in kernel/rcu/torture.c:
kernel/rcu/torture.c:902:6: warning: no previous prototype for ‘rcutorture_trace_dump’ [-Wmissing-prototypes]
kernel/rcu/torture.c:1572:6: warning: no previous prototype for ‘rcu_torture_barrier_cbf’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/rcu/torture.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/rcu/torture.c b/kernel/rcu/torture.c
index 732f8ae..dd3a431 100644
--- a/kernel/rcu/torture.c
+++ b/kernel/rcu/torture.c
@@ -899,7 +899,7 @@ rcu_torture_fakewriter(void *arg)
return 0;
}

-void rcutorture_trace_dump(void)
+static void rcutorture_trace_dump(void)
{
static atomic_t beenhere = ATOMIC_INIT(0);

@@ -1569,7 +1569,7 @@ static void rcu_torture_stall_cleanup(void)
}

/* Callback function for RCU barrier testing. */
-void rcu_torture_barrier_cbf(struct rcu_head *rcu)
+static void rcu_torture_barrier_cbf(struct rcu_head *rcu)
{
atomic_inc(&barrier_cbs_invoked);
}
--
1.7.9.5

2014-02-27 11:51:14

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 17/46] kernel: Move prototype declaration to appropriate header file from kernel/stop_machine.c

Move prototype declaration to header file include/linux/sched.h from
kernel/stop_machine.c because they are used by more than one file.

This eliminates the following warning in kernel/sched/core.c:
kernel/sched/core.c:851:6: warning: no previous prototype for ‘sched_set_stop_task’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
include/linux/sched.h | 2 +-
kernel/stop_machine.c | 2 --
2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index a781dec..fac6f9d 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -170,7 +170,6 @@ extern unsigned long nr_iowait(void);
extern unsigned long nr_iowait_cpu(int cpu);
extern unsigned long this_cpu_load(void);

-
extern void calc_global_load(unsigned long ticks);
extern void update_cpu_load_nohz(void);

@@ -187,6 +186,7 @@ extern void proc_sched_set_task(struct task_struct *p);
extern void
print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq);
#endif
+void sched_set_stop_task(int cpu, struct task_struct *stop);

/*
* Task state bitmask. NOTE! These bits are also
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
index 84571e0..d9a5c80 100644
--- a/kernel/stop_machine.c
+++ b/kernel/stop_machine.c
@@ -485,8 +485,6 @@ repeat:
}
}

-extern void sched_set_stop_task(int cpu, struct task_struct *stop);
-
static void cpu_stop_create(unsigned int cpu)
{
sched_set_stop_task(cpu, per_cpu(cpu_stopper_task, cpu));
--
1.7.9.5

2014-02-27 11:52:15

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 19/46] kernel: Include appropriate header file in locking/rtmutex-tester.c

Include appropriate header file kernel/locking/rtmutex_common.h in
kernel/locking/rtmutex-tester.c because it has prototype declaration of
function define din kernel/locking/rtmutex-tester.c.

This eliminates the following warning in
kernel/locking/rtmutex-tester.c:
kernel/locking/rtmutex-tester.c:139:6: warning: no previous prototype for ‘schedule_rt_mutex_test’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/locking/rtmutex-tester.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/locking/rtmutex-tester.c b/kernel/locking/rtmutex-tester.c
index 1d96dd0..b17eef2 100644
--- a/kernel/locking/rtmutex-tester.c
+++ b/kernel/locking/rtmutex-tester.c
@@ -16,7 +16,7 @@
#include <linux/freezer.h>
#include <linux/stat.h>

-#include "rtmutex.h"
+#include "rtmutex_common.h"

#define MAX_RT_TEST_THREADS 8
#define MAX_RT_TEST_MUTEXES 8
--
1.7.9.5

2014-02-27 11:52:36

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 18/46] kernel: Mark functions as static in sched/fair.c

Mark functions as static in kernel/sched/fair.c because they are not
used outside this file.

This eliminates the following warning in kernel/sched/fair.c:
kernel/sched/fair.c:1658:6: warning: no previous prototype for ‘task_numa_work’ [-Wmissing-prototypes]
kernel/sched/fair.c:1780:6: warning: no previous prototype for ‘task_tick_numa’ [-Wmissing-prototypes]
kernel/sched/fair.c:5269:22: warning: no previous prototype for ‘arch_scale_smt_power’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/sched/fair.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 966cc2b..fc8aff0 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1655,7 +1655,7 @@ static void reset_ptenuma_scan(struct task_struct *p)
* The expensive part of numa migration is done from task_work context.
* Triggered from task_tick_numa().
*/
-void task_numa_work(struct callback_head *work)
+static void task_numa_work(struct callback_head *work)
{
unsigned long migrate, next_scan, now = jiffies;
struct task_struct *p = current;
@@ -1777,7 +1777,7 @@ out:
/*
* Drive the periodic memory faults..
*/
-void task_tick_numa(struct rq *rq, struct task_struct *curr)
+static void task_tick_numa(struct rq *rq, struct task_struct *curr)
{
struct callback_head *work = &curr->numa_work;
u64 period, now;
@@ -5266,7 +5266,7 @@ static unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu)
return smt_gain;
}

-unsigned long __weak arch_scale_smt_power(struct sched_domain *sd, int cpu)
+static unsigned long arch_scale_smt_power(struct sched_domain *sd, int cpu)
{
return default_scale_smt_power(sd, cpu);
}
--
1.7.9.5

2014-02-27 11:53:43

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 20/46] kernel: Move prototype declaration to header file sched/sched.h from sched/core.c

Move prototype definition of function to header file
kernel/sched/sched.h from kernel/sched/core.c because it is used by more
than one file.

This eliminates the following warning in kernel/sched/deadline.c:62:6:
kernel/sched/deadline.c:62:6: warning: no previous prototype for ‘init_dl_bw’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/sched/core.c | 2 --
kernel/sched/sched.h | 1 +
2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index b46131e..90570e1 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1985,8 +1985,6 @@ static int dl_overflow(struct task_struct *p, int policy,
return err;
}

-extern void init_dl_bw(struct dl_bw *dl_b);
-
/*
* wake_up_new_task - wake up a newly created task for the first time.
*
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index c2119fd..586613e 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1204,6 +1204,7 @@ extern void resched_cpu(int cpu);
extern struct rt_bandwidth def_rt_bandwidth;
extern void init_rt_bandwidth(struct rt_bandwidth *rt_b, u64 period, u64 runtime);

+void init_dl_bw(struct dl_bw *dl_b);
extern struct dl_bandwidth def_dl_bandwidth;
extern void init_dl_bandwidth(struct dl_bandwidth *dl_b, u64 period, u64 runtime);
extern void init_dl_task_timer(struct sched_dl_entity *dl_se);
--
1.7.9.5

2014-02-27 11:54:55

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 21/46] kernel: Mark function as static in sched/deadline.c

Mark function as static in kernel/sched/deadline.c because it is not
used outside this file.

This eliminates the following warning in kernel/sched/deadline.c:
kernel/sched/deadline.c:993:21: warning: no previous prototype for ‘pick_next_task_dl’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/sched/deadline.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 0dd5e09..cd0f58a 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -990,7 +990,7 @@ static struct sched_dl_entity *pick_next_dl_entity(struct rq *rq,
return rb_entry(left, struct sched_dl_entity, rb_node);
}

-struct task_struct *pick_next_task_dl(struct rq *rq)
+static struct task_struct *pick_next_task_dl(struct rq *rq)
{
struct sched_dl_entity *dl_se;
struct task_struct *p;
--
1.7.9.5

2014-02-27 11:54:53

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH 08/46] kernel: MOve prototype declaration to header file include/linux/perf_event.h

On Thu, Feb 27, 2014 at 05:02:48PM +0530, Rashika Kheria wrote:
> Add prototype declaration of function to header file
> include/linux/perf_event.h because it is used by more than one file.
>
> This eliminates the following warning in kernel/events/core.c:
> kernel/events/core.c:3743:13: warning: no previous prototype for ‘arch_perf_update_userpage’ [-Wmissing-prototypes]

# git grep arch_perf_update_userpage
arch/x86/kernel/cpu/perf_event.c:void arch_perf_update_userpage(struct perf_event_mmap_page *userpg, u64 now)
kernel/events/core.c:void __weak arch_perf_update_userpage(struct perf_event_mmap_page *userpg, u64 now)
kernel/events/core.c: arch_perf_update_userpage(userpg, now);


There's two definitions; one weak, and one usage site.

What gives?

2014-02-27 11:58:13

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 22/46] kernel: Include appropriate header file in time/timekeeping_debug.c

Include appropriate header file kernel/time/timekeeping_internal.h in
kernel/time/timekeeping_debug.c because it has prototype declaration of
function defined in kernel/time/timekeeping_debug.c.

This eliminates the following warning in
kernel/time/timekeeping_debug.c:
kernel/time/timekeeping_debug.c:68:6: warning: no previous prototype for ‘tk_debug_account_sleep_time’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/time/timekeeping_debug.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/kernel/time/timekeeping_debug.c b/kernel/time/timekeeping_debug.c
index 802433a..4d54f97 100644
--- a/kernel/time/timekeeping_debug.c
+++ b/kernel/time/timekeeping_debug.c
@@ -21,6 +21,8 @@
#include <linux/seq_file.h>
#include <linux/time.h>

+#include "timekeeping_internal.h"
+
static unsigned int sleep_time_bin[32] = {0};

static int tk_debug_show_sleep_time(struct seq_file *s, void *data)
--
1.7.9.5

2014-02-27 11:58:11

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH 18/46] kernel: Mark functions as static in sched/fair.c

On Thu, Feb 27, 2014 at 05:20:19PM +0530, Rashika Kheria wrote:
> @@ -5266,7 +5266,7 @@ static unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu)
> return smt_gain;
> }
>
> -unsigned long __weak arch_scale_smt_power(struct sched_domain *sd, int cpu)
> +static unsigned long arch_scale_smt_power(struct sched_domain *sd, int cpu)
> {
> return default_scale_smt_power(sd, cpu);
> }

Fuck no; please think before sending.

I'm going to ignore all patches from you henceforth.

2014-02-27 12:00:06

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 23/46] kernel: Mark function as static in trace/ftrace.c

Mark function as static in kernel/trace/ftrace.c because it is not used
outside this file.

Thin eliminates the following warning in kernel/trace/ftrace.c:
kernel/trace/ftrace.c:717:5: warning: no previous prototype for ‘ftrace_profile_pages_init’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/trace/ftrace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index cd7f76d..d110d8a 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -714,7 +714,7 @@ static void ftrace_profile_reset(struct ftrace_profile_stat *stat)
FTRACE_PROFILE_HASH_SIZE * sizeof(struct hlist_head));
}

-int ftrace_profile_pages_init(struct ftrace_profile_stat *stat)
+static int ftrace_profile_pages_init(struct ftrace_profile_stat *stat)
{
struct ftrace_profile_page *pg;
int functions;
--
1.7.9.5

2014-02-27 12:01:31

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 24/46] kernel: Mark function as static in kernel/trace/ftrace.c and remove stub declaration from header file include/linux/ftrace.h

Mark function as static in kernel/trace/ftrace.c because it is not used
outside this file.
Also, remove unused stub declaration from header file
include/linux/ftrace.h.

This eliminates the following warning in kernel/trace/ftrace.c:
kernel/trace/ftrace.c:4268:6: warning: no previous prototype for ‘ftrace_release_mod’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
---
include/linux/ftrace.h | 1 -
kernel/trace/ftrace.c | 2 +-
2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index f4233b1..68ea184 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -532,7 +532,6 @@ static inline int skip_trace(unsigned long ip) { return 0; }
static inline int ftrace_force_update(void) { return 0; }
static inline void ftrace_disable_daemon(void) { }
static inline void ftrace_enable_daemon(void) { }
-static inline void ftrace_release_mod(struct module *mod) {}
static inline __init int register_ftrace_command(struct ftrace_func_command *cmd)
{
return -EINVAL;
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index d110d8a..9bacf45 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -4265,7 +4265,7 @@ static int ftrace_process_locs(struct module *mod,

#define next_to_ftrace_page(p) container_of(p, struct ftrace_page, next)

-void ftrace_release_mod(struct module *mod)
+static void ftrace_release_mod(struct module *mod)
{
struct dyn_ftrace *rec;
struct ftrace_page **last_pg;
--
1.7.9.5

2014-02-27 12:05:05

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 25/46] kernel: Add prototype declaration to header file include/linux/ftrace.h

Add prototype declaration of function to header file
include/linux/ftrace.h because it is used by more than one file.

This eliminates the following warning in kernel/trace/ftrace.c:
kernel/trace/ftrace.c:4914:5: warning: no previous prototype for ‘ftrace_graph_entry_stub’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
include/linux/ftrace.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 68ea184..da1c31f 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -672,6 +672,8 @@ struct ftrace_graph_ret {
typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */
typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */

+int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace);
+
#ifdef CONFIG_FUNCTION_GRAPH_TRACER

/* for init task */
--
1.7.9.5

2014-02-27 12:06:13

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 26/46] kernel: Mark functions as static in kernel/trace/trace.c

Mark functions as static in kernel/trace/trace.c
because they are not used outside this file.

This eliminates the following warning in kernel/trace/trace.c:
kernel/trace/trace.c:266:9: warning: no previous prototype for ‘buffer_ftrace_now’ [-Wmissing-prototypes]
kernel/trace/trace.c:590:6: warning: no previous prototype for ‘free_snapshot’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/trace/trace.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 815c878..f097949 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -263,7 +263,7 @@ int call_filter_check_discard(struct ftrace_event_call *call, void *rec,
}
EXPORT_SYMBOL_GPL(call_filter_check_discard);

-cycle_t buffer_ftrace_now(struct trace_buffer *buf, int cpu)
+static cycle_t buffer_ftrace_now(struct trace_buffer *buf, int cpu)
{
u64 ts;

@@ -587,7 +587,7 @@ static int alloc_snapshot(struct trace_array *tr)
return 0;
}

-void free_snapshot(struct trace_array *tr)
+static void free_snapshot(struct trace_array *tr)
{
/*
* We don't free the ring buffer. instead, resize it because
--
1.7.9.5

2014-02-27 12:06:51

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 27/46] kernel: Mark function as static in kernel/trace/trace_selftest.c

Mark function as static in kernel/trace/trace_selftest.c because it is
not used outside this file.

This eliminates the following warning in kernel/trace/trace_selftest.c:
kernel/trace/trace_selftest.c:318:5: warning: no previous prototype for ‘trace_selftest_startup_dynamic_tracing’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/trace/trace_selftest.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c
index e98fca6..bfecd63 100644
--- a/kernel/trace/trace_selftest.c
+++ b/kernel/trace/trace_selftest.c
@@ -315,9 +315,9 @@ static int trace_selftest_ops(int cnt)
}

/* Test dynamic code modification and ftrace filters */
-int trace_selftest_startup_dynamic_tracing(struct tracer *trace,
- struct trace_array *tr,
- int (*func)(void))
+static int trace_selftest_startup_dynamic_tracing(struct tracer *trace,
+ struct trace_array *tr,
+ int (*func)(void))
{
int save_ftrace_enabled = ftrace_enabled;
unsigned long count;
--
1.7.9.5

2014-02-27 12:08:11

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 28/46] kernel: Add prototype declaration to header file linux/ftrace.h

Add prototye declaration of function to header file
include/linux/ftrace.h
because it is used by more than one file.

This eliminates the following warning in
kernel/trace/trace_functions_graph.c:
kernel/trace/trace_functions_graph.c:218:15: warning: no previous prototype for ‘ftrace_return_to_handler’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
include/linux/ftrace.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index da1c31f..c4d1048 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -673,6 +673,7 @@ typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */
typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */

int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace);
+unsigned long ftrace_return_to_handler(unsigned long frame_pointer);

#ifdef CONFIG_FUNCTION_GRAPH_TRACER

--
1.7.9.5

2014-02-27 12:12:27

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 29/46] kernel: Mark functions as static in trace/trace_functions_graph.c

Mark functions as static in kernel/trace/trace_functions_graph.c because
they are not used outside this file.

This eliminates the following warning in
kernel/trace/trace_functions_graph.c:
kernel/trace/trace_functions_graph.c:333:5: warning: no previous prototype for ‘trace_graph_thresh_entry’ [-Wmissing-prototypes]
kernel/trace/trace_functions_graph.c:422:6: warning: no previous prototype for ‘trace_graph_thresh_return’ [-Wmissing-prototypes]
kernel/trace/trace_functions_graph.c:1408:6: warning: no previous prototype for ‘print_graph_headers’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/trace/trace_functions_graph.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 0b99120..9e9b5c2 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -330,7 +330,7 @@ int trace_graph_entry(struct ftrace_graph_ent *trace)
return ret;
}

-int trace_graph_thresh_entry(struct ftrace_graph_ent *trace)
+static int trace_graph_thresh_entry(struct ftrace_graph_ent *trace)
{
if (tracing_thresh)
return 1;
@@ -419,7 +419,7 @@ void set_graph_array(struct trace_array *tr)
smp_mb();
}

-void trace_graph_thresh_return(struct ftrace_graph_ret *trace)
+static void trace_graph_thresh_return(struct ftrace_graph_ret *trace)
{
if (tracing_thresh &&
(trace->rettime - trace->calltime < tracing_thresh))
@@ -1405,7 +1405,7 @@ static void __print_graph_headers_flags(struct seq_file *s, u32 flags)
seq_printf(s, " | | | |\n");
}

-void print_graph_headers(struct seq_file *s)
+static void print_graph_headers(struct seq_file *s)
{
print_graph_headers_flags(s, tracer_flags.val);
}
--
1.7.9.5

2014-02-27 12:12:39

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 30/46] kernel: Add prototype declaration to header file include/linux/smp.h

Add prototype definition of function to header file include/linux/smp.h
because it is used by more than one file.

This eliminates the following warning in kernel/smp.c:
kernel/smp.c:489:13: warning: no previous prototype for ‘smp_announce’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
include/linux/smp.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/include/linux/smp.h b/include/linux/smp.h
index 3834f43..0a9ca03 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -26,6 +26,8 @@ struct call_single_data {
u16 flags;
};

+void smp_announce(void);
+
/* total number of cpus in this system (may exceed NR_CPUS) */
extern unsigned int total_cpus;

--
1.7.9.5

2014-02-27 12:14:33

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 32/46] kernel: Add prototype declaration to header file include/linux/module.h

Add prototype definition of function to header file
include/linux/module.h because it is used by more than one file.

This eliminates the following warning in kernel/module.c:
kernel/module.c:3823:6: warning: no previous prototype for ‘module_layout’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
include/linux/module.h | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/include/linux/module.h b/include/linux/module.h
index eaf60ff..bf88877 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -82,6 +82,14 @@ void sort_extable(struct exception_table_entry *start,
void sort_main_extable(void);
void trim_init_extable(struct module *m);

+#ifdef CONFIG_MODVERSIONS
+void module_layout(struct module *mod,
+ struct modversion_info *ver,
+ struct kernel_param *kp,
+ struct kernel_symbol *ks,
+ struct tracepoint * const *tp);
+#endif
+
#ifdef MODULE
#define MODULE_GENERIC_TABLE(gtype, name) \
extern const struct gtype##_id __mod_##gtype##_table \
--
1.7.9.5

2014-02-27 12:14:35

by Yasuaki Ishimatsu

[permalink] [raw]
Subject: Re: [PATCH 04/46] kernel: Mark function as static in kernel/resource.c

(2014/02/27 20:14), Rashika Kheria wrote:
> Mark function as static in kernel/resource.c because it is not used
> outside this file.
>
> This eliminates the following warning in kernel/resource.c:
> kernel/resource.c:518:5: warning: no previous prototype for ‘reallocate_resource’ [-Wmissing-prototypes]
>
> Signed-off-by: Rashika Kheria <[email protected]>
> Reviewed-by: Josh Triplett <[email protected]>
> ---

Reviewed-by: Yasuaki Ishimatsu <[email protected]>

Thanks,
Yasuaki Ishimatsu

> kernel/resource.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/resource.c b/kernel/resource.c
> index 3f285dc..ede7db2 100644
> --- a/kernel/resource.c
> +++ b/kernel/resource.c
> @@ -515,9 +515,9 @@ static int find_resource(struct resource *root, struct resource *new,
> * @newsize: new size of the resource descriptor
> * @constraint: the size and alignment constraints to be met.
> */
> -int reallocate_resource(struct resource *root, struct resource *old,
> - resource_size_t newsize,
> - struct resource_constraint *constraint)
> +static int reallocate_resource(struct resource *root, struct resource *old,
> + resource_size_t newsize,
> + struct resource_constraint *constraint)
> {
> int err=0;
> struct resource new = *old;
>

2014-02-27 12:15:49

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 31/46] kernel: Mark function as static in kernel/module.c

Mark function as static in kernel/module.c because it is not used
outside this file.

This eliminates the following warning in kernel/module.c:
kernel/module.c:1719:6: warning: no previous prototype for ‘set_page_attributes’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/module.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/module.c b/kernel/module.c
index d24fcf2..93239aa 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1716,7 +1716,8 @@ static int __unlink_module(void *_mod)
* LKM RO/NX protection: protect module's text/ro-data
* from modification and any data from execution.
*/
-void set_page_attributes(void *start, void *end, int (*set)(unsigned long start, int num_pages))
+static void set_page_attributes(void *start, void *end,
+ int (*set)(unsigned long start, int num_pages))
{
unsigned long begin_pfn = PFN_DOWN((unsigned long)start);
unsigned long end_pfn = PFN_DOWN((unsigned long)end);
--
1.7.9.5

2014-02-27 12:17:27

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 34/46] kernel: Include appropriate header file in hung_task.c

Include appropriate header file include/linux/sched/sysctl.h in
kernel/hung_task.c because it has function declaration of function
defined in kernel/hung_task.c.

This elimiantes the following warning in kernel/hung_task.c:
kernel/hung_task.c:195:5: warning: no previous prototype for ‘proc_dohung_task_timeout_secs’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/hung_task.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/kernel/hung_task.c b/kernel/hung_task.c
index 0b9c169..2704c36 100644
--- a/kernel/hung_task.c
+++ b/kernel/hung_task.c
@@ -16,6 +16,7 @@
#include <linux/export.h>
#include <linux/sysctl.h>
#include <linux/utsname.h>
+#include <linux/sched/sysctl.h>
#include <trace/events/sched.h>

/*
--
1.7.9.5

2014-02-27 12:18:58

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 33/46] kernel: Add prototype declaration to header file include/linux/compat.h

Add prototype declaration of function to header file
include/linux/compat.h
because they are used by more than one file.

This eliminates the following warning in kernel/compat.c:
kernel/compat.c:357:17: warning: no previous prototype for ‘compat_sys_sigpending’ [-Wmissing-prototypes]
kernel/compat.c:446:17: warning: no previous prototype for ‘compat_sys_old_getrlimit’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
include/linux/compat.h | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/include/linux/compat.h b/include/linux/compat.h
index 3f448c6..083e0dd 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -305,6 +305,13 @@ struct compat_msgbuf;

extern void compat_exit_robust_list(struct task_struct *curr);

+asmlinkage long compat_sys_sigpending(compat_old_sigset_t __user *set);
+
+#ifdef COMPAT_RLIM_OLD_INFINITY
+asmlinkage long compat_sys_old_getrlimit(unsigned int resource,
+ struct compat_rlimit __user *rlim);
+#endif
+
asmlinkage long
compat_sys_set_robust_list(struct compat_robust_list_head __user *head,
compat_size_t len);
--
1.7.9.5

2014-02-27 12:20:29

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 35/46] kernel: Mark function as static in kernel/seccomp.c

Mark function as static in kernel/seccomp.c because it is not used
outside this file.

This eliminates the following warning in kernel/seccomp.c:
kernel/seccomp.c:296:6: warning: no previous prototype for ‘seccomp_attach_user_filter’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/seccomp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/seccomp.c b/kernel/seccomp.c
index b7a1004..0e004a7 100644
--- a/kernel/seccomp.c
+++ b/kernel/seccomp.c
@@ -293,7 +293,7 @@ fail:
*
* Returns 0 on success and non-zero otherwise.
*/
-long seccomp_attach_user_filter(char __user *user_filter)
+static long seccomp_attach_user_filter(char __user *user_filter)
{
struct sock_fprog fprog;
long ret = -EFAULT;
--
1.7.9.5

2014-02-27 12:20:57

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 36/46] kernel: Mark functions as static in kernel/tracepoint.c

Mark functions as static in kernel/tracepoint.c because they are not
used outside this file.

This eliminates the following warning in kernel/tracepoint.c:
kernel/tracepoint.c:326:6: warning: no previous prototype for ‘module_update_tracepoints’ [-Wmissing-prototypes]
kernel/tracepoint.c:702:5: warning: no previous prototype for ‘tracepoint_module_notify’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/tracepoint.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
index 29f2654..0e26255 100644
--- a/kernel/tracepoint.c
+++ b/kernel/tracepoint.c
@@ -323,7 +323,7 @@ static void tracepoint_update_probe_range(struct tracepoint * const *begin,
}

#ifdef CONFIG_MODULES
-void module_update_tracepoints(void)
+static void module_update_tracepoints(void)
{
struct tp_module *tp_mod;

@@ -332,7 +332,7 @@ void module_update_tracepoints(void)
tp_mod->tracepoints_ptrs + tp_mod->num_tracepoints);
}
#else /* CONFIG_MODULES */
-void module_update_tracepoints(void)
+static void module_update_tracepoints(void)
{
}
#endif /* CONFIG_MODULES */
@@ -699,7 +699,7 @@ static int tracepoint_module_going(struct module *mod)
return 0;
}

-int tracepoint_module_notify(struct notifier_block *self,
+static int tracepoint_module_notify(struct notifier_block *self,
unsigned long val, void *data)
{
struct module *mod = data;
--
1.7.9.5

2014-02-27 12:24:23

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 37/46] kernel: Include appropriate header file in tracepoint.c

Include appropriate header file include/trace/events/syscalls.h in
kernel/tracepoint.c because it has prototype definition of functions
defined in kernel/tracepoint.c.

This eliminates the following warning in kernel/tracepoint.c:
kernel/tracepoint.c:738:6: warning: no previous prototype for ‘syscall_regfunc’ [-Wmissing-prototypes]
kernel/tracepoint.c:755:6: warning: no previous prototype for ‘syscall_unregfunc’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/tracepoint.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
index 0e26255..124d733 100644
--- a/kernel/tracepoint.c
+++ b/kernel/tracepoint.c
@@ -26,6 +26,7 @@
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/static_key.h>
+#include <trace/events/syscalls.h>

extern struct tracepoint * const __start___tracepoints_ptrs[];
extern struct tracepoint * const __stop___tracepoints_ptrs[];
--
1.7.9.5

2014-02-27 12:25:16

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 39/46] kernel: Add prototype declaration to header file include/linux/irq_work.h

Add prototype declaration of function to header file
include/linux/irq_work.h because it is used by more than one file.

This eliminates the following warning in kernel/irq_work.c:
kernel/irq_work.c:51:13: warning: no previous prototype for ‘arch_irq_work_raise’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
include/linux/irq_work.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/include/linux/irq_work.h b/include/linux/irq_work.h
index 6601702..4212080 100644
--- a/include/linux/irq_work.h
+++ b/include/linux/irq_work.h
@@ -33,6 +33,7 @@ void init_irq_work(struct irq_work *work, void (*func)(struct irq_work *))
void irq_work_queue(struct irq_work *work);
void irq_work_run(void);
void irq_work_sync(struct irq_work *work);
+void arch_irq_work_raise(void);

#ifdef CONFIG_IRQ_WORK
bool irq_work_needs_cpu(void);
--
1.7.9.5

2014-02-27 12:25:28

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 38/46] kernel: Include appropriate header file in kernel/elfcore.c

Include appropriate header file include/linux/elfcore.h in
kernel/elfcore.c because it has prototype declaration of function
defined in kernel/elfcore.c.

This eliminates the following warning in kernel/elfcore.c:
kernel/elfcore.c:6:17: warning: no previous prototype for ‘elf_core_extra_phdrs’ [-Wmissing-prototypes]
kernel/elfcore.c:11:12: warning: no previous prototype for ‘elf_core_write_extra_phdrs’ [-Wmissing-prototypes]
kernel/elfcore.c:16:12: warning: no previous prototype for ‘elf_core_write_extra_data’ [-Wmissing-prototypes]
kernel/elfcore.c:21:15: warning: no previous prototype for ‘elf_core_extra_data_size’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/elfcore.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/kernel/elfcore.c b/kernel/elfcore.c
index e556751..a2b29b9 100644
--- a/kernel/elfcore.c
+++ b/kernel/elfcore.c
@@ -2,6 +2,7 @@
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/binfmts.h>
+#include <linux/elfcore.h>

Elf_Half __weak elf_core_extra_phdrs(void)
{
--
1.7.9.5

2014-02-27 12:30:27

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 40/46] kernel: Include appropriate header file in kernel/sched/core.c

Include appropriate header file include/linux/sched.h in
kernel/sched/core.c because it containes prototype declaration of
function defined in kernel/sched/core.c. Also, fix the typo error in
prototype declaration of function 'arch_sd_sibling_asym_packing’ in
include/linux/sched.h.

This eliminates the following warning in sched/core.c:
kernel/sched/core.c:5814:12: warning: no previous prototype for ‘arch_sd_sibling_asym_packing’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
include/linux/sched.h | 2 +-
kernel/sched/core.c | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index fac6f9d..56aa7ee 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -866,7 +866,7 @@ enum cpu_idle_type {
#define SD_OVERLAP 0x2000 /* sched_domains of this level overlap */
#define SD_NUMA 0x4000 /* cross-node balancing */

-extern int __weak arch_sd_sibiling_asym_packing(void);
+extern int __weak arch_sd_sibling_asym_packing(void);

struct sched_domain_attr {
int relax_domain_level;
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 90570e1..9c3df36 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -72,6 +72,7 @@
#include <linux/slab.h>
#include <linux/init_task.h>
#include <linux/binfmts.h>
+#include <linux/sched.h>
#include <linux/context_tracking.h>

#include <asm/switch_to.h>
--
1.7.9.5

2014-02-27 12:31:48

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 41/46] kernel: Mark functions as static in sched/core.c

Mark functions as static in kernel/sched/core.c because they are not
used outside this file.

This eliminates the following warning in kernel/sched/core.c:
kernel/sched/core.c:6346:22: warning: no previous prototype for ‘build_sched_domain’ [-Wmissing-prototypes]
kernel/sched/core.c:7733:5: warning: no previous prototype for ‘tg_set_cfs_quota’ [-Wmissing-prototypes]
kernel/sched/core.c:7746:6: warning: no previous prototype for ‘tg_get_cfs_quota’ [-Wmissing-prototypes]
kernel/sched/core.c:7759:5: warning: no previous prototype for ‘tg_set_cfs_period’ [-Wmissing-prototypes]
kernel/sched/core.c:7769:6: warning: no previous prototype for ‘tg_get_cfs_period’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/sched/core.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 9c3df36..7e1d58f 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6342,7 +6342,8 @@ static void __sdt_free(const struct cpumask *cpu_map)
}
}

-struct sched_domain *build_sched_domain(struct sched_domain_topology_level *tl,
+static struct sched_domain *build_sched_domain(
+ struct sched_domain_topology_level *tl,
const struct cpumask *cpu_map, struct sched_domain_attr *attr,
struct sched_domain *child, int cpu)
{
@@ -7729,7 +7730,7 @@ out_unlock:
return ret;
}

-int tg_set_cfs_quota(struct task_group *tg, long cfs_quota_us)
+static int tg_set_cfs_quota(struct task_group *tg, long cfs_quota_us)
{
u64 quota, period;

@@ -7742,7 +7743,7 @@ int tg_set_cfs_quota(struct task_group *tg, long cfs_quota_us)
return tg_set_cfs_bandwidth(tg, period, quota);
}

-long tg_get_cfs_quota(struct task_group *tg)
+static long tg_get_cfs_quota(struct task_group *tg)
{
u64 quota_us;

@@ -7755,7 +7756,7 @@ long tg_get_cfs_quota(struct task_group *tg)
return quota_us;
}

-int tg_set_cfs_period(struct task_group *tg, long cfs_period_us)
+static int tg_set_cfs_period(struct task_group *tg, long cfs_period_us)
{
u64 quota, period;

@@ -7765,7 +7766,7 @@ int tg_set_cfs_period(struct task_group *tg, long cfs_period_us)
return tg_set_cfs_bandwidth(tg, period, quota);
}

-long tg_get_cfs_period(struct task_group *tg)
+static long tg_get_cfs_period(struct task_group *tg)
{
u64 cfs_period_us;

--
1.7.9.5

2014-02-27 12:33:50

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 42/46] kernel: Add prototype declaration to appropriate header file include/linux/sched.h

Add prototype declaration of function to header file
include/linux/sched.h
because it used by more than one file.

This eliminates the following warning in kernel/sched/core.c:
kernel/sched/core.c:2822:25: warning: no previous prototype for ‘preempt_schedule_irq’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
include/linux/sched.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 56aa7ee..d162e3b 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -967,7 +967,7 @@ static inline struct cpumask *sched_domain_span(struct sched_domain *sd)

extern void partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[],
struct sched_domain_attr *dattr_new);
-
+asmlinkage void __sched preempt_schedule_irq(void);
/* Allocate an array of sched domains, for partition_sched_domains(). */
cpumask_var_t *alloc_sched_domains(unsigned int ndoms);
void free_sched_domains(cpumask_var_t doms[], unsigned int ndoms);
--
1.7.9.5

Subject: [tip:irq/urgent] genirq: Include missing header file in irqdomain.c

Commit-ID: 64be38ab03e9b238a1299857fef8b3707c0ed045
Gitweb: http://git.kernel.org/tip/64be38ab03e9b238a1299857fef8b3707c0ed045
Author: Rashika Kheria <[email protected]>
AuthorDate: Thu, 27 Feb 2014 17:10:12 +0530
Committer: Thomas Gleixner <[email protected]>
CommitDate: Thu, 27 Feb 2014 13:29:35 +0100

genirq: Include missing header file in irqdomain.c

Include appropriate header file include/linux/of_irq.h in
kernel/irq/irqdomain.c because it contains prototype definition of
function define in kernel/irq/irqdomain.c.

This eliminates the following warning in kernel/irq/irqdomain.c:
kernel/irq/irqdomain.c:468:14: warning: no previous prototype for ‘irq_create_of_mapping’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Link: http://lkml.kernel.org/r/eb89aebea7ff1a46122918ac389ebecf8248be9a.1393493276.git.rashika.kheria@gmail.com
Signed-off-by: Thomas Gleixner <[email protected]>
---
kernel/irq/irqdomain.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index cf68bb3..f140337 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -10,6 +10,7 @@
#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/of_address.h>
+#include <linux/of_irq.h>
#include <linux/topology.h>
#include <linux/seq_file.h>
#include <linux/slab.h>

2014-02-27 12:34:41

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 44/46] kernel: Move prototype declaration to header file kernel/sched/sched.h from kernel/sched/rt.c

Move prototype declaration of function to header file
kernel/sched/sched.h from kernel/sched/rt.c because it is used by more
than one file.

This eliminates the following warning in kernel/sched/debug.c:
kernel/sched/debug.c:246:6: warning: no previous prototype for ‘print_rt_rq’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/sched/rt.c | 1 -
kernel/sched/sched.h | 1 +
2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index a2740b7..2fe28c8 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -2015,7 +2015,6 @@ const struct sched_class rt_sched_class = {
};

#ifdef CONFIG_SCHED_DEBUG
-extern void print_rt_rq(struct seq_file *m, int cpu, struct rt_rq *rt_rq);

void print_rt_stats(struct seq_file *m, int cpu)
{
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index c3688e2..608dd7b 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1485,6 +1485,7 @@ extern struct sched_entity *__pick_first_entity(struct cfs_rq *cfs_rq);
extern struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq);
extern void print_cfs_stats(struct seq_file *m, int cpu);
extern void print_rt_stats(struct seq_file *m, int cpu);
+void print_rt_rq(struct seq_file *m, int cpu, struct rt_rq *rt_rq);

extern void init_cfs_rq(struct cfs_rq *cfs_rq);
extern void init_rt_rq(struct rt_rq *rt_rq, struct rq *rq);
--
1.7.9.5

2014-02-27 12:35:30

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 43/46] kernel: Add prototype declaration to header file kernel/sched/sched.h

Add prototype declaration of function to header file
kernel/sched/sched.h because it is used by more than one file.

This eliminates the following warning in kernel/sched/core.c:
kernel/sched/core.c:2760:25: warning: no previous prototype for ‘schedule_user’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
kernel/sched/sched.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 586613e..c3688e2 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -286,6 +286,7 @@ static inline int walk_tg_tree(tg_visitor down, tg_visitor up, void *data)

extern int tg_nop(struct task_group *tg, void *data);

+asmlinkage void __sched schedule_user(void);
extern void free_fair_sched_group(struct task_group *tg);
extern int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent);
extern void unregister_fair_sched_group(struct task_group *tg, int cpu);
--
1.7.9.5

2014-02-27 12:37:30

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 46/46] kernel: Add prototype declaration to header file include/linux/sched.h

Add prototype declaration of function to header file
include/linux/sched.h because it is used by more than one file.

This eliminates the following warning in kernel/sched/fair.c:
kernel/sched/fair.c:5254:22: warning: no previous prototype for ‘arch_scale_freq_power’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
include/linux/sched.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index f08958b..f83081b 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -966,6 +966,7 @@ static inline struct cpumask *sched_domain_span(struct sched_domain *sd)
return to_cpumask(sd->span);
}

+unsigned long arch_scale_freq_power(struct sched_domain *sd, int cpu);
extern void partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[],
struct sched_domain_attr *dattr_new);
asmlinkage void __sched preempt_schedule_irq(void);
--
1.7.9.5

2014-02-27 12:39:13

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 45/46] kernel: Move prototype declaration to header file include/linux/sched.h from init/main.c

Add prototype declaration of function to header file
include/linux/sched.h from init/main.c because it is used by more than
one file.

This eliminates the following warning in kernel/fork.c:
kernel/fork.c:252:13: warning: no previous prototype for ‘fork_init’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
include/linux/sched.h | 1 +
init/main.c | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index d162e3b..f08958b 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -161,6 +161,7 @@ extern void get_avenrun(unsigned long *loads, unsigned long offset, int shift);
load += n*(FIXED_1-exp); \
load >>= FSHIFT;

+void fork_init(unsigned long mempages);
extern unsigned long total_forks;
extern int nr_threads;
DECLARE_PER_CPU(unsigned long, process_counts);
diff --git a/init/main.c b/init/main.c
index eb03090..48929e3 100644
--- a/init/main.c
+++ b/init/main.c
@@ -91,7 +91,6 @@
static int kernel_init(void *);

extern void init_IRQ(void);
-extern void fork_init(unsigned long);
extern void radix_tree_init(void);
#ifndef CONFIG_DEBUG_RODATA
static inline void mark_rodata_ro(void) { }
--
1.7.9.5

2014-02-27 13:37:04

by Mathieu Desnoyers

[permalink] [raw]
Subject: Re: [PATCH 37/46] kernel: Include appropriate header file in tracepoint.c

----- Original Message -----
> From: "Rashika Kheria" <[email protected]>
> To: [email protected]
> Cc: "Rashika Kheria" <[email protected]>, "Mathieu Desnoyers" <[email protected]>, "Sasha Levin"
> <[email protected]>, "Andrew Morton" <[email protected]>, "Paul E. McKenney"
> <[email protected]>, "Sahara" <[email protected]>, [email protected]
> Sent: Thursday, February 27, 2014 7:22:05 AM
> Subject: [PATCH 37/46] kernel: Include appropriate header file in tracepoint.c
>
> Include appropriate header file include/trace/events/syscalls.h in
> kernel/tracepoint.c because it has prototype definition of functions
> defined in kernel/tracepoint.c.
>
> This eliminates the following warning in kernel/tracepoint.c:
> kernel/tracepoint.c:738:6: warning: no previous prototype for
> ‘syscall_regfunc’ [-Wmissing-prototypes]
> kernel/tracepoint.c:755:6: warning: no previous prototype for
> ‘syscall_unregfunc’ [-Wmissing-prototypes]

Tracepoints are the infrastructure on which trace events are build. tracepoint.c
should not include a trace event header: this is an abstraction inversion.

I propose we move the

extern void syscall_regfunc(void);
extern void syscall_unregfunc(void);

declarations to include/linux/tracepoint.h instead.

Thanks,

Mathieu

>
> Signed-off-by: Rashika Kheria <[email protected]>
> Reviewed-by: Josh Triplett <[email protected]>
> ---
> kernel/tracepoint.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
> index 0e26255..124d733 100644
> --- a/kernel/tracepoint.c
> +++ b/kernel/tracepoint.c
> @@ -26,6 +26,7 @@
> #include <linux/slab.h>
> #include <linux/sched.h>
> #include <linux/static_key.h>
> +#include <trace/events/syscalls.h>
>
> extern struct tracepoint * const __start___tracepoints_ptrs[];
> extern struct tracepoint * const __stop___tracepoints_ptrs[];
> --
> 1.7.9.5
>
>

--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

2014-02-27 13:40:06

by Mathieu Desnoyers

[permalink] [raw]
Subject: Re: [PATCH 36/46] kernel: Mark functions as static in kernel/tracepoint.c

----- Original Message -----
> From: "Rashika Kheria" <[email protected]>
> To: [email protected]
> Cc: "Rashika Kheria" <[email protected]>, "Mathieu Desnoyers" <[email protected]>, "Sasha Levin"
> <[email protected]>, "Andrew Morton" <[email protected]>, "Paul E. McKenney"
> <[email protected]>, "Sahara" <[email protected]>, [email protected]
> Sent: Thursday, February 27, 2014 7:20:47 AM
> Subject: [PATCH 36/46] kernel: Mark functions as static in kernel/tracepoint.c
>
> Mark functions as static in kernel/tracepoint.c because they are not
> used outside this file.
>
> This eliminates the following warning in kernel/tracepoint.c:
> kernel/tracepoint.c:326:6: warning: no previous prototype for
> ‘module_update_tracepoints’ [-Wmissing-prototypes]
> kernel/tracepoint.c:702:5: warning: no previous prototype for
> ‘tracepoint_module_notify’ [-Wmissing-prototypes]

Yes, this needs to be fixed. However, I recommend to simply queue
this cleanup for 3.15 (no -stable backport), as it is not fixing
anything critical.

Acked-by: Mathieu Desnoyers <[email protected]>

>
> Signed-off-by: Rashika Kheria <[email protected]>
> Reviewed-by: Josh Triplett <[email protected]>
> ---
> kernel/tracepoint.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
> index 29f2654..0e26255 100644
> --- a/kernel/tracepoint.c
> +++ b/kernel/tracepoint.c
> @@ -323,7 +323,7 @@ static void tracepoint_update_probe_range(struct
> tracepoint * const *begin,
> }
>
> #ifdef CONFIG_MODULES
> -void module_update_tracepoints(void)
> +static void module_update_tracepoints(void)
> {
> struct tp_module *tp_mod;
>
> @@ -332,7 +332,7 @@ void module_update_tracepoints(void)
> tp_mod->tracepoints_ptrs + tp_mod->num_tracepoints);
> }
> #else /* CONFIG_MODULES */
> -void module_update_tracepoints(void)
> +static void module_update_tracepoints(void)
> {
> }
> #endif /* CONFIG_MODULES */
> @@ -699,7 +699,7 @@ static int tracepoint_module_going(struct module *mod)
> return 0;
> }
>
> -int tracepoint_module_notify(struct notifier_block *self,
> +static int tracepoint_module_notify(struct notifier_block *self,
> unsigned long val, void *data)
> {
> struct module *mod = data;
> --
> 1.7.9.5
>
>

--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

2014-02-27 15:11:43

by Toshi Kani

[permalink] [raw]
Subject: Re: [PATCH 03/46] kernel: Move prototype declaration to header file include/linux/cpu.h

On Thu, 2014-02-27 at 16:42 +0530, Rashika Kheria wrote:
> Add prototype declaration to header file include/linux/cpu.h because
> they are used by more than one file.
>
> This eliminates the following warning in kernel/cpu.c:
> kernel/cpu.c:512:13: warning: no previous prototype for ‘arch_enable_nonboot_cpus_begin’ [-Wmissing-prototypes]
> kernel/cpu.c:516:13: warning: no previous prototype for ‘arch_enable_nonboot_cpus_end’ [-Wmissing-prototypes]
>
> Signed-off-by: Rashika Kheria <[email protected]>
> Reviewed-by: Josh Triplett <[email protected]>
> ---
> arch/x86/kernel/smpboot.c | 1 +
> include/linux/cpu.h | 2 ++
> 2 files changed, 3 insertions(+)
>
> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
> index a32da80..e428764 100644
> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c
> @@ -49,6 +49,7 @@
> #include <linux/bootmem.h>
> #include <linux/err.h>
> #include <linux/nmi.h>
> +#include <linux/cpu.h>
> #include <linux/tboot.h>
> #include <linux/stackprotector.h>
> #include <linux/gfp.h>
> diff --git a/include/linux/cpu.h b/include/linux/cpu.h
> index 03e235ad..9f633b0 100644
> --- a/include/linux/cpu.h
> +++ b/include/linux/cpu.h
> @@ -38,6 +38,8 @@ extern void cpu_remove_dev_attr(struct device_attribute *attr);
>
> extern int cpu_add_dev_attr_group(struct attribute_group *attrs);
> extern void cpu_remove_dev_attr_group(struct attribute_group *attrs);
> +void arch_enable_nonboot_cpus_begin(void);
> +void arch_enable_nonboot_cpus_end(void);

Can we simply include linux/smp.h, which defines them already?

Thanks,
-Toshi



>
> #ifdef CONFIG_HOTPLUG_CPU
> extern void unregister_cpu(struct cpu *cpu);

2014-02-27 15:14:10

by Toshi Kani

[permalink] [raw]
Subject: Re: [PATCH 04/46] kernel: Mark function as static in kernel/resource.c

On Thu, 2014-02-27 at 16:44 +0530, Rashika Kheria wrote:
> Mark function as static in kernel/resource.c because it is not used
> outside this file.
>
> This eliminates the following warning in kernel/resource.c:
> kernel/resource.c:518:5: warning: no previous prototype for ‘reallocate_resource’ [-Wmissing-prototypes]
>
> Signed-off-by: Rashika Kheria <[email protected]>
> Reviewed-by: Josh Triplett <[email protected]>

Acked-by: Toshi Kani <[email protected]>

Thanks,
-Toshi


2014-02-27 15:33:30

by Kees Cook

[permalink] [raw]
Subject: Re: [PATCH 35/46] kernel: Mark function as static in kernel/seccomp.c

On Thu, Feb 27, 2014 at 4:20 AM, Rashika Kheria
<[email protected]> wrote:
> Mark function as static in kernel/seccomp.c because it is not used
> outside this file.
>
> This eliminates the following warning in kernel/seccomp.c:
> kernel/seccomp.c:296:6: warning: no previous prototype for ‘seccomp_attach_user_filter’ [-Wmissing-prototypes]
>
> Signed-off-by: Rashika Kheria <[email protected]>
> Reviewed-by: Josh Triplett <[email protected]>

Acked-by: Kees Cook <[email protected]>

Thanks!

-Kees

> ---
> kernel/seccomp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/seccomp.c b/kernel/seccomp.c
> index b7a1004..0e004a7 100644
> --- a/kernel/seccomp.c
> +++ b/kernel/seccomp.c
> @@ -293,7 +293,7 @@ fail:
> *
> * Returns 0 on success and non-zero otherwise.
> */
> -long seccomp_attach_user_filter(char __user *user_filter)
> +static long seccomp_attach_user_filter(char __user *user_filter)
> {
> struct sock_fprog fprog;
> long ret = -EFAULT;
> --
> 1.7.9.5
>



--
Kees Cook
Chrome OS Security

2014-02-27 15:48:56

by Will Drewry

[permalink] [raw]
Subject: Re: [PATCH 35/46] kernel: Mark function as static in kernel/seccomp.c

On Thu, Feb 27, 2014 at 9:33 AM, Kees Cook <[email protected]> wrote:
> On Thu, Feb 27, 2014 at 4:20 AM, Rashika Kheria
> <[email protected]> wrote:
>> Mark function as static in kernel/seccomp.c because it is not used
>> outside this file.
>>
>> This eliminates the following warning in kernel/seccomp.c:
>> kernel/seccomp.c:296:6: warning: no previous prototype for 'seccomp_attach_user_filter' [-Wmissing-prototypes]
>>
>> Signed-off-by: Rashika Kheria <[email protected]>
>> Reviewed-by: Josh Triplett <[email protected]>
>
> Acked-by: Kees Cook <[email protected]>

Acked-by: Will Drewry <[email protected]>

It amazing what things slip through. Thanks!

>> ---
>> kernel/seccomp.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/kernel/seccomp.c b/kernel/seccomp.c
>> index b7a1004..0e004a7 100644
>> --- a/kernel/seccomp.c
>> +++ b/kernel/seccomp.c
>> @@ -293,7 +293,7 @@ fail:
>> *
>> * Returns 0 on success and non-zero otherwise.
>> */
>> -long seccomp_attach_user_filter(char __user *user_filter)
>> +static long seccomp_attach_user_filter(char __user *user_filter)
>> {
>> struct sock_fprog fprog;
>> long ret = -EFAULT;
>> --
>> 1.7.9.5
>>

2014-02-27 15:52:34

by Josh Triplett

[permalink] [raw]
Subject: Re: [PATCH 08/46] kernel: MOve prototype declaration to header file include/linux/perf_event.h

On Thu, Feb 27, 2014 at 12:54:14PM +0100, Peter Zijlstra wrote:
> On Thu, Feb 27, 2014 at 05:02:48PM +0530, Rashika Kheria wrote:
> > Add prototype declaration of function to header file
> > include/linux/perf_event.h because it is used by more than one file.
> >
> > This eliminates the following warning in kernel/events/core.c:
> > kernel/events/core.c:3743:13: warning: no previous prototype for ‘arch_perf_update_userpage’ [-Wmissing-prototypes]
>
> # git grep arch_perf_update_userpage
> arch/x86/kernel/cpu/perf_event.c:void arch_perf_update_userpage(struct perf_event_mmap_page *userpg, u64 now)
> kernel/events/core.c:void __weak arch_perf_update_userpage(struct perf_event_mmap_page *userpg, u64 now)
> kernel/events/core.c: arch_perf_update_userpage(userpg, now);
>
>
> There's two definitions; one weak, and one usage site.
>
> What gives?

There's no prototype for the function anywhere, so -Wmissing-prototypes
rightfully complains. Adding the prototype to a header included in both
source files ensures that the function signatures must match, and
eliminates the warning.

- Josh Triplett

2014-02-27 16:03:34

by Josh Triplett

[permalink] [raw]
Subject: Re: [PATCH 18/46] kernel: Mark functions as static in sched/fair.c

On Thu, Feb 27, 2014 at 12:58:05PM +0100, Peter Zijlstra wrote:
> On Thu, Feb 27, 2014 at 05:20:19PM +0530, Rashika Kheria wrote:
> > @@ -5266,7 +5266,7 @@ static unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu)
> > return smt_gain;
> > }
> >
> > -unsigned long __weak arch_scale_smt_power(struct sched_domain *sd, int cpu)
> > +static unsigned long arch_scale_smt_power(struct sched_domain *sd, int cpu)
> > {
> > return default_scale_smt_power(sd, cpu);
> > }
>
> Fuck no; please think before sending.
>
> I'm going to ignore all patches from you henceforth.

Did you perhaps check, and notice that there are *zero* uses of this
function in the kernel? Nothing overrides this weak symbol; it is no
longer needed. You removed the one and only user in your commit:

commit ee08d1284ea9235b29bd2d9b7493b4b4cf3da09c
Author: Peter Zijlstra <[email protected]>
Date: Wed Jun 13 15:24:45 2012 +0200

sched/x86: Remove broken power estimation

The x86 sched power implementation has been broken forever and gets in
the way of other stuff, remove it.

When I reviewed Rashika's patch and provided a Reviewed-by, I provided
the following feedback:

Josh Triplett wrote:
> I'd suggest waiting to see how the scheduler folks respond to this patch
> series, and then if they accept the changes marking unused __weak
> functions as static, you could follow up with a patch that folds them
> into their callers and gets rid of them entirely.

(That feedback was based on the assumption that the simplest possible
mark-it-static patch would be a good starting point.)

Now, given all of the above, perhaps you could provide some useful
feedback on what you find so objectionable about this patch?

- Josh Triplett

2014-02-27 16:15:58

by Oleg Nesterov

[permalink] [raw]
Subject: Re: [PATCH 05/46] kernel: Include appropriate header file in kernel/signal.c

On 02/27, Rashika Kheria wrote:
>
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -42,6 +42,7 @@
> #include <asm/siginfo.h>
> #include <asm/cacheflush.h>
> #include "audit.h" /* audit_signal_info() */
> +#include "debug/kdb/kdb_private.h"

Perhaps this should go under "#ifdef CONFIG_KGDB_KDB" along with
"#include <linux/kdb.h>" we already have?

Oleg.

2014-02-27 16:18:20

by Josh Triplett

[permalink] [raw]
Subject: Re: [PATCH 24/46] kernel: Mark function as static in kernel/trace/ftrace.c and remove stub declaration from header file include/linux/ftrace.h

On Thu, Feb 27, 2014 at 05:31:21PM +0530, Rashika Kheria wrote:
> Mark function as static in kernel/trace/ftrace.c because it is not used
> outside this file.
> Also, remove unused stub declaration from header file
> include/linux/ftrace.h.
>
> This eliminates the following warning in kernel/trace/ftrace.c:
> kernel/trace/ftrace.c:4268:6: warning: no previous prototype for ‘ftrace_release_mod’ [-Wmissing-prototypes]
>
> Signed-off-by: Rashika Kheria <[email protected]>

Reviewed-by: Josh Triplett <[email protected]>

> include/linux/ftrace.h | 1 -
> kernel/trace/ftrace.c | 2 +-
> 2 files changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
> index f4233b1..68ea184 100644
> --- a/include/linux/ftrace.h
> +++ b/include/linux/ftrace.h
> @@ -532,7 +532,6 @@ static inline int skip_trace(unsigned long ip) { return 0; }
> static inline int ftrace_force_update(void) { return 0; }
> static inline void ftrace_disable_daemon(void) { }
> static inline void ftrace_enable_daemon(void) { }
> -static inline void ftrace_release_mod(struct module *mod) {}
> static inline __init int register_ftrace_command(struct ftrace_func_command *cmd)
> {
> return -EINVAL;
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index d110d8a..9bacf45 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -4265,7 +4265,7 @@ static int ftrace_process_locs(struct module *mod,
>
> #define next_to_ftrace_page(p) container_of(p, struct ftrace_page, next)
>
> -void ftrace_release_mod(struct module *mod)
> +static void ftrace_release_mod(struct module *mod)
> {
> struct dyn_ftrace *rec;
> struct ftrace_page **last_pg;
> --
> 1.7.9.5
>

2014-02-27 16:20:55

by Josh Triplett

[permalink] [raw]
Subject: Re: [PATCH 03/46] kernel: Move prototype declaration to header file include/linux/cpu.h

On Thu, Feb 27, 2014 at 08:04:29AM -0700, Toshi Kani wrote:
> On Thu, 2014-02-27 at 16:42 +0530, Rashika Kheria wrote:
> > Add prototype declaration to header file include/linux/cpu.h because
> > they are used by more than one file.
> >
> > This eliminates the following warning in kernel/cpu.c:
> > kernel/cpu.c:512:13: warning: no previous prototype for ‘arch_enable_nonboot_cpus_begin’ [-Wmissing-prototypes]
> > kernel/cpu.c:516:13: warning: no previous prototype for ‘arch_enable_nonboot_cpus_end’ [-Wmissing-prototypes]
> >
> > Signed-off-by: Rashika Kheria <[email protected]>
> > Reviewed-by: Josh Triplett <[email protected]>
> > ---
> > arch/x86/kernel/smpboot.c | 1 +
> > include/linux/cpu.h | 2 ++
> > 2 files changed, 3 insertions(+)
> >
> > diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
> > index a32da80..e428764 100644
> > --- a/arch/x86/kernel/smpboot.c
> > +++ b/arch/x86/kernel/smpboot.c
> > @@ -49,6 +49,7 @@
> > #include <linux/bootmem.h>
> > #include <linux/err.h>
> > #include <linux/nmi.h>
> > +#include <linux/cpu.h>
> > #include <linux/tboot.h>
> > #include <linux/stackprotector.h>
> > #include <linux/gfp.h>
> > diff --git a/include/linux/cpu.h b/include/linux/cpu.h
> > index 03e235ad..9f633b0 100644
> > --- a/include/linux/cpu.h
> > +++ b/include/linux/cpu.h
> > @@ -38,6 +38,8 @@ extern void cpu_remove_dev_attr(struct device_attribute *attr);
> >
> > extern int cpu_add_dev_attr_group(struct attribute_group *attrs);
> > extern void cpu_remove_dev_attr_group(struct attribute_group *attrs);
> > +void arch_enable_nonboot_cpus_begin(void);
> > +void arch_enable_nonboot_cpus_end(void);
>
> Can we simply include linux/smp.h, which defines them already?

Ah, looks like those prototypes were only added to linux/smp.h very
recently, to fix this exact issue, in:

commit fb37bb04d6c8d6c44e61d9da189dcfa6aa0f135e
Author: Paul Gortmaker <[email protected]>
Date: Mon Feb 10 14:25:49 2014 -0800

smp.h: fix x86+cpu.c sparse warnings about arch nonboot CPU calls

Use what we already do for arch_disable_smp_support() to fix these:

arch/x86/kernel/smpboot.c:1155:6: warning: symbol 'arch_enable_nonboot_cpus_begin' was not declared. Should it be static?
arch/x86/kernel/smpboot.c:1160:6: warning: symbol 'arch_enable_nonboot_cpus_end' was not declared. Should it be static?
kernel/cpu.c:512:13: warning: symbol 'arch_enable_nonboot_cpus_begin' was not declared. Should it be static?
kernel/cpu.c:516:13: warning: symbol 'arch_enable_nonboot_cpus_end' was not declared. Should it be static?

2014-02-27 16:25:43

by Paul E. McKenney

[permalink] [raw]
Subject: Re: [PATCH 16/46] kernel: Mark function as static in kernel/rcu/torture.c

On Thu, Feb 27, 2014 at 05:16:57PM +0530, Rashika Kheria wrote:
> Mark functions as static in kernel/rcu/torture.c because they are not
> used outside this file.
>
> This eliminates the following warning in kernel/rcu/torture.c:
> kernel/rcu/torture.c:902:6: warning: no previous prototype for ‘rcutorture_trace_dump’ [-Wmissing-prototypes]
> kernel/rcu/torture.c:1572:6: warning: no previous prototype for ‘rcu_torture_barrier_cbf’ [-Wmissing-prototypes]
>
> Signed-off-by: Rashika Kheria <[email protected]>
> Reviewed-by: Josh Triplett <[email protected]>

Queued for 3.16, thank you both!

I had to hand-apply the patch due to recent changes in my -rcu tree
compared to mainline. The resulting commit is shown below. If there
are problems with it, please let me know.

Thanx, Paul

> ---
> kernel/rcu/torture.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/rcu/torture.c b/kernel/rcu/torture.c
> index 732f8ae..dd3a431 100644
> --- a/kernel/rcu/torture.c
> +++ b/kernel/rcu/torture.c
> @@ -899,7 +899,7 @@ rcu_torture_fakewriter(void *arg)
> return 0;
> }
>
> -void rcutorture_trace_dump(void)
> +static void rcutorture_trace_dump(void)
> {
> static atomic_t beenhere = ATOMIC_INIT(0);
>
> @@ -1569,7 +1569,7 @@ static void rcu_torture_stall_cleanup(void)
> }
>
> /* Callback function for RCU barrier testing. */
> -void rcu_torture_barrier_cbf(struct rcu_head *rcu)
> +static void rcu_torture_barrier_cbf(struct rcu_head *rcu)
> {
> atomic_inc(&barrier_cbs_invoked);
> }
> --
> 1.7.9.5
>

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

commit b386536bde22f505cb01f21ac6a63e687657c3df
Author: Rashika Kheria <[email protected]>
Date: Thu Feb 27 17:16:57 2014 +0530

kernel: Mark function as static in kernel/rcu/torture.c

Mark functions as static in kernel/rcu/torture.c because they are not
used outside this file.

This eliminates the following warning in kernel/rcu/torture.c:
kernel/rcu/torture.c:902:6: warning: no previous prototype for ‘rcutorture_trace_dump’ [-Wmissing-prototypes]
kernel/rcu/torture.c:1572:6: warning: no previous prototype for ‘rcu_torture_barrier_cbf’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
Signed-off-by: Paul E. McKenney <[email protected]>

diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 0d973f893c18..d78331666bca 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -806,7 +806,7 @@ rcu_torture_fakewriter(void *arg)
return 0;
}

-void rcutorture_trace_dump(void)
+static void rcutorture_trace_dump(void)
{
static atomic_t beenhere = ATOMIC_INIT(0);

@@ -1183,7 +1183,7 @@ static int __init rcu_torture_stall_init(void)
}

/* Callback function for RCU barrier testing. */
-void rcu_torture_barrier_cbf(struct rcu_head *rcu)
+static void rcu_torture_barrier_cbf(struct rcu_head *rcu)
{
atomic_inc(&barrier_cbs_invoked);
}

2014-02-27 16:32:40

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH 02/46] kernel: Add prototype definition to include/linux/kernel.h

On Thu, 27 Feb 2014 16:38:50 +0530
Rashika Kheria <[email protected]> wrote:

> Add prototype declaration to header file include/linux/kernel.h because
> it is used by more than one file.
>
> This also eliminates the following warning in kernel/panic.c:
> kernel/panic.c:55:13: warning: no previous prototype for ‘panic_smp_self_stop’ [-Wmissing-prototypes]
>
> Signed-off-by: Rashika Kheria <[email protected]>
> Reviewed-by: Josh Triplett <[email protected]>
> ---
> arch/tile/kernel/smp.c | 1 +
> include/linux/kernel.h | 2 ++
> kernel/panic.c | 1 +
> 3 files changed, 4 insertions(+)
>
> diff --git a/arch/tile/kernel/smp.c b/arch/tile/kernel/smp.c
> index 01e8ab2..8b645fd 100644
> --- a/arch/tile/kernel/smp.c
> +++ b/arch/tile/kernel/smp.c
> @@ -19,6 +19,7 @@
> #include <linux/io.h>
> #include <linux/irq.h>
> #include <linux/module.h>
> +#include <linux/kernel.h>
> #include <asm/cacheflush.h>
> #include <asm/homecache.h>
>
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index 196d1ea..c7cee7d 100644
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -154,6 +154,8 @@ struct completion;
> struct pt_regs;
> struct user;
>
> +void __weak panic_smp_self_stop(void);

Is __weak required in a prototype? What about the override that is not
weak.

-- Steve


> +
> #ifdef CONFIG_PREEMPT_VOLUNTARY
> extern int _cond_resched(void);
> # define might_resched() _cond_resched()
> diff --git a/kernel/panic.c b/kernel/panic.c
> index 6d63003..14e08c2 100644
> --- a/kernel/panic.c
> +++ b/kernel/panic.c
> @@ -23,6 +23,7 @@
> #include <linux/sysrq.h>
> #include <linux/init.h>
> #include <linux/nmi.h>
> +#include <linux/kernel.h>
>
> #define PANIC_TIMER_STEP 100
> #define PANIC_BLINK_SPD 18

2014-02-27 16:34:56

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH 23/46] kernel: Mark function as static in trace/ftrace.c

On Thu, 27 Feb 2014 17:27:49 +0530
Rashika Kheria <[email protected]> wrote:

> Mark function as static in kernel/trace/ftrace.c because it is not used
> outside this file.
>
> Thin eliminates the following warning in kernel/trace/ftrace.c:
> kernel/trace/ftrace.c:717:5: warning: no previous prototype for ‘ftrace_profile_pages_init’ [-Wmissing-prototypes]
>
> Signed-off-by: Rashika Kheria <[email protected]>
> Reviewed-by: Josh Triplett <[email protected]>

Acked-by: Steven Rostedt <[email protected]>

-- Steve

> ---
> kernel/trace/ftrace.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index cd7f76d..d110d8a 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -714,7 +714,7 @@ static void ftrace_profile_reset(struct ftrace_profile_stat *stat)
> FTRACE_PROFILE_HASH_SIZE * sizeof(struct hlist_head));
> }
>
> -int ftrace_profile_pages_init(struct ftrace_profile_stat *stat)
> +static int ftrace_profile_pages_init(struct ftrace_profile_stat *stat)
> {
> struct ftrace_profile_page *pg;
> int functions;

2014-02-27 16:39:32

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH 24/46] kernel: Mark function as static in kernel/trace/ftrace.c and remove stub declaration from header file include/linux/ftrace.h

On Thu, 27 Feb 2014 17:31:21 +0530
Rashika Kheria <[email protected]> wrote:

> Mark function as static in kernel/trace/ftrace.c because it is not used
> outside this file.
> Also, remove unused stub declaration from header file
> include/linux/ftrace.h.
>
> This eliminates the following warning in kernel/trace/ftrace.c:
> kernel/trace/ftrace.c:4268:6: warning: no previous prototype for ‘ftrace_release_mod’ [-Wmissing-prototypes]
>
> Signed-off-by: Rashika Kheria <[email protected]>

Acked-by: Steven Rostedt <[email protected]>

-- Steve

> ---
> include/linux/ftrace.h | 1 -
> kernel/trace/ftrace.c | 2 +-
> 2 files changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
> index f4233b1..68ea184 100644
> --- a/include/linux/ftrace.h
> +++ b/include/linux/ftrace.h
> @@ -532,7 +532,6 @@ static inline int skip_trace(unsigned long ip) { return 0; }
> static inline int ftrace_force_update(void) { return 0; }
> static inline void ftrace_disable_daemon(void) { }
> static inline void ftrace_enable_daemon(void) { }
> -static inline void ftrace_release_mod(struct module *mod) {}
> static inline __init int register_ftrace_command(struct ftrace_func_command *cmd)
> {
> return -EINVAL;
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index d110d8a..9bacf45 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -4265,7 +4265,7 @@ static int ftrace_process_locs(struct module *mod,
>
> #define next_to_ftrace_page(p) container_of(p, struct ftrace_page, next)
>
> -void ftrace_release_mod(struct module *mod)
> +static void ftrace_release_mod(struct module *mod)
> {
> struct dyn_ftrace *rec;
> struct ftrace_page **last_pg;

2014-02-27 16:43:55

by Josh Triplett

[permalink] [raw]
Subject: Re: [PATCH 02/46] kernel: Add prototype definition to include/linux/kernel.h

On Thu, Feb 27, 2014 at 11:32:30AM -0500, Steven Rostedt wrote:
> On Thu, 27 Feb 2014 16:38:50 +0530
> Rashika Kheria <[email protected]> wrote:
> > Add prototype declaration to header file include/linux/kernel.h because
> > it is used by more than one file.
> >
> > This also eliminates the following warning in kernel/panic.c:
> > kernel/panic.c:55:13: warning: no previous prototype for ‘panic_smp_self_stop’ [-Wmissing-prototypes]
> >
> > Signed-off-by: Rashika Kheria <[email protected]>
> > Reviewed-by: Josh Triplett <[email protected]>
> > ---
> > arch/tile/kernel/smp.c | 1 +
> > include/linux/kernel.h | 2 ++
> > kernel/panic.c | 1 +
> > 3 files changed, 4 insertions(+)
> >
> > diff --git a/arch/tile/kernel/smp.c b/arch/tile/kernel/smp.c
> > index 01e8ab2..8b645fd 100644
> > --- a/arch/tile/kernel/smp.c
> > +++ b/arch/tile/kernel/smp.c
> > @@ -19,6 +19,7 @@
> > #include <linux/io.h>
> > #include <linux/irq.h>
> > #include <linux/module.h>
> > +#include <linux/kernel.h>
> > #include <asm/cacheflush.h>
> > #include <asm/homecache.h>
> >
> > diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> > index 196d1ea..c7cee7d 100644
> > --- a/include/linux/kernel.h
> > +++ b/include/linux/kernel.h
> > @@ -154,6 +154,8 @@ struct completion;
> > struct pt_regs;
> > struct user;
> >
> > +void __weak panic_smp_self_stop(void);
>
> Is __weak required in a prototype? What about the override that is not
> weak.

That's a good question. It's definitely not required, and should be
dropped. What I don't know is if it's broken to include it: does it
make the non-weak definition weak?

- Josh Triplett

2014-02-27 17:04:44

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH 02/46] kernel: Add prototype definition to include/linux/kernel.h

[ Dropped Chen Gang, Tony Lu, Chris Metcalf and Robin Holt as their
emails are bouncing for me ]

On Thu, 27 Feb 2014 08:43:36 -0800
Josh Triplett <[email protected]> wrote:

> > > +void __weak panic_smp_self_stop(void);
> >
> > Is __weak required in a prototype? What about the override that is not
> > weak.
>
> That's a good question. It's definitely not required, and should be
> dropped. What I don't know is if it's broken to include it: does it
> make the non-weak definition weak?

I don't think so, but it is inconsistent. Best to not include it in the
prototype. This is a clean up patch after all. Lets not clean up one
thing and make something else messy in the process.

-- Steve

2014-02-27 19:23:57

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH 08/46] kernel: MOve prototype declaration to header file include/linux/perf_event.h

On Thu, Feb 27, 2014 at 07:51:50AM -0800, Josh Triplett wrote:
> On Thu, Feb 27, 2014 at 12:54:14PM +0100, Peter Zijlstra wrote:
> > On Thu, Feb 27, 2014 at 05:02:48PM +0530, Rashika Kheria wrote:
> > > Add prototype declaration of function to header file
> > > include/linux/perf_event.h because it is used by more than one file.
> > >
> > > This eliminates the following warning in kernel/events/core.c:
> > > kernel/events/core.c:3743:13: warning: no previous prototype for ‘arch_perf_update_userpage’ [-Wmissing-prototypes]
> >
> > # git grep arch_perf_update_userpage
> > arch/x86/kernel/cpu/perf_event.c:void arch_perf_update_userpage(struct perf_event_mmap_page *userpg, u64 now)
> > kernel/events/core.c:void __weak arch_perf_update_userpage(struct perf_event_mmap_page *userpg, u64 now)
> > kernel/events/core.c: arch_perf_update_userpage(userpg, now);
> >
> >
> > There's two definitions; one weak, and one usage site.
> >
> > What gives?
>
> There's no prototype for the function anywhere, so -Wmissing-prototypes
> rightfully complains. Adding the prototype to a header included in both
> source files ensures that the function signatures must match, and
> eliminates the warning.

Definitions don't require prior declarations. Only usage without prior
definitions require them.

I still don't see a problem.

Seems to me you're just blindly making a stupid checker happy, just
shoot it in the face.

2014-02-27 19:24:42

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH 18/46] kernel: Mark functions as static in sched/fair.c

On Thu, Feb 27, 2014 at 08:03:22AM -0800, Josh Triplett wrote:
> On Thu, Feb 27, 2014 at 12:58:05PM +0100, Peter Zijlstra wrote:
> > On Thu, Feb 27, 2014 at 05:20:19PM +0530, Rashika Kheria wrote:
> > > @@ -5266,7 +5266,7 @@ static unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu)
> > > return smt_gain;
> > > }
> > >
> > > -unsigned long __weak arch_scale_smt_power(struct sched_domain *sd, int cpu)
> > > +static unsigned long arch_scale_smt_power(struct sched_domain *sd, int cpu)
> > > {
> > > return default_scale_smt_power(sd, cpu);
> > > }
> >
> > Fuck no; please think before sending.
> >
> > I'm going to ignore all patches from you henceforth.
>
> Did you perhaps check, and notice that there are *zero* uses of this
> function in the kernel? Nothing overrides this weak symbol; it is no
> longer needed. You removed the one and only user in your commit:

I know that; but you don't get to remove interfaces under the guise of a
static checker and without mention of such in the changelog.

You should bloody well know better.

2014-02-27 19:37:56

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH 25/46] kernel: Add prototype declaration to header file include/linux/ftrace.h

On Thu, 27 Feb 2014 17:32:47 +0530
Rashika Kheria <[email protected]> wrote:

> Add prototype declaration of function to header file
> include/linux/ftrace.h because it is used by more than one file.
>
> This eliminates the following warning in kernel/trace/ftrace.c:
> kernel/trace/ftrace.c:4914:5: warning: no previous prototype for ‘ftrace_graph_entry_stub’ [-Wmissing-prototypes]
>
> Signed-off-by: Rashika Kheria <[email protected]>
> Reviewed-by: Josh Triplett <[email protected]>
> ---
> include/linux/ftrace.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
> index 68ea184..da1c31f 100644
> --- a/include/linux/ftrace.h
> +++ b/include/linux/ftrace.h
> @@ -672,6 +672,8 @@ struct ftrace_graph_ret {
> typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */
> typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */
>
> +int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace);

This doesn't need to be in a header file as it is only called by
assmebly. But I have no problems with it being in one, but it should
have a comment stating this:

/* This is only called by assembly code, declared here for consistency */

-- Steve

> +
> #ifdef CONFIG_FUNCTION_GRAPH_TRACER
>
> /* for init task */

2014-02-27 19:43:07

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH 26/46] kernel: Mark functions as static in kernel/trace/trace.c

On Thu, 27 Feb 2014 17:33:53 +0530
Rashika Kheria <[email protected]> wrote:

> Mark functions as static in kernel/trace/trace.c
> because they are not used outside this file.
>
> This eliminates the following warning in kernel/trace/trace.c:
> kernel/trace/trace.c:266:9: warning: no previous prototype for ‘buffer_ftrace_now’ [-Wmissing-prototypes]
> kernel/trace/trace.c:590:6: warning: no previous prototype for ‘free_snapshot’ [-Wmissing-prototypes]
>
> Signed-off-by: Rashika Kheria <[email protected]>
> Reviewed-by: Josh Triplett <[email protected]>

Acked-by: Steven Rostedt <[email protected]>

-- Steve

> ---
> kernel/trace/trace.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 815c878..f097949 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -263,7 +263,7 @@ int call_filter_check_discard(struct ftrace_event_call *call, void *rec,
> }
> EXPORT_SYMBOL_GPL(call_filter_check_discard);
>
> -cycle_t buffer_ftrace_now(struct trace_buffer *buf, int cpu)
> +static cycle_t buffer_ftrace_now(struct trace_buffer *buf, int cpu)
> {
> u64 ts;
>
> @@ -587,7 +587,7 @@ static int alloc_snapshot(struct trace_array *tr)
> return 0;
> }
>
> -void free_snapshot(struct trace_array *tr)
> +static void free_snapshot(struct trace_array *tr)
> {
> /*
> * We don't free the ring buffer. instead, resize it because

2014-02-27 19:54:28

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH 27/46] kernel: Mark function as static in kernel/trace/trace_selftest.c

On Thu, 27 Feb 2014 17:36:41 +0530
Rashika Kheria <[email protected]> wrote:

> Mark function as static in kernel/trace/trace_selftest.c because it is
> not used outside this file.
>
> This eliminates the following warning in kernel/trace/trace_selftest.c:
> kernel/trace/trace_selftest.c:318:5: warning: no previous prototype for ‘trace_selftest_startup_dynamic_tracing’ [-Wmissing-prototypes]
>
> Signed-off-by: Rashika Kheria <[email protected]>
> Reviewed-by: Josh Triplett <[email protected]>

Acked-by: Steven Rostedt <[email protected]>

-- Steve

> ---
> kernel/trace/trace_selftest.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c
> index e98fca6..bfecd63 100644
> --- a/kernel/trace/trace_selftest.c
> +++ b/kernel/trace/trace_selftest.c
> @@ -315,9 +315,9 @@ static int trace_selftest_ops(int cnt)
> }
>
> /* Test dynamic code modification and ftrace filters */
> -int trace_selftest_startup_dynamic_tracing(struct tracer *trace,
> - struct trace_array *tr,
> - int (*func)(void))
> +static int trace_selftest_startup_dynamic_tracing(struct tracer *trace,
> + struct trace_array *tr,
> + int (*func)(void))
> {
> int save_ftrace_enabled = ftrace_enabled;
> unsigned long count;

2014-02-27 19:56:28

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH 28/46] kernel: Add prototype declaration to header file linux/ftrace.h

On Thu, 27 Feb 2014 17:38:01 +0530
Rashika Kheria <[email protected]> wrote:

> Add prototye declaration of function to header file
> include/linux/ftrace.h
> because it is used by more than one file.
>
> This eliminates the following warning in
> kernel/trace/trace_functions_graph.c:
> kernel/trace/trace_functions_graph.c:218:15: warning: no previous prototype for ‘ftrace_return_to_handler’ [-Wmissing-prototypes]
>
> Signed-off-by: Rashika Kheria <[email protected]>
> Reviewed-by: Josh Triplett <[email protected]>
> ---
> include/linux/ftrace.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
> index da1c31f..c4d1048 100644
> --- a/include/linux/ftrace.h
> +++ b/include/linux/ftrace.h
> @@ -673,6 +673,7 @@ typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */
> typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */
>
> int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace);
> +unsigned long ftrace_return_to_handler(unsigned long frame_pointer);

Like ftrace_graph_entry_stub() this too is only called from assembly.
Just make the comment I asked to add apply to both of them.

-- Steve

>
> #ifdef CONFIG_FUNCTION_GRAPH_TRACER
>

2014-02-27 19:57:46

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH 29/46] kernel: Mark functions as static in trace/trace_functions_graph.c

On Thu, 27 Feb 2014 17:40:11 +0530
Rashika Kheria <[email protected]> wrote:

> Mark functions as static in kernel/trace/trace_functions_graph.c because
> they are not used outside this file.
>
> This eliminates the following warning in
> kernel/trace/trace_functions_graph.c:
> kernel/trace/trace_functions_graph.c:333:5: warning: no previous prototype for ‘trace_graph_thresh_entry’ [-Wmissing-prototypes]
> kernel/trace/trace_functions_graph.c:422:6: warning: no previous prototype for ‘trace_graph_thresh_return’ [-Wmissing-prototypes]
> kernel/trace/trace_functions_graph.c:1408:6: warning: no previous prototype for ‘print_graph_headers’ [-Wmissing-prototypes]
>
> Signed-off-by: Rashika Kheria <[email protected]>
> Reviewed-by: Josh Triplett <[email protected]>

Acked-by: Steven Rostedt <[email protected]>

-- Steve


> ---
> kernel/trace/trace_functions_graph.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
> index 0b99120..9e9b5c2 100644
> --- a/kernel/trace/trace_functions_graph.c
> +++ b/kernel/trace/trace_functions_graph.c
> @@ -330,7 +330,7 @@ int trace_graph_entry(struct ftrace_graph_ent *trace)
> return ret;
> }
>
> -int trace_graph_thresh_entry(struct ftrace_graph_ent *trace)
> +static int trace_graph_thresh_entry(struct ftrace_graph_ent *trace)
> {
> if (tracing_thresh)
> return 1;
> @@ -419,7 +419,7 @@ void set_graph_array(struct trace_array *tr)
> smp_mb();
> }
>
> -void trace_graph_thresh_return(struct ftrace_graph_ret *trace)
> +static void trace_graph_thresh_return(struct ftrace_graph_ret *trace)
> {
> if (tracing_thresh &&
> (trace->rettime - trace->calltime < tracing_thresh))
> @@ -1405,7 +1405,7 @@ static void __print_graph_headers_flags(struct seq_file *s, u32 flags)
> seq_printf(s, " | | | |\n");
> }
>
> -void print_graph_headers(struct seq_file *s)
> +static void print_graph_headers(struct seq_file *s)
> {
> print_graph_headers_flags(s, tracer_flags.val);
> }

2014-02-27 22:48:18

by Josh Triplett

[permalink] [raw]
Subject: Re: [PATCH 25/46] kernel: Add prototype declaration to header file include/linux/ftrace.h

On Thu, Feb 27, 2014 at 02:37:53PM -0500, Steven Rostedt wrote:
> On Thu, 27 Feb 2014 17:32:47 +0530
> Rashika Kheria <[email protected]> wrote:
>
> > Add prototype declaration of function to header file
> > include/linux/ftrace.h because it is used by more than one file.
> >
> > This eliminates the following warning in kernel/trace/ftrace.c:
> > kernel/trace/ftrace.c:4914:5: warning: no previous prototype for ‘ftrace_graph_entry_stub’ [-Wmissing-prototypes]
> >
> > Signed-off-by: Rashika Kheria <[email protected]>
> > Reviewed-by: Josh Triplett <[email protected]>
> > ---
> > include/linux/ftrace.h | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
> > index 68ea184..da1c31f 100644
> > --- a/include/linux/ftrace.h
> > +++ b/include/linux/ftrace.h
> > @@ -672,6 +672,8 @@ struct ftrace_graph_ret {
> > typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */
> > typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */
> >
> > +int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace);
>
> This doesn't need to be in a header file as it is only called by
> assmebly. But I have no problems with it being in one, but it should
> have a comment stating this:
>
> /* This is only called by assembly code, declared here for consistency */

That seems quite reasonable, yeah.

- Josh Triplett

2014-02-27 22:55:50

by Josh Triplett

[permalink] [raw]
Subject: Re: [PATCH 08/46] kernel: MOve prototype declaration to header file include/linux/perf_event.h

On Thu, Feb 27, 2014 at 08:23:35PM +0100, Peter Zijlstra wrote:
> On Thu, Feb 27, 2014 at 07:51:50AM -0800, Josh Triplett wrote:
> > On Thu, Feb 27, 2014 at 12:54:14PM +0100, Peter Zijlstra wrote:
> > > On Thu, Feb 27, 2014 at 05:02:48PM +0530, Rashika Kheria wrote:
> > > > Add prototype declaration of function to header file
> > > > include/linux/perf_event.h because it is used by more than one file.
> > > >
> > > > This eliminates the following warning in kernel/events/core.c:
> > > > kernel/events/core.c:3743:13: warning: no previous prototype for ‘arch_perf_update_userpage’ [-Wmissing-prototypes]
> > >
> > > # git grep arch_perf_update_userpage
> > > arch/x86/kernel/cpu/perf_event.c:void arch_perf_update_userpage(struct perf_event_mmap_page *userpg, u64 now)
> > > kernel/events/core.c:void __weak arch_perf_update_userpage(struct perf_event_mmap_page *userpg, u64 now)
> > > kernel/events/core.c: arch_perf_update_userpage(userpg, now);
> > >
> > >
> > > There's two definitions; one weak, and one usage site.
> > >
> > > What gives?
> >
> > There's no prototype for the function anywhere, so -Wmissing-prototypes
> > rightfully complains. Adding the prototype to a header included in both
> > source files ensures that the function signatures must match, and
> > eliminates the warning.
>
> Definitions don't require prior declarations. Only usage without prior
> definitions require them.
>
> I still don't see a problem.

There's value in -Wmissing-prototypes; it's equivalent to the Sparse
check that ensures functions are marked as static when they're not used
outside the file they're defined in (though unlike the Sparse check it
only applies to functions, not data). The goal isn't "make the warning
go away"; the goal of passing -Wmissing-prototypes is:

- Get rid of unused functions (many of which have been caught by this
effort).
- Mark functions as static where possible (which enables the above and
also improves code generation).
- Include headers that declare functions in the source files that define
them, not just in the source files that use them. That keeps the
declaration and definition in sync (which has caught some real bugs as
part of this effort).
- When no such header exists for a function used across multiple files,
add the prototype to an appropriate header and use that. Again, this
has caught real bugs as part of this effort, when the definition and
use were out of sync. (For instance, disagreeing in return type.)

2014-02-27 23:09:11

by Josh Triplett

[permalink] [raw]
Subject: Re: [PATCH 18/46] kernel: Mark functions as static in sched/fair.c

On Thu, Feb 27, 2014 at 08:24:35PM +0100, Peter Zijlstra wrote:
> On Thu, Feb 27, 2014 at 08:03:22AM -0800, Josh Triplett wrote:
> > Did you perhaps check, and notice that there are *zero* uses of this
> > function in the kernel? Nothing overrides this weak symbol; it is no
> > longer needed. You removed the one and only user in your commit:
>
> I know that; but you don't get to remove interfaces under the guise of a
> static checker and without mention of such in the changelog.

So the changelog message needed improvement. Got it; that would have
been helpful to hear.

The kernel hardly goes to great lengths to preserve old interfaces with
no users (per stable_api_nonsense), and the commit message already stated
that the function was being marked as static because it wasn't used
elsewhere. But sure, perhaps something like the following, added to the
commit message, would address your concern?

"""
arch_scale_smt_power, in particular, is a __weak function provided for
architectures to override. However, the only overriding definition was
removed before v3.6, in commit ee08d1284ea9235b29bd2d9b7493b4b4cf3da09c
("sched/x86: Remove broken power estimation"). Thus, drop the __weak
and make the function static.
"""

Or would you prefer to see it completely eliminated (inlining it into
its caller) as part of the same patch?

- Josh Triplett

2014-02-28 02:45:49

by James Morris

[permalink] [raw]
Subject: Re: [PATCH 35/46] kernel: Mark function as static in kernel/seccomp.c

On Thu, 27 Feb 2014, Rashika Kheria wrote:

> Mark function as static in kernel/seccomp.c because it is not used
> outside this file.
>
> This eliminates the following warning in kernel/seccomp.c:
> kernel/seccomp.c:296:6: warning: no previous prototype for ?seccomp_attach_user_filter? [-Wmissing-prototypes]
>
> Signed-off-by: Rashika Kheria <[email protected]>
> Reviewed-by: Josh Triplett <[email protected]>

Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git next


--
James Morris
<[email protected]>

2014-02-28 08:59:00

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH 18/46] kernel: Mark functions as static in sched/fair.c

On Thu, Feb 27, 2014 at 03:09:05PM -0800, [email protected] wrote:
> On Thu, Feb 27, 2014 at 08:24:35PM +0100, Peter Zijlstra wrote:
> > On Thu, Feb 27, 2014 at 08:03:22AM -0800, Josh Triplett wrote:
> > > Did you perhaps check, and notice that there are *zero* uses of this
> > > function in the kernel? Nothing overrides this weak symbol; it is no
> > > longer needed. You removed the one and only user in your commit:
> >
> > I know that; but you don't get to remove interfaces under the guise of a
> > static checker and without mention of such in the changelog.
>
> So the changelog message needed improvement. Got it; that would have
> been helpful to hear.
>
> The kernel hardly goes to great lengths to preserve old interfaces with
> no users (per stable_api_nonsense), and the commit message already stated
> that the function was being marked as static because it wasn't used
> elsewhere. But sure, perhaps something like the following, added to the
> commit message, would address your concern?
>
> """
> arch_scale_smt_power, in particular, is a __weak function provided for
> architectures to override. However, the only overriding definition was
> removed before v3.6, in commit ee08d1284ea9235b29bd2d9b7493b4b4cf3da09c
> ("sched/x86: Remove broken power estimation"). Thus, drop the __weak
> and make the function static.
> """
>
> Or would you prefer to see it completely eliminated (inlining it into
> its caller) as part of the same patch?

Also remove the arch_ prefix, its not longer an arch function if you
make it static, is it.

2014-02-28 09:39:05

by Peter Oberparleiter

[permalink] [raw]
Subject: Re: [PATCH 11/46] kernel: Add prototype declaration in kernel/gcov/base.c

On 27.02.2014 12:39, Rashika Kheria wrote:
> Add prototype declarations of functions in kernel/gcov/base.c. These
> functions are required by GCC builtins and hence can not be removed
> despite of their unreferenced appearance in kernel source.
>
> This eliminates the following warning in kernel/gcov/base.c:
> kernel/gcov/base.c:30:6: warning: no previous prototype for ?__gcov_init? [-Wmissing-prototypes]
> kernel/gcov/base.c:58:6: warning: no previous prototype for ?__gcov_flush? [-Wmissing-prototypes]
> kernel/gcov/base.c:64:6: warning: no previous prototype for ?__gcov_merge_add? [-Wmissing-prototypes]
> kernel/gcov/base.c:70:6: warning: no previous prototype for ?__gcov_merge_single? [-Wmissing-prototypes]
> kernel/gcov/base.c:76:6: warning: no previous prototype for?__gcov_merge_delta? [-Wmissing-prototypes]
> kernel/gcov/base.c:82:6: warning: no previous prototype for ?__gcov_merge_ior? [-Wmissing-prototypes]
>
> Signed-off-by: Rashika Kheria <[email protected]>

Acked-by: Peter Oberparleiter <[email protected]>

> ---
> kernel/gcov/base.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/kernel/gcov/base.c b/kernel/gcov/base.c
> index f45b75b..c0cb53a 100644
> --- a/kernel/gcov/base.c
> +++ b/kernel/gcov/base.c
> @@ -27,6 +27,7 @@ static DEFINE_MUTEX(gcov_lock);
> * __gcov_init is called by gcc-generated constructor code for each object
> * file compiled with -fprofile-arcs.
> */
> +void __gcov_init(struct gcov_info *info);
> void __gcov_init(struct gcov_info *info)
> {
> static unsigned int gcov_version;
> @@ -55,30 +56,35 @@ EXPORT_SYMBOL(__gcov_init);
> * These functions may be referenced by gcc-generated profiling code but serve
> * no function for kernel profiling.
> */
> +void __gcov_flush(void);
> void __gcov_flush(void)
> {
> /* Unused. */
> }
> EXPORT_SYMBOL(__gcov_flush);
>
> +void __gcov_merge_add(gcov_type *counters, unsigned int n_counters);
> void __gcov_merge_add(gcov_type *counters, unsigned int n_counters)
> {
> /* Unused. */
> }
> EXPORT_SYMBOL(__gcov_merge_add);
>
> +void __gcov_merge_single(gcov_type *counters, unsigned int n_counters);
> void __gcov_merge_single(gcov_type *counters, unsigned int n_counters)
> {
> /* Unused. */
> }
> EXPORT_SYMBOL(__gcov_merge_single);
>
> +void __gcov_merge_delta(gcov_type *counters, unsigned int n_counters);
> void __gcov_merge_delta(gcov_type *counters, unsigned int n_counters)
> {
> /* Unused. */
> }
> EXPORT_SYMBOL(__gcov_merge_delta);
>
> +void __gcov_merge_ior(gcov_type *counters, unsigned int n_counters);
> void __gcov_merge_ior(gcov_type *counters, unsigned int n_counters)
> {
> /* Unused. */
>

--
Peter Oberparleiter
Linux on System z Development - IBM Germany

2014-02-28 11:41:09

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH 08/46] kernel: MOve prototype declaration to header file include/linux/perf_event.h

On Thu, Feb 27, 2014 at 02:55:45PM -0800, [email protected] wrote:
> On Thu, Feb 27, 2014 at 08:23:35PM +0100, Peter Zijlstra wrote:
> > On Thu, Feb 27, 2014 at 07:51:50AM -0800, Josh Triplett wrote:
> > > On Thu, Feb 27, 2014 at 12:54:14PM +0100, Peter Zijlstra wrote:
> > > > On Thu, Feb 27, 2014 at 05:02:48PM +0530, Rashika Kheria wrote:
> > > > > Add prototype declaration of function to header file
> > > > > include/linux/perf_event.h because it is used by more than one file.
> > > > >
> > > > > This eliminates the following warning in kernel/events/core.c:
> > > > > kernel/events/core.c:3743:13: warning: no previous prototype for ‘arch_perf_update_userpage’ [-Wmissing-prototypes]
> > > >
> > > > # git grep arch_perf_update_userpage
> > > > arch/x86/kernel/cpu/perf_event.c:void arch_perf_update_userpage(struct perf_event_mmap_page *userpg, u64 now)
> > > > kernel/events/core.c:void __weak arch_perf_update_userpage(struct perf_event_mmap_page *userpg, u64 now)
> > > > kernel/events/core.c: arch_perf_update_userpage(userpg, now);
> > > >
> > > >
> > > > There's two definitions; one weak, and one usage site.
> > > >
> > > > What gives?
> > >
> > > There's no prototype for the function anywhere, so -Wmissing-prototypes
> > > rightfully complains. Adding the prototype to a header included in both
> > > source files ensures that the function signatures must match, and
> > > eliminates the warning.
> >
> > Definitions don't require prior declarations. Only usage without prior
> > definitions require them.
> >
> > I still don't see a problem.
>
> There's value in -Wmissing-prototypes; it's equivalent to the Sparse
> check that ensures functions are marked as static when they're not used
> outside the file they're defined in (though unlike the Sparse check it
> only applies to functions, not data). The goal isn't "make the warning
> go away"; the goal of passing -Wmissing-prototypes is:
>
> - Get rid of unused functions (many of which have been caught by this
> effort).
> - Mark functions as static where possible (which enables the above and
> also improves code generation).
> - Include headers that declare functions in the source files that define
> them, not just in the source files that use them. That keeps the
> declaration and definition in sync (which has caught some real bugs as
> part of this effort).
> - When no such header exists for a function used across multiple files,
> add the prototype to an appropriate header and use that. Again, this
> has caught real bugs as part of this effort, when the definition and
> use were out of sync. (For instance, disagreeing in return type.)

Well then say that already; the reason I reacted so strongly is because
I'm busy, and I don't have time for */46 patches that look like robot
output.

The changelog reads like its just making warns go away; the patches look
automated; including the typical non-thinking robot fails; _AND_ its
got a review tag from someone who should bloody well know better than to
send crap patches like this.

This all is a huge waste of time from my side; and you're doing your
intern a disservice by training him to be a thoughtless robot.

2014-02-28 13:21:13

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH 14/46] kernel: Move prototype declaration to header file kernel/power/power.h

On Thu 2014-02-27 17:13:53, Rashika Kheria wrote:
> Move prototype declaration of function to header file
> kernel/power/power.h
> because it is used by more than one file.
>
> This eliminates the following warning in kernel/power/snapshot.c:
> kernel/power/snapshot.c:1588:16: warning: no previous prototype for ‘swsusp_save’ [-Wmissing-prototypes]
>
> Signed-off-by: Rashika Kheria <[email protected]>
> Reviewed-by: Josh Triplett <[email protected]>

Acked-by: Pavel Machek <[email protected]>

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html