From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 904E1A09E4; Tue, 23 Mar 2021 12:30:47 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 299C04069E; Tue, 23 Mar 2021 12:30:47 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id EEFE640689 for ; Tue, 23 Mar 2021 12:30:44 +0100 (CET) IronPort-SDR: d/8ThqVZ/yFQD6ruVvMl6CzUL+VkQWPju0fb8MECIjk0G7PjzqZN++hWFWbrop59EuPj0GDFWW aplidSbCEz2A== X-IronPort-AV: E=McAfee;i="6000,8403,9931"; a="169791384" X-IronPort-AV: E=Sophos;i="5.81,271,1610438400"; d="scan'208";a="169791384" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2021 04:30:43 -0700 IronPort-SDR: +3iJVaCuHkMf25b5k/kN/u6zMzWDC6mnxWK/ocMOVbYOWQtuT+9YIi7twZnF0wfF9l7py2n8r/ YupTagzp3W/g== X-IronPort-AV: E=Sophos;i="5.81,271,1610438400"; d="scan'208";a="374211211" Received: from aburakov-mobl.ger.corp.intel.com (HELO [10.213.246.243]) ([10.213.246.243]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2021 04:30:41 -0700 To: Thomas Monjalon , dev@dpdk.org Cc: sarosh.arif@emumba.com, Stephen Hemminger References: <20210211220544.55439-1-thomas@monjalon.net> <20210321090903.612998-1-thomas@monjalon.net> From: "Burakov, Anatoly" Message-ID: <6593f04c-acb6-9671-dc86-29d52ab65d55@intel.com> Date: Tue, 23 Mar 2021 11:30:38 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <20210321090903.612998-1-thomas@monjalon.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2] usertools: check 0-division with hugepage size X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" On 21-Mar-21 9:09 AM, Thomas Monjalon wrote: > The default page size can be None, and the page size from user request > can be 0 kB if lower than 1024. In these cases, a division will fail. > In order to avoid a Python exception, the page size is checked > and an error message "Invalid page size" is printed. > > A similar error message is printed in set_hugepages() > if the size is not supported, except at this stage the message can be > completed with "Valid page sizes". > Unfortunately the first check is too early to print such information. > > A third error message can be printed in a different place (get_memsize) > in case of a format issue, e.g. a negative size. > The function get_memsize() is also used for total requested size, > so the error message "not a valid page size" was potentially wrong. > This message is replaced with the more general "is not a valid size". > > Signed-off-by: Thomas Monjalon > Acked-by: Stephen Hemminger > --- > v2: use simple "if not" construct for both None and 0 > --- Acked-by: Anatoly Burakov -- Thanks, Anatoly