linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Steve Wise" <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
To: 'Doug Ledford' <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	'Christoph Lameter' <cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	'Mark Bloch' <markb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	'Jason Gunthorpe'
	<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>,
	'Steve Wise' <swise-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>,
	'Majd Dibbiny' <majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	alonvi-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org
Subject: RE: [PATCH 1/3] ib core: Make device counter infrastructure dynamic
Date: Tue, 17 May 2016 11:06:10 -0500	[thread overview]
Message-ID: <004001d1b056$0778d350$166a79f0$@opengridcomputing.com> (raw)
In-Reply-To: <3e9a3e19-58cb-c25f-89a1-f0e51df562d8-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>



> -----Original Message-----
> From: linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [mailto:linux-rdma-
> owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org] On Behalf Of Doug Ledford
> Sent: Tuesday, May 17, 2016 11:01 AM
> To: Christoph Lameter
> Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Mark Bloch; Jason Gunthorpe; Steve Wise; Majd
> Dibbiny; alonvi-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org
> Subject: Re: [PATCH 1/3] ib core: Make device counter infrastructure dynamic
> 
> On 05/17/2016 10:19 AM, Christoph Lameter wrote:
> >
> > On Mon, 16 May 2016, Doug Ledford wrote:
> >>
> >> Thanks, this looks good now.  When the other two patches come through
> >
> > The patch can stand on its own and there has been the expectation
> > expressed by Mellanox that they want to see this merged first. Guess this
> > is to reduce the amount of rewrite they would have to do if things change.
> > Then also the team from Mellanox can directly merge the driver changes
> > without my involvement.
> >
> 
> OK.  There are comments from Jason outstanding, and I found one thing
> that I missed in my earlier reviews.  I think we need to refactor how we
> pull out the stats, or at least consider doing so.  In particular, look
> at how many stats the cxgb3 driver fills in:
> 
> +	stats->dirname = "iw_stats";
> +	stats->name = names;
> +
> +	stats->value[IPINRECEIVES] = ((u64)m.ipInReceive_hi << 32) +
> m.ipInReceive_lo;
> +	stats->value[IPINHDRERRORS] = ((u64)m.ipInHdrErrors_hi << 32) +
> m.ipInHdrErrors_lo;
> +	stats->value[IPINADDRERRORS] = ((u64)m.ipInAddrErrors_hi << 32) +
> m.ipInAddrErrors_lo;
> +	stats->value[IPINUNKNOWNPROTOS] = ((u64)m.ipInUnknownProtos_hi <<
> 32)
> + m.ipInUnknownProtos_lo;
> +	stats->value[IPINDISCARDS] = ((u64)m.ipInDiscards_hi << 32) +
> m.ipInDiscards_lo;
> +	stats->value[IPINDELIVERS] = ((u64)m.ipInDelivers_hi << 32) +
> m.ipInDelivers_lo;
> +	stats->value[IPOUTREQUESTS] = ((u64)m.ipOutRequests_hi << 32) +
> m.ipOutRequests_lo;
> +	stats->value[IPOUTDISCARDS] = ((u64)m.ipOutDiscards_hi << 32) +
> m.ipOutDiscards_lo;
> +	stats->value[IPOUTNOROUTES] = ((u64)m.ipOutNoRoutes_hi << 32) +
> m.ipOutNoRoutes_lo;
> +	stats->value[IPREASMTIMEOUT] = 	m.ipReasmTimeout;
> +	stats->value[IPREASMREQDS] = m.ipReasmReqds;
> +	stats->value[IPREASMOKS] = m.ipReasmOKs;
> +	stats->value[IPREASMFAILS] = m.ipReasmFails;
> +	stats->value[TCPACTIVEOPENS] =	m.tcpActiveOpens;
> +	stats->value[TCPPASSIVEOPENS] =	m.tcpPassiveOpens;
> +	stats->value[TCPATTEMPTFAILS] = m.tcpAttemptFails;
> +	stats->value[TCPESTABRESETS] = m.tcpEstabResets;
> +	stats->value[TCPCURRESTAB] = m.tcpOutRsts;
> +	stats->value[TCPINSEGS] = m.tcpCurrEstab;
> +	stats->value[TCPOUTSEGS] = ((u64)m.tcpInSegs_hi << 32) + m.tcpInSegs_lo;
> +	stats->value[TCPRETRANSSEGS] = ((u64)m.tcpOutSegs_hi << 32) +
> m.tcpOutSegs_lo;
> +	stats->value[TCPINERRS] = ((u64)m.tcpRetransSeg_hi << 32) +
> m.tcpRetransSeg_lo,
> +	stats->value[TCPOUTRSTS] = ((u64)m.tcpInErrs_hi << 32) + m.tcpInErrs_lo;
> +	stats->value[TCPRTOMIN] = m.tcpRtoMin;
> +	stats->value[TCPRTOMAX] = m.tcpRtoMax;
> 
> That's a lot of copies, and shifts, and everything else.  Then look at
> what it does to get them:
> 
>  	ret = dev->rdev.t3cdev_p->ctl(dev->rdev.t3cdev_p, RDMA_GET_MIB, &m);
> 
> I didn't dig too deep, but that looks suspiciously like it might be an
> actual mailbox command to the card.  That can be rather expensive.
>

It is not a mailbox command, but indirect register reads (ie a write_reg +
read_reg operation).  See
cxgb_rdma_ctl(RDMA_GIT_MIB)->t3_tp_get_mib_stats()->t3_read_indirect().
 
> Then look at how we get the stats to print them to user space:
> 
> +static ssize_t show_protocol_stats(struct ib_device *dev, int index,
> +				   u8 port, char *buf)
> +{
> +	struct rdma_protocol_stats stats = {0};
> +	ssize_t ret;
> +
> +	ret = dev->get_protocol_stats(dev, &stats, port);
> +	if (ret)
> +		return ret;
> +
> +	return sprintf(buf, "%llu\n", stats.value[index]);
> +}
> 
> In a nutshell, we go through the effort of a suspected mailbox command,
> then we fill in all of the stats including all of the copies and shifts
> and everything else, then we print out precisely one and only one stat
> before we throw the rest of them away.  If someone goes into the stats
> directory for a card and does cat * or for i in *; do echo -ne "$i:\t";
> cat $i; done, then we will issue 25 mailbox commands, and fill out all
> 25 stats structs 25 times, just to print out one complete set of stats.
> For cxgb4 this isn't so bad, it's only got 4 items.  But the longer the
> list gets, the worst this is because it makes our efficiency of
> operation O(n^2).  Since we can't break out mailbox commands to only
> provide part of the data, I think we need to consider using a cached
> struct for each device.  If the cached data is less than a certain age
> on subsequent reads, we use the cached data.  If it's too old, we
> discard it and get new data.



--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2016-05-17 16:06 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-15 15:54 [PATCH 0/3] Dynamically extendable device counter support Christoph Lameter
2016-03-15 15:54 ` [PATCH 1/3] ib core: Make device counter infrastructure dynamic Christoph Lameter
     [not found]   ` <20160315155455.173645653-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>
2016-03-16 15:47     ` Dennis Dalessandro
     [not found]       ` <20160316154738.GA26530-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2016-03-16 17:17         ` Christoph Lameter
     [not found]           ` <alpine.DEB.2.20.1603161213560.15010-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-03-16 17:45             ` Dennis Dalessandro
2016-03-17  7:23     ` Leon Romanovsky
     [not found]       ` <20160317072354.GB25216-2ukJVAZIZ/Y@public.gmane.org>
2016-03-17  8:17         ` Leon Romanovsky
     [not found]           ` <20160317081716.GD25216-2ukJVAZIZ/Y@public.gmane.org>
2016-03-18  1:57             ` Christoph Lameter
     [not found]               ` <alpine.DEB.2.20.1603172057030.18714-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-03-18  6:20                 ` Leon Romanovsky
     [not found]                   ` <20160318062009.GI25216-2ukJVAZIZ/Y@public.gmane.org>
2016-03-18 14:33                     ` Christoph Lameter
     [not found]                       ` <alpine.DEB.2.20.1603180932310.25235-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-03-18 15:51                         ` Leon Romanovsky
2016-03-18  1:56         ` Christoph Lameter
     [not found]           ` <alpine.DEB.2.20.1603172054540.18714-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-03-18  6:16             ` Leon Romanovsky
     [not found]               ` <20160318061659.GH25216-2ukJVAZIZ/Y@public.gmane.org>
2016-03-18 14:34                 ` Christoph Lameter
     [not found]                   ` <alpine.DEB.2.20.1603180933320.25235-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-03-18 15:42                     ` Leon Romanovsky
2016-05-13 19:18     ` Doug Ledford
     [not found]       ` <057c8ac8-1d34-e7b9-c0ad-91d805c81139-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-16 13:52         ` Christoph Lameter
     [not found]           ` <alpine.DEB.2.20.1605160851370.23895-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-05-16 15:43             ` Doug Ledford
     [not found]               ` <041c6da0-e022-2bd1-5f00-e569c077e154-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-16 17:04                 ` Christoph Lameter
     [not found]                   ` <alpine.DEB.2.20.1605161203010.26453-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-05-16 17:27                     ` Doug Ledford
     [not found]                       ` <db1bf3dd-20b1-3f2f-eaa3-25e5e8aff35b-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-16 17:49                         ` Christoph Lameter
     [not found]                           ` <alpine.DEB.2.20.1605161238560.10085-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-05-16 18:01                             ` Doug Ledford
     [not found]                               ` <102cd100-55f7-fa85-cd75-ba0db5b9fa34-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-17 14:19                                 ` Christoph Lameter
     [not found]                                   ` <alpine.DEB.2.20.1605170918080.9956-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-05-17 16:00                                     ` Doug Ledford
     [not found]                                       ` <3e9a3e19-58cb-c25f-89a1-f0e51df562d8-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-17 16:06                                         ` Steve Wise [this message]
2016-05-17 17:00                                         ` Jason Gunthorpe
     [not found]                                           ` <20160517170027.GC19976-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-05-17 17:34                                             ` Doug Ledford
     [not found]                                               ` <bc83cc75-aa2e-6fc6-e1c6-a0190b972013-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-18 17:25                                                 ` Jason Gunthorpe
     [not found]                                                   ` <20160518172542.GA15516-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-05-18 18:11                                                     ` Doug Ledford
     [not found]                                                       ` <12e991bc-aa9b-a8b0-3cd4-b56d58a44d60-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-18 18:17                                                         ` Steve Wise
2016-05-18 19:01                                                         ` Christoph Lameter
     [not found]                                                           ` <alpine.DEB.2.20.1605181401030.29313-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-05-18 20:27                                                             ` Steve Wise
2016-05-19 14:34                                                               ` Christoph Lameter
2016-05-19 19:24                                                               ` Doug Ledford
2016-05-18 21:11                                                         ` Jason Gunthorpe
2016-05-16 18:06                             ` Jason Gunthorpe
2016-05-16 18:27                             ` Steve Wise
2016-03-15 15:54 ` [PATCH 2/3] mlx4: Add support for protocol statistics Christoph Lameter
2016-03-15 15:54 ` [PATCH 3/3] mlx5: Implement new counter infrastructure Christoph Lameter
     [not found]   ` <20160315155455.397561811-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>
2016-05-13 19:18     ` Doug Ledford
     [not found]       ` <d01d42d9-08a8-968a-97f9-40188301170a-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-16 13:52         ` Christoph Lameter
     [not found]           ` <alpine.DEB.2.20.1605160852260.23895-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-05-16 15:44             ` Doug Ledford

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='004001d1b056$0778d350$166a79f0$@opengridcomputing.com' \
    --to=swise-7bpotxp6k4+p2yhjcf5u+vpxobypeauw@public.gmane.org \
    --cc=alonvi-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=markb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=swise-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).