[ovs-dev] [ovs-discuss] OVS Support for RT Kernel

Viresh Kumar viresh.kumar at linaro.org
Mon Aug 26 09:03:14 UTC 2013


On 24 August 2013 06:30, Jesse Gross <jesse at nicira.com> wrote:
> Putting a big lock around the majority of the packet processing
> doesn't seem like a particularly good idea for performance and you
> would need to make sure that you get all the entry points. You would
> probably be better off serializing the parts that actually need it,
> like updating stats counters.

Obviously.. I didn't knew earlier what exactly are we looking to protect
here :)

Does something like this makes sense?

diff --git a/datapath/actions.c b/datapath/actions.c
index fa4b904..37ab132 100644
--- a/datapath/actions.c
+++ b/datapath/actions.c
@@ -607,7 +607,12 @@ int ovs_execute_actions(struct datapath *dp,
struct sk_buff *skb)
        int error;

        /* Check whether we've looped too much. */
+#ifdef CONFIG_PREEMPT_RT_FULL
+       get_cpu_light();
        loop = &__get_cpu_var(loop_counters);
+#else
+       loop = &get_cpu_var(loop_counters);
+#endif
        if (unlikely(++loop->count > MAX_LOOPS))
                loop->looping = true;
        if (unlikely(loop->looping)) {
@@ -629,5 +634,10 @@ out_loop:
        if (!--loop->count)
                loop->looping = false;

+#ifdef CONFIG_PREEMPT_RT_FULL
+       put_cpu_light();
+#else
+       put_cpu_var(loop_counters);
+#endif
        return error;
 }
diff --git a/datapath/datapath.c b/datapath/datapath.c
index 27deec8..a0fa3de 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -940,9 +940,7 @@ static int ovs_packet_cmd_execute(struct sk_buff
*skb, struct genl_info *info)
        if (!dp)
                goto err_unlock;

-       local_bh_disable();
        err = ovs_execute_actions(dp, packet);
-       local_bh_enable();
        rcu_read_unlock();

        ovs_flow_free(flow, false);

-------------x---------------x----------

Thanks a lot Jesse.

--
Viresh



More information about the dev mailing list