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 6503BA0503; Thu, 31 Mar 2022 16:37:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 05605410FA; Thu, 31 Mar 2022 16:37:58 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 60E444014F for ; Thu, 31 Mar 2022 16:37:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648737476; x=1680273476; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=ySqCurZ4tt9X0txutzHw3zoi3ROfROvXIVYzfUe+7VQ=; b=Har0RSLPUuLw4safzuvGGNjJvQK0S7sPVSW1JIXJfL/t2T5Ty53TCEFC jXr6FD1Yb9rDxKtPOx2+nE1lYZAfs4S505KYvvWKi2hDGdRqhjqK4nzIU tTQdqIlVglBSNq2/BF8Kqn6D6R/HbW5i0oWewuHghKZ5ElTeUsIE1gtlE cgC13BxkRQMFrG/+Pd1yO4NyDTWkDZgWMTIVSW8lfZBcStWi8ry3IS1oC uygwDYYtSnYLrp24vKvpQa4TexwsMi3B5Vu7GhSGa90qRJGsewrxvFBYv 3bDMB2RwYa8VzgJagKseN0HrDTFIglxoDaom1kDSavrAQfDN+2DMNzzub w==; X-IronPort-AV: E=McAfee;i="6200,9189,10302"; a="259832197" X-IronPort-AV: E=Sophos;i="5.90,225,1643702400"; d="scan'208";a="259832197" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2022 07:37:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,225,1643702400"; d="scan'208";a="695510462" Received: from orsmsx605.amr.corp.intel.com ([10.22.229.18]) by fmsmga001.fm.intel.com with ESMTP; 31 Mar 2022 07:37:53 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Thu, 31 Mar 2022 07:37:53 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Thu, 31 Mar 2022 07:37:52 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Thu, 31 Mar 2022 07:37:52 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.43) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Thu, 31 Mar 2022 07:37:52 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kFQRU9hBHgZHHpR5VYRdeGkHyLKuij6PZ5EpLFPC0lLxw1HsvfhrF3sHP0PU9ncOU0BeuobArr+t+ZllkwF+7ma6W8hfY3C0EZY/cu/ofzw9x8/A1qlQIw7H6MFHheHZ9JSh3ufoDh2wNK8QmjFVAelgOygM6xwZbLe+i9ol+Uvz52/z9aGwevw4/RDkdvyNDcJAXBw5CPsYnEOm1QMmgBiOuFZSzsmZBoAaxYO49W5bHmpqES5HPMKzH+NCdHStxb5rgyF5JJvesFmhG6ffHX+kGTPIxZvcflGTWsIBWfxOSLRujKkBlxX1ggLUI0cPpo6VbGclhSfsD5zAex9ojg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=F5WPZF3GiKNOstQo6/TcDJdIj6zzaxh3bAyFftM8LWs=; b=NoKqYB+LO0ikbMWnAHZy8oM1UjZ+EmzlBJWrVbggdc33Ij+igkVO0fX+jj9x1QqcWhxxs4Ta1EM0YWqVTCYpekTdyvvF3nLYOqqyTD16B8vmPAm6NiPuBK066Tutm1mAcpTlQqz0L12vNl5QWUhxgmyZkTv5nQrOqbfroew0xu3+tw2FwriOnQIV2p9D3dhPnaODuElhkkkDGON5DBtMjJvvp0SZg4pdHuy2Zh+26XGwalwSZfLlUbRW9y/Hko9pwN/U72lQ9AirshefOUo7B8KAsPHTB9wBoKjR4iuv6zKAdcPLwp1dVMExD6Ey0mBrrtMfFH7jpCDqvNbtEL0OQA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5093.namprd11.prod.outlook.com (2603:10b6:510:3e::23) by SA2PR11MB5114.namprd11.prod.outlook.com (2603:10b6:806:114::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.21; Thu, 31 Mar 2022 14:37:46 +0000 Received: from PH0PR11MB5093.namprd11.prod.outlook.com ([fe80::1068:ac4c:532e:d810]) by PH0PR11MB5093.namprd11.prod.outlook.com ([fe80::1068:ac4c:532e:d810%6]) with mapi id 15.20.5123.023; Thu, 31 Mar 2022 14:37:45 +0000 Message-ID: <518e43f6-29d6-b86e-aa48-83868d0f8d25@intel.com> Date: Thu, 31 Mar 2022 15:37:40 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.7.0 Subject: Re: [PATCH v3] usertools: add check for IOMMU support in dpdk-devbind Content-Language: en-US To: Fidaullah Noonari , CC: References: <20220315062652.78332-1-fidaullah.noonari@emumba.com> <20220321122727.614290-1-fidaullah.noonari@emumba.com> From: "Burakov, Anatoly" In-Reply-To: <20220321122727.614290-1-fidaullah.noonari@emumba.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: DB8PR06CA0057.eurprd06.prod.outlook.com (2603:10a6:10:120::31) To PH0PR11MB5093.namprd11.prod.outlook.com (2603:10b6:510:3e::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2e2feca1-cf3c-4930-632e-08da1324056b X-MS-TrafficTypeDiagnostic: SA2PR11MB5114:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eUufmYpcssvQvHgsXAgno50aMBYiC8JrU86YPtB5EnuOWR67gvp4qW0HfDja805TZPLK8vxKecya7A1Ci/08HQX+SrzMIkpV0WUoSrFJtHAugoK8f/aRUOWCm9OjK9uhO9dQN8lNo/Yt76pn5d6VZpAsubvAEJYEikGDELVNlTRy9EWmv8r9ApncsL7ZaIQiiSxkCMScorusFY8oAp6UkJbXepaQGGbi2reso/xJoM4kWkYOP1j2ReX9KvY0wh70eLmPx5hV6+g/AhpFznWd07SADKCBQcEWUj/NjM8mjQtZLBkL3szgY7L4tK5caWMS2QKT5b7Nl0R4ckNTsmTtetfB2Mfx9abnqEooQOyIx9Pn9LZnu/P8Mis7UAPisXXFgkMRbHyzAEH3bQi0KUTsvY9FdVEkLwnuDKfcA4awvJ+JnnzAIqp/JtP11ambcShgDS/18wft5LZ+Pd4NMV9MMDf0rLr+OmBHAyfMeFq+9BEByofFYvn14Ig1hsq4UHOHC5MVj4jAWM9OcOOjkrJGBigIIfrYpDVnZ/IB8y5RBGV5gPx0WCq4xLShe54TBCKEwS/Jnv459kjLP+qL0T+uDOd3KpnhpJzQZc/lRME0Rpq2ekVD+cbV5yZm/41TngkEOGXPSBY2taGWSfn0uxN75jBnVhC7HxFElbo0T8gvecJVQh1ZJbNcdvvNXJDLckuLTDOeSGVrFn0hhSb2+MdvlZP2jny/e0A3eL1UrqAy4GE= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5093.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(5660300002)(8676002)(66476007)(86362001)(31696002)(4326008)(66556008)(66946007)(83380400001)(2906002)(8936002)(82960400001)(38100700002)(6506007)(316002)(186003)(6666004)(6486002)(508600001)(26005)(2616005)(53546011)(6512007)(31686004)(36756003)(45980500001)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?b3ZjNDM2VVV3VXJSOWVWVFpTQ0FUbE52eEJ0M2JGVDNyZUI1c05oK3diZVBG?= =?utf-8?B?Vk1nY2ZMeVdqcVBTQTNkdEVtL3VVSnZjMDRLa1VFOVlxSnYrY1h4cSt4elVI?= =?utf-8?B?SnBRMkVxeDBkZ1ljNDk2TTVuZXg2UHJPY0tPNWdCSWx2QXBnSUJqVGM4dzgy?= =?utf-8?B?NzI0NVJOc3JKM0NQZm1WYzVHNTRuRWF0TjU0bFQ2RXhmcjZtOSs5NmpvNFVU?= =?utf-8?B?Y1dSTjhjbHMyRWJpRmtyeUZTNklSTEN2R0tIMHp1YkxMTWU3MmYxRittbjNl?= =?utf-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Dc2ZtTGlYOGpGQUtDRnJ6aHlSaGZDSCsxSytE?= =?utf-8?B?WXR2cFFMbUQ2VUpzZ0lRM0M3NVZacm1qUGJZUDFkelQyYk1RWDRZU0hINlhq?= =?utf-8?B?OXVxZlJBQ3IvRFlSMk4wNFpPUFRIajZNMzVvRGpDeW5MU3I2TGdqb3oyeTB5?= =?utf-8?B?OVZOOEZ5S0pyWG5jam1NYVlGM3NVVmNvaG00eDNrMTVHSjREOWNhMVFuRWpm?= =?utf-8?B?WUU1S1V6UXYrTGU2Mml0dWY5WVB5djJhbXM5Ymd0MG1nWlJ5MmVrbW00OW5N?= =?utf-8?Q?33Lyf0lb3jLf2vds=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 2e2feca1-cf3c-4930-632e-08da1324056b X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5093.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2022 14:37:45.8739 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jMrxNbC/xd/EursTx0uobsMFrWXsqXbsat6v0jID7ShEq+rJWQtj+bKviLHbFTTjNuwvW/gnrenesAdUAxnymyvyvDUXlTn7n5QqEeZILUs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR11MB5114 X-OriginatorOrg: 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 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? > + > + if not noiommu_flag: > + print("Error: failed to bind vfio-pci - IOMMU support is disabled") > + print("Info: use --noiommu-mode for binding in noiommu mode") > + sys.exit() > + > + try: > + with open(filename, "w") as f: > + f.write("1") > + f.close() > + except OSError as err: > + sys.exit("Error: failed to enable unsafe noiommu mode - Cannot open %s: %s" > + % (filename, err)) Same as above. Otherwise LGTM, Acked-by: Anatoly Burakov -- Thanks, Anatoly