All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pravin Shelar <pshelar@ovn.org>
To: Andy Zhou <azhou@ovn.org>
Cc: Greg Rose <gvrose8192@gmail.com>, Joe Stringer <joe@ovn.org>,
	Linux Kernel Network Developers <netdev@vger.kernel.org>
Subject: Re: [net-next v2 3/4] openvswitch: Add meter infrastructure
Date: Fri, 3 Nov 2017 09:22:48 -0700	[thread overview]
Message-ID: <CAOrHB_B5jNQ2AV-uaS5YBr-z22Vp1u-xh5Fr5LsdYiC_E9B+Rw@mail.gmail.com> (raw)
In-Reply-To: <CABKoBm2=7=JvxeUK1mxwyy1e5Qo4sB-QEYa1fJtEd6vfTrESJQ@mail.gmail.com>

On Thu, Nov 2, 2017 at 7:43 PM, Andy Zhou <azhou@ovn.org> wrote:
> On Thu, Nov 2, 2017 at 5:07 AM, Pravin Shelar <pshelar@ovn.org> wrote:
>> On Thu, Nov 2, 2017 at 3:07 AM, Andy Zhou <azhou@ovn.org> wrote:
>>> On Fri, Oct 20, 2017 at 8:32 PM, Pravin Shelar <pshelar@ovn.org> wrote:
>>>> On Thu, Oct 19, 2017 at 5:58 PM, Andy Zhou <azhou@ovn.org> wrote:
>>>>>
>>>>> On Thu, Oct 19, 2017 at 02:47 Pravin Shelar <pshelar@ovn.org> wrote:
>>>>>>
>>>>>> On Tue, Oct 17, 2017 at 12:36 AM, Andy Zhou <azhou@ovn.org> wrote:
>>>>>> > OVS kernel datapath so far does not support Openflow meter action.
>>>>>> > This is the first stab at adding kernel datapath meter support.
>>>>>> > This implementation supports only drop band type.
>>>>>> >
>>>>>> > Signed-off-by: Andy Zhou <azhou@ovn.org>
>>>>>> > ---
>>>>>> >  net/openvswitch/Makefile   |   1 +
>>>>>> >  net/openvswitch/datapath.c |  14 +-
>>>>>> >  net/openvswitch/datapath.h |   3 +
>>>>>> >  net/openvswitch/meter.c    | 604
>>>>>> > +++++++++++++++++++++++++++++++++++++++++++++
>>>>>> >  net/openvswitch/meter.h    |  54 ++++
>>>>>> >  5 files changed, 674 insertions(+), 2 deletions(-)
>>>>>> >  create mode 100644 net/openvswitch/meter.c
>>>>>> >  create mode 100644 net/openvswitch/meter.h
>>>>>> >
>>>>>> This patch mostly looks good. I have one comment below.
>>>>>>
>>>>>> > +static int ovs_meter_cmd_set(struct sk_buff *skb, struct genl_info
>>>>>> > *info)
>>>>>> > +{
>>>>>> > +       struct nlattr **a = info->attrs;
>>>>>> > +       struct dp_meter *meter, *old_meter;
>>>>>> > +       struct sk_buff *reply;
>>>>>> > +       struct ovs_header *ovs_reply_header;
>>>>>> > +       struct ovs_header *ovs_header = info->userhdr;
>>>>>> > +       struct datapath *dp;
>>>>>> > +       int err;
>>>>>> > +       u32 meter_id;
>>>>>> > +       bool failed;
>>>>>> > +
>>>>>> > +       meter = dp_meter_create(a);
>>>>>> > +       if (IS_ERR_OR_NULL(meter))
>>>>>> > +               return PTR_ERR(meter);
>>>>>> > +
>>>>>> > +       reply = ovs_meter_cmd_reply_start(info, OVS_METER_CMD_SET,
>>>>>> > +                                         &ovs_reply_header);
>>>>>> > +       if (IS_ERR(reply)) {
>>>>>> > +               err = PTR_ERR(reply);
>>>>>> > +               goto exit_free_meter;
>>>>>> > +       }
>>>>>> > +
>>>>>> > +       ovs_lock();
>>>>>> > +       dp = get_dp(sock_net(skb->sk), ovs_header->dp_ifindex);
>>>>>> > +       if (!dp) {
>>>>>> > +               err = -ENODEV;
>>>>>> > +               goto exit_unlock;
>>>>>> > +       }
>>>>>> > +
>>>>>> > +       if (!a[OVS_METER_ATTR_ID]) {
>>>>>> > +               err = -ENODEV;
>>>>>> > +               goto exit_unlock;
>>>>>> > +       }
>>>>>> > +
>>>>>> > +       meter_id = nla_get_u32(a[OVS_METER_ATTR_ID]);
>>>>>> > +
>>>>>> > +       /* Cannot fail after this. */
>>>>>> > +       old_meter = lookup_meter(dp, meter_id);
>>>>>> I do not see RCU read lock taken here. This is not correctness issue
>>>>>> but it could cause RCU checker to spit out warning message. You could
>>>>>> do same trick that is done in get_dp() to avoid this issue.
>>>>>
>>>>> O.K.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Can you also test the code with rcu sparse check config option enabled?
>>>>>
>>>>>
>>>>> Do you mean to sparse compile with CONFIG_PROVE_LOCKING and
>>>>> CONFIG_DENUG_OBJECTS_RCU_HEAD?
>>>>
>>>> You could use all following options simultaneously:
>>>> CONFIG_PREEMPT
>>>> CONFIG_DEBUG_PREEMPT
>>>> CONFIG_DEBUG_SPINLOCK
>>>> CONFIG_DEBUG_ATOMIC_SLEEP
>>>> CONFIG_PROVE_RCU
>>>> CONFIG_DEBUG_OBJECTS_RCU_HEAD
>>>
>>> Thanks, I turned on those flags but did not get any error message. Do you
>>> mind share the RCU checker message?
>>
>> There would be assert failure and stack trace. so it would be pretty
>> obvious in kernel log messages.
>> Let me know if you do not see any stack trace while running meter
>> create, delete and execute.
>
> No I did not see them.
ok, Can you send out patch against latest net-next?

  reply	other threads:[~2017-11-03 16:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-17  7:36 [net-next v2 0/4] Openvswitch meter action Andy Zhou
2017-10-17  7:36 ` [net-next v2 1/4] openvswitch: Add meter netlink definitions Andy Zhou
2017-10-17  7:36 ` [net-next v2 2/4] openvswitch: export get_dp() API Andy Zhou
2017-10-17  7:36 ` [net-next v2 3/4] openvswitch: Add meter infrastructure Andy Zhou
2017-10-18 18:47   ` Pravin Shelar
     [not found]     ` <CABKoBm1JdL3K=oG-xn7kc31t_CHM-EtnexQngoyrGQ8PUZitSg@mail.gmail.com>
2017-10-21  3:32       ` Pravin Shelar
2017-11-02 10:07         ` Andy Zhou
2017-11-02 12:07           ` Pravin Shelar
2017-11-03  2:43             ` Andy Zhou
2017-11-03 16:22               ` Pravin Shelar [this message]
2017-10-17  7:36 ` [net-next v2 4/4] openvswitch: Add meter action support Andy Zhou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOrHB_B5jNQ2AV-uaS5YBr-z22Vp1u-xh5Fr5LsdYiC_E9B+Rw@mail.gmail.com \
    --to=pshelar@ovn.org \
    --cc=azhou@ovn.org \
    --cc=gvrose8192@gmail.com \
    --cc=joe@ovn.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.