* [dpdk-dev] [PATCH] Nonnumeric input check for Setting hugepages
@ 2020-04-06 8:50 Muhammad Bilal
2020-11-26 17:52 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
0 siblings, 1 reply; 2+ messages in thread
From: Muhammad Bilal @ 2020-04-06 8:50 UTC (permalink / raw)
To: john.mcnamara; +Cc: dev, Muhammad Bilal, stable
Bugzilla ID: 432
Cc: dev@dpdk.org
Cc: stable@dpdk.org
Cc: john.mcnamara@intel.com
Signed-off-by: Muhammad Bilal <m.bilal@emumba.com>
---
usertools/dpdk-setup.sh | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/usertools/dpdk-setup.sh b/usertools/dpdk-setup.sh
index e5bbe9fee..b0535be34 100755
--- a/usertools/dpdk-setup.sh
+++ b/usertools/dpdk-setup.sh
@@ -321,13 +321,19 @@ set_non_numa_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
+ numeric="^[[:digit:]]+$"
+ PG_PATH="/sys/kernel/mm/hugepages/hugepages-${HUGEPGSZ}"
+ if [[ $Pages =~ $numeric ]]; then
+ echo "echo $Pages > $PG_PATH/nr_hugepages" > .echo_tmp
+ echo "Reserving hugepages"
+ sudo sh .echo_tmp
+ rm -f .echo_tmp
- create_mnt_huge
+ create_mnt_huge
+ else
+ echo "Please enter a numeric value"
+ fi
}
#
@@ -343,10 +349,17 @@ set_numa_pages()
echo " enter '64' to reserve 64 * 2MB pages on each node"
echo > .echo_tmp
+ numeric="^[[:digit:]]+$"
for d in /sys/devices/system/node/node? ; do
node=$(basename $d)
echo -n "Number of pages for $node: "
read Pages
+ while [[ ! "$Pages" =~ $numeric ]]; do
+ echo "Please enter a numeric value"
+ echo -n "Number of pages for $node: "
+ read Pages
+ done
+
echo "echo $Pages > $d/hugepages/hugepages-${HUGEPGSZ}/nr_hugepages" >> .echo_tmp
done
echo "Reserving hugepages"
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH] Nonnumeric input check for Setting hugepages
2020-04-06 8:50 [dpdk-dev] [PATCH] Nonnumeric input check for Setting hugepages Muhammad Bilal
@ 2020-11-26 17:52 ` Thomas Monjalon
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2020-11-26 17:52 UTC (permalink / raw)
To: Muhammad Bilal; +Cc: john.mcnamara, dev, stable
06/04/2020 10:50, Muhammad Bilal:
> Bugzilla ID: 432
> Cc: dev@dpdk.org
> Cc: stable@dpdk.org
> Cc: john.mcnamara@intel.com
> Signed-off-by: Muhammad Bilal <m.bilal@emumba.com>
> ---
> usertools/dpdk-setup.sh | 23 ++++++++++++++++++-----
This script is now replaced with usertools/dpdk-hugepages.py
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-26 17:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-06 8:50 [dpdk-dev] [PATCH] Nonnumeric input check for Setting hugepages Muhammad Bilal
2020-11-26 17:52 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).