lib/classifier: Lockless lookups.
authorJarno Rajahalme <jrajahalme@nicira.com>
Fri, 11 Jul 2014 09:29:08 +0000 (02:29 -0700)
committerJarno Rajahalme <jrajahalme@nicira.com>
Fri, 11 Jul 2014 11:19:30 +0000 (04:19 -0700)
commitafae68b16f01559df44e3fd62f1fc020faec5731
tree8b881329ce5c15a2da7fb275667588fca3e05988
parentf358a2cb2e545bd3ec3390892477441797f9a351
lib/classifier: Lockless lookups.

Now that all the relevant classifier structures use RCU and internal
mutual exclusion for modifications, we can remove the fat-rwlock and
thus make the classifier lookups lockless.

As the readers are operating concurrently with the writers, a
concurrent reader may or may not see a new rule being added by a
writer, depending on how the concurrent events overlap with each
other.  Overall, this is no different from the former locked behavior,
but there the visibility of the new rule only depended on the timing
of the locking functions.

A new rule is first added to the segment indices, so the readers may
find the rule in the indices before the rule is visible in the
subtables 'rules' map.  This may result in us losing the opportunity
to quit lookups earlier, resulting in sub-optimal wildcarding.  This
will be fixed by forthcoming revalidation always scheduled after flow
table changes.

Similar behavior may happen due to us removing the overlapping rule
(if any) from the indices only after the corresponding new rule has
been added.

The subtable's max priority is updated only after a rule is inserted
to the maps, so the concurrent readers may not see the rule, as the
updated priority ordered subtable list will only be visible after the
subtable's max priority is updated.

Similarly, the classifier's partitions are updated by the caller after
the rule is inserted to the maps, so the readers may keep skipping the
subtable until they see the updated partitions.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
lib/classifier.c
lib/classifier.h
lib/dpif-netdev.c
ofproto/ofproto-dpif.c
ofproto/ofproto-provider.h
ofproto/ofproto.c
ofproto/ofproto.h
tests/test-classifier.c
utilities/ovs-ofctl.c