[ovs-dev] [PATCH 1/3] datapath: Replace __force type cast with rcu_dereference_raw().

Andy Zhou azhou at nicira.com
Thu Oct 23 23:34:06 UTC 2014


All three patches looks good.
Acked-by: Andy Zhou <azhou at nicira.com>

The git-am complained about some format error on the 2nd patch. You
may want to fix up
before pushing.

 Applying: datapath: Fix comment style.
/home/azhou/projs/ovs-review/ovs/.git/rebase-apply/patch:105: space
before tab in indent.
      * update skb->csum here.
/home/azhou/projs/ovs-review/ovs/.git/rebase-apply/patch:106: space
before tab in indent.
      */
warning: 2 lines add whitespace errors.

On Mon, Oct 20, 2014 at 4:13 PM, Pravin B Shelar <pshelar at nicira.com> wrote:
> rcu_dereference_raw() api is cleaner way of accessing RCU pointer
> when no locking is required.
>
> Signed-off-by: Pravin B Shelar <pshelar at nicira.com>
> ---
>  datapath/datapath.c   |    2 +-
>  datapath/flow_table.c |    8 ++++----
>  datapath/vport.c      |    2 +-
>  3 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/datapath/datapath.c b/datapath/datapath.c
> index 9e2dcfa..5ff10e5 100644
> --- a/datapath/datapath.c
> +++ b/datapath/datapath.c
> @@ -1202,7 +1202,7 @@ static int ovs_flow_cmd_del(struct sk_buff *skb, struct genl_info *info)
>         ovs_flow_tbl_remove(&dp->table, flow);
>         ovs_unlock();
>
> -       reply = ovs_flow_cmd_alloc_info((const struct sw_flow_actions __force *)flow->sf_acts,
> +       reply = ovs_flow_cmd_alloc_info(rcu_dereference_raw(flow->sf_acts),
>                                         info, false);
>
>         if (likely(reply)) {
> diff --git a/datapath/flow_table.c b/datapath/flow_table.c
> index 4efef13..9656cfe 100644
> --- a/datapath/flow_table.c
> +++ b/datapath/flow_table.c
> @@ -146,11 +146,11 @@ static void flow_free(struct sw_flow *flow)
>  {
>         int node;
>
> -       kfree((struct sw_flow_actions __force *)flow->sf_acts);
> +       kfree(rcu_dereference_raw(flow->sf_acts));
>         for_each_node(node)
>                 if (flow->stats[node])
>                         kmem_cache_free(flow_stats_cache,
> -                                       (struct flow_stats __force *)flow->stats[node]);
> +                                       rcu_dereference_raw(flow->stats[node]));
>         kmem_cache_free(flow_cache, flow);
>  }
>
> @@ -334,10 +334,10 @@ skip_flows:
>   * error path. */
>  void ovs_flow_tbl_destroy(struct flow_table *table)
>  {
> -       struct table_instance *ti = (struct table_instance __force *)table->ti;
> +       struct table_instance *ti = rcu_dereference_raw(table->ti);
>
>         free_percpu(table->mask_cache);
> -       kfree((struct mask_array __force *)table->mask_array);
> +       kfree(rcu_dereference_raw(table->mask_array));
>         table_instance_destroy(ti, false);
>  }
>
> diff --git a/datapath/vport.c b/datapath/vport.c
> index fd52903..18f3956 100644
> --- a/datapath/vport.c
> +++ b/datapath/vport.c
> @@ -166,7 +166,7 @@ struct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *ops,
>   */
>  void ovs_vport_free(struct vport *vport)
>  {
> -       kfree((struct vport_portids __force *)vport->upcall_portids);
> +       kfree(rcu_dereference_raw(vport->upcall_portids));
>         free_percpu(vport->percpu_stats);
>         kfree(vport);
>  }
> --
> 1.7.1
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list