From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io0-f195.google.com (mail-io0-f195.google.com [209.85.223.195]) by dpdk.org (Postfix) with ESMTP id F21228DA1 for ; Mon, 16 Apr 2018 16:45:52 +0200 (CEST) Received: by mail-io0-f195.google.com with SMTP id d5so18352353iob.9 for ; Mon, 16 Apr 2018 07:45:52 -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=yEe9foYfzuAXotYqU84S5NO9XLq+otRz1ee2SYHdNLY=; b=TZd9cJN4vd7sfef5u3G1YV/ECuAY1K6h9cEIqnOGyIsWYQOnAw/Lc6m36J74YZTrbc Fpnu7zAIYNP8bhxJDdn5o5rVdCRIkxxNkEUzMRMhu58O2aBBjNWoJVxMLl5pcxtMgQCE HwyREGi596JTyBzWJKTlEiO/hACN0VOutX43MSRa5K9TAMfcrIKwPXyk7qzsufDbfIYv EGpbOsE/fW+07cR7Cpgaf9WGcXxdVDFelLFM+9UywW484DdjdJZmtMXX1EvHcGbLenid WyjedX3rp8UcUrwDba3yzDkcNwK0QaFHPObhaKQ6BormuNtZim9HtxASxebUeO4y2fM8 7+Bg== 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=yEe9foYfzuAXotYqU84S5NO9XLq+otRz1ee2SYHdNLY=; b=jxW4FzM7TT9AyEWlQlGnMxbSnAFFpuz8IPv0vHCsCAaQx3pPzt0jdcTPlyInBTU0JM 7z8j5VF/6/0k1xd+4jotKv7S8RmcnMd9A9LY7B9zIUPv5sGV987ybKEATRXI5u+YTs7v CVebWJc26ZB8CO6Tx4sKJ5D3LNNmSGYMOT70B7/9r5RI8FA+huuWf63sKUCyjTAlZwHS 3QgO+Vk9gBO5nrbGrJ2Ksb46LnfWfpB7LVHfOzP6LZKtFqHj08u4hXsjnAXBWVlQ3JCP zRfMxuTDfG5Qkxv34Oo8+LX53hmSlhhjzSbFh51R1mjmMDo6Z+yk8gGH8LX8/xyaPBRH o3kg== X-Gm-Message-State: ALQs6tB2aqFywSf805ZGRz8GIBYj4cJLtZIqwChtaePxoc3/dKIjJf9G ALhj+AcgWO7hDEU62m8fRd8VvMx0Ix9LdVrPlQIAqA== X-Google-Smtp-Source: AIpwx49wJcbiwyEc8r7c6YIVDtVuEq+AJWrNoous8GBAMOHwaBGrvutA802G85B2ia/HcrdiFN3lJSwH95KC2cwt6fE= X-Received: by 10.107.95.23 with SMTP id t23mr25483542iob.242.1523889952223; Mon, 16 Apr 2018 07:45:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.142.145 with HTTP; Mon, 16 Apr 2018 07:45:51 -0700 (PDT) In-Reply-To: References: <1523644244-17511-1-git-send-email-arnon@qwilt.com> <1523644244-17511-9-git-send-email-arnon@qwilt.com> From: Arnon Warshavsky Date: Mon, 16 Apr 2018 17:45:51 +0300 Message-ID: To: "Burakov, Anatoly" Cc: Thomas Monjalon , wenzhuo.lu@intel.com, declan.doherty@intel.com, jerin.jacob@caviumnetworks.com, Bruce Richardson , ferruh.yigit@intel.com, dev@dpdk.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v3 08/13] 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: Mon, 16 Apr 2018 14:45:53 -0000 Thanks Anatoly Will do On Mon, Apr 16, 2018 at 2:30 PM, Burakov, Anatoly wrote: > On 13-Apr-18 7:30 PM, Arnon Warshavsky wrote: > >> replace panic calls with log and retrun value. >> >> Signed-off-by: Arnon Warshavsky >> --- >> lib/librte_eal/linuxapp/eal/eal_hugepage_info.c | 21 >> +++++++++++++++------ >> 1 file changed, 15 insertions(+), 6 deletions(-) >> >> diff --git a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c >> b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c >> index 8bbf771..43af5b5 100644 >> --- a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c >> +++ b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c >> @@ -80,8 +80,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 0; >> + } >> while(fgets(buffer, sizeof(buffer), fd)){ >> if (strncmp(buffer, str_hugepagesz, hugepagesz_len) == 0){ >> size = rte_str_to_size(&buffer[hugepagesz_len]); >> @@ -89,8 +92,11 @@ >> } >> } >> fclose(fd); >> - if (size == 0) >> - rte_panic("Cannot get default hugepage size from %s\n", >> proc_meminfo); >> + if (size == 0) { >> + RTE_LOG(CRIT, EAL, "%s(): Cannot get default hugepage >> size from %s\n", >> + __func__, proc_meminfo); >> + return 0; >> + } >> return size; >> > > If returning default hugepage size of 0 is now a possibility, the calling > code needs to be able to handle that. Perhaps rewrite it as returning int, > and accepting pointer to pagesz? e.g. > > static int get_default_hp_size(uint64_t *page_sz) > > and fix the code below to handle error in reading default page size? > > } >> @@ -116,8 +122,11 @@ >> 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(); >> >> > -- > Thanks, > Anatoly > -- *Arnon Warshavsky* *Qwilt | work: +972-72-2221634 | mobile: +972-50-8583058 | arnon@qwilt.com *