Re: [ovs-dev] [PATCH 8/8] lib/classifier: Use cmap.

2014-07-19 Thread Ben Pfaff
On Sat, Jul 19, 2014 at 10:07:16PM +0300, Jarno Rajahalme wrote: > > > On Jul 19, 2014, at 8:27 PM, Ben Pfaff wrote: > > > > We could make some operations lockless, like read and store, > > These would be enough for RCU cmap and classifier, right? Refcount > needs the read-modify-write operatio

Re: [ovs-dev] [PATCH 8/8] lib/classifier: Use cmap.

2014-07-19 Thread Jarno Rajahalme
> On Jul 19, 2014, at 8:27 PM, Ben Pfaff wrote: > > We could make some operations lockless, like read and store, These would be enough for RCU cmap and classifier, right? Refcount needs the read-modify-write operations, though. > but I don't > know how to make read-modify-write operations loc

Re: [ovs-dev] [PATCH 2/5] lib/cmap, lib/classifier: Avoid aliasing pointers.

2014-07-19 Thread Ben Pfaff
On Sat, Jul 19, 2014 at 11:33:36AM +0300, Jarno Rajahalme wrote: > > > Sent from my iPhone > > > On Jul 19, 2014, at 10:03 AM, Ben Pfaff wrote: > > > >> On Fri, Jul 18, 2014 at 11:33:38PM -0700, Ben Pfaff wrote: > >>> On Fri, Jul 18, 2014 at 09:05:49PM -0700, Jarno Rajahalme wrote: > >>> Older

[ovs-dev] [PATCH 1/2] cmap, classifier: Avoid unsafe aliasing in iterators.

2014-07-19 Thread Ben Pfaff
CMAP_FOR_EACH and CLS_FOR_EACH and their variants tried to use void ** as a "pointer to any kind of pointer". That is a violation of the aliasing rules in ISO C which technically yields undefined behavior. With GCC 4.1, it causes both warnings and actual misbehavior. One option would to add -fno

[ovs-dev] [PATCH 2/2] classifier: Refactor cls_cursor_advance() to make it easier to follow.

2014-07-19 Thread Ben Pfaff
Signed-off-by: Ben Pfaff --- lib/classifier.c | 49 + 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/lib/classifier.c b/lib/classifier.c index 2ff539d..af28070 100644 --- a/lib/classifier.c +++ b/lib/classifier.c @@ -1250,36 +1250,1

Re: [ovs-dev] [PATCH 8/8] lib/classifier: Use cmap.

2014-07-19 Thread Ben Pfaff
We could make some operations lockless, like read and store, but I don't know how to make read-modify-write operations lockless generically. What do you have in mind? On Sat, Jul 19, 2014 at 11:37:42AM +0300, Jarno Rajahalme wrote: > Would it be a bad idea to make the trivial types with sizes less

Re: [ovs-dev] [PATCH 2/5] lib/cmap, lib/classifier: Avoid aliasing pointers.

2014-07-19 Thread Ben Pfaff
I didn't look at the classifier yet. Maybe it can't work the same way. On Jul 19, 2014 1:33 AM, "Jarno Rajahalme" wrote: > > > Sent from my iPhone > > > On Jul 19, 2014, at 10:03 AM, Ben Pfaff wrote: > > > >> On Fri, Jul 18, 2014 at 11:33:38PM -0700, Ben Pfaff wrote: > >>> On Fri, Jul 18, 2014 a

Re: [ovs-dev] [PATCH 8/8] lib/classifier: Use cmap.

2014-07-19 Thread Jarno Rajahalme
Would it be a bad idea to make the trivial types with sizes less than void pointer lockless in ovs-atomic-pthread just like in gcc4+, at least for x86/64? Jarno > On Jul 19, 2014, at 10:05 AM, Ben Pfaff wrote: > > I guess not, I see that xenddk-6.0.0-50762, at least, doesn't have a > libato

Re: [ovs-dev] [PATCH 2/5] lib/cmap, lib/classifier: Avoid aliasing pointers.

2014-07-19 Thread Jarno Rajahalme
Sent from my iPhone > On Jul 19, 2014, at 10:03 AM, Ben Pfaff wrote: > >> On Fri, Jul 18, 2014 at 11:33:38PM -0700, Ben Pfaff wrote: >>> On Fri, Jul 18, 2014 at 09:05:49PM -0700, Jarno Rajahalme wrote: >>> Older GCC (e.g. 4.1.2) did not like the pointer casts used for >>> initializing the iter

Re: [ovs-dev] [PATCH 8/8] lib/classifier: Use cmap.

2014-07-19 Thread Ben Pfaff
I guess not, I see that xenddk-6.0.0-50762, at least, doesn't have a libatomic. On Sat, Jul 19, 2014 at 12:04:25AM -0700, Ben Pfaff wrote: > Does it make a difference if you add -latomic to the linker flags? > > On Fri, Jul 18, 2014 at 05:32:39PM -0700, Jarno Rajahalme wrote: > > From config.log:

Re: [ovs-dev] [PATCH 8/8] lib/classifier: Use cmap.

2014-07-19 Thread Ben Pfaff
Does it make a difference if you add -latomic to the linker flags? On Fri, Jul 18, 2014 at 05:32:39PM -0700, Jarno Rajahalme wrote: > From config.log: > > configure:13921: checking whether gcc -std=gnu99 supports GCC 4.0+ atomic > built-ins > configure:13988: gcc -std=gnu99 -o conftest -g -O2

Re: [ovs-dev] [PATCH 2/5] lib/cmap, lib/classifier: Avoid aliasing pointers.

2014-07-19 Thread Ben Pfaff
On Fri, Jul 18, 2014 at 11:33:38PM -0700, Ben Pfaff wrote: > On Fri, Jul 18, 2014 at 09:05:49PM -0700, Jarno Rajahalme wrote: > > Older GCC (e.g. 4.1.2) did not like the pointer casts used for > > initializing the iteration cursors. This patch changes the code to > > avoid the void casts for GCC,