Skip to content

Commit

Permalink
net: mana: Fix perf regression: remove rx_cqes, tx_cqes counters
Browse files Browse the repository at this point in the history
The apc->eth_stats.rx_cqes is one per NIC (vport), and it's on the
frequent and parallel code path of all queues. So, r/w into this
single shared variable by many threads on different CPUs creates a
lot caching and memory overhead, hence perf regression. And, it's
not accurate due to the high volume concurrent r/w.

For example, a workload is iperf with 128 threads, and with RPS
enabled. We saw perf regression of 25% with the previous patch
adding the counters. And this patch eliminates the regression.

Since the error path of mana_poll_rx_cq() already has warnings, so
keeping the counter and convert it to a per-queue variable is not
necessary. So, just remove this counter from this high frequency
code path.

Also, remove the tx_cqes counter for the same reason. We have
warnings & other counters for errors on that path, and don't need
to count every normal cqe processing.

Cc: [email protected]
Fixes: bd7fc6e ("net: mana: Add new MANA VF performance counters for easier troubleshooting")
Signed-off-by: Haiyang Zhang <[email protected]>
Reviewed-by: Horatiu Vultur <[email protected]>
Reviewed-by: Jiri Pirko <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
  • Loading branch information
haiyangz authored and Paolo Abeni committed May 30, 2023
1 parent 111d467 commit 1919b39
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 14 deletions.
10 changes: 0 additions & 10 deletions drivers/net/ethernet/microsoft/mana/mana_en.c
Original file line number Diff line number Diff line change
Expand Up @@ -1279,8 +1279,6 @@ static void mana_poll_tx_cq(struct mana_cq *cq)
if (comp_read < 1)
return;

apc->eth_stats.tx_cqes = comp_read;

for (i = 0; i < comp_read; i++) {
struct mana_tx_comp_oob *cqe_oob;

Expand Down Expand Up @@ -1363,8 +1361,6 @@ static void mana_poll_tx_cq(struct mana_cq *cq)
WARN_ON_ONCE(1);

cq->work_done = pkt_transmitted;

apc->eth_stats.tx_cqes -= pkt_transmitted;
}

static void mana_post_pkt_rxq(struct mana_rxq *rxq)
Expand Down Expand Up @@ -1626,15 +1622,11 @@ static void mana_poll_rx_cq(struct mana_cq *cq)
{
struct gdma_comp *comp = cq->gdma_comp_buf;
struct mana_rxq *rxq = cq->rxq;
struct mana_port_context *apc;
int comp_read, i;

apc = netdev_priv(rxq->ndev);

comp_read = mana_gd_poll_cq(cq->gdma_cq, comp, CQE_POLLING_BUFFER);
WARN_ON_ONCE(comp_read > CQE_POLLING_BUFFER);

apc->eth_stats.rx_cqes = comp_read;
rxq->xdp_flush = false;

for (i = 0; i < comp_read; i++) {
Expand All @@ -1646,8 +1638,6 @@ static void mana_poll_rx_cq(struct mana_cq *cq)
return;

mana_process_rx_cqe(rxq, cq, &comp[i]);

apc->eth_stats.rx_cqes--;
}

if (rxq->xdp_flush)
Expand Down
2 changes: 0 additions & 2 deletions drivers/net/ethernet/microsoft/mana/mana_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ static const struct {
} mana_eth_stats[] = {
{"stop_queue", offsetof(struct mana_ethtool_stats, stop_queue)},
{"wake_queue", offsetof(struct mana_ethtool_stats, wake_queue)},
{"tx_cqes", offsetof(struct mana_ethtool_stats, tx_cqes)},
{"tx_cq_err", offsetof(struct mana_ethtool_stats, tx_cqe_err)},
{"tx_cqe_unknown_type", offsetof(struct mana_ethtool_stats,
tx_cqe_unknown_type)},
{"rx_cqes", offsetof(struct mana_ethtool_stats, rx_cqes)},
{"rx_coalesced_err", offsetof(struct mana_ethtool_stats,
rx_coalesced_err)},
{"rx_cqe_unknown_type", offsetof(struct mana_ethtool_stats,
Expand Down
2 changes: 0 additions & 2 deletions include/net/mana/mana.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,8 @@ struct mana_tx_qp {
struct mana_ethtool_stats {
u64 stop_queue;
u64 wake_queue;
u64 tx_cqes;
u64 tx_cqe_err;
u64 tx_cqe_unknown_type;
u64 rx_cqes;
u64 rx_coalesced_err;
u64 rx_cqe_unknown_type;
};
Expand Down

0 comments on commit 1919b39

Please sign in to comment.