diff mbox series

[V1] update virtio func cases to support 2M hugepage env

Message ID 20200814091520.62326-1-qimaix.xiao@intel.com (mailing list archive)
State Accepted
Headers show
Series [V1] update virtio func cases to support 2M hugepage env | expand

Commit Message

Xiao, QimaiX Aug. 14, 2020, 9:15 a.m. UTC
*. add eal parameter single-file-segments for 2M env test

Signed-off-by: Xiao Qimai <qimaix.xiao@intel.com>
---
 tests/TestSuite_loopback_multi_paths_port_restart.py     | 7 +++++++
 tests/TestSuite_loopback_multi_queues.py                 | 7 +++++++
 tests/TestSuite_loopback_virtio_user_server_mode.py      | 9 +++++++++
 ...estSuite_pvp_virtio_user_multi_queues_port_restart.py | 7 +++++++
 tests/TestSuite_vhost_1024_ethports.py                   | 9 +++++++++
 tests/TestSuite_vhost_enqueue_interrupt.py               | 7 +++++++
 tests/TestSuite_vhost_event_idx_interrupt.py             | 7 +++++++
 tests/TestSuite_vhost_virtio_user_interrupt.py           | 7 +++++++
 tests/TestSuite_vm2vm_virtio_pmd.py                      | 9 +++++++++
 tests/TestSuite_vm2vm_virtio_user.py                     | 9 +++++++++
 10 files changed, 78 insertions(+)

Comments

Xiao, QimaiX Aug. 14, 2020, 9:43 a.m. UTC | #1
Tested-by: Xiao, QimaiX <qimaix.xiao@intel.com>

Regards,
Xiao Qimai

> -----Original Message-----
> From: Xiao, QimaiX <qimaix.xiao@intel.com>
> Sent: Friday, August 14, 2020 5:15 PM
> To: dts@dpdk.org
> Cc: Xiao, QimaiX <qimaix.xiao@intel.com>
> Subject: [dts][PATCH V1] update virtio func cases to support 2M hugepage
> env
> 
> *. add eal parameter single-file-segments for 2M env test
> 
> Signed-off-by: Xiao Qimai <qimaix.xiao@intel.com>
> ---
>  tests/TestSuite_loopback_multi_paths_port_restart.py     | 7 +++++++
>  tests/TestSuite_loopback_multi_queues.py                 | 7 +++++++
>  tests/TestSuite_loopback_virtio_user_server_mode.py      | 9 +++++++++
>  ...estSuite_pvp_virtio_user_multi_queues_port_restart.py | 7 +++++++
>  tests/TestSuite_vhost_1024_ethports.py                   | 9 +++++++++
>  tests/TestSuite_vhost_enqueue_interrupt.py               | 7 +++++++
>  tests/TestSuite_vhost_event_idx_interrupt.py             | 7 +++++++
>  tests/TestSuite_vhost_virtio_user_interrupt.py           | 7 +++++++
>  tests/TestSuite_vm2vm_virtio_pmd.py                      | 9 +++++++++
>  tests/TestSuite_vm2vm_virtio_user.py                     | 9 +++++++++
>  10 files changed, 78 insertions(+)
> 
> diff --git a/tests/TestSuite_loopback_multi_paths_port_restart.py
> b/tests/TestSuite_loopback_multi_paths_port_restart.py
> index 3f44232..1e91af4 100644
> --- a/tests/TestSuite_loopback_multi_paths_port_restart.py
> +++ b/tests/TestSuite_loopback_multi_paths_port_restart.py
> @@ -84,11 +84,18 @@ class TestLoopbackPortRestart(TestCase):
>          self.vhost.send_expect(command_line_client, "testpmd> ", 120)
>          self.vhost.send_expect("set fwd mac", "testpmd> ", 120)
> 
> +    @property
> +    def check_2M_env(self):
> +        out = self.dut.send_expect("cat /proc/meminfo |grep
> Hugepagesize|awk '{print($2)}'", "# ")
> +        return True if out == '2048' else False
> +
>      def start_virtio_user_testpmd(self, pmd_arg):
>          """
>          start testpmd of vhost user
>          """
>          eal_param = self.dut.create_eal_parameters(cores=self.core_list_user,
> prefix='virtio', no_pci=True,
> vdevs=['net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-net,%s' %
> pmd_arg["version"]])
> +        if self.check_2M_env:
> +            eal_param += " --single-file-segments"
>          command_line_user = self.dut.target + "/app/testpmd " + eal_param + "
> -- -i %s --rss-ip --nb-cores=1 --txd=1024 --rxd=1024" % pmd_arg["path"]
>          self.virtio_user.send_expect(command_line_user, "testpmd> ", 120)
>          self.virtio_user.send_expect("set fwd mac", "testpmd> ", 120) diff --git
> a/tests/TestSuite_loopback_multi_queues.py
> b/tests/TestSuite_loopback_multi_queues.py
> index 10abb72..8300dfc 100644
> --- a/tests/TestSuite_loopback_multi_queues.py
> +++ b/tests/TestSuite_loopback_multi_queues.py
> @@ -93,11 +93,18 @@ class TestLoopbackMultiQueues(TestCase):
>          self.vhost.send_expect(command_line_client, "testpmd> ", 120)
>          self.vhost.send_expect("set fwd mac", "testpmd> ", 120)
> 
> +    @property
> +    def check_2M_env(self):
> +        out = self.dut.send_expect("cat /proc/meminfo |grep
> Hugepagesize|awk '{print($2)}'", "# ")
> +        return True if out == '2048' else False
> +
>      def start_virtio_testpmd(self, args):
>          """
>          start testpmd on virtio
>          """
>          eal_param = self.dut.create_eal_parameters(cores=self.core_list_user,
> prefix='virtio', no_pci=True,
> vdevs=['net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-
> net,queues=%d,%s' % (self.queue_number, args["version"])])
> +        if self.check_2M_env:
> +            eal_param += " --single-file-segments"
>          command_line_user = self.dut.target + "/app/testpmd " + eal_param + "
> -- -i %s --nb-cores=%d --rxq=%d --txq=%d --txd=1024 --rxd=1024" %
> (args["path"], self.nb_cores, self.queue_number, self.queue_number)
>          self.virtio_user.send_expect(command_line_user, "testpmd> ", 120)
>          self.virtio_user.send_expect("set fwd mac", "testpmd> ", 120) diff --git
> a/tests/TestSuite_loopback_virtio_user_server_mode.py
> b/tests/TestSuite_loopback_virtio_user_server_mode.py
> index 742aa09..d329d46 100644
> --- a/tests/TestSuite_loopback_virtio_user_server_mode.py
> +++ b/tests/TestSuite_loopback_virtio_user_server_mode.py
> @@ -82,11 +82,18 @@ class TestLoopbackVirtioUserServerMode(TestCase):
>          self.vhost.send_expect(command_line_client, "testpmd> ", 120)
>          self.vhost.send_expect("set fwd mac", "testpmd> ", 120)
> 
> +    @property
> +    def check_2M_env(self):
> +        out = self.dut.send_expect("cat /proc/meminfo |grep
> Hugepagesize|awk '{print($2)}'", "# ")
> +        return True if out == '2048' else False
> +
>      def lanuch_virtio_user_testpmd(self, args):
>          """
>          start testpmd of vhost user
>          """
>          eal_param = self.dut.create_eal_parameters(cores=self.core_list_user,
> prefix='virtio', no_pci=True,
> vdevs=['net_virtio_user0,mac=00:01:02:03:04:05,path=vhost-
> net,server=1,queues=1,%s' % args["version"]])
> +        if self.check_2M_env:
> +            eal_param += " --single-file-segments"
>          command_line_user = self.dut.target + "/app/testpmd " + eal_param + "
> -- -i --rxq=1 --txq=1 --no-numa"
>          self.virtio_user.send_expect(command_line_user, "testpmd> ", 120)
>          self.virtio_user.send_expect("set fwd mac", "testpmd> ", 120) @@ -
> 102,6 +109,8 @@ class TestLoopbackVirtioUserServerMode(TestCase):
>          start testpmd of vhost user
>          """
>          eal_param = self.dut.create_eal_parameters(cores=self.core_list_user,
> prefix='virtio', no_pci=True,
> vdevs=['net_virtio_user0,mac=00:01:02:03:04:05,path=vhost-
> net,server=1,queues=%d,%s' % (self.queue_number, mode)])
> +        if self.check_2M_env:
> +            eal_param += " --single-file-segments"
>          command_line_user = self.dut.target + "/app/testpmd " + eal_param + "
> -- -i %s --nb-cores=%d --rxq=%d --txq=%d" % (extern_params, self.nb_cores,
> self.queue_number, self.queue_number)
>          self.virtio_user.send_expect(command_line_user, "testpmd> ", 120)
>          self.virtio_user.send_expect("set fwd mac", "testpmd> ", 120) diff --git
> a/tests/TestSuite_pvp_virtio_user_multi_queues_port_restart.py
> b/tests/TestSuite_pvp_virtio_user_multi_queues_port_restart.py
> index 0cd6fb2..c35f79d 100644
> --- a/tests/TestSuite_pvp_virtio_user_multi_queues_port_restart.py
> +++ b/tests/TestSuite_pvp_virtio_user_multi_queues_port_restart.py
> @@ -99,6 +99,11 @@ class
> TestPVPVirtioUserMultiQueuesPortRestart(TestCase):
>          self.vhost.send_expect("set fwd mac", "testpmd> ", 120)
>          self.vhost.send_expect("start", "testpmd> ", 120)
> 
> +    @property
> +    def check_2M_env(self):
> +        out = self.dut.send_expect("cat /proc/meminfo |grep
> Hugepagesize|awk '{print($2)}'", "# ")
> +        return True if out == '2048' else False
> +
>      def start_virtio_user_testpmd(self, vdevs, vector_flag=False):
>          """
>          start testpmd in vm depend on different path @@ -106,6 +111,8 @@
> class TestPVPVirtioUserMultiQueuesPortRestart(TestCase):
>          testcmd = self.dut.target + "/app/testpmd "
>          eal_params = self.dut.create_eal_parameters(cores=self.core_list[5:8],
> prefix='virtio', no_pci=True,
>                                                      vdevs=[vdevs])
> +        if self.check_2M_env:
> +            eal_params += " --single-file-segments"
>          if vector_flag:
>              para = " -- -i --tx-offloads=0x0 --enable-hw-vlan-strip --rss-ip --nb-
> cores=2 --rxq=%s --txq=%s --rss-ip" % (
>              self.queue_number, self.queue_number) diff --git
> a/tests/TestSuite_vhost_1024_ethports.py
> b/tests/TestSuite_vhost_1024_ethports.py
> index 6e02c83..b764936 100644
> --- a/tests/TestSuite_vhost_1024_ethports.py
> +++ b/tests/TestSuite_vhost_1024_ethports.py
> @@ -71,10 +71,19 @@ class TestVhost1024Ethports(TestCase):
>              "sed -i
> 's/CONFIG_RTE_MAX_ETHPORTS=1024$/CONFIG_RTE_MAX_ETHPORTS=32/
> ' config/common_base", '#', 30)
>          self.dut.build_install_dpdk(self.target)
> 
> +    @property
> +    def check_2M_env(self):
> +        out = self.dut.send_expect("cat /proc/meminfo |grep
> Hugepagesize|awk '{print($2)}'", "# ")
> +        return True if out == '2048' else False
> +
>      def test_launch_vhost_with_1024_ethports(self):
>          """
>          Test function of launch vhost with 1024 ethports
>          """
> +        if self.check_2M_env:
> +            hugepages = int(self.dut.get_total_huge_pages())
> +            if hugepages< 20480:
> +                self.dut.send_expect('echo 20480 >
> + /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages',
> expected='#
> + ', timeout=30)
>          command_line_vdev = ''
>          for ethport in range(self.max_ethport):
>              command_line_vdev += '--vdev "eth_vhost%d,iface=vhost-
> net%d,queues=%d" ' %(ethport, ethport, self.queue) diff --git
> a/tests/TestSuite_vhost_enqueue_interrupt.py
> b/tests/TestSuite_vhost_enqueue_interrupt.py
> index 9d3f5bc..5520782 100644
> --- a/tests/TestSuite_vhost_enqueue_interrupt.py
> +++ b/tests/TestSuite_vhost_enqueue_interrupt.py
> @@ -89,11 +89,18 @@ class TestVhostEnqueueInterrupt(TestCase):
>          """
>          vdev = "net_virtio_user0,mac=%s,path=./vhost-
> net,server=1,queues=%d" % (self.vmac, self.queues) if not packed else
> "net_virtio_user0,mac=%s,path=./vhost-
> net,server=1,queues=%d,packed_vq=1" % (self.vmac, self.queues)
>          eal_params = self.dut.create_eal_parameters(cores=self.core_list_virtio,
> prefix='virtio', no_pci=True, ports=[self.pci_info], vdevs=[vdev])
> +        if self.check_2M_env:
> +            eal_params += " --single-file-segments"
>          para = " -- -i --rxq=%d --txq=%d --rss-ip" % (self.queues, self.queues)
>          command_line_client =  self.dut.target + "/app/testpmd " + eal_params
> + para
>          self.virtio_user.send_expect(command_line_client, "testpmd> ", 120)
>          self.virtio_user.send_expect("set fwd txonly", "testpmd> ", 20)
> 
> +    @property
> +    def check_2M_env(self):
> +        out = self.dut.send_expect("cat /proc/meminfo |grep
> Hugepagesize|awk '{print($2)}'", "# ")
> +        return True if out == '2048' else False
> +
>      def lanuch_l3fwd_power(self):
>          """
>          launch l3fwd-power with a virtual vhost device diff --git
> a/tests/TestSuite_vhost_event_idx_interrupt.py
> b/tests/TestSuite_vhost_event_idx_interrupt.py
> index 4bb40c7..e82bd46 100644
> --- a/tests/TestSuite_vhost_event_idx_interrupt.py
> +++ b/tests/TestSuite_vhost_event_idx_interrupt.py
> @@ -82,6 +82,11 @@ class TestVhostEventIdxInterrupt(TestCase):
>          out = self.dut.send_expect("make -C examples/l3fwd-power", "#")
>          self.verify("Error" not in out, "compilation l3fwd-power error")
> 
> +    @property
> +    def check_2M_env(self):
> +        out = self.dut.send_expect("cat /proc/meminfo |grep
> Hugepagesize|awk '{print($2)}'", "# ")
> +        return True if out == '2048' else False
> +
>      def lanuch_l3fwd_power(self):
>          """
>          launch l3fwd-power with a virtual vhost device @@ -109,6 +114,8 @@
> class TestVhostEventIdxInterrupt(TestCase):
>          example_para = "./examples/l3fwd-power/build/l3fwd-power "
>          para = " --log-level=9 %s -- -p %s --parse-ptype 1 --config '%s' --interrupt-
> only" % (vdev_info, port_info, config_info)
>          eal_params =
> self.dut.create_eal_parameters(cores=self.core_list_l3fwd, no_pci=True)
> +        if self.check_2M_env:
> +            eal_params += " --single-file-segments "
>          command_line_client = example_para + eal_params + para
>          self.vhost.get_session_before(timeout=2)
>          self.vhost.send_expect(command_line_client, "POWER", 40) diff --git
> a/tests/TestSuite_vhost_virtio_user_interrupt.py
> b/tests/TestSuite_vhost_virtio_user_interrupt.py
> index 2f430d8..e882c3a 100644
> --- a/tests/TestSuite_vhost_virtio_user_interrupt.py
> +++ b/tests/TestSuite_vhost_virtio_user_interrupt.py
> @@ -89,11 +89,18 @@ class TestVirtioUserInterrupt(TestCase):
>          out = self.dut.build_dpdk_apps("./examples/l3fwd-power")
>          self.verify("Error" not in out, "compilation l3fwd-power error")
> 
> +    @property
> +    def check_2M_env(self):
> +        out = self.dut.send_expect("cat /proc/meminfo |grep
> Hugepagesize|awk '{print($2)}'", "# ")
> +        return True if out == '2048' else False
> +
>      def launch_l3fwd(self, path, packed=False):
>          self.core_interrupt = self.core_list_l3fwd[0]
>          example_para = "./examples/l3fwd-power/build/l3fwd-power "
>          vdev = "virtio_user0,path=%s,cq=1" % path if not packed else
> "virtio_user0,path=%s,cq=1,packed_vq=1" % path
>          eal_params =
> self.dut.create_eal_parameters(cores=self.core_list_l3fwd, prefix='l3fwd-
> pwd', no_pci=True, ports=[self.pci_info], vdevs=[vdev])
> +        if self.check_2M_env:
> +            eal_params += " --single-file-segments"
>          para = " --config='(0,0,%s)' --parse-ptype --interrupt-only" %
> self.core_interrupt
>          cmd_l3fwd = example_para + eal_params + " --log-level='user1,7' -- -p 1
> " + para
>          self.l3fwd.get_session_before(timeout=2)
> diff --git a/tests/TestSuite_vm2vm_virtio_pmd.py
> b/tests/TestSuite_vm2vm_virtio_pmd.py
> index 7fea5bf..c26a084 100644
> --- a/tests/TestSuite_vm2vm_virtio_pmd.py
> +++ b/tests/TestSuite_vm2vm_virtio_pmd.py
> @@ -112,6 +112,11 @@ class TestVM2VMVirtioPMD(TestCase):
>          self.vhost_user.send_expect("set fwd mac", "testpmd> ", 30)
>          self.vhost_user.send_expect("start", "testpmd> ", 30)
> 
> +    @property
> +    def check_2M_env(self):
> +        out = self.dut.send_expect("cat /proc/meminfo |grep
> Hugepagesize|awk '{print($2)}'", "# ")
> +        return True if out == '2048' else False
> +
>      def start_virtio_testpmd_with_vhost_net1(self, path_mode,
> extern_param):
>          """
>          launch the testpmd as virtio with vhost_net1 @@ -121,6 +126,8 @@
> class TestVM2VMVirtioPMD(TestCase):
>          testcmd = self.dut.target + "/app/testpmd "
>          vdev = "--vdev=net_virtio_user1,mac=00:01:02:03:04:05,path=./vhost-
> net1,queues=1,%s " % path_mode
>          eal_params = self.dut.create_eal_parameters(cores=virtio_mask,
> no_pci=True, prefix='virtio', ports=[self.pci_info])
> +        if self.check_2M_env:
> +            eal_params += " --single-file-segments"
>          para = " -- -i --nb-cores=1 --txd=1024 --rxd=1024 %s" % extern_param
>          command_line = testcmd + eal_params + vdev + para
>          self.virtio_user1.send_expect(command_line, 'testpmd> ', 30) @@ -
> 136,6 +143,8 @@ class TestVM2VMVirtioPMD(TestCase):
>          testcmd = self.dut.target + "/app/testpmd "
>          vdev = "--vdev=net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-
> net0,queues=1,%s " % path_mode
>          eal_params = self.dut.create_eal_parameters(cores=virtio_mask,
> no_pci=True, prefix='virtio0', ports=[self.pci_info])
> +        if self.check_2M_env:
> +            eal_params += " --single-file-segments "
>          para = " -- -i --nb-cores=1 --txd=1024 --rxd=1024 %s" % extern_param
>          command_line = testcmd + eal_params + vdev + para
>          self.virtio_user0.send_expect(command_line, 'testpmd> ', 30) diff --git
> a/tests/TestSuite_vm2vm_virtio_user.py
> b/tests/TestSuite_vm2vm_virtio_user.py
> index 343e2d2..e743e61 100644
> --- a/tests/TestSuite_vm2vm_virtio_user.py
> +++ b/tests/TestSuite_vm2vm_virtio_user.py
> @@ -125,12 +125,19 @@ class TestVM2VMVirtioUser(TestCase):
>          self.pmd_vhost.execute_cmd(self.command_line, timeout=30)
>          self.pmd_vhost.execute_cmd('set fwd %s' % fwd_mode)
> 
> +    @property
> +    def check_2M_env(self):
> +        out = self.dut.send_expect("cat /proc/meminfo |grep
> Hugepagesize|awk '{print($2)}'", "# ")
> +        return True if out == '2048' else False
> +
>      def start_virtio_testpmd_with_vhost_net1(self, path_mode,
> extern_params, ringsize):
>          """
>          launch the testpmd as virtio with vhost_net1
>          """
>          eal_params =
> self.dut.create_eal_parameters(cores=self.core_list_virtio1,
>                  no_pci=True, prefix=self.virtio_prefix, fixed_prefix=True)
> +        if self.check_2M_env:
> +            eal_params += " --single-file-segments "
>          vdev_params = '--
> vdev=net_virtio_user1,mac=00:01:02:03:04:05,path=./vhost-
> net1,queues=1,%s,queue_size=%d ' % (path_mode, ringsize)
>          command_line = self.dut.target + "/app/testpmd %s " + \
>              "--socket-mem %s %s -- -i --nb-cores=1 --txd=%d --rxd=%d %s"
> @@ -147,6 +154,8 @@ class TestVM2VMVirtioUser(TestCase):
>          """
>          eal_params =
> self.dut.create_eal_parameters(cores=self.core_list_virtio0,
>                  no_pci=True, prefix='virtio0')
> +        if self.check_2M_env:
> +            eal_params += " --single-file-segments "
>          vdev_params = '--
> vdev=net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-
> net0,queues=1,%s,queue_size=%d ' % (path_mode, ringsize)
>          command_line = self.dut.target + '/app/testpmd %s ' + \
>              '--socket-mem %s %s -- -i --nb-cores=1 --txd=%d --rxd=%d %s'
> --
> 2.25.1
Tu, Lijuan Aug. 21, 2020, 3:13 a.m. UTC | #2
> *. add eal parameter single-file-segments for 2M env test
> 
> Signed-off-by: Xiao Qimai <qimaix.xiao@intel.com>

Applied
diff mbox series

Patch

diff --git a/tests/TestSuite_loopback_multi_paths_port_restart.py b/tests/TestSuite_loopback_multi_paths_port_restart.py
index 3f44232..1e91af4 100644
--- a/tests/TestSuite_loopback_multi_paths_port_restart.py
+++ b/tests/TestSuite_loopback_multi_paths_port_restart.py
@@ -84,11 +84,18 @@  class TestLoopbackPortRestart(TestCase):
         self.vhost.send_expect(command_line_client, "testpmd> ", 120)
         self.vhost.send_expect("set fwd mac", "testpmd> ", 120)
 
+    @property
+    def check_2M_env(self):
+        out = self.dut.send_expect("cat /proc/meminfo |grep Hugepagesize|awk '{print($2)}'", "# ")
+        return True if out == '2048' else False
+
     def start_virtio_user_testpmd(self, pmd_arg):
         """
         start testpmd of vhost user
         """
         eal_param = self.dut.create_eal_parameters(cores=self.core_list_user, prefix='virtio', no_pci=True, vdevs=['net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-net,%s' % pmd_arg["version"]])
+        if self.check_2M_env:
+            eal_param += " --single-file-segments"
         command_line_user = self.dut.target + "/app/testpmd " + eal_param + " -- -i %s --rss-ip --nb-cores=1 --txd=1024 --rxd=1024" % pmd_arg["path"]
         self.virtio_user.send_expect(command_line_user, "testpmd> ", 120)
         self.virtio_user.send_expect("set fwd mac", "testpmd> ", 120)
diff --git a/tests/TestSuite_loopback_multi_queues.py b/tests/TestSuite_loopback_multi_queues.py
index 10abb72..8300dfc 100644
--- a/tests/TestSuite_loopback_multi_queues.py
+++ b/tests/TestSuite_loopback_multi_queues.py
@@ -93,11 +93,18 @@  class TestLoopbackMultiQueues(TestCase):
         self.vhost.send_expect(command_line_client, "testpmd> ", 120)
         self.vhost.send_expect("set fwd mac", "testpmd> ", 120)
 
+    @property
+    def check_2M_env(self):
+        out = self.dut.send_expect("cat /proc/meminfo |grep Hugepagesize|awk '{print($2)}'", "# ")
+        return True if out == '2048' else False
+
     def start_virtio_testpmd(self, args):
         """
         start testpmd on virtio
         """
         eal_param = self.dut.create_eal_parameters(cores=self.core_list_user, prefix='virtio', no_pci=True, vdevs=['net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-net,queues=%d,%s' % (self.queue_number, args["version"])])
+        if self.check_2M_env:
+            eal_param += " --single-file-segments"
         command_line_user = self.dut.target + "/app/testpmd " + eal_param + " -- -i %s --nb-cores=%d --rxq=%d --txq=%d --txd=1024 --rxd=1024" % (args["path"], self.nb_cores, self.queue_number, self.queue_number)
         self.virtio_user.send_expect(command_line_user, "testpmd> ", 120)
         self.virtio_user.send_expect("set fwd mac", "testpmd> ", 120)
diff --git a/tests/TestSuite_loopback_virtio_user_server_mode.py b/tests/TestSuite_loopback_virtio_user_server_mode.py
index 742aa09..d329d46 100644
--- a/tests/TestSuite_loopback_virtio_user_server_mode.py
+++ b/tests/TestSuite_loopback_virtio_user_server_mode.py
@@ -82,11 +82,18 @@  class TestLoopbackVirtioUserServerMode(TestCase):
         self.vhost.send_expect(command_line_client, "testpmd> ", 120)
         self.vhost.send_expect("set fwd mac", "testpmd> ", 120)
 
+    @property
+    def check_2M_env(self):
+        out = self.dut.send_expect("cat /proc/meminfo |grep Hugepagesize|awk '{print($2)}'", "# ")
+        return True if out == '2048' else False
+
     def lanuch_virtio_user_testpmd(self, args):
         """
         start testpmd of vhost user
         """
         eal_param = self.dut.create_eal_parameters(cores=self.core_list_user, prefix='virtio', no_pci=True, vdevs=['net_virtio_user0,mac=00:01:02:03:04:05,path=vhost-net,server=1,queues=1,%s' % args["version"]])
+        if self.check_2M_env:
+            eal_param += " --single-file-segments"
         command_line_user = self.dut.target + "/app/testpmd " + eal_param + " -- -i --rxq=1 --txq=1 --no-numa"
         self.virtio_user.send_expect(command_line_user, "testpmd> ", 120)
         self.virtio_user.send_expect("set fwd mac", "testpmd> ", 120)
@@ -102,6 +109,8 @@  class TestLoopbackVirtioUserServerMode(TestCase):
         start testpmd of vhost user
         """
         eal_param = self.dut.create_eal_parameters(cores=self.core_list_user, prefix='virtio', no_pci=True, vdevs=['net_virtio_user0,mac=00:01:02:03:04:05,path=vhost-net,server=1,queues=%d,%s' % (self.queue_number, mode)])
+        if self.check_2M_env:
+            eal_param += " --single-file-segments"
         command_line_user = self.dut.target + "/app/testpmd " + eal_param + " -- -i %s --nb-cores=%d --rxq=%d --txq=%d" % (extern_params, self.nb_cores, self.queue_number, self.queue_number)
         self.virtio_user.send_expect(command_line_user, "testpmd> ", 120)
         self.virtio_user.send_expect("set fwd mac", "testpmd> ", 120)
diff --git a/tests/TestSuite_pvp_virtio_user_multi_queues_port_restart.py b/tests/TestSuite_pvp_virtio_user_multi_queues_port_restart.py
index 0cd6fb2..c35f79d 100644
--- a/tests/TestSuite_pvp_virtio_user_multi_queues_port_restart.py
+++ b/tests/TestSuite_pvp_virtio_user_multi_queues_port_restart.py
@@ -99,6 +99,11 @@  class TestPVPVirtioUserMultiQueuesPortRestart(TestCase):
         self.vhost.send_expect("set fwd mac", "testpmd> ", 120)
         self.vhost.send_expect("start", "testpmd> ", 120)
 
+    @property
+    def check_2M_env(self):
+        out = self.dut.send_expect("cat /proc/meminfo |grep Hugepagesize|awk '{print($2)}'", "# ")
+        return True if out == '2048' else False
+
     def start_virtio_user_testpmd(self, vdevs, vector_flag=False):
         """
         start testpmd in vm depend on different path
@@ -106,6 +111,8 @@  class TestPVPVirtioUserMultiQueuesPortRestart(TestCase):
         testcmd = self.dut.target + "/app/testpmd "
         eal_params = self.dut.create_eal_parameters(cores=self.core_list[5:8], prefix='virtio', no_pci=True,
                                                     vdevs=[vdevs])
+        if self.check_2M_env:
+            eal_params += " --single-file-segments"
         if vector_flag:
             para = " -- -i --tx-offloads=0x0 --enable-hw-vlan-strip --rss-ip --nb-cores=2 --rxq=%s --txq=%s --rss-ip" % (
             self.queue_number, self.queue_number)
diff --git a/tests/TestSuite_vhost_1024_ethports.py b/tests/TestSuite_vhost_1024_ethports.py
index 6e02c83..b764936 100644
--- a/tests/TestSuite_vhost_1024_ethports.py
+++ b/tests/TestSuite_vhost_1024_ethports.py
@@ -71,10 +71,19 @@  class TestVhost1024Ethports(TestCase):
             "sed -i 's/CONFIG_RTE_MAX_ETHPORTS=1024$/CONFIG_RTE_MAX_ETHPORTS=32/' config/common_base", '#', 30)
         self.dut.build_install_dpdk(self.target)
 
+    @property
+    def check_2M_env(self):
+        out = self.dut.send_expect("cat /proc/meminfo |grep Hugepagesize|awk '{print($2)}'", "# ")
+        return True if out == '2048' else False
+
     def test_launch_vhost_with_1024_ethports(self):
         """
         Test function of launch vhost with 1024 ethports
         """
+        if self.check_2M_env:
+            hugepages = int(self.dut.get_total_huge_pages())
+            if hugepages< 20480:
+                self.dut.send_expect('echo 20480 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages', expected='# ', timeout=30)
         command_line_vdev = ''
         for ethport in range(self.max_ethport):
             command_line_vdev += '--vdev "eth_vhost%d,iface=vhost-net%d,queues=%d" ' %(ethport, ethport, self.queue)
diff --git a/tests/TestSuite_vhost_enqueue_interrupt.py b/tests/TestSuite_vhost_enqueue_interrupt.py
index 9d3f5bc..5520782 100644
--- a/tests/TestSuite_vhost_enqueue_interrupt.py
+++ b/tests/TestSuite_vhost_enqueue_interrupt.py
@@ -89,11 +89,18 @@  class TestVhostEnqueueInterrupt(TestCase):
         """
         vdev = "net_virtio_user0,mac=%s,path=./vhost-net,server=1,queues=%d" % (self.vmac, self.queues) if not packed else "net_virtio_user0,mac=%s,path=./vhost-net,server=1,queues=%d,packed_vq=1" % (self.vmac, self.queues)
         eal_params = self.dut.create_eal_parameters(cores=self.core_list_virtio, prefix='virtio', no_pci=True, ports=[self.pci_info], vdevs=[vdev])
+        if self.check_2M_env:
+            eal_params += " --single-file-segments"
         para = " -- -i --rxq=%d --txq=%d --rss-ip" % (self.queues, self.queues)
         command_line_client =  self.dut.target + "/app/testpmd " + eal_params + para
         self.virtio_user.send_expect(command_line_client, "testpmd> ", 120)
         self.virtio_user.send_expect("set fwd txonly", "testpmd> ", 20)
 
+    @property
+    def check_2M_env(self):
+        out = self.dut.send_expect("cat /proc/meminfo |grep Hugepagesize|awk '{print($2)}'", "# ")
+        return True if out == '2048' else False
+
     def lanuch_l3fwd_power(self):
         """
         launch l3fwd-power with a virtual vhost device
diff --git a/tests/TestSuite_vhost_event_idx_interrupt.py b/tests/TestSuite_vhost_event_idx_interrupt.py
index 4bb40c7..e82bd46 100644
--- a/tests/TestSuite_vhost_event_idx_interrupt.py
+++ b/tests/TestSuite_vhost_event_idx_interrupt.py
@@ -82,6 +82,11 @@  class TestVhostEventIdxInterrupt(TestCase):
         out = self.dut.send_expect("make -C examples/l3fwd-power", "#")
         self.verify("Error" not in out, "compilation l3fwd-power error")
 
+    @property
+    def check_2M_env(self):
+        out = self.dut.send_expect("cat /proc/meminfo |grep Hugepagesize|awk '{print($2)}'", "# ")
+        return True if out == '2048' else False
+
     def lanuch_l3fwd_power(self):
         """
         launch l3fwd-power with a virtual vhost device
@@ -109,6 +114,8 @@  class TestVhostEventIdxInterrupt(TestCase):
         example_para = "./examples/l3fwd-power/build/l3fwd-power "
         para = " --log-level=9 %s -- -p %s --parse-ptype 1 --config '%s' --interrupt-only" % (vdev_info, port_info, config_info)
         eal_params = self.dut.create_eal_parameters(cores=self.core_list_l3fwd, no_pci=True)
+        if self.check_2M_env:
+            eal_params += " --single-file-segments "
         command_line_client = example_para + eal_params + para
         self.vhost.get_session_before(timeout=2)
         self.vhost.send_expect(command_line_client, "POWER", 40)
diff --git a/tests/TestSuite_vhost_virtio_user_interrupt.py b/tests/TestSuite_vhost_virtio_user_interrupt.py
index 2f430d8..e882c3a 100644
--- a/tests/TestSuite_vhost_virtio_user_interrupt.py
+++ b/tests/TestSuite_vhost_virtio_user_interrupt.py
@@ -89,11 +89,18 @@  class TestVirtioUserInterrupt(TestCase):
         out = self.dut.build_dpdk_apps("./examples/l3fwd-power")
         self.verify("Error" not in out, "compilation l3fwd-power error")
 
+    @property
+    def check_2M_env(self):
+        out = self.dut.send_expect("cat /proc/meminfo |grep Hugepagesize|awk '{print($2)}'", "# ")
+        return True if out == '2048' else False
+
     def launch_l3fwd(self, path, packed=False):
         self.core_interrupt = self.core_list_l3fwd[0]
         example_para = "./examples/l3fwd-power/build/l3fwd-power "
         vdev = "virtio_user0,path=%s,cq=1" % path if not packed else "virtio_user0,path=%s,cq=1,packed_vq=1" % path
         eal_params = self.dut.create_eal_parameters(cores=self.core_list_l3fwd, prefix='l3fwd-pwd', no_pci=True, ports=[self.pci_info], vdevs=[vdev])
+        if self.check_2M_env:
+            eal_params += " --single-file-segments"
         para = " --config='(0,0,%s)' --parse-ptype --interrupt-only" % self.core_interrupt
         cmd_l3fwd = example_para + eal_params + " --log-level='user1,7' -- -p 1 " + para
         self.l3fwd.get_session_before(timeout=2)
diff --git a/tests/TestSuite_vm2vm_virtio_pmd.py b/tests/TestSuite_vm2vm_virtio_pmd.py
index 7fea5bf..c26a084 100644
--- a/tests/TestSuite_vm2vm_virtio_pmd.py
+++ b/tests/TestSuite_vm2vm_virtio_pmd.py
@@ -112,6 +112,11 @@  class TestVM2VMVirtioPMD(TestCase):
         self.vhost_user.send_expect("set fwd mac", "testpmd> ", 30)
         self.vhost_user.send_expect("start", "testpmd> ", 30)
 
+    @property
+    def check_2M_env(self):
+        out = self.dut.send_expect("cat /proc/meminfo |grep Hugepagesize|awk '{print($2)}'", "# ")
+        return True if out == '2048' else False
+
     def start_virtio_testpmd_with_vhost_net1(self, path_mode, extern_param):
         """
         launch the testpmd as virtio with vhost_net1
@@ -121,6 +126,8 @@  class TestVM2VMVirtioPMD(TestCase):
         testcmd = self.dut.target + "/app/testpmd "
         vdev = "--vdev=net_virtio_user1,mac=00:01:02:03:04:05,path=./vhost-net1,queues=1,%s " % path_mode
         eal_params = self.dut.create_eal_parameters(cores=virtio_mask, no_pci=True, prefix='virtio', ports=[self.pci_info])
+        if self.check_2M_env:
+            eal_params += " --single-file-segments"
         para = " -- -i --nb-cores=1 --txd=1024 --rxd=1024 %s" % extern_param
         command_line = testcmd + eal_params + vdev + para
         self.virtio_user1.send_expect(command_line, 'testpmd> ', 30)
@@ -136,6 +143,8 @@  class TestVM2VMVirtioPMD(TestCase):
         testcmd = self.dut.target + "/app/testpmd "
         vdev = "--vdev=net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-net0,queues=1,%s " % path_mode
         eal_params = self.dut.create_eal_parameters(cores=virtio_mask, no_pci=True, prefix='virtio0', ports=[self.pci_info])
+        if self.check_2M_env:
+            eal_params += " --single-file-segments "
         para = " -- -i --nb-cores=1 --txd=1024 --rxd=1024 %s" % extern_param
         command_line = testcmd + eal_params + vdev + para
         self.virtio_user0.send_expect(command_line, 'testpmd> ', 30)
diff --git a/tests/TestSuite_vm2vm_virtio_user.py b/tests/TestSuite_vm2vm_virtio_user.py
index 343e2d2..e743e61 100644
--- a/tests/TestSuite_vm2vm_virtio_user.py
+++ b/tests/TestSuite_vm2vm_virtio_user.py
@@ -125,12 +125,19 @@  class TestVM2VMVirtioUser(TestCase):
         self.pmd_vhost.execute_cmd(self.command_line, timeout=30)
         self.pmd_vhost.execute_cmd('set fwd %s' % fwd_mode)
 
+    @property
+    def check_2M_env(self):
+        out = self.dut.send_expect("cat /proc/meminfo |grep Hugepagesize|awk '{print($2)}'", "# ")
+        return True if out == '2048' else False
+
     def start_virtio_testpmd_with_vhost_net1(self, path_mode, extern_params, ringsize):
         """
         launch the testpmd as virtio with vhost_net1
         """
         eal_params = self.dut.create_eal_parameters(cores=self.core_list_virtio1,
                 no_pci=True, prefix=self.virtio_prefix, fixed_prefix=True)
+        if self.check_2M_env:
+            eal_params += " --single-file-segments "
         vdev_params = '--vdev=net_virtio_user1,mac=00:01:02:03:04:05,path=./vhost-net1,queues=1,%s,queue_size=%d ' % (path_mode, ringsize)
         command_line = self.dut.target + "/app/testpmd %s " + \
             "--socket-mem %s %s -- -i --nb-cores=1 --txd=%d --rxd=%d %s"
@@ -147,6 +154,8 @@  class TestVM2VMVirtioUser(TestCase):
         """
         eal_params = self.dut.create_eal_parameters(cores=self.core_list_virtio0,
                 no_pci=True, prefix='virtio0')
+        if self.check_2M_env:
+            eal_params += " --single-file-segments "
         vdev_params = '--vdev=net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-net0,queues=1,%s,queue_size=%d ' % (path_mode, ringsize)
         command_line = self.dut.target + '/app/testpmd %s ' + \
             '--socket-mem %s %s -- -i --nb-cores=1 --txd=%d --rxd=%d %s'