From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-f68.google.com (mail-it0-f68.google.com [209.85.214.68]) by dpdk.org (Postfix) with ESMTP id 6246EF988 for ; Fri, 20 Apr 2018 15:12:05 +0200 (CEST) Received: by mail-it0-f68.google.com with SMTP id 85-v6so2418674iti.4 for ; Fri, 20 Apr 2018 06:12:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qwilt-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=XkwugWneC7pk8Tw38I7b2cLF2s/cvkn2DXCeuAbegPQ=; b=iqqNfPYLWCK0a8PyuOGvBgbMo1PJZvVVgL3VePP9VSSi0lampLdGAqGrWSz9oCE/t8 5RU18tfN8VJleOIXhMP5GCipap23OZiAZtD78e13oBR+ayXp5U2vR4Pl/TimndcziZ7h 5gYllgBLdhNrzlCwPFOwcs4meAVMff4bmw3ZlGmh40ZUx/k10G55IQbo4wkXP4PZ0dxV vzK03mYCVAAkIUVGdd96yyFVm3DtTmVhWzipoztq9H1MKymcuTa0nnPZq0ojHp++Wwy5 CdnhEFRGH+tNRalcteWRCTp9MAFI/TtV2woJrSme51q1gL56UWwoN0NI5ykO96L2JyaF lRXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=XkwugWneC7pk8Tw38I7b2cLF2s/cvkn2DXCeuAbegPQ=; b=F1L4cbtMSXolPp+KU3/IkfOc6m6sSWvwKcTjZWJ+AMCXP/2fNNsxwvigwP/Tm4e1fN T9BJHOyKWaXpo38ORSLvYgEwF2hhfG1KZ+iC0BpG3awGXsVjZThY+wX5G1jdcd1WK8p1 vFbi00hXBPYnMj0Jg9EdDrUIbUSqwXsRTqdFEfW1RHadOATeu7m/2rlU1is7Zyf3R6S+ q0i6DBHAzZp+W1sDAg9aIZB/zdOB/uQmdxxY/6Ao7oH5gMip4v+iQ4WL4cFwngcBmBea DnBmIEMu6R+MfxFYevtUatFbl4BuqCcQVh8u5cDuMVcDJI3TOPV1Rsg3NRHLxBlOZLVZ RlOg== X-Gm-Message-State: ALQs6tCs2IirhLDPND8ccQkHT3NjRGBiC/wyKmXQNrew0btNUOrZwfEm 6L1xgGMLIqMdrPfqMGPqyJd3m/00m65vbTL2eGgg5Q== X-Google-Smtp-Source: AIpwx488/7PTc6ENerIiKOg/jwTRBTqxHWcco5mXdH3f8B5SBHwwYG/byiaqUt3whMX393GohmEtK8bC6yblvqV22P8= X-Received: by 2002:a24:94e:: with SMTP id 75-v6mr2974404itm.37.1524229924712; Fri, 20 Apr 2018 06:12:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.142.145 with HTTP; Fri, 20 Apr 2018 06:12:04 -0700 (PDT) In-Reply-To: References: <1524117669-25729-1-git-send-email-arnon@qwilt.com> <1524117669-25729-8-git-send-email-arnon@qwilt.com> From: Arnon Warshavsky Date: Fri, 20 Apr 2018 16:12:04 +0300 Message-ID: To: Kevin Traynor Cc: Thomas Monjalon , "Burakov, Anatoly" , "Lu, Wenzhuo" , "Doherty, Declan" , jerin.jacob@caviumnetworks.com, Bruce Richardson , "Yigit, Ferruh" , dev@dpdk.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v4 07/11] eal: replace rte_panic instances in hugepage_info X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Apr 2018 13:12:05 -0000 Thanks Kevin Will address that On Thu, Apr 19, 2018 at 5:36 PM, Kevin Traynor wrote: > On 04/19/2018 07:01 AM, Arnon Warshavsky wrote: > > replace panic calls with log and retrun value. > > > > v4 > > static size calculation function changed to return success/fail code > > in addition to filling the size result. > > > > fyi - this patch doesn't apply on master branch without fuzz > > > Signed-off-by: Arnon Warshavsky > > --- > > lib/librte_eal/linuxapp/eal/eal_hugepage_info.c | 32 > ++++++++++++++++--------- > > 1 file changed, 21 insertions(+), 11 deletions(-) > > > > diff --git a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c > b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c > > index fb4b667..debae32 100644 > > --- a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c > > +++ b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c > > @@ -145,8 +145,8 @@ > > return num_pages; > > } > > > > -static uint64_t > > -get_default_hp_size(void) > > +static int > > +get_default_hp_size(uint64_t *result) > > { > > const char proc_meminfo[] = "/proc/meminfo"; > > const char str_hugepagesz[] = "Hugepagesize:"; > > @@ -155,8 +155,11 @@ > > unsigned long long size = 0; > > > > FILE *fd = fopen(proc_meminfo, "r"); > > - if (fd == NULL) > > - rte_panic("Cannot open %s\n", proc_meminfo); > > + if (fd == NULL) { > > + RTE_LOG(CRIT, EAL, "%s(): Cannot open %s\n", > > + __func__, proc_meminfo); > > + return -1; > > + } > > while(fgets(buffer, sizeof(buffer), fd)){ > > if (strncmp(buffer, str_hugepagesz, hugepagesz_len) == 0){ > > size = rte_str_to_size(&buffer[hugepagesz_len]); > > @@ -164,9 +167,13 @@ > > } > > } > > fclose(fd); > > - if (size == 0) > > - rte_panic("Cannot get default hugepage size from %s\n", > proc_meminfo); > > - return size; > > + if (size == 0) { > > + RTE_LOG(CRIT, EAL, "%s(): Cannot get default hugepage size > from %s\n", > > + __func__, proc_meminfo); > > + return -1; > > + } > > + *result = size; > > + return 0; > > } > > > > static const char * > > @@ -191,11 +198,14 @@ > > char *retval = NULL; > > > > FILE *fd = fopen(proc_mounts, "r"); > > - if (fd == NULL) > > - rte_panic("Cannot open %s\n", proc_mounts); > > + if (fd == NULL) { > > + RTE_LOG(CRIT, EAL, "%s(): Cannot open %s\n", > > + __func__, proc_mounts); > > + return NULL; > > + } > > > > - if (default_size == 0) > > - default_size = get_default_hp_size(); > > + if ((default_size == 0) && (get_default_hp_size(&default_size) != > 0)) > > + return NULL; > > > > while (fgets(buf, sizeof(buf), fd)){ > > if (rte_strsplit(buf, sizeof(buf), splitstr, > _FIELDNAME_MAX, > > > > -- *Arnon Warshavsky* *Qwilt | work: +972-72-2221634 | mobile: +972-50-8583058 | arnon@qwilt.com *