From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932196AbWLLLME (ORCPT ); Tue, 12 Dec 2006 06:12:04 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932197AbWLLLME (ORCPT ); Tue, 12 Dec 2006 06:12:04 -0500 Received: from mx2.mail.elte.hu ([157.181.151.9]:40057 "EHLO mx2.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932196AbWLLLMB (ORCPT ); Tue, 12 Dec 2006 06:12:01 -0500 Date: Tue, 12 Dec 2006 12:10:28 +0100 From: Ingo Molnar To: Andrew Morton Cc: Linus Torvalds , linux-kernel@vger.kernel.org Subject: [patch] lockdep: fix seqlock_init() Message-ID: <20061212111028.GA13908@elte.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.2i X-ELTE-VirusStatus: clean X-ELTE-SpamScore: -2.6 X-ELTE-SpamLevel: X-ELTE-SpamCheck: no X-ELTE-SpamVersion: ELTE 2.0 X-ELTE-SpamCheck-Details: score=-2.6 required=5.9 tests=BAYES_00 autolearn=no SpamAssassin version=3.0.3 -2.6 BAYES_00 BODY: Bayesian spam probability is 0 to 1% [score: 0.0000] Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Subject: [patch] lockdep: fix seqlock_init() From: Ingo Molnar seqlock_init() needs to use spin_lock_init() for dynamic locks, so that lockdep is notified about the presence of a new lock. (this is a fallout of the recent networking merge, which started using the so-far unused seqlock_init() API.) This fix solves the following lockdep-internal warning on current -git: INFO: trying to register non-static key. the code is fine but needs lockdep annotation. turning off the locking correctness validator. [] dump_trace+0x63/0x1e8 [] show_trace_log_lvl+0x19/0x2e [] show_trace+0x12/0x14 [] dump_stack+0x14/0x16 [] __lock_acquire+0x10c/0x9f9 [] lock_acquire+0x56/0x72 [] _spin_lock+0x35/0x42 [] neigh_destroy+0x9d/0x12e [] neigh_periodic_timer+0x10a/0x15c [] run_timer_softirq+0x126/0x18e [] __do_softirq+0x6b/0xe6 [] do_softirq+0x64/0xd2 [] ksoftirqd+0x82/0x138 [] kthread+0xb2/0xd7 [] kernel_thread_helper+0x7/0x10 Signed-off-by: Ingo Molnar --- include/linux/seqlock.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) Index: linux-hres-timers.q/include/linux/seqlock.h =================================================================== --- linux-hres-timers.q.orig/include/linux/seqlock.h +++ linux-hres-timers.q/include/linux/seqlock.h @@ -44,8 +44,11 @@ typedef struct { #define SEQLOCK_UNLOCKED \ __SEQLOCK_UNLOCKED(old_style_seqlock_init) -#define seqlock_init(x) \ - do { *(x) = (seqlock_t) __SEQLOCK_UNLOCKED(x); } while (0) +#define seqlock_init(x) \ + do { \ + (x)->sequence = 0; \ + spin_lock_init(&(x)->lock); \ + } while (0) #define DEFINE_SEQLOCK(x) \ seqlock_t x = __SEQLOCK_UNLOCKED(x)