From patchwork Tue Dec 17 15:07:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Traynor X-Patchwork-Id: 1211467 X-Patchwork-Delegate: i.maximets@samsung.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="b9LG/g7R"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47chNF31KLz9sRl for ; Wed, 18 Dec 2019 02:08:13 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 6EEF4204F9; Tue, 17 Dec 2019 15:08:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dwxILMQmrDWl; Tue, 17 Dec 2019 15:08:10 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 1E4FA20484; Tue, 17 Dec 2019 15:08:10 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0D092C1AE8; Tue, 17 Dec 2019 15:08:10 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6DCDCC077D for ; Tue, 17 Dec 2019 15:08:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 5CC7D86132 for ; Tue, 17 Dec 2019 15:08:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Qw0RpUYZr6JC for ; Tue, 17 Dec 2019 15:08:08 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by whitealder.osuosl.org (Postfix) with ESMTPS id AFDB984D6E for ; Tue, 17 Dec 2019 15:08:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576595287; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GxivkQN91w+xClOLEyDN7Rh/wsK93auCoO5iZCNy0as=; b=b9LG/g7RVb1/FEUtw/hAWV/bsOsd96p0C5WDYWH9rT7zLywleMKSy26h7miI0taYAX/o6x SYKlrnPajLB5nxCNiLjFvphZwlFYA14YpAwLdofXgypiIQux7BqqxJSG9kMxc4FuIvCkej rgkLhkugdNV+sCVHgLsTmWKkY3szrKE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-379-JTo08tGLNn6nwIyuscZJkg-1; Tue, 17 Dec 2019 10:08:04 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C30D71800D42; Tue, 17 Dec 2019 15:08:02 +0000 (UTC) Received: from rh.redhat.com (unknown [10.36.118.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E8B15C1B0; Tue, 17 Dec 2019 15:08:01 +0000 (UTC) From: Kevin Traynor To: dev@openvswitch.org Date: Tue, 17 Dec 2019 15:07:37 +0000 Message-Id: <20191217150737.24039-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: JTo08tGLNn6nwIyuscZJkg-1 X-Mimecast-Spam-Score: 0 Cc: i.maximets@ovn.org Subject: [ovs-dev] [PATCH] netdev-dpdk: Fix sw stats perf drop. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Accessing the sw stats in the vhost datapath of a PVP test can incur a performance drop of ~2%. Most of the time these stats will just be getting zero added to them. By checking if there is a non-zero update first, we can avoid accessing them when they won't be updated and avoid the performance drop. Fixes: 2f862c712e52 ("netdev-dpdk: Detailed packet drop statistics.") Signed-off-by: Kevin Traynor Acked-by: Eelco Chaudron --- lib/netdev-dpdk.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 89c73a29b..238f29a2a 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -2175,5 +2175,4 @@ netdev_dpdk_vhost_update_rx_counters(struct netdev_dpdk *dev, int qos_drops) { - struct netdev_dpdk_sw_stats *sw_stats = dev->sw_stats; struct netdev_stats *stats = &dev->stats; struct dp_packet *packet; @@ -2206,5 +2205,7 @@ netdev_dpdk_vhost_update_rx_counters(struct netdev_dpdk *dev, } - sw_stats->rx_qos_drops += qos_drops; + if (OVS_UNLIKELY(qos_drops)) { + dev->sw_stats->rx_qos_drops += qos_drops; + } } @@ -2370,5 +2371,4 @@ netdev_dpdk_vhost_update_tx_counters(struct netdev_dpdk *dev, struct netdev_dpdk_sw_stats *sw_stats_add) { - struct netdev_dpdk_sw_stats *sw_stats = dev->sw_stats; int dropped = sw_stats_add->tx_mtu_exceeded_drops + sw_stats_add->tx_qos_drops + @@ -2385,8 +2385,12 @@ netdev_dpdk_vhost_update_tx_counters(struct netdev_dpdk *dev, } - sw_stats->tx_retries += sw_stats_add->tx_retries; - sw_stats->tx_failure_drops += sw_stats_add->tx_failure_drops; - sw_stats->tx_mtu_exceeded_drops += sw_stats_add->tx_mtu_exceeded_drops; - sw_stats->tx_qos_drops += sw_stats_add->tx_qos_drops; + if (OVS_UNLIKELY(dropped || sw_stats_add->tx_retries)) { + struct netdev_dpdk_sw_stats *sw_stats = dev->sw_stats; + + sw_stats->tx_retries += sw_stats_add->tx_retries; + sw_stats->tx_failure_drops += sw_stats_add->tx_failure_drops; + sw_stats->tx_mtu_exceeded_drops += sw_stats_add->tx_mtu_exceeded_drops; + sw_stats->tx_qos_drops += sw_stats_add->tx_qos_drops; + } }