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 5E600A0548 for ; Mon, 22 Mar 2021 18:17:19 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 53E58140DED; Mon, 22 Mar 2021 18:17:19 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id E5FE74003D; Mon, 22 Mar 2021 18:17:15 +0100 (CET) IronPort-SDR: wTj5m2JCy2a49uJwKO/3o9+f+k07XdJ8p+EohC4Qe+NV/GVPlOfGDTL7X+mDvTAfhdGmfe+rFp oAL/QRFZduZQ== X-IronPort-AV: E=McAfee;i="6000,8403,9931"; a="186995416" X-IronPort-AV: E=Sophos;i="5.81,269,1610438400"; d="scan'208";a="186995416" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2021 10:17:15 -0700 IronPort-SDR: sS9YvILBf+wl6EkDyKxj800BQht5srI85fhHzRc9hhPa5xNGi7t8WLd6P0u3RAYTextBkTchNR FDnH8upZODOQ== X-IronPort-AV: E=Sophos;i="5.81,269,1610438400"; d="scan'208";a="407916401" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.252.14.44]) ([10.252.14.44]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2021 10:17:12 -0700 To: Guoyang Zhou , dev@dpdk.org Cc: bluca@debian.org, cloud.wangxiaoyun@huawei.com, luoxianjun@huawei.com, yin.yinshi@huawei.com, luojiachen@huawei.com, chenlizhong@huawei.com, zengweiliang.zengweiliang@huawei.com, liqingqing3@huawei.com, stable@dpdk.org References: <1615796077-68790-1-git-send-email-zhouguoyang@huawei.com> From: Ferruh Yigit X-User: ferruhy Message-ID: Date: Mon, 22 Mar 2021 17:17:09 +0000 MIME-Version: 1.0 In-Reply-To: <1615796077-68790-1-git-send-email-zhouguoyang@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-stable] [PATCH v1 1/1] net/hinic: fix coredump when PMD used by fstack X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On 3/15/2021 8:14 AM, Guoyang Zhou wrote: > The fstack will use secondary process to access the memory of > eth_dev_ops , and it wants to get the info of dev, but hinic > driver does not initialized it when in secondary process. > I guess the issue is not specific to the f-stack, perhaps can generalize the patch title. > Fixes: 66f64dd6dc86 ("net/hinic: fix secondary process") > Cc: stable@dpdk.org > Signed-off-by: Guoyang Zhou > --- > drivers/net/hinic/base/hinic_compat.h | 25 ++++++++----------------- > drivers/net/hinic/hinic_pmd_ethdev.c | 5 +++++ > 2 files changed, 13 insertions(+), 17 deletions(-) > > diff --git a/drivers/net/hinic/base/hinic_compat.h b/drivers/net/hinic/base/hinic_compat.h > index 6dd210e..aea3320 100644 > --- a/drivers/net/hinic/base/hinic_compat.h > +++ b/drivers/net/hinic/base/hinic_compat.h > @@ -171,6 +171,7 @@ static inline u32 readl(const volatile void *addr) > #else > #define CLOCK_TYPE CLOCK_MONOTONIC > #endif > +#define HINIC_MUTEX_TIMEOUT 10 > > static inline unsigned long clock_gettime_ms(void) > { > @@ -225,24 +226,14 @@ static inline int hinic_mutex_destroy(pthread_mutex_t *pthreadmutex) > static inline int hinic_mutex_lock(pthread_mutex_t *pthreadmutex) > { > int err; > + struct timespec tout; > > - err = pthread_mutex_lock(pthreadmutex); > - if (!err) { > - return err; > - } else if (err == EOWNERDEAD) { > - PMD_DRV_LOG(ERR, "Mutex lock failed. (ErrorNo=%d)", errno); > -#if defined(__GLIBC__) > -#if __GLIBC_PREREQ(2, 12) > - (void)pthread_mutex_consistent(pthreadmutex); > -#else > - (void)pthread_mutex_consistent_np(pthreadmutex); > -#endif > -#else > - (void)pthread_mutex_consistent(pthreadmutex); > -#endif > - } else { > - PMD_DRV_LOG(ERR, "Mutex lock failed. (ErrorNo=%d)", errno); > - } > + (void)clock_gettime(CLOCK_TYPE, &tout); > + > + tout.tv_sec += HINIC_MUTEX_TIMEOUT; > + err = pthread_mutex_timedlock(pthreadmutex, &tout); > + if (err) > + PMD_DRV_LOG(ERR, "Mutex lock failed. (ErrorNo=%d)", err); > Is above change related to the secondary process fix? > return err; > } > diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c > index 1d6b710..057e7b1 100644 > --- a/drivers/net/hinic/hinic_pmd_ethdev.c > +++ b/drivers/net/hinic/hinic_pmd_ethdev.c > @@ -3085,6 +3085,10 @@ static int hinic_dev_close(struct rte_eth_dev *dev) > .filter_ctrl = hinic_dev_filter_ctrl, > }; > > +static const struct eth_dev_ops hinic_dev_sec_ops = { > + .dev_infos_get = hinic_dev_infos_get, > +}; > + > static int hinic_func_init(struct rte_eth_dev *eth_dev) > { > struct rte_pci_device *pci_dev; > @@ -3099,6 +3103,7 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev) > > /* EAL is SECONDARY and eth_dev is already created */ > if (rte_eal_process_type() != RTE_PROC_PRIMARY) { > + eth_dev->dev_ops = &hinic_dev_sec_ops; Why not using existing dev_ops but creating a new one? > PMD_DRV_LOG(INFO, "Initialize %s in secondary process", > eth_dev->data->name); > >