06 Nov, 2013
1 commit
-
In order to enable lockdep on seqcount/seqlock structures, we
must explicitly initialize any locks.The u64_stats_sync structure, uses a seqcount, and thus we need
to introduce a u64_stats_init() function and use it to initialize
the structure.This unfortunately adds a lot of fairly trivial initialization code
to a number of drivers. But the benefit of ensuring correctness makes
this worth while.Because these changes are required for lockdep to be enabled, and the
changes are quite trivial, I've not yet split this patch out into 30-some
separate patches, as I figured it would be better to get the various
maintainers thoughts on how to best merge this change along with
the seqcount lockdep enablement.Feedback would be appreciated!
Signed-off-by: John Stultz
Acked-by: Julian Anastasov
Signed-off-by: Peter Zijlstra
Cc: Alexey Kuznetsov
Cc: "David S. Miller"
Cc: Eric Dumazet
Cc: Hideaki YOSHIFUJI
Cc: James Morris
Cc: Jesse Gross
Cc: Mathieu Desnoyers
Cc: "Michael S. Tsirkin"
Cc: Mirko Lindner
Cc: Patrick McHardy
Cc: Roger Luethi
Cc: Rusty Russell
Cc: Simon Horman
Cc: Stephen Hemminger
Cc: Steven Rostedt
Cc: Thomas Petazzoni
Cc: Wensong Zhang
Cc: netdev@vger.kernel.org
Link: http://lkml.kernel.org/r/1381186321-4906-2-git-send-email-john.stultz@linaro.org
Signed-off-by: Ingo Molnar
29 Nov, 2010
1 commit
-
These warnings are spewed during a build of a 'allnoconfig' kernel
(especially the ones from u64_stats_sync.h show up a lot) when building
with -Wextra (which I often do)..
They are
a) annoying
b) easy to get rid of.
This patch kills them off.include/linux/u64_stats_sync.h:70:1: warning: ‘inline’ is not at beginning of declaration
include/linux/u64_stats_sync.h:77:1: warning: ‘inline’ is not at beginning of declaration
include/linux/u64_stats_sync.h:84:1: warning: ‘inline’ is not at beginning of declaration
include/linux/u64_stats_sync.h:96:1: warning: ‘inline’ is not at beginning of declaration
include/linux/u64_stats_sync.h:115:1: warning: ‘inline’ is not at beginning of declaration
include/linux/u64_stats_sync.h:127:1: warning: ‘inline’ is not at beginning of declaration
kernel/time.c:241:1: warning: ‘inline’ is not at beginning of declaration
kernel/time.c:257:1: warning: ‘inline’ is not at beginning of declaration
kernel/perf_event.c:4513:1: warning: ‘inline’ is not at beginning of declaration
mm/page_alloc.c:4012:1: warning: ‘inline’ is not at beginning of declarationSigned-off-by: Jesper Juhl
Signed-off-by: Jiri Kosina
29 Jun, 2010
2 commits
-
- Must disable preemption in case of 32bit UP in u64_stats_fetch_begin()
and u64_stats_fetch_retry()- Add new u64_stats_fetch_begin_bh() and u64_stats_fetch_retry_bh() for
network usage, disabling BH on 32bit UP only.Signed-off-by: Eric Dumazet
Signed-off-by: David S. Miller -
- Add a comment about interrupts:
6) If counter might be written by an interrupt, readers should block
interrupts.- Fix a typo in sample of use.
Signed-off-by: Eric Dumazet
Signed-off-by: David S. Miller
24 Jun, 2010
1 commit
-
To properly implement 64bits network statistics on 32bit or 64bit hosts,
we provide one new type and four methods, to ease conversions.Stats producer should use following template granted it already got an
exclusive access to counters (include/linux/u64_stats_sync.h contains
some documentation about details)u64_stats_update_begin(&stats->syncp);
stats->bytes64 += len;
stats->packets64++;
u64_stats_update_end(&stats->syncp);While a consumer should use following template to get consistent
snapshot :u64 tbytes, tpackets;
unsigned int start;do {
start = u64_stats_fetch_begin(&stats->syncp);
tbytes = stats->bytes64;
tpackets = stats->packets64;
} while (u64_stats_fetch_retry(&stats->lock, syncp));Suggested by David Miller, and comments courtesy of Nick Piggin.
Signed-off-by: Eric Dumazet
Signed-off-by: David S. Miller