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 DC318A0507; Thu, 31 Mar 2022 16:44:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 82BE4410FA; Thu, 31 Mar 2022 16:44:40 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 24C554014F for ; Thu, 31 Mar 2022 16:44:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648737879; x=1680273879; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=h5N/YQvkt0nsAtzBu/lZBB4yil3WWo0xgizmOBW/ECc=; b=S0+X4MMbhJPcJVe6sMaadYPWR3HiYTtYfp5HthOYXxJxUSBFSm95Gufe JyVVhtY5Tb2SEOxNzJ9rJFrccb3cN1EZbfY9t1t22Fy3ie7r0pt5DJKnl CWphQxdk5Skwyx16//g/TTrhpCEWOFUMSOTRapkUMADO88Yj3MRWwRZ2D OBbHZEaqIw0h/sxRvC0rVHC/aTs2HhY42srwcn193MyuxPsbsh+UXiPb6 4gxvC8VIX6KKBlDQMdXD1NTvjt6MsgKiZoeu34xcP7HLLnahHg993fhbp ZYLdu2Ekq3ZkL9oV6dZrMw+hANjwPrg/T4ByUBZlxe44XEsFJTeIuwbTU w==; X-IronPort-AV: E=McAfee;i="6200,9189,10302"; a="258686584" X-IronPort-AV: E=Sophos;i="5.90,225,1643702400"; d="scan'208";a="258686584" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2022 07:44:37 -0700 X-IronPort-AV: E=Sophos;i="5.90,225,1643702400"; d="scan'208";a="547361806" Received: from bricha3-mobl.ger.corp.intel.com ([10.55.133.67]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 31 Mar 2022 07:44:35 -0700 Date: Thu, 31 Mar 2022 15:44:32 +0100 From: Bruce Richardson To: "Burakov, Anatoly" Cc: Fidaullah Noonari , stephen@networkplumber.org, dev@dpdk.org Subject: Re: [PATCH v3] usertools: add check for IOMMU support in dpdk-devbind Message-ID: References: <20220315062652.78332-1-fidaullah.noonari@emumba.com> <20220321122727.614290-1-fidaullah.noonari@emumba.com> <518e43f6-29d6-b86e-aa48-83868d0f8d25@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <518e43f6-29d6-b86e-aa48-83868d0f8d25@intel.com> 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 On Thu, Mar 31, 2022 at 03:37:40PM +0100, Burakov, Anatoly wrote: > On 21-Mar-22 12:27 PM, Fidaullah Noonari wrote: > > binding with vfio driver, when IOMMU is disabled, causes program to crash. > > this patch adds a flag for noiommmu-mode. when this is set, if IOMMU is > > disabled, it changes vfio into unsafe noiommu mode and prints warning > > message. > > > > Signed-off-by: Fidaullah Noonari > > --- > > Hi, > > > +def check_noiommu_mode(): > > + """checks and enables the noiommu mode for vfio drivers""" > > + global noiommu_flag > > + filename = "/sys/module/vfio/parameters/enable_unsafe_noiommu_mode" > > + > > + try: > > + with open(filename,"r") as f: > > + if f.read(1) == "1": > > + return > > + except OSError as err: > > + sys.exit("Error: failed to enable unsafe noiommu mode - Cannot open %s: %s" > > + % (filename, err)) > > Nitpick, but maybe use f-strings instead of old-school string interpolation? > Do we still not need to support some distros that don't have Python earlier than 3.6, where this support was added?