DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Sarosh Arif <sarosh.arif@emumba.com>
Cc: sthemmin@microsoft.com, dev <dev@dpdk.org>
Subject: Re: [dpdk-dev] [v2 PATCH] usertools: show an error message if unable to reserve requested hugepages
Date: Thu, 7 Jan 2021 07:37:25 -0800	[thread overview]
Message-ID: <20210107073725.426f12d4@hermes.local> (raw)
In-Reply-To: <CABoZmYPgCrT_ZL-eYM7nGC4U=t68dHAyqpCKToMdR2qf9Z3+Mw@mail.gmail.com>

On Thu, 7 Jan 2021 13:06:35 +0500
Sarosh Arif <sarosh.arif@emumba.com> wrote:

> On Thu, Dec 17, 2020 at 11:19 PM Stephen Hemminger
> <stephen@networkplumber.org> wrote:
> >
> > On Thu, 17 Dec 2020 16:16:16 +0500
> > Sarosh Arif <sarosh.arif@emumba.com> wrote:
> >  
> > > +    if get_hugepages(path) != pages:
> > > +        print("Unable to reserve required pages. The pages reserved are:")
> > > +        global SHOW_HUGEPAGES
> > > +        SHOW_HUGEPAGES = True  
> >
> >
> > Please don't add global's to this script.
> >
> > The script is close to being clean according to pylint, and globals
> > are considered bad style and shouldn't be used.
> >
> > I would just exit if huge pages could not be setup.  
> 
> How about if we just print a warning message such as "Unable to
> reserve required pages" before exiting, in case the pages are not
> reserved due to lack of space in RAM? Then leave it upon the user to
> query how many pages are actually reserved.
> >
> > The script should leave it up to the user to do another query about
> > status if they care about what the result is.  

Just call sys.exit with a message that is all that is needed.

Or maybe trapping other write errors to sysfs here. Probably the
kernel has already tried to report the error, but the try/except code
is not seeing it.

  reply	other threads:[~2021-01-07 15:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-30 12:45 [dpdk-dev] [PATCH] " Sarosh Arif
2020-11-30 16:43 ` Stephen Hemminger
2020-12-17 11:16 ` [dpdk-dev] [v2 PATCH] " Sarosh Arif
2020-12-17 18:15   ` Stephen Hemminger
2021-01-07  8:06     ` Sarosh Arif
2021-01-07 15:37       ` Stephen Hemminger [this message]
2021-01-08  9:06 ` [dpdk-dev] [v3 " Sarosh Arif
2021-02-05 18:24   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210107073725.426f12d4@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=sarosh.arif@emumba.com \
    --cc=sthemmin@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).