[v2,4/6] usertools/setup: remove hugepage functions
Checks
Commit Message
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 <ferruh.yigit@intel.com>
---
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(-)
Comments
Hi Ferruh,
Tested V2 patch, the docs also build successfully.
Thanks,
Conor.
> From: Yigit, Ferruh <ferruh.yigit@intel.com>
> Sent: Thursday 26 November 2020 14:19
> To: Thomas Monjalon <thomas@monjalon.net>
> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; dev@dpdk.org;
> techboard@dpdk.org; Stephen Hemminger
> <stephen@networkplumber.org>; Richardson, Bruce
> <bruce.richardson@intel.com>; Walsh, Conor <conor.walsh@intel.com>
> Subject: [PATCH v2 4/6] usertools/setup: remove hugepage functions
>
> 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 <ferruh.yigit@intel.com>
Tested-by: Conor Walsh <conor.walsh@intel.com>
@@ -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 <linux_gsg>` 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?
@@ -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>>
@@ -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