DPDK patches and discussions
 help / color / mirror / Atom feed
From: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	"alialnu@mellanox.com" <alialnu@mellanox.com>,
	"orgerlitz@mellanox.com" <orgerlitz@mellanox.com>,
	"wenzhuo.lu@intel.com" <wenzhuo.lu@intel.com>,
	"beilei.xing@intel.com" <beilei.xing@intel.com>,
	"bernard.iremonger@intel.com" <bernard.iremonger@intel.com>
Cc: "hemant.agrawal@nxp.com" <hemant.agrawal@nxp.com>,
	"jerinj@marvell.com" <jerinj@marvell.com>,
	"viacheslavo@mellanox.com" <viacheslavo@mellanox.com>,
	"thomas@monjalon.net" <thomas@monjalon.net>,
	Ruifeng Wang <Ruifeng.Wang@arm.com>,
	Phil Yang <Phil.Yang@arm.com>, nd <nd@arm.com>,
	"zhihong.wang@intel.com" <zhihong.wang@intel.com>,
	"stable@dpdk.org" <stable@dpdk.org>,
	Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>,
	nd <nd@arm.com>
Subject: Re: [dpdk-dev] [PATCH v2 1/5] app/testpmd: clock gettime call in throughput calculation
Date: Mon, 6 Jul 2020 16:53:12 +0000
Message-ID: <DB6PR0802MB22169EA1BAD32CA99EFC543398690@DB6PR0802MB2216.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <6dd1c866-8e41-4952-9792-b1fd492d0908@intel.com>

Hi Ferruh,
	Thanks for your comments.

<snip>

> Subject: Re: [PATCH v2 1/5] app/testpmd: clock gettime call in throughput
> calculation
> 
> On 6/26/2020 11:09 PM, Honnappa Nagarahalli wrote:
> > The throughput calculation requires a counter that measures passing of
> > time. However, the kernel saves and restores the PMU state when a
> > thread is unscheduled and scheduled. This ensures that the PMU cycles
> > are not counted towards a thread that is not scheduled. Hence, when
> > RTE_ARM_EAL_RDTSC_USE_PMU is enabled, the PMU cycles do not
> represent
> > the passing of time.
> 
> Does this mean 'rte_rdtsc()' is broken for Arm?
It depends on the kernel I think. IMO, for isolated CPUs it should be fine. It is currently getting fixed through a kernel patch. Once the kernel patch is up streamed, we will make the required changes in DPDK.

> Wouldn't it cause more serious issue than testpmd throughput stats?
Within DPDK, it does not seem to be used for anything critical (I have fixed one).

> 
> > This results in incorrect calculation of throughput numbers.
> > Use clock_gettime system call to calculate the time passed since last
> > call.
> >
> > Bugzilla ID: 450
> > Fixes: 0e106980301d ("app/testpmd: show throughput in port stats")
> > Cc: zhihong.wang@intel.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> > Reviewed-by: Phil Yang <phil.yang@arm.com>
> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> > Tested-by: Phil Yang <phil.yang@arm.com>
> > Tested-by: Ali Alnubani <alialnu@mellanox.com>
> 
> <...>
> 
> > @@ -195,10 +204,17 @@ nic_stats_display(portid_t port_id)
> >  		}
> >  	}
> >
> > -	diff_cycles = prev_cycles[port_id];
> > -	prev_cycles[port_id] = rte_rdtsc();
> > -	if (diff_cycles > 0)
> > -		diff_cycles = prev_cycles[port_id] - diff_cycles;
> > +	diff_ns = 0;
> > +	if (clock_gettime(CLOCK_TYPE_ID, &cur_time) == 0) {
> 
> I guess 'rte_rdtsc()' is faster, but since this is not in the data path, I think it is
> OK.
> 
> <...>
> 
> > @@ -217,10 +233,10 @@ nic_stats_display(portid_t port_id)
> >  		(stats.obytes - prev_bytes_tx[port_id]) : 0;
> >  	prev_bytes_rx[port_id] = stats.ibytes;
> >  	prev_bytes_tx[port_id] = stats.obytes;
> > -	mbps_rx = diff_cycles > 0 ?
> > -		diff_bytes_rx * rte_get_tsc_hz() / diff_cycles : 0;
> > -	mbps_tx = diff_cycles > 0 ?
> > -		diff_bytes_tx * rte_get_tsc_hz() / diff_cycles : 0;
> > +	mbps_rx = diff_ns > 0 ?
> > +		(double)diff_bytes_rx / diff_ns * NS_PER_SEC : 0;
> > +	mbps_tx = diff_ns > 0 ?
> > +		(double)diff_bytes_tx / diff_ns * NS_PER_SEC : 0;
> 
> The calculation also fixes other issue in the stats.
> With previous method, if the sampling between two stats is a little long,
> "diff_pkts_rx * rte_get_tsc_hz()" can overflow and produce wrong 'bps'.
> 
> 
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

  reply	other threads:[~2020-07-06 16:53 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-17 14:43 [dpdk-dev] [PATCH " Honnappa Nagarahalli
2020-06-17 14:43 ` [dpdk-dev] [PATCH 2/5] app/testpmd: enable burst stats for flowgen mode rx path Honnappa Nagarahalli
2020-06-18 14:57   ` Phil Yang
2020-06-17 14:43 ` [dpdk-dev] [PATCH 3/5] app/testpmd: enable burst stats for noisy vnf mode Honnappa Nagarahalli
2020-06-18  7:16   ` Jens Freimann
2020-06-17 14:43 ` [dpdk-dev] [PATCH 4/5] app/testpmd: fix burst percentage calculation Honnappa Nagarahalli
2020-06-18 15:01   ` Phil Yang
2020-06-23 13:33   ` Ali Alnubani
2020-06-17 14:43 ` [dpdk-dev] [PATCH 5/5] app/testpmd: enable empty polls in burst stats Honnappa Nagarahalli
2020-06-18 15:05   ` Phil Yang
2020-06-23 13:34   ` Ali Alnubani
2020-06-17 15:16 ` [dpdk-dev] [PATCH 1/5] app/testpmd: clock gettime call in throughput calculation Jerin Jacob
2020-06-18  4:03   ` Honnappa Nagarahalli
2020-06-18 10:16     ` Jerin Jacob
2020-06-18 15:08 ` Phil Yang
2020-06-23 13:33 ` Ali Alnubani
2020-06-26 22:09 ` [dpdk-dev] [PATCH v2 " Honnappa Nagarahalli
2020-06-26 22:09   ` [dpdk-dev] [PATCH v2 2/5] app/testpmd: enable burst stats for flowgen mode rx path Honnappa Nagarahalli
2020-07-06 16:02     ` Ferruh Yigit
2020-07-06 17:06       ` Honnappa Nagarahalli
2020-07-06 17:17         ` Ferruh Yigit
2020-07-06 18:46           ` Honnappa Nagarahalli
2020-06-26 22:09   ` [dpdk-dev] [PATCH v2 3/5] app/testpmd: enable burst stats for noisy vnf mode Honnappa Nagarahalli
2020-07-06 16:08     ` Ferruh Yigit
2020-07-06 16:59       ` Honnappa Nagarahalli
2020-07-06 17:11         ` Ferruh Yigit
2020-07-06 17:41           ` Honnappa Nagarahalli
2020-06-26 22:09   ` [dpdk-dev] [PATCH v2 4/5] app/testpmd: fix burst percentage calculation Honnappa Nagarahalli
2020-07-06 16:10     ` Ferruh Yigit
2020-06-26 22:09   ` [dpdk-dev] [PATCH v2 5/5] app/testpmd: enable empty polls in burst stats Honnappa Nagarahalli
2020-07-06 17:05     ` Ferruh Yigit
2020-07-06 19:11       ` Honnappa Nagarahalli
2020-07-07  9:32         ` Ferruh Yigit
2020-07-06 15:36   ` [dpdk-dev] [PATCH v2 1/5] app/testpmd: clock gettime call in throughput calculation Ferruh Yigit
2020-07-06 16:53     ` Honnappa Nagarahalli [this message]
2020-07-06 17:19       ` Ferruh Yigit
2020-07-06 23:32 ` [dpdk-dev] [PATCH v3 1/3] " Honnappa Nagarahalli
2020-07-06 23:32   ` [dpdk-dev] [PATCH v3 2/3] app/testpmd: fix burst percentage calculation Honnappa Nagarahalli
2020-07-06 23:32   ` [dpdk-dev] [PATCH v3 3/3] app/testpmd: enable empty polls in burst stats Honnappa Nagarahalli
2020-07-07 17:47   ` [dpdk-dev] [PATCH v3 1/3] app/testpmd: clock gettime call in throughput calculation Ferruh Yigit

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=DB6PR0802MB22169EA1BAD32CA99EFC543398690@DB6PR0802MB2216.eurprd08.prod.outlook.com \
    --to=honnappa.nagarahalli@arm.com \
    --cc=Phil.Yang@arm.com \
    --cc=Ruifeng.Wang@arm.com \
    --cc=alialnu@mellanox.com \
    --cc=beilei.xing@intel.com \
    --cc=bernard.iremonger@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=jerinj@marvell.com \
    --cc=nd@arm.com \
    --cc=orgerlitz@mellanox.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    --cc=viacheslavo@mellanox.com \
    --cc=wenzhuo.lu@intel.com \
    --cc=zhihong.wang@intel.com \
    /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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git