From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 682191B4FF for ; Fri, 23 Nov 2018 10:12:54 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Nov 2018 01:12:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,269,1539673200"; d="scan'208";a="107035111" Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.251.82.123]) ([10.251.82.123]) by fmsmga002.fm.intel.com with ESMTP; 23 Nov 2018 01:12:52 -0800 To: Darek Stojaczyk , dev@dpdk.org References: <20181121184132.34039-1-dariusz.stojaczyk@intel.com> From: "Burakov, Anatoly" Message-ID: <902e9ebc-e658-fd41-55ce-8ba9e3a72728@intel.com> Date: Fri, 23 Nov 2018 09:12:51 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181121184132.34039-1-dariusz.stojaczyk@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] vfio: don't needlessly setup devices in secondary process 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: Fri, 23 Nov 2018 09:12:54 -0000 On 21-Nov-18 6:41 PM, Darek Stojaczyk wrote: > Setting up a device that wasn't setup in the primary > process will possibly break the primary process. That's > because the IPC message to retrieve the group fd in the > primary will also *open* that group if it wasn't opened > before. Even though the secondary process closes that fd > soon after as a part of its error handling path, the > primary process leaks it. > > What's worse, opening that fd on the primary will > increment the process-local counter of opened groups. > If it was 0 before, then the group will never be added > to the vfio container, nor dpdk memory will be ever > mapped. > > This patch moves the proper error checks earlier in the > code to fuly prevent setting up devices in secondary > processes that weren't setup in the primary process. > > Fixes: 2f4adfad0a69 ("vfio: add multiprocess support") > Cc: anatoly.burakov@intel.com > > Signed-off-by: Darek Stojaczyk > --- Acked-by: Anatoly Burakov -- Thanks, Anatoly