core/locking changes for v3.1
Subsystems (7)
Linus,
Please pull the latest core-locking-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git core-locking-for-linus
Thanks,
Ingo
------------------>
Anton Blanchard (1):
lockup detector: Fix reference to the non-existent CONFIG_DETECT_SOFTLOCKUP option
Dima Zavin (1):
plist: Remove the need to supply locks to plist heads
Jean Delvare (1):
mutex: Make mutex_destroy() an inline function
Peter Zijlstra (1):
lockdep: Fix lockdep_no_validate against IRQ states
include/linux/mutex.h | 2 +- include/linux/plist.h | 55 ++-------------------------------------------- include/linux/rtmutex.h | 4 +- kernel/fork.c | 2 +- kernel/futex.c | 2 +- kernel/lockdep.c | 3 ++ kernel/pm_qos_params.c | 6 ++-- kernel/rtmutex.c | 2 +- kernel/sched.c | 4 +- lib/Kconfig.debug | 4 +- lib/plist.c | 7 +----- 11 files changed, 20 insertions(+), 71 deletions(-)
include/linux/mutex.h +1 -1
@@ -92,7 +92,7 @@ do { \ \ __mutex_init((mutex), #mutex, &__key); \ } while (0) -# define mutex_destroy (mutex) do { } while (0) +static inline void mutex_destroy (struct mutex *lock) {}#endif #ifdef CONFIG_DEBUG_LOCK_ALLOC
include/linux/plist.h +3 -52
85 lines not on this page · raw message
include/linux/rtmutex.h +2 -2
@@ -66,7 +66,7 @@ struct hrtimer_sleeper;#define __RT_MUTEX_INITIALIZER (mutexname) \ { .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \ - , .wait_list = PLIST_HEAD_INIT_RAW(mutexname.wait_list, mutexname.wait_lock) \ + , .wait_list = PLIST_HEAD_INIT(mutexname.wait_list) \ , .owner = NULL \ __DEBUG_RT_MUTEX_INITIALIZER(mutexname)}
@@ -100,7 +100,7 @@ extern void rt_mutex_unlock(struct rt_mutex *lock);#ifdef CONFIG_RT_MUTEXES # define INIT_RT_MUTEXES (tsk) \ - .pi_waiters = PLIST_HEAD_INIT(tsk.pi_waiters, tsk.pi_lock), \ + .pi_waiters = PLIST_HEAD_INIT(tsk.pi_waiters), \ INIT_RT_MUTEX_DEBUG(tsk)#else # define INIT_RT_MUTEXES (tsk)
kernel/fork.c +1 -1
@@ -1013,7 +1013,7 @@ static void rt_mutex_init_task(struct task_struct *p) {raw_spin_lock_init (&p->pi_lock);#ifdef CONFIG_RT_MUTEXES -plist_head_init_raw (&p->pi_waiters, &p->pi_lock); +plist_head_init (&p->pi_waiters); p->pi_blocked_on =NULL ;#endif }
kernel/futex.c +1 -1
@@ -2697,7 +2697,7 @@ static int __init futex_init(void) futex_cmpxchg_enabled =1 ;for (i =0 ; i <ARRAY_SIZE (futex_queues); i++) { -plist_head_init (&futex_queues[i].chain, &futex_queues[i].lock); +plist_head_init (&futex_queues[i].chain);spin_lock_init (&futex_queues[i].lock); }
kernel/lockdep.c +3 -0
@@ -2468,6 +2468,9 @@ mark_held_locks(struct task_struct *curr, enum mark_type mark)BUG_ON (usage_bit >=LOCK_USAGE_STATES ); +if (hlock_class (hlock)->key == &__lockdep_no_validate__) +continue ; +if (!mark_lock (curr, hlock, usage_bit))return 0 ; }
kernel/pm_qos_params.c +3 -3
@@ -74,7 +74,7 @@ static DEFINE_SPINLOCK(pm_qos_lock);static struct pm_qos_object null_pm_qos;static BLOCKING_NOTIFIER_HEAD (cpu_dma_lat_notifier);static struct pm_qos_object cpu_dma_pm_qos = { - .requests =PLIST_HEAD_INIT (cpu_dma_pm_qos.requests, pm_qos_lock), + .requests =PLIST_HEAD_INIT (cpu_dma_pm_qos.requests), .notifiers = &cpu_dma_lat_notifier, .name ="cpu_dma_latency" , .target_value =PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE ,
@@ -84,7 +84,7 @@ static struct pm_qos_object cpu_dma_pm_qos = {static BLOCKING_NOTIFIER_HEAD (network_lat_notifier);static struct pm_qos_object network_lat_pm_qos = { - .requests =PLIST_HEAD_INIT (network_lat_pm_qos.requests, pm_qos_lock), + .requests =PLIST_HEAD_INIT (network_lat_pm_qos.requests), .notifiers = &network_lat_notifier, .name ="network_latency" , .target_value =PM_QOS_NETWORK_LAT_DEFAULT_VALUE ,
@@ -95,7 +95,7 @@ static struct pm_qos_object network_lat_pm_qos = {static BLOCKING_NOTIFIER_HEAD (network_throughput_notifier);static struct pm_qos_object network_throughput_pm_qos = { - .requests =PLIST_HEAD_INIT (network_throughput_pm_qos.requests, pm_qos_lock), + .requests =PLIST_HEAD_INIT (network_throughput_pm_qos.requests), .notifiers = &network_throughput_notifier, .name ="network_throughput" , .target_value =PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE ,
kernel/rtmutex.c +1 -1
@@ -890,7 +890,7 @@ void __rt_mutex_init(struct rt_mutex *lock, const char *name) { lock->owner =NULL ;raw_spin_lock_init (&lock->wait_lock); -plist_head_init_raw (&lock->wait_list, &lock->wait_lock); +plist_head_init (&lock->wait_list);debug_rt_mutex_init (lock, name); }
kernel/sched.c +2 -2
@@ -7781,7 +7781,7 @@ static void init_rt_rq(struct rt_rq *rt_rq, struct rq *rq)#ifdef CONFIG_SMP rt_rq->rt_nr_migratory =0 ; rt_rq->overloaded =0 ; -plist_head_init_raw (&rt_rq->pushable_tasks, &rq->lock); +plist_head_init (&rt_rq->pushable_tasks);#endif rt_rq->rt_time =0 ;
@@ -7986,7 +7986,7 @@ void __init sched_init(void)#endif #ifdef CONFIG_RT_MUTEXES -plist_head_init_raw (&init_task.pi_waiters, &init_task.pi_lock); +plist_head_init (&init_task.pi_waiters);#endif /*
lib/Kconfig.debug +2 -2
@@ -227,7 +227,7 @@ config BOOTPARAM_SOFTLOCKUP_PANIC_VALUE config DETECT_HUNG_TASK bool "Detect Hung Tasks" depends on DEBUG_KERNEL - default DETECT_SOFTLOCKUP + default LOCKUP_DETECTOR help Say Y here to enable the kernel to detect "hung tasks", which are bugs that cause the task to be stuck in
@@ -866,7 +866,7 @@ config BOOT_PRINTK_DELAY system, and then set "lpj=M" before setting "boot_delay=N". NOTE: Using this option may adversely affect SMP systems. I.e., processors other than the first one may not boot up. - BOOT_PRINTK_DELAY also may cause DETECT_SOFTLOCKUP to detect + BOOT_PRINTK_DELAY also may cause LOCKUP_DETECTOR to detect what it believes to be lockup conditions. config RCU_TORTURE_TEST
lib/plist.c +1 -6
@@ -56,11 +56,6 @@ static void plist_check_list(struct list_head *top)static void plist_check_head (struct plist_head *head) { -WARN_ON (head != &test_head && !head->rawlock && !head->spinlock); -if (head->rawlock) -WARN_ON_SMP (!raw_spin_is_locked (head->rawlock)); -if (head->spinlock) -WARN_ON_SMP (!spin_is_locked (head->spinlock));if (!plist_head_empty (head))plist_check_list (&plist_first (head)->prio_list);plist_check_list (&head->node_list);
@@ -180,7 +175,7 @@ static int __init plist_test(void)unsigned int r =local_clock ();printk (KERN_INFO "start plist test\n" ); -plist_head_init (&test_head,NULL ); +plist_head_init (&test_head);for (i =0 ; i <ARRAY_SIZE (test_node); i++)plist_node_init (test_node + i,0 );
Hi,
Quoted 14 lines · Ingo Molnar
Linus,
Please pull the latest core-locking-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.gitcore-locking-for-linusThanks,
Ingo
------------------>
Anton Blanchard (1):
lockup detector: Fix reference to the non-existentCONFIG_DETECT_SOFTLOCKUPoption
Quoted 9 lines
Dima Zavin (1):
plist: Remove the need to supply locks to plist headsJean Delvare (1):
mutex: Makemutex_destroy()an inline functionPeter Zijlstra (1):
lockdep: Fixlockdep_no_validateagainst IRQ states
from today's master, this last commit triggers:
/src/linux/linux/kernel/lockdep.c: In function 'mark_held_locks':
/src/linux/linux/kernel/lockdep.c:2471:31: warning: comparison of distinct pointer types lacks a cast
I'm not sure if both struct member and variable's type are correct nor the comparability between struct lockdep_subclass_key *' and struct lock_class_key *'. So I'll let you fix this.
- Arnaud
Quoted 300 lines
include/linux/mutex.h | 2 +-
include/linux/plist.h | 55 ++--------------------------------------------include/linux/rtmutex.h| 4 +-
kernel/fork.c | 2 +-
kernel/futex.c | 2 +-
kernel/lockdep.c | 3 ++
kernel/pm_qos_params.c | 6 ++--
kernel/rtmutex.c | 2 +-
kernel/sched.c | 4 +-
lib/Kconfig.debug | 4 +-
lib/plist.c | 7 +-----11 files changed, 20 insertions(+), 71 deletions(-)include/linux/mutex.h +1
-1@@ -92,7 +92,7 @@ do { \ \ __mutex_init((mutex), #mutex, &__key); \ } while (0) -# define mutex_destroy (mutex) do { } while (0) +static inline void mutex_destroy (struct mutex *lock) {} #endif #ifdef CONFIG_DEBUG_LOCK_ALLOCinclude/linux/plist.h +2
-32@@ -77,14 +77,9 @@ #include <linux/kernel.h> #include <linux/list.h> -#include <linux/spinlock_types.h> struct plist_head { struct list_head node_list; -#ifdef CONFIG_DEBUG_PI_LIST - raw_spinlock_t *rawlock; - spinlock_t *spinlock; -#endif }; struct plist_node {@@ -93,37 +88,13 @@ struct plist_node { struct list_head node_list; }; -#ifdef CONFIG_DEBUG_PI_LIST -# define PLIST_HEAD_LOCK_INIT (_lock) .spinlock = _lock -# define PLIST_HEAD_LOCK_INIT_RAW (_lock) .rawlock = _lock -#else -# define PLIST_HEAD_LOCK_INIT (_lock) -# define PLIST_HEAD_LOCK_INIT_RAW (_lock) -#endif - -#define _PLIST_HEAD_INIT (head) \ - .node_list = LIST_HEAD_INIT((head).node_list) - /*** PLIST_HEAD_INIT - static struct plist_head initializer * @head: struct plist_head variable name -* @_lock: lock to initialize for this list -*/ -#define PLIST_HEAD_INIT (head, _lock) \ -{ \ - _PLIST_HEAD_INIT(head), \ - PLIST_HEAD_LOCK_INIT(&(_lock)) \ -} - -/** -* PLIST_HEAD_INIT_RAW - static struct plist_head initializer -* @head: struct plist_head variable name -* @_lock: lock to initialize for this list */ -#define PLIST_HEAD_INIT_RAW (head, _lock) \ +#define PLIST_HEAD_INIT (head) \ { \ - _PLIST_HEAD_INIT(head), \ - PLIST_HEAD_LOCK_INIT_RAW(&(_lock)) \ + .node_list = LIST_HEAD_INIT((head).node_list) \ } /**@@ -141,31 +112,11 @@ struct plist_node { /*** plist_head_init - dynamic struct plist_head initializer * @head: &struct plist_head pointer -* @lock: spinlock protecting the list (debugging) */ static inline void
include/linux/plist.h +1
-1-plist_head_init(struct plist_head *head, spinlock_t *lock) +plist_head_init(struct plist_head *head){
INIT_LIST_HEAD(&head->node_list);include/linux/plist.h +0
-19-#ifdef CONFIG_DEBUG_PI_LIST - head->spinlock = lock; - head->rawlock = NULL; -#endif -} - -/** -* plist_head_init_raw - dynamic struct plist_head initializer -* @head: &struct plist_head pointer -* @lock: raw_spinlock protecting the list (debugging) -*/ -static inline void -plist_head_init_raw (struct plist_head *head,raw_spinlock_t *lock) -{ - INIT_LIST_HEAD(&head->node_list); -#ifdef CONFIG_DEBUG_PI_LIST - head->rawlock = lock; - head->spinlock = NULL; -#endif }
/**
include/linux/rtmutex.h +2
-2@@ -66,7 +66,7 @@ struct hrtimer_sleeper; #define __RT_MUTEX_INITIALIZER(mutexname) \ { .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \ - , .wait_list = PLIST_HEAD_INIT_RAW(mutexname.wait_list, mutexname.wait_lock) \ + , .wait_list = PLIST_HEAD_INIT(mutexname.wait_list) \ , .owner = NULL \ __DEBUG_RT_MUTEX_INITIALIZER(mutexname)}@@ -100,7 +100,7 @@ extern void rt_mutex_unlock(struct rt_mutex *lock); #ifdef CONFIG_RT_MUTEXES # define INIT_RT_MUTEXES(tsk) \ - .pi_waiters = PLIST_HEAD_INIT(tsk.pi_waiters, tsk.pi_lock), \ + .pi_waiters = PLIST_HEAD_INIT(tsk.pi_waiters), \ INIT_RT_MUTEX_DEBUG(tsk) #else # define INIT_RT_MUTEXES(tsk)kernel/fork.c +1
-1@@ -1013,7 +1013,7 @@ static void rt_mutex_init_task(struct task_struct *p) { raw_spin_lock_init(&p->pi_lock); #ifdef CONFIG_RT_MUTEXES - plist_head_init_raw(&p->pi_waiters, &p->pi_lock); + plist_head_init(&p->pi_waiters); p->pi_blocked_on = NULL; #endif }kernel/futex.c +1
-1@@ -2697,7 +2697,7 @@ static int __init futex_init(void) futex_cmpxchg_enabled = 1; for (i = 0; i < ARRAY_SIZE(futex_queues); i++) { - plist_head_init(&futex_queues[i].chain, &futex_queues[i].lock); + plist_head_init(&futex_queues[i].chain); spin_lock_init(&futex_queues[i].lock); }kernel/lockdep.c +3
-0@@ -2468,6 +2468,9 @@ mark_held_locks(struct task_struct *curr, enum mark_type mark) BUG_ON(usage_bit >= LOCK_USAGE_STATES); + if (hlock_class(hlock)->key == &__lockdep_no_validate__) + continue; + if (!mark_lock(curr, hlock, usage_bit)) return 0; }kernel/pm_qos_params.c +3
-3@@ -74,7 +74,7 @@ static DEFINE_SPINLOCK(pm_qos_lock); static struct pm_qos_object null_pm_qos; static BLOCKING_NOTIFIER_HEAD(cpu_dma_lat_notifier); static struct pm_qos_object cpu_dma_pm_qos = { - .requests = PLIST_HEAD_INIT(cpu_dma_pm_qos.requests, pm_qos_lock), + .requests = PLIST_HEAD_INIT(cpu_dma_pm_qos.requests), .notifiers = &cpu_dma_lat_notifier, .name = "cpu_dma_latency", .target_value = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE,@@ -84,7 +84,7 @@ static struct pm_qos_object cpu_dma_pm_qos = { static BLOCKING_NOTIFIER_HEAD(network_lat_notifier); static struct pm_qos_object network_lat_pm_qos = { - .requests = PLIST_HEAD_INIT(network_lat_pm_qos.requests, pm_qos_lock), + .requests = PLIST_HEAD_INIT(network_lat_pm_qos.requests), .notifiers = &network_lat_notifier, .name = "network_latency", .target_value = PM_QOS_NETWORK_LAT_DEFAULT_VALUE,@@ -95,7 +95,7 @@ static struct pm_qos_object network_lat_pm_qos = { static BLOCKING_NOTIFIER_HEAD(network_throughput_notifier); static struct pm_qos_object network_throughput_pm_qos = { - .requests = PLIST_HEAD_INIT(network_throughput_pm_qos.requests, pm_qos_lock), + .requests = PLIST_HEAD_INIT(network_throughput_pm_qos.requests), .notifiers = &network_throughput_notifier, .name = "network_throughput", .target_value = PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE,kernel/rtmutex.c +1
-1@@ -890,7 +890,7 @@ void __rt_mutex_init(struct rt_mutex *lock, const char *name) { lock->owner = NULL; raw_spin_lock_init(&lock->wait_lock); - plist_head_init_raw(&lock->wait_list, &lock->wait_lock); + plist_head_init(&lock->wait_list); debug_rt_mutex_init(lock, name); }kernel/sched.c +2
-2@@ -7781,7 +7781,7 @@ static void init_rt_rq(struct rt_rq *rt_rq, struct rq *rq) #ifdef CONFIG_SMP rt_rq->rt_nr_migratory = 0; rt_rq->overloaded = 0; - plist_head_init_raw(&rt_rq->pushable_tasks, &rq->lock); + plist_head_init(&rt_rq->pushable_tasks); #endif rt_rq->rt_time = 0;@@ -7986,7 +7986,7 @@ void __init sched_init(void) #endif #ifdef CONFIG_RT_MUTEXES - plist_head_init_raw(&init_task.pi_waiters, &init_task.pi_lock); + plist_head_init(&init_task.pi_waiters); #endif /*lib/Kconfig.debug +0
-0@@ -227,7 +227,7 @@ config BOOTPARAM_SOFTLOCKUP_PANIC_VALUEconfig
DETECT_HUNG_TASK
bool "Detect Hung Tasks"
depends onDEBUG_KERNEL
- defaultDETECT_SOFTLOCKUP
+ defaultLOCKUP_DETECTOR
help
Say Y here to enable the kernel to detect "hung tasks", which are bugs that cause the task to be stuck inlib/Kconfig.debug +0
-0@@ -866,7 +866,7 @@ config BOOT_PRINTK_DELAYsystem, and then set "lpj=M" before setting "boot_delay=N".
NOTE: Using this option may adversely affect SMP systems. I.e., processors other than the first one may not boot up.
-BOOT_PRINTK_DELAYalso may causeDETECT_SOFTLOCKUPto detect
+BOOT_PRINTK_DELAYalso may causeLOCKUP_DETECTORto detect what it believes to be lockup conditions.config
RCU_TORTURE_TESTlib/plist.c +1
-7@@ -56,11 +56,6 @@ static void plist_check_list(struct list_head *top) static void plist_check_head(struct plist_head *head) { - WARN_ON(head != &test_head && !head->rawlock && !head->spinlock); - if (head->rawlock) - WARN_ON_SMP(!raw_spin_is_locked(head->rawlock)); - if (head->spinlock) - WARN_ON_SMP(!spin_is_locked(head->spinlock)); if (!plist_head_empty(head)) plist_check_list(&plist_first(head)->prio_list); plist_check_list(&head->node_list);@@ -180,7 +175,7 @@ static int __init plist_test(void) unsigned int r = local_clock(); printk(KERN_INFO "start plist test\n"); - plist_head_init(&test_head, NULL); + plist_head_init(&test_head); for (i = 0; i < ARRAY_SIZE(test_node); i++) plist_node_init(test_node + i, 0); --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 5 lines · Arnaud Lacombe
Quoted 3 lines
Peter Zijlstra (1):
lockdep: Fixlockdep_no_validateagainst IRQ statesfrom today's master, this last commit triggers:
Quoted 7 lines
/src/linux/linux/kernel/lockdep.c: In function '
mark_held_locks':
/src/linux/linux/kernel/lockdep.c:2471:31: warning: comparison of distinct pointer types lacks a castI'm not sure if both struct member and variable's type are correct nor the comparability between
struct lockdep_subclass_key *' andstructlock_class_key*'. So I'll let you fix this.
Argh, I really need -Werror to even see warnings, compiler output just flies by waaaaaay too fast.
The warning is harmless in this case, but the below makes it go away.
--- kernel/lockdep.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/lockdep.c +1 -1
@@ -2468,7 +2468,7 @@ mark_held_locks(struct task_struct *curr, enum mark_type mark)BUG_ON (usage_bit >=LOCK_USAGE_STATES ); -if (hlock_class (hlock)->key == &__lockdep_no_validate__) +if (hlock_class (hlock)->key == __lockdep_no_validate__.subkeys)continue ;if (!mark_lock (curr, hlock, usage_bit))
Quoted 3 lines · Peter Zijlstra
Argh, I really need -Werror to even see warnings, compiler output just flies by waaaaaay too fast.
Do what I do:
make -j32 > ../makes
that way the only thing you see is the warnings (and the final link report).
That pattern was one reason why I wanted me default compile to be warning-clean. Of course, then gcc started adding more warnings, and it's not clean any more ("warning: statement with no effect" from the fact that we just define many functions to '(0)' when they are disabled) but my current personal compile config only gets four warnings.
I realize there are *many* more warnings once you start enabling more special code - as usual, the core code tends to be better quality, and the further away from that base you get, the worse things get.
But it would definitely be good if most kernel developers did the above. Do it for just your personal config - at least you'll see the warnings in code you write (because presumably your personal config will have that code enabled ;)
Linus
Quoted 23 lines · Linus Torvalds
Quoted 3 lines · Peter Zijlstra
Argh, I really need -Werror to even see warnings, compiler output just flies by waaaaaay too fast.
Do what I do:
make -j32 > ../makes
that way the only thing you see is the warnings (and the final link report).
That pattern was one reason why I wanted me default compile to be warning-clean. Of course, then gcc started adding more warnings, and it's not clean any more ("warning: statement with no effect" from the fact that we just define many functions to '(0)' when they are disabled) but my current personal compile config only gets four warnings.
I realize there are *many* more warnings once you start enabling more special code - as usual, the core code tends to be better quality, and the further away from that base you get, the worse things get.
Quoted 4 lines
But it would definitely be good if most kernel developers did the above. Do it for just your personal config - at least you'll see the warnings in code you write (because presumably your personal config will have that code enabled ;)
Here is what i see on 'make defconfig' (which enables common core and common drivers):
sound/pci/hda/patch_sigmatel.c: In function ‘stac92xx_init’:sound/pci/hda/patch_sigmatel.c:4385:3: warning: statement with no effect [-Wunused-value]sound/pci/hda/patch_sigmatel.c: In function ‘stac92xx_resume’:sound/pci/hda/patch_sigmatel.c:4925:3: warning: statement with no effect [-Wunused-value]sound/pci/hda/patch_realtek.c: In function ‘alc_init’:sound/pci/hda/patch_realtek.c:4176:2: warning: statement with no effect [-Wunused-value]sound/pci/hda/patch_realtek.c: In function ‘alc_resume’:sound/pci/hda/patch_realtek.c:4558:2: warning: statement with no effect [-Wunused-value]sound/pci/hda/patch_realtek.c: In function ‘alc269_resume’:sound/pci/hda/patch_realtek.c:14878:2: warning: statement with no effect [-Wunused-value]net/sched/sch_generic.c: In function ‘dev_graft_qdisc’:net/sched/sch_generic.c:678:2: warning: the comparison will always evaluate as ‘true’ for the address of ‘noop_qdisc’ will never be NULL [-Waddress]net/netfilter/nf_conntrack_core.c: In function ‘nf_conntrack_init’:net/netfilter/nf_conntrack_core.c:1579:3: warning: the comparison will always evaluate as ‘true’ for the address of ‘nf_conntrack_attach’ will never be NULL [-Waddress] net/netfilter/nf_conntrack_core.c:1580:3: warning: the comparison will always evaluate as ‘true’ for the address of ‘destroy_conntrack’ will never be NULL [-Waddress]sound/pci/hda/hda_codec.c: In function ‘snd_hda_mixer_amp_switch_put’:sound/pci/hda/hda_codec.c:2320:2: warning: statement with no effect [-Wunused-value]net/netfilter/nf_conntrack_proto.c: In function ‘nf_conntrack_l3proto_unregister’:net/netfilter/nf_conntrack_proto.c:210:2: warning: the comparison will always evaluate as ‘true’ for the address of ‘nf_conntrack_l3proto_generic’ will never be NULL [-Waddress] net/netfilter/nf_conntrack_proto.c: In function ‘nf_conntrack_l4proto_unregister’:net/netfilter/nf_conntrack_proto.c:345:2: warning: the comparison will always evaluate as ‘true’ for the address of ‘nf_conntrack_l4proto_generic’ will never be NULL [-Waddress] net/netfilter/nf_conntrack_proto.c: In function ‘nf_conntrack_proto_init’:net/netfilter/nf_conntrack_proto.c:370:3: warning: the comparison will always evaluate as ‘true’ for the address of ‘nf_conntrack_l3proto_generic’ will never be NULL [-Waddress] drivers/md/dm.c: In function ‘split_bvec’:drivers/md/dm.c:1052:3: warning: statement with no effect [-Wunused-value]drivers/md/dm.c: In function ‘clone_bio’:drivers/md/dm.c:1079:3: warning: statement with no effect [-Wunused-value]drivers/md/dm-table.c: In function ‘dm_table_set_integrity’:drivers/md/dm-table.c:1193:2: warning: statement with no effect [-Wunused-value]net/ipv4/netfilter/nf_nat_standalone.c: In function ‘nf_nat_standalone_init’:net/ipv4/netfilter/nf_nat_standalone.c:287:2: warning: the comparison will always evaluate as ‘true’ for the address of ‘nat_decode_session’ will never be NULL [-Waddress] net/ipv4/netfilter/nf_nat_core.c: In function ‘nf_nat_protocol_unregister’:net/ipv4/netfilter/nf_nat_core.c:528:2: warning: the comparison will always evaluate as ‘true’ for the address of ‘nf_nat_unknown_protocol’ will never be NULL [-Waddress] net/ipv4/netfilter/nf_nat_core.c: In function ‘nf_nat_init’:net/ipv4/netfilter/nf_nat_core.c:739:3: warning: the comparison will always evaluate as ‘true’ for the address of ‘nf_nat_unknown_protocol’ will never be NULL [-Waddress] net/ipv4/netfilter/nf_nat_core.c:740:2: warning: the comparison will always evaluate as ‘true’ for the address of ‘nf_nat_protocol_tcp’ will never be NULL [-Waddress] net/ipv4/netfilter/nf_nat_core.c:741:2: warning: the comparison will always evaluate as ‘true’ for the address of ‘nf_nat_protocol_udp’ will never be NULL [-Waddress] net/ipv4/netfilter/nf_nat_core.c:742:2: warning: the comparison will always evaluate as ‘true’ for the address of ‘nf_nat_protocol_icmp’ will never be NULL [-Waddress] net/ipv4/netfilter/nf_nat_core.c:751:2: warning: the comparison will always evaluate as ‘true’ for the address of ‘nf_nat_seq_adjust’ will never be NULL [-Waddress] net/ipv4/netfilter/nf_nat_core.c:753:2: warning: the comparison will always evaluate as ‘true’ for the address of ‘nfnetlink_parse_nat_setup’ will never be NULL [-Waddress] net/ipv4/netfilter/nf_nat_core.c:756:2: warning: the comparison will always evaluate as ‘true’ for the address of ‘nf_nat_get_offset’ will never be NULL [-Waddress]net/ipv4/netfilter/nf_nat_ftp.c: In function ‘nf_nat_ftp_init’:net/ipv4/netfilter/nf_nat_ftp.c:123:2: warning: the comparison will always evaluate as ‘true’ for the address of ‘nf_nat_ftp’ will never be NULL [-Waddress]net/ipv4/netfilter/nf_nat_irc.c: In function ‘nf_nat_irc_init’:net/ipv4/netfilter/nf_nat_irc.c:85:2: warning: the comparison will always evaluate as ‘true’ for the address of ‘help’ will never be NULL [-Waddress]
In file included from drivers/usb/host/ohci-hcd.c:101:0:drivers/usb/host/ohci-dbg.c: In function ‘fill_registers_buffer’:drivers/usb/host/ohci-dbg.c:642:2: warning: the comparison will always evaluate as ‘true’ for the address of ‘next’ will never be NULL [-Waddress]drivers/usb/host/ohci-dbg.c:661:3: warning: the comparison will always evaluate as ‘true’ for the address of ‘next’ will never be NULL [-Waddress]net/ipv4/netfilter/nf_nat_sip.c: In function ‘nf_nat_sip_init’:net/ipv4/netfilter/nf_nat_sip.c:550:2: warning: the comparison will always evaluate as ‘true’ for the address of ‘ip_nat_sip’ will never be NULL [-Waddress]net/ipv4/netfilter/nf_nat_sip.c:551:2: warning: the comparison will always evaluate as ‘true’ for the address of ‘ip_nat_sip_seq_adjust’ will never be NULL [-Waddress] net/ipv4/netfilter/nf_nat_sip.c:552:2: warning: the comparison will always evaluate as ‘true’ for the address of ‘ip_nat_sip_expect’ will never be NULL [-Waddress] net/ipv4/netfilter/nf_nat_sip.c:553:2: warning: the comparison will always evaluate as ‘true’ for the address of ‘ip_nat_sdp_addr’ will never be NULL [-Waddress] net/ipv4/netfilter/nf_nat_sip.c:554:2: warning: the comparison will always evaluate as ‘true’ for the address of ‘ip_nat_sdp_port’ will never be NULL [-Waddress] net/ipv4/netfilter/nf_nat_sip.c:555:2: warning: the comparison will always evaluate as ‘true’ for the address of ‘ip_nat_sdp_session’ will never be NULL [-Waddress] net/ipv4/netfilter/nf_nat_sip.c:556:2: warning: the comparison will always evaluate as ‘true’ for the address of ‘ip_nat_sdp_media’ will never be NULL [-Waddress]
Setup is 15260 bytes (padded to 15360 bytes).
System is 4654 kB
CRC 43bdb86
Not pretty :-/
Thanks,
Ingo
Quoted 5 lines · Ingo Molnar
..
net/netfilter/nf_conntrack_core.c: In function ‘nf_conntrack_init’:net/netfilter/nf_conntrack_core.c:1579:3: warning: the comparison will always evaluate as ‘true’ for the address of ‘nf_conntrack_attach’ will never be NULL [-Waddress]
These all seem to be essentially compiler bugs.
We have macros that do generic things (in this case "rcu_assign_pointer()" and tests their values. The fact that the tests sometimes end up being statically true (or false) is not something the compiler should complain about - it should use it to optimize the code.
Sad.
We can make a compiler bug-report, or disable -Waddress. Or maybe we can write the tests in a way that doesn't trigger the compiler bug.
This same issue is why I hated -Wsign-compare. Some of the things gcc complained about were just technically moronic. So compiler warnings are not always a good thing.
Linus
Quoted 15 lines · Linus Torvalds
Quoted 5 lines · Ingo Molnar
..
net/netfilter/nf_conntrack_core.c: In function ‘nf_conntrack_init’:net/netfilter/nf_conntrack_core.c:1579:3: warning: the comparison will always evaluate as ‘true’ for the address of ‘nf_conntrack_attach’ will never be NULL [-Waddress]These all seem to be essentially compiler bugs.
We have macros that do generic things (in this case "
rcu_assign_pointer()" and tests their values. The fact that the tests sometimes end up being statically true (or false) is not something the compiler should complain about - it should use it to optimize the code.
Quoted 8 lines
Sad.
We can make a compiler bug-report, or disable -Waddress. Or maybe we can write the tests in a way that doesn't trigger the compiler bug.
This same issue is why I hated -Wsign-compare. Some of the things gcc complained about were just technically moronic. So compiler warnings are not always a good thing.
With -Wno-address added (see the first patch below) it looks a lot more useful:
aldebaran:~/linux/linux> make -j32 >e sound/pci/hda/patch_sigmatel.c: In function ‘stac92xx_init’:sound/pci/hda/patch_sigmatel.c:4385:3: warning: statement with no effect [-Wunused-value]sound/pci/hda/patch_sigmatel.c: In function ‘stac92xx_resume’:sound/pci/hda/patch_sigmatel.c:4925:3: warning: statement with no effect [-Wunused-value]sound/pci/hda/patch_realtek.c: In function ‘alc_init’:sound/pci/hda/patch_realtek.c:4176:2: warning: statement with no effect [-Wunused-value]sound/pci/hda/patch_realtek.c: In function ‘alc_resume’:sound/pci/hda/patch_realtek.c:4558:2: warning: statement with no effect [-Wunused-value]sound/pci/hda/hda_codec.c: In function ‘snd_hda_mixer_amp_switch_put’:sound/pci/hda/hda_codec.c:2320:2: warning: statement with no effect [-Wunused-value]sound/pci/hda/patch_realtek.c: In function ‘alc269_resume’:sound/pci/hda/patch_realtek.c:14878:2: warning: statement with no effect [-Wunused-value]drivers/md/dm.c: In function ‘split_bvec’:drivers/md/dm.c:1052:3: warning: statement with no effect [-Wunused-value]drivers/md/dm.c: In function ‘clone_bio’:drivers/md/dm.c:1079:3: warning: statement with no effect [-Wunused-value]drivers/md/dm-table.c: In function ‘dm_table_set_integrity’:drivers/md/dm-table.c:1193:2: warning: statement with no effect [-Wunused-value]
Setup is 15260 bytes (padded to 15360 bytes).
System is 4654 kB
CRC 6d1b94ea
those unused-x warnings seem legit and should be fixed. For example the second patch below fixed the dm.c warnings.
That's with:
gcc version 4.6.0 20110509 (Red Hat 4.6.0-7) (GCC)
so a reasonably recent GCC. I think we should kill -Waddress.
Thanks,
Ingo
Makefile +2 -2
@@ -559,9 +559,9 @@ endif # $(dot-config) all: vmlinux ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE -KBUILD_CFLAGS += -Os +KBUILD_CFLAGS += -Os -Wno-address else -KBUILD_CFLAGS += -O2 +KBUILD_CFLAGS += -O2 -Wno-address endif include $(srctree)/arch/$(SRCARCH)/Makefile
include/linux/bio.h +1 -1
@@ -527,7 +527,7 @@ extern void bio_integrity_init(void);#define bioset_integrity_create (a, b) (0)#define bio_integrity_prep (a) (0)#define bio_integrity_enabled (a) (0) -#define bio_integrity_clone (a, b, c, d) (0) +#define bio_integrity_clone (a, b, c, d) ({0;})#define bioset_integrity_free (a) do { } while (0)#define bio_integrity_free (a, b) do { } while (0)#define bio_integrity_endio (a, b) do { } while (0)
Hi,
Quoted 89 lines · Ingo Molnar
Quoted 15 lines · Linus Torvalds
Quoted 5 lines · Ingo Molnar
..
net/netfilter/nf_conntrack_core.c: In function ‘nf_conntrack_init’:net/netfilter/nf_conntrack_core.c:1579:3: warning: the comparison will always evaluate as ‘true’ for the address of ‘nf_conntrack_attach’ will never be NULL [-Waddress]These all seem to be essentially compiler bugs.
We have macros that do generic things (in this case "
rcu_assign_pointer()" and tests their values. The fact that the tests sometimes end up being statically true (or false) is not something the compiler should complain about - it should use it to optimize the code.Quoted 8 lines
Sad.
We can make a compiler bug-report, or disable -Waddress. Or maybe we can write the tests in a way that doesn't trigger the compiler bug.
This same issue is why I hated -Wsign-compare. Some of the things gcc complained about were just technically moronic. So compiler warnings are not always a good thing.
With -Wno-address added (see the first patch below) it looks a lot more useful:
aldebaran:~/linux/linux> make -j32 >e
sound/pci/hda/patch_sigmatel.c: In function ‘stac92xx_init’:sound/pci/hda/patch_sigmatel.c:4385:3: warning: statement with no effect [-Wunused-value]sound/pci/hda/patch_sigmatel.c: In function ‘stac92xx_resume’:sound/pci/hda/patch_sigmatel.c:4925:3: warning: statement with no effect [-Wunused-value]sound/pci/hda/patch_realtek.c: In function ‘alc_init’:sound/pci/hda/patch_realtek.c:4176:2: warning: statement with no effect [-Wunused-value]sound/pci/hda/patch_realtek.c: In function ‘alc_resume’:sound/pci/hda/patch_realtek.c:4558:2: warning: statement with no effect [-Wunused-value]sound/pci/hda/hda_codec.c: In function ‘snd_hda_mixer_amp_switch_put’:sound/pci/hda/hda_codec.c:2320:2: warning: statement with no effect [-Wunused-value]sound/pci/hda/patch_realtek.c: In function ‘alc269_resume’:sound/pci/hda/patch_realtek.c:14878:2: warning: statement with no effect [-Wunused-value]drivers/md/dm.c: In function ‘split_bvec’:drivers/md/dm.c:1052:3: warning: statement with no effect [-Wunused-value]drivers/md/dm.c: In function ‘clone_bio’:drivers/md/dm.c:1079:3: warning: statement with no effect [-Wunused-value]drivers/md/dm-table.c: In function ‘dm_table_set_integrity’:drivers/md/dm-table.c:1193:2: warning: statement with no effect [-Wunused-value]
Setup is 15260 bytes (padded to 15360 bytes).
System is 4654 kB
CRC6d1b94eathose unused-x warnings seem legit and should be fixed. For example the second patch below fixed the
dm.cwarnings.That's with:
gcc version 4.6.0 20110509 (Red Hat 4.6.0-7) (GCC)
so a reasonably recent GCC. I think we should kill -Waddress.
Thanks,
Ingo
Makefile +0
-0@@ -559,9 +559,9 @@ endif # $(dot-config)all: vmlinux
ifdef
CONFIG_CC_OPTIMIZE_FOR_SIZEMakefile +1
-1-KBUILD_CFLAGS += -Os +KBUILD_CFLAGS += -Os -Wno-addresselse
Makefile +1
-1-KBUILD_CFLAGS += -O2 +KBUILD_CFLAGS += -O2 -Wno-address
Quoted 2 lines
endif
did you submit this to linux-kbuild@ ?
Quoted 8 lines
include $(srctree)/arch/$(SRCARCH)/Makefile
include/linux/bio.h +0
-0
include/linux/bio.h extern void bio_integrity_init(void); · line 533
Quoted 8 lines
include/linux/bio.h +1
-1@@ -527,7 +527,7 @@ extern void bio_integrity_init(void); #define bioset_integrity_create(a, b) (0) #define bio_integrity_prep(a) (0) #define bio_integrity_enabled(a) (0) -#define bio_integrity_clone (a, b, c, d) (0) +#define bio_integrity_clone (a, b, c, d) ({0;}) #define bioset_integrity_free(a) do { } while (0) #define bio_integrity_free(a, b) do { } while (0) #define bio_integrity_endio(a, b) do { } while (0)
likewise, but to the maintainer of `include/linux/bio.h' ?
Hi,
Quoted 9 lines · Linus Torvalds
Quoted 5 lines · Ingo Molnar
..
net/netfilter/nf_conntrack_core.c: In function ‘nf_conntrack_init’:net/netfilter/nf_conntrack_core.c:1579:3: warning: the comparison will always evaluate as ‘true’ for the address of ‘nf_conntrack_attach’ will never be NULL [-Waddress]These all seem to be essentially compiler bugs.
Quoted 8 lines
We have macros that do generic things (in this case "
rcu_assign_pointer()" and tests their values. The fact that the tests sometimes end up being statically true (or false) is not something the compiler should complain about - it should use it to optimize the code.Sad.
I'm not sure that it is the compiler fault, or a limitation of the C language which has no notion of templates and obliges people to do convoluted hack mixing __typeof__ and macros.
I'd have been interested to use the 'auto' keyword in generic static inlines declaration. Instead, we have to deal with __typeof__ and macros, which have no real signification for the compiler itself, so it cannot make the difference between a conditional in a macros, there for genericity, and "real" code, where such a warning would be useful.
my 0.2 c.
- Arnaud
Quoted 9 lines
We can make a compiler bug-report, or disable -Waddress. Or maybe we can write the tests in a way that doesn't trigger the compiler bug.
This same issue is why I hated -Wsign-compare. Some of the things gcc complained about were just technically moronic. So compiler warnings are not always a good thing.
Linus
[tip:core/urgent] lockdep: Fix up warning
In reply to Peter ZijlstraCommit-ID: 70a0686a72c7a7e554b404ca11406ceec709d425 Gitweb: http://git.kernel.org/tip/70a0686a72c7a7e554b404ca11406ceec709d425 Author: Peter Zijlstra <[email protected]> AuthorDate: Mon, 25 Jul 2011 12:09:59 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Thu, 4 Aug 2011 10:17:41 +0200
lockdep: Fix up warning
Quoted 3 lines · Arnaud Lacombe
/src/linux/linux/kernel/lockdep.c: In function '
mark_held_locks':
/src/linux/linux/kernel/lockdep.c:2471:31: warning: comparison of distinct pointer types lacks a cast
The warning is harmless in this case, but the below makes it go away.
--- kernel/lockdep.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/lockdep.c +1 -1
@@ -2468,7 +2468,7 @@ mark_held_locks(struct task_struct *curr, enum mark_type mark)BUG_ON (usage_bit >=LOCK_USAGE_STATES ); -if (hlock_class (hlock)->key == &__lockdep_no_validate__) +if (hlock_class (hlock)->key == __lockdep_no_validate__.subkeys)continue ;if (!mark_lock (curr, hlock, usage_bit))