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 06EADA0577 for ; Mon, 6 Apr 2020 10:50:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C1D902B96; Mon, 6 Apr 2020 10:50:51 +0200 (CEST) Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) by dpdk.org (Postfix) with ESMTP id B07461BED8 for ; Mon, 6 Apr 2020 10:50:50 +0200 (CEST) Received: by mail-lj1-f196.google.com with SMTP id k21so13799987ljh.2 for ; Mon, 06 Apr 2020 01:50:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emumba-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=OFZdy+fPDbkkk3CIkbBzv695167bz7xjg6hqQCGIOV8=; b=ABSrATan4ikhw6dLDKiF8jRa3jCIRqdUWq6awWw2VHeRMYQcU+NBIqp2ShPBo0KNmm BYkJmdEOPrpRRTNCku1yz89x9YlBrFzCwLGfeGveFDrzdkoMGZ8fwDgdOI73UVWJE3Q4 PWiPk1ZNadm3VO8g1d30X9eweHlGfAhu6khj0hZUI+Ompz/f8dUXoEN183v1DvVsM12z O2YLOpmhFW6Dpxta52xgyjmf6a4HkyoDHxX3DfrLy6WSylwzVhIsaziCBHeVDMJCs6XE ExIBkehp/lLxfb6saq1uUz1E2oDYwMYHa+L43sVweJgEue36GUqbet6SvOMn6etyyDz/ SmXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=OFZdy+fPDbkkk3CIkbBzv695167bz7xjg6hqQCGIOV8=; b=fhTJ8APGszvScPkyvuT1qJpE5JPWdHfqldaoa8j2ckdLHHwRkej0IKzMltbmjRiT/G Wx34Ta1Rm1LmEz+23Mk9WeSgYTKhN8gDMFJ+uIWnw05P33CDBTG+Si/e7es2kotmVHYt QD5tNk9bzwK6KlzcqQW0ZHUhODSNgncxAiB4gUk/Ecqn2jR68JRxFrPvhxiF2kjNdQst gM1JCOc26Q3bBoko1ID/rcrStAAB0OV4wodTDCtVgW4J0NylddHaL88/+jpYB4V0/xgt BJ0W6lY+1P/oxRI76lAo6cI+NtFTxRAfnOeQqLSLazCRTWFT5Ct0PutTcdfGlSnQ251g KtTA== X-Gm-Message-State: AGi0PuZr586ArqtIupk3iLJRoQ2j6MNg9k0IoKzN0iAaOB1KdUZ5YPg/ +kN24hvLIYHSqP18k0CEZ1Q5NQ== X-Google-Smtp-Source: APiQypIJX0LuUXBp/TLpJjgpP2YJA4hZZBcHnkP9FPqcb4806h5NKdIHfvym2+Ci22yd3kui0vzUDQ== X-Received: by 2002:a2e:914b:: with SMTP id q11mr11384130ljg.291.1586163050040; Mon, 06 Apr 2020 01:50:50 -0700 (PDT) Received: from localhost.localdomain ([103.255.6.82]) by smtp.gmail.com with ESMTPSA id m13sm255450lfk.12.2020.04.06.01.50.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Apr 2020 01:50:49 -0700 (PDT) From: Muhammad Bilal To: john.mcnamara@intel.com Cc: dev@dpdk.org, Muhammad Bilal , stable@dpdk.org Date: Mon, 6 Apr 2020 13:50:18 +0500 Message-Id: <20200406085018.25957-1-m.bilal@emumba.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-stable] [PATCH] Nonnumeric input check for Setting hugepages X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Bugzilla ID: 432 Cc: dev@dpdk.org Cc: stable@dpdk.org Cc: john.mcnamara@intel.com Signed-off-by: Muhammad Bilal --- 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