[ovs-git] Open vSwitch: datpath: Avoid reporting half updated statistics. (master)

dev at openvswitch.org dev at openvswitch.org
Sat Aug 21 03:32:29 UTC 2010

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Open vSwitch".

The branch, master has been updated
       via  38c6ecbc8d3664daed077617bb3b3508ba8aa767 (commit)
      from  16e9d4f64f4ad7adf3e5f619e65a2045282b3969 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 38c6ecbc8d3664daed077617bb3b3508ba8aa767
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=38c6ecbc8d3664daed077617bb3b3508ba8aa767
Author: Jesse Gross <jesse at nicira.com>
datpath: Avoid reporting half updated statistics.
We enforce mutual exclusion when updating statistics by disabling
bottom halves and only writing to per-CPU state.  However, reading
requires looking at the statistics for foreign CPUs, which could be
in the process of updating them since there isn't a lock.  This means
we could get garbage values for 64-bit values on 32-bit machines or
byte counts that don't correspond to packet counts, etc.

This commit introduces a sequence lock for statistics values to avoid
this problem.  Getting a write lock is very cheap - it only requires
incrementing a counter plus a memory barrier (which is compiled away
on x86) to acquire or release the lock and will never block.  On
read we spin until the sequence number hasn't changed in the middle
of the operation, indicating that the we have a consistent set of

Signed-off-by: Jesse Gross <jesse at nicira.com>


Summary of changes:
 datapath/datapath.c |   29 +++++++++++++++++++++++------
 datapath/datapath.h |    2 ++
 datapath/vport.c    |   24 ++++++++++++++++++------
 datapath/vport.h    |    2 ++
 4 files changed, 45 insertions(+), 12 deletions(-)

Open vSwitch

More information about the git mailing list