From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <thomas@monjalon.net>
Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com
 [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 9034B1B5D9
 for <dev@dpdk.org>; Tue, 17 Oct 2017 23:24:14 +0200 (CEST)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.nyi.internal (Postfix) with ESMTP id 39E7F20C45;
 Tue, 17 Oct 2017 17:24:14 -0400 (EDT)
Received: from frontend2 ([10.202.2.161])
 by compute1.internal (MEProxy); Tue, 17 Oct 2017 17:24:14 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 cc:content-transfer-encoding:content-type:date:from:in-reply-to
 :message-id:mime-version:references:subject:to:x-me-sender
 :x-me-sender:x-sasl-enc; s=mesmtp; bh=WmVd6fu21lc5upWBOuNaRSj7Ni
 kjM5xMSDPXokXnoZM=; b=fW6b155ttEUCtdjwvJUHXJfoqqJResGI9WA8rYT8i9
 EjqKnQCl10gP9a2IPkaFe6cfy74w4Uj/HvhtOAGyf34np16p8EzvOeg6ttEGaXF2
 wBFMs+ok/Mi6g4dAfvDzrsdQEe8HBqCTAWhdFVZytgPvkgunjI19oBVA/ogogDVc
 w=
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:content-type
 :date:from:in-reply-to:message-id:mime-version:references
 :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=WmVd6f
 u21lc5upWBOuNaRSj7NikjM5xMSDPXokXnoZM=; b=iSUwZEOcOMa+7Z56x9EP3l
 omeh7aOLu3qNRpvE7QSpiHgLOJM+YnMWXFP6GnSwphZXJNUaBu7o//uDj2R+uUal
 /F2COeI/G1I9E/v0c3C8iOXoWY5ds5IM1cGYWHuSn8kzx0hyZJjTlupgIRApjjOu
 xLxBqp+0m2nwtsHbAJfxR/ZxwxdIArKRQDP1x6ztCtqtNQMbRtxI1rbVxHayTOdW
 bZYoOtAIz+eaDQ0qxUEvlHA8pkxYstQjYPjLd+BJXce8YAYULNGGreHtndyaTOof
 aQUlJynK4jgEyQoVGzlsSfx+dKmBT+9AXCXlMwd2cyk7lXkBbVIaEWGVvm+I3inw
 ==
X-ME-Sender: <xms:_nTmWS9ecCQHczFsr_0nCanD0X4H8N2wPAwZllqQwXjVNJeuinQI3w>
Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184])
 by mail.messagingengine.com (Postfix) with ESMTPA id DD968245E3;
 Tue, 17 Oct 2017 17:24:13 -0400 (EDT)
From: Thomas Monjalon <thomas@monjalon.net>
To: Xiaoyun Li <xiaoyun.li@intel.com>, konstantin.ananyev@intel.com,
 bruce.richardson@intel.com
Cc: dev@dpdk.org, wenzhuo.lu@intel.com, helin.zhang@intel.com,
 ophirmu@mellanox.com
Date: Tue, 17 Oct 2017 23:24:12 +0200
Message-ID: <4482530.zMd2RtzCvC@xps>
In-Reply-To: <1507885309-165144-2-git-send-email-xiaoyun.li@intel.com>
References: <1507206794-79941-1-git-send-email-xiaoyun.li@intel.com>
 <1507885309-165144-1-git-send-email-xiaoyun.li@intel.com>
 <1507885309-165144-2-git-send-email-xiaoyun.li@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
Subject: Re: [dpdk-dev] [PATCH v8 1/3] eal/x86: run-time dispatch over memcpy
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 17 Oct 2017 21:24:14 -0000

Hi,

13/10/2017 11:01, Xiaoyun Li:
> This patch dynamically selects functions of memcpy at run-time based
> on CPU flags that current machine supports. This patch uses function
> pointers which are bind to the relative functions at constrctor time.
> In addition, AVX512 instructions set would be compiled only if users
> config it enabled and the compiler supports it.
> 
> Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
> ---
Keeping only the major changes of the patch for later discussions:
[...]
>  static inline void *
>  rte_memcpy(void *dst, const void *src, size_t n)
>  {
> -	if (!(((uintptr_t)dst | (uintptr_t)src) & ALIGNMENT_MASK))
> -		return rte_memcpy_aligned(dst, src, n);
> +	if (n <= RTE_X86_MEMCPY_THRESH)
> +		return rte_memcpy_internal(dst, src, n);
>  	else
> -		return rte_memcpy_generic(dst, src, n);
> +		return (*rte_memcpy_ptr)(dst, src, n);
>  }
[...]
> +static inline void *
> +rte_memcpy_internal(void *dst, const void *src, size_t n)
> +{
> +	if (!(((uintptr_t)dst | (uintptr_t)src) & ALIGNMENT_MASK))
> +		return rte_memcpy_aligned(dst, src, n);
> +	else
> +		return rte_memcpy_generic(dst, src, n);
> +}

The significant change of this patch is to call a function pointer
for packet size > 128 (RTE_X86_MEMCPY_THRESH).

Please could you provide some benchmark numbers?

>>From a test done at Mellanox, there might be a performance degradation
of about 15% in testpmd txonly with AVX2.
Is there someone else seeing a performance degradation?