From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mogw0926.ocn.ad.jp (mogw0926.ocn.ad.jp [153.149.227.32]) by dpdk.org (Postfix) with ESMTP id ABE021B8AE for ; Thu, 1 Feb 2018 05:05:19 +0100 (CET) Received: from mf-smf-ucb034c3 (mf-smf-ucb034c3.ocn.ad.jp [153.153.66.229]) by mogw0926.ocn.ad.jp (Postfix) with ESMTP id 39492B8023A; Thu, 1 Feb 2018 13:05:18 +0900 (JST) Received: from ntt.pod01.mv-mta-ucb030 ([153.149.230.164]) by mf-smf-ucb034c3 with ESMTP id h67Oecrq7Ek2Yh67ieutRe; Thu, 01 Feb 2018 13:05:18 +0900 Received: from smtp.ocn.ne.jp ([153.149.227.166]) by ntt.pod01.mv-mta-ucb030 with id 5G5G1x0063c2f7501G5GYG; Thu, 01 Feb 2018 04:05:18 +0000 Received: from localhost.localdomain (sp1-66-99-86.msc.spmode.ne.jp [1.66.99.86]) by smtp.ocn.ne.jp (Postfix) with ESMTPA; Thu, 1 Feb 2018 13:05:16 +0900 (JST) From: ogawa.yasufumi@lab.ntt.co.jp To: spp@dpdk.org, ferruh.yigit@intel.com Cc: Yasufumi Ogawa Date: Thu, 1 Feb 2018 13:04:57 +0900 Message-Id: <20180201040501.8004-11-ogawa.yasufumi@lab.ntt.co.jp> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20180201040501.8004-1-ogawa.yasufumi@lab.ntt.co.jp> References: <20180201040501.8004-1-ogawa.yasufumi@lab.ntt.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [spp] [PATCH 11/15] docs: add performance_opt section X-BeenThere: spp@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Soft Patch Panel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 04:05:20 -0000 From: Yasufumi Ogawa Add section for performance optimization containing following topics. * Reduce context switches * Optimizing QEMU performance Signed-off-by: Yasufumi Ogawa --- docs/guides/setup/index.rst | 1 + docs/guides/setup/performance_opt.rst | 106 ++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 docs/guides/setup/performance_opt.rst diff --git a/docs/guides/setup/index.rst b/docs/guides/setup/index.rst index 972132d..0ac18af 100644 --- a/docs/guides/setup/index.rst +++ b/docs/guides/setup/index.rst @@ -38,3 +38,4 @@ Setup Guide getting_started howto_use use_cases + performance_opt diff --git a/docs/guides/setup/performance_opt.rst b/docs/guides/setup/performance_opt.rst new file mode 100644 index 0000000..2bf8a5e --- /dev/null +++ b/docs/guides/setup/performance_opt.rst @@ -0,0 +1,106 @@ +.. BSD LICENSE + Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +Performance Optimization +======================== + +Reduce Context Switches +----------------------- + +Use the ``isolcpus`` Linux kernel parameter to isolate them +from Linux scheduler to reduce context switches. +It prevents workloads of other processes than DPDK running on +reserved cores with ``isolcpus`` parameter. + +For Ubuntu 16.04, define ``isolcpus`` in ``/etc/default/grub``. + +.. code-block:: console + + GRUB_CMDLINE_LINUX_DEFAULT=“isolcpus=0-3,5,7” + +The value of this ``isolcpus`` depends on your environment and usage. +This example reserves six cores(0,1,2,3,5,7). + + +Optimizing QEMU Performance +--------------------------- + +QEMU process runs threads for vcpu emulation. It is effective strategy +for pinning vcpu threads to decicated cores. + +To find vcpu threads, you use ``ps`` command to find PID of QEMU process +and ``pstree`` command for threads launched from QEMU process. + +.. code-block:: console + + $ ps ea + PID TTY STAT TIME COMMAND + 192606 pts/11 Sl+ 4:42 ./x86_64-softmmu/qemu-system-x86_64 -cpu host ... + +Run ``pstree`` with ``-p`` and this PID to find all threads launched from QEMU. + +.. code-block:: console + + $ pstree -p 192606 + qemu-system-x86(192606)--+--{qemu-system-x8}(192607) + |--{qemu-system-x8}(192623) + |--{qemu-system-x8}(192624) + |--{qemu-system-x8}(192625) + |--{qemu-system-x8}(192626) + +Update affinity by using ``taskset`` command to pin vcpu threads. +The vcpu threads is listed from the second entry and later. +In this example, assign PID 192623 to core 4, PID 192624 to core 5 +and so on. + +.. code-block:: console + + $ sudo taskset -pc 4 192623 + pid 192623's current affinity list: 0-31 + pid 192623's new affinity list: 4 + $ sudo taskset -pc 5 192624 + pid 192624's current affinity list: 0-31 + pid 192624's new affinity list: 5 + $ sudo taskset -pc 6 192625 + pid 192625's current affinity list: 0-31 + pid 192625's new affinity list: 6 + $ sudo taskset -pc 7 192626 + pid 192626's current affinity list: 0-31 + pid 192626's new affinity list: 7 + + +Reference +--------- + +* [1] `Best pinning strategy for latency/performance trade-off `_ +* [2] `PVP reference benchmark setup using testpmd `_ +* [3] `Enabling Additional Functionality `_ +* [4] `How to get best performance with NICs on Intel platforms `_ -- 2.7.4