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 05FA4A0A0E for ; Mon, 10 May 2021 18:14:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F387E40140; Mon, 10 May 2021 18:14:02 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2069.outbound.protection.outlook.com [40.107.243.69]) by mails.dpdk.org (Postfix) with ESMTP id A142C40140 for ; Mon, 10 May 2021 18:14:00 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cRdfaSE3ERelBPHQ+s3SqnZxBRt+Veeg6lGvv+JCJJn3pKH1QXpyvcbJx4/mXk0IFAKc0CCuAQ8pmbRi8xEpqHsKRypAQHo2ggPPZUOPb06IzEV3MmcowmNZOFKzI9e6qmPTYYstlBtDZLIDSdQUiHpoEKa15n5PrIWnhq8q74hXt0tFeLXEnq3FPw+C1i/6oLUmp8Y91dAMlJD6r2UF0ykRwHrfhEYW2rTM180s2PxhBXbVKkcq5Ug7AwuGSlL5jAYArI6yiXiSlHRArEp51oCVlPnEiyzk9zTNPDkYKrh0z9ZA8SNchOm67nJHnaYdc7g+ZGmcqUT96JIMwCIm6Q== 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-SenderADCheck; bh=SQssZpH5MECHCsY7o219IW4VGbI4/qNrPaFoj/JZv2Y=; b=QvZHoW0sZfU4uKWxM0afVMLRCl9H8JM6bLZsYz7hdY/koV9c69Qja1DCU8VYqUFn4imJgWQujzGQtRiY+i09H0elW2dU4XSJMuUxINhcUUSFrmjyg3TsbkmZQgDGGtgMIIRaiuyMMz/vHkGJh602uPOcR3MmNiK25NpDZKGLnb4pUQzW1N/WKFcbPDD+KvzJsUbtNl5rAezuRkO7F7Q3Qnc1f0vc0DhsllfgP+yE49VlJZyz0HiGFw9ko1mMtiVhr/o9VadolHqhI116uVVgAJ6aEVEUpYDYjNQlaD4mY0c9e6CiTNnLerpczrWyZH8GOa1v/HRW79dYDrgZi3Okyg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SQssZpH5MECHCsY7o219IW4VGbI4/qNrPaFoj/JZv2Y=; b=D7A/buyVWMNfNaXH0xdmwtRsV5UMNKPOF9bAbFc1oIOzcb0izLdBdqu+BJQYbXCxhglXlrwGSj+M7CeiALFBNz+j2WJCu9UWmIxa5qojGKW5XugqogvKUjTGew9O+ZUWmtD0pzhhPWac7nMyDFXpNImTxMHVywsMbf/124GhXV7EVTn1SIqpwl9FH86GXSUKCJZcuYZbmDPe3qICX4p2hoFdxNe0LxGx4e0mSuXiKwN/1gWQEAveXFWjnEiE/dOzA9TBkfNa/KmPXlF2Pop3lt8smLgmMaWq8tDsnoI+Cf+snnIj1EeQsNkbP8SKS6SvwSTfue0YSgFHYtj7JYuB2Q== Received: from MWHPR01CA0041.prod.exchangelabs.com (2603:10b6:300:101::27) by MN2PR12MB3917.namprd12.prod.outlook.com (2603:10b6:208:166::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.26; Mon, 10 May 2021 16:13:58 +0000 Received: from CO1NAM11FT051.eop-nam11.prod.protection.outlook.com (2603:10b6:300:101:cafe::2) by MWHPR01CA0041.outlook.office365.com (2603:10b6:300:101::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Mon, 10 May 2021 16:13:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT051.mail.protection.outlook.com (10.13.174.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Mon, 10 May 2021 16:13:58 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 16:13:55 +0000 From: Xueming Li To: Guoyang Zhou CC: Luca Boccassi , dpdk stable Date: Tue, 11 May 2021 00:00:58 +0800 Message-ID: <20210510160258.30982-109-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210510160258.30982-1-xuemingl@nvidia.com> References: <20210510160258.30982-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 223c4c15-8b9a-45d8-8da0-08d913ce9e1b X-MS-TrafficTypeDiagnostic: MN2PR12MB3917: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ag4P50DO/LoFYbnpscK96oL23uElH+SS2sq7tsWOgHYuwln+s7VvdcUNnw2e73Aj/nds4oa4aoTWu0CABhIVYKPq8tiavMho42FJXkowf4vhCpHRUImzm1L/8+ALi9Zg9YTCiijSOQrP21C9ilLoV92JUviRyTRvRW9OWf52G/u46oShUUYCFeNhn1pGUSxlsbcCN9zhR6FZqckfjUISWJE4wS4+hxHhwiG+ZZ5zgFEJAnwBIR0AIX0s4KRLPPL3mqfTaHj9VQxyrBNMnFct5FuMpxrAL9E9HghiewrZQ4MxGVWc/GERFpYQZeRaldA/5LBoaoUR+RD+GJ/ATC4DHRbnM/VlSLFFE6to5Ngc1SIwfILRBmuwxIdpJClarX9bhGrRJ+GUfbCHisHwyriYtiP33wHiAAd5KorCuuRdFBbDyqqq1pXDLbvhwZMUveTD4HsY6SmePADO6r3GwYpYeFnF0lFlC9Kokfbe5eV/UQzKQUh091stlPAJUwXouX/eFOPM1LMKzXbZdmPj572paYy2x3CzI1bfzRUN749lnA7OzRNtz62pEuzrXEkFOA2vpPgwTueL46EJtdnO8z4Z6WAQtjDNZ/8b6j2sr9tv4exFwGb5vkNaAl5BPz/5teUK8ktDo7kMUXRUwU7IspOTGoNqUm2/joihfjEIe7XirLEQGZu/VyGnSR/q7cxcdSSisHGyac+6/oO055GaEodzrkzvxFJkipSQAfcpfrlV6kFLyZqENqKD1BLsRjWmxJ+2/awW7gugiWU8LeseYLO3QQ== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(376002)(396003)(136003)(39860400002)(346002)(46966006)(36840700001)(26005)(86362001)(36756003)(7696005)(36906005)(6286002)(36860700001)(966005)(55016002)(356005)(336012)(2616005)(82740400003)(426003)(6916009)(7636003)(70206006)(47076005)(2906002)(1076003)(53546011)(5660300002)(16526019)(83380400001)(54906003)(70586007)(82310400003)(8936002)(316002)(8676002)(186003)(4326008)(478600001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2021 16:13:58.4653 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 223c4c15-8b9a-45d8-8da0-08d913ce9e1b X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT051.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3917 Subject: [dpdk-stable] patch 'net/hinic: fix crash in secondary process' has been queued to stable release 20.11.2 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" Hi, FYI, your patch has been queued to stable release 20.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/12/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/de81fe259ae6738425d3f761028ec8fe96f70f8c Thanks. Xueming Li --- >From de81fe259ae6738425d3f761028ec8fe96f70f8c Mon Sep 17 00:00:00 2001 From: Guoyang Zhou Date: Tue, 23 Mar 2021 21:17:51 +0800 Subject: [PATCH] net/hinic: fix crash in secondary process Cc: Luca Boccassi [ upstream commit 4c670dfaa417bc5604c9c58b505a74e2725acdb2 ] Some apps, such as fstack, will use secondary process to access the memory of eth_dev_ops, and they want to get the info of dev, but hinic driver does not initialized it when in secondary process. Fixes: 66f64dd6dc86 ("net/hinic: fix secondary process") 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 6dd210ec06..aea332046e 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); return err; } diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c index 5a2c171099..f1b3ba3927 100644 --- a/drivers/net/hinic/hinic_pmd_ethdev.c +++ b/drivers/net/hinic/hinic_pmd_ethdev.c @@ -3085,6 +3085,10 @@ static const struct eth_dev_ops hinic_pmd_vf_ops = { .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; PMD_DRV_LOG(INFO, "Initialize %s in secondary process", eth_dev->data->name); -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-05-10 23:59:29.447945000 +0800 +++ 0110-net-hinic-fix-crash-in-secondary-process.patch 2021-05-10 23:59:26.500000000 +0800 @@ -1 +1 @@ -From 4c670dfaa417bc5604c9c58b505a74e2725acdb2 Mon Sep 17 00:00:00 2001 +From de81fe259ae6738425d3f761028ec8fe96f70f8c Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Luca Boccassi + +[ upstream commit 4c670dfaa417bc5604c9c58b505a74e2725acdb2 ] @@ -11 +13,0 @@ -Cc: stable@dpdk.org @@ -64 +66 @@ -index 2352dd1615..b5a36a863b 100644 +index 5a2c171099..f1b3ba3927 100644 @@ -67,2 +69,2 @@ -@@ -3063,6 +3063,10 @@ static const struct eth_dev_ops hinic_pmd_vf_ops = { - .flow_ops_get = hinic_dev_flow_ops_get, +@@ -3085,6 +3085,10 @@ static const struct eth_dev_ops hinic_pmd_vf_ops = { + .filter_ctrl = hinic_dev_filter_ctrl, @@ -78 +80 @@ -@@ -3077,6 +3081,7 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev) +@@ -3099,6 +3103,7 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev)