From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (xvm-189-124.dc0.ghst.net [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3D849A0524; Thu, 7 Jan 2021 16:37:42 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BDFC5140FEA; Thu, 7 Jan 2021 16:37:41 +0100 (CET) Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by mails.dpdk.org (Postfix) with ESMTP id 7AE1D140FE4 for ; Thu, 7 Jan 2021 16:37:40 +0100 (CET) Received: by mail-pl1-f169.google.com with SMTP id g3so3740089plp.2 for ; Thu, 07 Jan 2021 07:37:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=O9fc72ABYy1OxZzWpAqNEyHzGFKcpkJUcBM2mpi0a08=; b=1C5/HsYUQb8veN0IR9NKTiW+Mss91hrs4mO8p8TA/CoVRxtORO/ZucgwCy0MIYPjJ/ I9BFQm/PXlxowgOHnZJywn3UDuErje/HVOX6Nj5Wek2VlwLJ5nhSp1vV85WqN1bjI/pc IzYGdwbMKcXKRffA++I9FDKLS6E08SWO4R3lioWDcVcPHh/Z2cV2DjHVEaW9aQoZvOFa 1zNpt8NCcTwlCUi6JYA8WlPtStj6mFz0JNnahsP+pOEumUxWowsbx6o7mHnJo9puzMWS +FYYYbkKZLRyICCwCqPNw0ouT5Lc/T4roMEjTJANLniFQS3DnDffIiiEoegFsNVmBHWO L1ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=O9fc72ABYy1OxZzWpAqNEyHzGFKcpkJUcBM2mpi0a08=; b=ngrOHV+ihvtYeT/Bddrur2o58Rg+FmGoWYijFZDpHVQWpr1XPuE3IdRm3IsGYPdbRM 4b/XZXVJaDPYRzJCwVg9AhBDYbYKxfffB7r5XyUiTKb2EA2dTJB6BJOCJ0KBFDPDwn+g xIjlCCwN5hEnGAUsaIH1d0LLCwIsHnAhIrMjEB/HWfXYvRuivewnTWAxiMmq0De+Arye Ta8cLgfi1nMgC1Gmb/jCBI+fl4mrb2CwR9HS4qSRTYhZwXuJ6lcDRIaS9GjXItCATA8t G2JRM/JfPgdbS9QntfqVVNQdji71dMJLTqVEVZcU8pH43ZKhWmHPCitl6dcvy7YxatiU W8FA== X-Gm-Message-State: AOAM533GRN5+vXiXVw5ug+g1iD4gmSf0/msGiGjJQ67ehRi7V1TBLvK4 OqEk9OivtSeizn4rh+rJO5y0+w== X-Google-Smtp-Source: ABdhPJz48NL39kO63+p/CdmH96C0iF5PZWSkFQjGgfkPGa2D5NcUJaaqqfy03gnioH1DMaS4M9P+Rw== X-Received: by 2002:a17:90a:46c2:: with SMTP id x2mr9929766pjg.15.1610033859651; Thu, 07 Jan 2021 07:37:39 -0800 (PST) Received: from hermes.local (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id y5sm6612925pfp.45.2021.01.07.07.37.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 07:37:39 -0800 (PST) Date: Thu, 7 Jan 2021 07:37:25 -0800 From: Stephen Hemminger To: Sarosh Arif Cc: sthemmin@microsoft.com, dev Message-ID: <20210107073725.426f12d4@hermes.local> In-Reply-To: References: <20201130124533.23341-1-sarosh.arif@emumba.com> <20201217111616.24057-1-sarosh.arif@emumba.com> <20201217101552.670926d0@hermes.local> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [v2 PATCH] usertools: show an error message if unable to reserve requested hugepages 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 Thu, 7 Jan 2021 13:06:35 +0500 Sarosh Arif wrote: > On Thu, Dec 17, 2020 at 11:19 PM Stephen Hemminger > wrote: > > > > On Thu, 17 Dec 2020 16:16:16 +0500 > > Sarosh Arif 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.