From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2A810A052A; Thu, 26 Nov 2020 15:20:03 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C0E58C9BA; Thu, 26 Nov 2020 15:18:55 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 8D7EBC93A; Thu, 26 Nov 2020 15:18:50 +0100 (CET) IronPort-SDR: b9HwNi6snRvDcYRP0UecWas0p+A7bJRe2E6HmtjJWYAKSr4FrtqeUWAQXmnsvWhGx4ZsCYv4I8 wAm5HhBWyn8Q== X-IronPort-AV: E=McAfee;i="6000,8403,9816"; a="172445627" X-IronPort-AV: E=Sophos;i="5.78,372,1599548400"; d="scan'208";a="172445627" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Nov 2020 06:18:50 -0800 IronPort-SDR: W75kxrqcAAlOnevFk3azXEXuRSkjsVRPWAkAfiEIxxzHR26lwGnK5WJt1Lel9tC1iwfa1TPG9a 0kmVRoAwRL+A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,372,1599548400"; d="scan'208";a="333392346" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.180]) by orsmga006.jf.intel.com with ESMTP; 26 Nov 2020 06:18:48 -0800 From: Ferruh Yigit To: Thomas Monjalon Cc: Ferruh Yigit , dev@dpdk.org, techboard@dpdk.org, Stephen Hemminger , Bruce Richardson , conor.walsh@intel.com Date: Thu, 26 Nov 2020 14:18:30 +0000 Message-Id: <20201126141832.2277628-5-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201126141832.2277628-1-ferruh.yigit@intel.com> References: <20201126141832.2277628-1-ferruh.yigit@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 4/6] usertools/setup: remove hugepage functions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" There is a specific tool to setup hugepages, with better support, no need to have duplication. The hugepage script is: './usertools/dpdk-hugepages.py' Please try "./usertools/dpdk-hugepages.py -h" for more information about the tool. Signed-off-by: Ferruh Yigit --- doc/guides/faq/faq.rst | 4 +- doc/guides/linux_gsg/quick_start.rst | 90 +++-------------- usertools/dpdk-setup.sh | 145 ++------------------------- 3 files changed, 25 insertions(+), 214 deletions(-) diff --git a/doc/guides/faq/faq.rst b/doc/guides/faq/faq.rst index ee8c1697b4ad..5bc2926fa5d7 100644 --- a/doc/guides/faq/faq.rst +++ b/doc/guides/faq/faq.rst @@ -22,8 +22,8 @@ When you stop and restart the test application, it looks to see if the pages are If you look in the directory, you will see ``n`` number of 2M pages files. If you specified 1024, you will see 1024 page files. These are then placed in memory segments to get contiguous memory. -If you need to change the number of pages, it is easier to first remove the pages. The usertools/dpdk-setup.sh script provides an option to do this. -See the "Quick Start Setup Script" section in the :ref:`DPDK Getting Started Guide ` for more information. +If you need to change the number of pages, it is easier to first remove the pages. The ./usertools/dpdk-hugepages.py script supports to do this. +See the :doc:`../tools/hugepages` for more information. If I execute "l2fwd -l 0-3 -m 64 -n 3 -- -p 3", I get the following output, indicating that there are no socket 0 hugepages to allocate the mbuf and ring structures to? diff --git a/doc/guides/linux_gsg/quick_start.rst b/doc/guides/linux_gsg/quick_start.rst index f46c50d04b65..630def36a173 100644 --- a/doc/guides/linux_gsg/quick_start.rst +++ b/doc/guides/linux_gsg/quick_start.rst @@ -14,18 +14,14 @@ The dpdk-setup.sh script, found in the usertools subdirectory, allows the user t * Remove the DPDK KNI kernel module -* Create and delete hugepages for NUMA and non-NUMA cases - * View network port status and reserve ports for DPDK application use * Set up permissions for using VFIO as a non-privileged user -* Look at hugepages in the meminfo - -* List hugepages in ``/mnt/huge`` - Please refer to :doc:`../prog_guide/build-sdk-meson` for building DPDK. +Please refer to :doc:`../tools/hugepages` for setting up hugepages for DPDK. + Script Organization ------------------- @@ -36,14 +32,9 @@ The following is a brief synopsis of each step. **Step 1: Setup Environment** The user configures the Linux* environment to support the running of DPDK applications. -Hugepages can be set up for NUMA or non-NUMA systems. Any existing hugepages will be removed. Network ports may be bound to DPDK kernel module for DPDK application use. -**Step 2: Examining the System** - -This step provides some tools for examining the status of hugepage mappings. - -**Step 3: System Cleanup** +**Step 2: System Cleanup** The final step has options for restoring the system to its original state. @@ -74,43 +65,29 @@ Some options in the script prompt the user for further data before proceeding. [1] Insert VFIO module - [2] Setup hugepage mappings for non-NUMA systems - - [3] Setup hugepage mappings for NUMA systems - - [4] Display current Ethernet device settings - - [5] Bind Ethernet device to IGB UIO module - - [6] Bind Ethernet device to VFIO module - - [7] Setup VFIO permissions - - ------------------------------------------------------------------------ + [2] Display current Ethernet device settings - Step 2: Other tools + [3] Bind Ethernet device to IGB UIO module - ------------------------------------------------------------------------ + [4] Bind Ethernet device to VFIO module - [8] List hugepage info from /proc/meminfo + [5] Setup VFIO permissions ------------------------------------------------------------------------ - Step 3: Uninstall and system cleanup + Step 2: Uninstall and system cleanup ------------------------------------------------------------------------ - [9] Unbind NICs from IGB UIO driver - - [10] Remove IGB UIO module + [6] Unbind NICs from IGB UIO driver - [11] Remove VFIO module + [7] Remove IGB UIO module - [12] Remove KNI module + [8] Remove VFIO module - [13] Remove hugepage mappings + [9] Remove KNI module - [14] Exit Script + [10] Exit Script Option: @@ -118,46 +95,7 @@ The following selection demonstrates the starting of the DPDK UIO driver. .. code-block:: console - Option: 10 + Option: 7 Unloading any existing DPDK UIO module Loading DPDK UIO module - -The following selection demonstrates the creation of hugepages in a NUMA system. -1024 2 MByte pages are assigned to each node. -The result is that the application should use -m 4096 for starting the application to access both memory areas -(this is done automatically if the -m option is not provided). - -.. note:: - - If prompts are displayed to remove temporary files, type 'y'. - -.. code-block:: console - - Option: 3 - - Removing currently reserved hugepages - mounting /mnt/huge and removing directory - Input the number of 2MB pages for each node - Example: to have 128MB of hugepages available per node, - enter '64' to reserve 64 * 2MB pages on each node - Number of pages for node0: 1024 - Number of pages for node1: 1024 - Reserving hugepages - Creating /mnt/huge and mounting as hugetlbfs - -The following selection demonstrates the launch of the test application to run on a single core. - -.. code-block:: console - - Option: 8 - - Enter hex bitmask of cores to execute test app on - Example: to execute app on cores 0 to 7, enter 0xff - bitmask: 0x01 - Launching app - EAL: coremask set to 1 - EAL: Detected lcore 0 on socket 0 - ... - EAL: Main core 0 is ready (tid=1b2ad720) - RTE>> diff --git a/usertools/dpdk-setup.sh b/usertools/dpdk-setup.sh index 759f6c096536..1e36661e572e 100755 --- a/usertools/dpdk-setup.sh +++ b/usertools/dpdk-setup.sh @@ -15,8 +15,6 @@ echo "-------------------------------------------------------------------------- echo " RTE_SDK exported as $RTE_SDK" echo "------------------------------------------------------------------------------" -HUGEPGSZ=`cat /proc/meminfo | grep Hugepagesize | cut -d : -f 2 | tr -d ' '` - # # Sets QUIT variable so script will finish. # @@ -31,36 +29,6 @@ q() quit } -# -# Creates hugepage filesystem. -# -create_mnt_huge() -{ - echo "Creating /mnt/huge and mounting as hugetlbfs" - sudo mkdir -p /mnt/huge - - grep -s '/mnt/huge' /proc/mounts > /dev/null - if [ $? -ne 0 ] ; then - sudo mount -t hugetlbfs nodev /mnt/huge - fi -} - -# -# Removes hugepage filesystem. -# -remove_mnt_huge() -{ - echo "Unmounting /mnt/huge and removing directory" - grep -s '/mnt/huge' /proc/mounts > /dev/null - if [ $? -eq 0 ] ; then - sudo umount /mnt/huge - fi - - if [ -d /mnt/huge ] ; then - sudo rm -R /mnt/huge - fi -} - # # Unloads igb_uio.ko. # @@ -182,79 +150,6 @@ set_vfio_permissions() fi } -# -# Removes all reserved hugepages. -# -clear_huge_pages() -{ - echo > .echo_tmp - for d in /sys/devices/system/node/node? ; do - echo "echo 0 > $d/hugepages/hugepages-${HUGEPGSZ}/nr_hugepages" >> .echo_tmp - done - echo "Removing currently reserved hugepages" - sudo sh .echo_tmp - rm -f .echo_tmp - - remove_mnt_huge -} - -# -# Creates hugepages. -# -set_non_numa_pages() -{ - clear_huge_pages - - echo "" - echo " Input the number of ${HUGEPGSZ} hugepages" - echo " Example: to have 128MB of hugepages available in a 2MB huge page system," - echo " enter '64' to reserve 64 * 2MB pages" - echo -n "Number of pages: " - read Pages - - echo "echo $Pages > /sys/kernel/mm/hugepages/hugepages-${HUGEPGSZ}/nr_hugepages" > .echo_tmp - - echo "Reserving hugepages" - sudo sh .echo_tmp - rm -f .echo_tmp - - create_mnt_huge -} - -# -# Creates hugepages on specific NUMA nodes. -# -set_numa_pages() -{ - clear_huge_pages - - echo "" - echo " Input the number of ${HUGEPGSZ} hugepages for each node" - echo " Example: to have 128MB of hugepages available per node in a 2MB huge page system," - echo " enter '64' to reserve 64 * 2MB pages on each node" - - echo > .echo_tmp - for d in /sys/devices/system/node/node? ; do - node=$(basename $d) - echo -n "Number of pages for $node: " - read Pages - echo "echo $Pages > $d/hugepages/hugepages-${HUGEPGSZ}/nr_hugepages" >> .echo_tmp - done - echo "Reserving hugepages" - sudo sh .echo_tmp - rm -f .echo_tmp - - create_mnt_huge -} - -# -# Print hugepage information. -# -grep_meminfo() -{ - grep -i huge /proc/meminfo -} - # # Calls dpdk-devbind.py --status to show the devices and what they # are all bound to, in terms of drivers. @@ -329,41 +224,23 @@ step1_func() TEXT[1]="Insert VFIO module" FUNC[1]="load_vfio_module" - TEXT[2]="Setup hugepage mappings for non-NUMA systems" - FUNC[2]="set_non_numa_pages" - - TEXT[3]="Setup hugepage mappings for NUMA systems" - FUNC[3]="set_numa_pages" + TEXT[2]="Display current Ethernet/Baseband/Crypto device settings" + FUNC[2]="show_devices" - TEXT[4]="Display current Ethernet/Baseband/Crypto device settings" - FUNC[4]="show_devices" + TEXT[3]="Bind Ethernet/Baseband/Crypto device to IGB UIO module" + FUNC[3]="bind_devices_to_igb_uio" - TEXT[5]="Bind Ethernet/Baseband/Crypto device to IGB UIO module" - FUNC[5]="bind_devices_to_igb_uio" - - TEXT[6]="Bind Ethernet/Baseband/Crypto device to VFIO module" - FUNC[6]="bind_devices_to_vfio" - - TEXT[7]="Setup VFIO permissions" - FUNC[7]="set_vfio_permissions" -} - -# -# Other options -# -step2_func() -{ - TITLE="Other tools" - - TEXT[1]="List hugepage info from /proc/meminfo" - FUNC[1]="grep_meminfo" + TEXT[4]="Bind Ethernet/Baseband/Crypto device to VFIO module" + FUNC[4]="bind_devices_to_vfio" + TEXT[5]="Setup VFIO permissions" + FUNC[5]="set_vfio_permissions" } # # Options for cleaning up the system # -step3_func() +step2_func() { TITLE="Uninstall and system cleanup" @@ -378,14 +255,10 @@ step3_func() TEXT[4]="Remove KNI module" FUNC[4]="remove_kni_module" - - TEXT[5]="Remove hugepage mappings" - FUNC[5]="clear_huge_pages" } STEPS[1]="step1_func" STEPS[2]="step2_func" -STEPS[3]="step3_func" QUIT=0 -- 2.26.2