From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by dpdk.org (Postfix) with ESMTP id 900F11B4DA for ; Thu, 27 Sep 2018 17:54:03 +0200 (CEST) Received: by mail-wm1-f67.google.com with SMTP id z16-v6so6505918wmi.3 for ; Thu, 27 Sep 2018 08:54:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=N+503ufcSZvcyDC2tUGuldlnpEGb7Sbv84HMQGOu5Qg=; b=CoknLl2B4IAisDHMQaARIUe+atzVYKRUcrpQdLprF6QK9Hx9VUkO14mZ6MvzjqdqRw 7D2bJKEQuUfUuo0YasBoaOcjNWdpkk/FFepIMUG/Llu28CipPA3JSRvAcT3XiYA9if3L cSqr/A6T4MYQdOGydoGxu8l4WEXIfJkM7hsgppzT62VLxI2zatIaP3htQNhItVKheVcf /Y/QhNVSbDVLiFo7REDdTgYa+RwAUWqU22VcZvY/U7EX8tvdpAXUwEOq4ntEv9eKf5aw 6mV6BnZWJBV+D+0Qs7yahpaWHuWOTh+6RFrdZj73KocvY+GuTDr3uou3YGMln5dLeoTa ybpQ== X-Gm-Message-State: ABuFfoiUmM5WyY48XEfD5y/kD8RsvPJXzj+/h3rlOC7yhl8v5iw5TAbS l6UTJF8y4RaRnV6DbSW/fpIbCQGcku6wgqNJVNk= X-Google-Smtp-Source: ACcGV60PLd7zQiMamyEGlky0stSgNaA2WUN628gV428PrWUzGC/nwjik0mF7WQPOC36UTzFSPYcaICB+lmQSO/NCeZ4= X-Received: by 2002:a1c:234c:: with SMTP id j73-v6mr5387184wmj.68.1538063642872; Thu, 27 Sep 2018 08:54:02 -0700 (PDT) MIME-Version: 1.0 References: <20180911232906.18352-1-dg@adax.com> <20180919195549.5585-1-dg@adax.com> <20180919195549.5585-6-dg@adax.com> <1bc03874-f981-f5f2-e071-76c4fc1da96e@intel.com> In-Reply-To: <1bc03874-f981-f5f2-e071-76c4fc1da96e@intel.com> From: Dan Gora Date: Thu, 27 Sep 2018 12:53:24 -0300 Message-ID: To: Ferruh Yigit Cc: dev@dpdk.org, Igor Ryzhov , Stephen Hemminger Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v2 5/5] examples/kni: improve zeroing statistics X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2018 15:54:03 -0000 On Thu, Sep 27, 2018 at 8:40 AM Ferruh Yigit wrote: > >> Not sure about introducing an extra check to datapath for possible error on > >> stats zero. I am for dropping this patch, what do you think? > > > > This is literally adding one instruction to the datapath. Not even an > > atomic instruction. There is no effect on the performance caused by > > this change. > > > > Is that not better than the user (like me who experienced this) > > wondering why they cannot zero the counters even when there is no > > traffic? > > Can we have something like, stop the forwarding, clear the stats and start > forwarding back? This is what is broken. The stats do not zero because you have the two worker threads who are constantly performing: kni_stats[port_id].rx_packets += num; and kni_stats[port_id].tx_packets += nb_tx; You know how read/inc/write races work, right? These are not atomic increments, so the other thread zeroing these counters is _always_ going to race with these worker threads overwriting the counters with the old values. With no traffic it's worse because the worker threads perform these increments even more often! > Yes effect is small but it is for each packet, it doesn't make sense to me to > add extra check for each packet for the rare case of stats reset. Its not rare at all! You cannot zero the statistics around 80% of the time on my machine when there is no traffic. It's trivial to reproduce this. Just run a little traffic, stop the traffic, zero the stats and check the stats. If you cannot zero the statistics reliably under any circumstance then the statistics themselves are worthless and should be removed. It's better to have no stats than completely unreliable ones.