[ovs-git] [openvswitch/ovs] 0b8390: lib/ovs-atomic: Add missing macro argument parenth...

GitHub noreply at github.com
Fri Aug 29 17:33:51 UTC 2014


  Branch: refs/heads/master
  Home:   https://github.com/openvswitch/ovs
  Commit: 0b83904fbcec1d33296f9df05b607b61aec63912
      https://github.com/openvswitch/ovs/commit/0b83904fbcec1d33296f9df05b607b61aec63912
  Author: Jarno Rajahalme <jrajahalme at nicira.com>
  Date:   2014-08-29 (Fri, 29 Aug 2014)

  Changed paths:
    M lib/ovs-atomic-gcc4+.h
    M lib/ovs-atomic-i586.h
    M lib/ovs-atomic-x86_64.h

  Log Message:
  -----------
  lib/ovs-atomic: Add missing macro argument parentheses.

Otherwise the dereference operator could target a portion of a ternary
expression, for example.

Also minor style fixes.

Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


  Commit: 2864e627e57e9d77efac3af0e7677a0c75c90c62
      https://github.com/openvswitch/ovs/commit/2864e627e57e9d77efac3af0e7677a0c75c90c62
  Author: Jarno Rajahalme <jrajahalme at nicira.com>
  Date:   2014-08-29 (Fri, 29 Aug 2014)

  Changed paths:
    M lib/ovs-atomic.h

  Log Message:
  -----------
  lib/ovs-atomic: Clarified comments on ovs_refcount_unref().

ovs_refcount_unref() needs to syncronize with the other instances of
itself rather than with ovs_refcount_ref().

Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


  Commit: b119717bcdc72e2b7c39199345b1b376e9bbd333
      https://github.com/openvswitch/ovs/commit/b119717bcdc72e2b7c39199345b1b376e9bbd333
  Author: Jarno Rajahalme <jrajahalme at nicira.com>
  Date:   2014-08-29 (Fri, 29 Aug 2014)

  Changed paths:
    M lib/ovs-atomic.h

  Log Message:
  -----------
  lib/ovs-atomic: Add helpers for relaxed atomic access.

When an atomic variable is not serving to synchronize threads about
the state of other (atomic or non-atomic) variables, no memory barrier
is needed with the atomic operation.  However, the default memory
order for an atomic operation is memory_order_seq_cst, which always
causes a system-wide locking of the memory bus and prevents both the
CPU and the compiler from reordering memory accesses accross the
atomic operation.  This can add considerable stalls as each atomic
operation (regardless of memory order) always includes a memory
access.

In most cases we can let the compiler reorder memory accesses to
minimize the time we spend waiting for the completion of the atomic
memory accesses by using the relaxed memory order.  This patch adds
helpers to make such accesses a little easier on the eye (and the
fingers :-), but does not try to hide them completely.

Following patches make use of these and remove all the (implied)
memory_order_seq_cst use from the OVS code base.

Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


  Commit: a36cd3ff27967ed174f203833471704c85ceac2d
      https://github.com/openvswitch/ovs/commit/a36cd3ff27967ed174f203833471704c85ceac2d
  Author: Jarno Rajahalme <jrajahalme at nicira.com>
  Date:   2014-08-29 (Fri, 29 Aug 2014)

  Changed paths:
    M lib/ovs-atomic.h

  Log Message:
  -----------
  lib/ovs-atomic: Add atomic_count.

Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


  Commit: 91a96379e5e0942b6d963ff1538eccc5ba46a697
      https://github.com/openvswitch/ovs/commit/91a96379e5e0942b6d963ff1538eccc5ba46a697
  Author: Jarno Rajahalme <jrajahalme at nicira.com>
  Date:   2014-08-29 (Fri, 29 Aug 2014)

  Changed paths:
    M lib/dpif-netdev.c
    M lib/ovs-thread.h

  Log Message:
  -----------
  lib: Use shorter form of relaxed atomic access.

Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


  Commit: ca4fbdfe52f4dee36391fb8ec006ee2190a339fc
      https://github.com/openvswitch/ovs/commit/ca4fbdfe52f4dee36391fb8ec006ee2190a339fc
  Author: Jarno Rajahalme <jrajahalme at nicira.com>
  Date:   2014-08-29 (Fri, 29 Aug 2014)

  Changed paths:
    M lib/jsonrpc.c
    M lib/ofp-msgs.c
    M lib/ofp-parse.c

  Log Message:
  -----------
  lib/jsonrpc, lib/ofp-msgs, lib/ofp-parse: Use atomic_count.

Trivial ID counters do not synchronize anything, therefore can use
atomic_count.

Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


  Commit: 94f756daf21af97876266015e758aa96556ff6e8
      https://github.com/openvswitch/ovs/commit/94f756daf21af97876266015e758aa96556ff6e8
  Author: Jarno Rajahalme <jrajahalme at nicira.com>
  Date:   2014-08-29 (Fri, 29 Aug 2014)

  Changed paths:
    M lib/bfd.c

  Log Message:
  -----------
  lib/bfd: Used relaxed atomics and optimize bfd_should_process_flow().

The atomics here do not synchronize the state of any other variables,
so we can use atomic_count and relaxed atomics.

bfd_should_process_flow() is rearranged to set the megaflow mask bits
only if necessary, and to avoid the atomic operation on non-BFD
packets.

Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


  Commit: 7e2b277bed0878b5350f61de9e43d1a5b4d7c34b
      https://github.com/openvswitch/ovs/commit/7e2b277bed0878b5350f61de9e43d1a5b4d7c34b
  Author: Jarno Rajahalme <jrajahalme at nicira.com>
  Date:   2014-08-29 (Fri, 29 Aug 2014)

  Changed paths:
    M lib/cfm.c

  Log Message:
  -----------
  lib/cfm: Use relaxed atomics and optimize cfm_should_process_flow().

The atomics here do not synchronize the state of any other variables,
so we can use relaxed atomics.
    
cfm_should_process_flow() is rearranged to set the megaflow mask bits
only if necessary, and to avoid the atomic operation on non-CFM
packets.
    
Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


  Commit: 7424fc4464482885a37896b3ad2b9644f59d4cda
      https://github.com/openvswitch/ovs/commit/7424fc4464482885a37896b3ad2b9644f59d4cda
  Author: Jarno Rajahalme <jrajahalme at nicira.com>
  Date:   2014-08-29 (Fri, 29 Aug 2014)

  Changed paths:
    M lib/dpif-linux.c

  Log Message:
  -----------
  lib/dpif-linux: Use relaxed atomics for 'dump->status'.

'dump->status' does not syncronize the state of any other variable, so
we can use relaxed atomics on it.

Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


  Commit: fd0318be8ddfed0213aa188180ce7179a9ed8cbd
      https://github.com/openvswitch/ovs/commit/fd0318be8ddfed0213aa188180ce7179a9ed8cbd
  Author: Jarno Rajahalme <jrajahalme at nicira.com>
  Date:   2014-08-29 (Fri, 29 Aug 2014)

  Changed paths:
    M lib/netdev.c

  Log Message:
  -----------
  lib/netdev: Do not use atomics when not needed.

All access to struct netdev_registered_class ref_cnt member was done
with netdev_class_mutex held, so it does not need to be an atomic
variable.

Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


  Commit: 97e5b2e58a382dc3c07a36e2252115d594a905d1
      https://github.com/openvswitch/ovs/commit/97e5b2e58a382dc3c07a36e2252115d594a905d1
  Author: Jarno Rajahalme <jrajahalme at nicira.com>
  Date:   2014-08-29 (Fri, 29 Aug 2014)

  Changed paths:
    M lib/netdev-dummy.c

  Log Message:
  -----------
  lib/netdev-dummy: Use relaxed atomics for a trivial counter.

Even though there is no need to optimize netdev-dummy, it might be
good to do this right, in case it serves as an inspiration for
something else later.

Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


  Commit: 812c272cde924d22124f504f217ef574b59c0dff
      https://github.com/openvswitch/ovs/commit/812c272cde924d22124f504f217ef574b59c0dff
  Author: Jarno Rajahalme <jrajahalme at nicira.com>
  Date:   2014-08-29 (Fri, 29 Aug 2014)

  Changed paths:
    M lib/netdev-linux.c

  Log Message:
  -----------
  lib/netdev-linux: Use atomic_count for 'miimon_cnt'.

'miimon_cnt' and the actual device miimon configuration is only
loosely coupled, so we can use the relaxed atomic_count for it.

Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


  Commit: 6750f6281b147ee1f9abf7cb5872c067c0489367
      https://github.com/openvswitch/ovs/commit/6750f6281b147ee1f9abf7cb5872c067c0489367
  Author: Jarno Rajahalme <jrajahalme at nicira.com>
  Date:   2014-08-29 (Fri, 29 Aug 2014)

  Changed paths:
    M ofproto/netflow.c

  Log Message:
  -----------
  ofproto/netflow: Use atomic_count for 'netflow_count'.

'netflow_count' and the existence of actual netflow objects is not
tightly synchronized, so we can use the relaxed atomic_count for it.

Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


  Commit: b482e960fb6ceda457ddb052ec3d48bc7af3abab
      https://github.com/openvswitch/ovs/commit/b482e960fb6ceda457ddb052ec3d48bc7af3abab
  Author: Jarno Rajahalme <jrajahalme at nicira.com>
  Date:   2014-08-29 (Fri, 29 Aug 2014)

  Changed paths:
    M ofproto/ofproto-dpif-upcall.c

  Log Message:
  -----------
  ofproto/ofproto-dpif-upcall: Use relaxed atomic operations.

Neither 'enable_megaflows', 'udpif->flow_limit', 'udpif->n_flows', nor
'udpif->n_flows_timestamp' are used to synchronize the state of any
other variables, so we can use relaxed atomic operations to access
them.

Move the atomic read operation of 'enable_megaflows' outside the loop
in handle_upcalls().

Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


  Commit: fc4a1204b79a0bfd8111c3e4bc1c6e403dfac944
      https://github.com/openvswitch/ovs/commit/fc4a1204b79a0bfd8111c3e4bc1c6e403dfac944
  Author: Jarno Rajahalme <jrajahalme at nicira.com>
  Date:   2014-08-29 (Fri, 29 Aug 2014)

  Changed paths:
    M lib/timeval.c

  Log Message:
  -----------
  lib/timeval: Use relaxed atomics also when writing on 'slow_path'.

Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


  Commit: afcea9ea04695308e42d23d088449e1d0de492ad
      https://github.com/openvswitch/ovs/commit/afcea9ea04695308e42d23d088449e1d0de492ad
  Author: Jarno Rajahalme <jrajahalme at nicira.com>
  Date:   2014-08-29 (Fri, 29 Aug 2014)

  Changed paths:
    M ofproto/ofproto-dpif.c
    M ofproto/ofproto.c

  Log Message:
  -----------
  ofproto/ofproto: Use relaxed atomics.

Neither 'miss_config', 'n_missed', nor 'n_matched' is used to
synchronize the state of any other variable, so we can use relaxed
atomic operations on them.

Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


Compare: https://github.com/openvswitch/ovs/compare/985998e88953...afcea9ea0469


More information about the git mailing list