From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DA48FA04FD; Wed, 15 Jan 2020 11:30:08 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 306FB1BFD3; Wed, 15 Jan 2020 11:30:08 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 871ED1BFB4; Wed, 15 Jan 2020 11:30:06 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Jan 2020 02:30:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,322,1574150400"; d="scan'208";a="213659306" Received: from unknown (HELO [10.237.220.132]) ([10.237.220.132]) by orsmga007.jf.intel.com with ESMTP; 15 Jan 2020 02:30:04 -0800 To: Fang TongHao , dev@dpdk.org Cc: stable@dpdk.org References: <20200109023529.1285-1-fangtonghao@sangfor.com.cn> From: "Burakov, Anatoly" Message-ID: <26ad1d8b-b63c-ca40-b4cc-865e128336b8@intel.com> Date: Wed, 15 Jan 2020 10:30:03 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: <20200109023529.1285-1-fangtonghao@sangfor.com.cn> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH] ethdev: fix secondary process change share memory 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 09-Jan-20 2:35 AM, Fang TongHao wrote: > Hi all,I am from Sangfor Tech.I found a bug when using DPDK in > multiprocess scenario.The secondary process enters > "rte_eth_dev_pci_copy_info" function when initializing.Then it > sets the value of struct "rte_eth_dev_data.dev_flags" to zero, > but this struct is shared by primary process and secondary > process, and the value change is unexpected by primary process. > This may cause very serious damage.I think > the secondary process should not enter "rte_eth_dev_pci_copy_info" > function or changes the value of struct "rte_eth_dev_data.dev_flags" > in shared memory. > I fixed this bug by adding an if-statement to forbid the secondary > process changing the above-mentioned value. > Thansk, All. Hi, Thanks for your contribution! However, your patch could use some improvements, as it currently doesn't meet the standards expected by the DPDK community. First of all, the commit log shouldn't read like an email :) Suggested rewording: ---- When secondary process enters `rte_eth_copy_pci_info`, it resets the rte_eth_dev_data.dev_flags to zero. This may cause unintended consequences because this is a structure that is shared between primary and secondary processes. Fix it by only overwriting the flags if the process is primary. --- Your commit message has also incorrectly called out the offending function as `rte_eth_dev_copy_pci_info`, while it is actually named `rte_eth_copy_pci_info`. Also, a Fixes: tag is missing. Please use git blame to find the commit that introduced the issue, and use the 'fixline' formatting. Please see Contribution Guidelines[1] on how to properly format fixline. You will find instructions on how to submit a version 2 of the patch in the same document[2]. [1] https://doc.dpdk.org/guides/contributing/patches.html#commit-messages-body [2] https://doc.dpdk.org/guides/contributing/patches.html#steps-to-getting-your-patch-merged -- Thanks, Anatoly