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 52F6241E21; Thu, 9 Mar 2023 21:22:23 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3273140ED7; Thu, 9 Mar 2023 21:22:23 +0100 (CET) Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by mails.dpdk.org (Postfix) with ESMTP id 72D4D40695 for ; Thu, 9 Mar 2023 21:22:21 +0100 (CET) Received: by mail-pj1-f46.google.com with SMTP id kb15so3205863pjb.1 for ; Thu, 09 Mar 2023 12:22:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; t=1678393340; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=J5TpqB5W7jaRQQ8lgDnsG+ZD8Nmf4tdrEQalEKO0vww=; b=DZGrRWpBCWkCGlzlP3Qv4VzNNpW1SOb5dIXZ4HX4hjNU1049lgzlN52bhVhapvbK22 PsUeHzA6fHziUduKholm1o1/cLJHNsHwJfVLArXyNV6NGFB0OrmpRSQXrWwVeEkvKyvH rAIQ+bwWtCEQucU51rMO8jusge951S0K1Zz9XlGWErvaRd3EkpinPX6e2K35qmLtXcN5 GT93oYUsfvviTEjiWh6lL5Pbu7+SgJoEEsnu4d1lzVl6CKfC1URBbr8k1WfWQMbhnTn8 kWWHlkr6pmJJ8tCzYieF4cJpeG6Tr+JXaXy511/mLlytdF1L83guig8qyfdnLCdcY/Vj Ch9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678393340; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=J5TpqB5W7jaRQQ8lgDnsG+ZD8Nmf4tdrEQalEKO0vww=; b=zbEKHV0LFUvY3wS3emRmlVCtbhxlWhBxVizWOx9HajZ6NttICkE+MkynblKd8/tHbl A0NSya+bMWXoY8LduNcRyzo9J2w9AAzUcx7HWOC/oPF0/CilaTtlW5l0NfuTIafOyhhP 9TUf1PhtDOPKk+q6lYDes6eWK8KAUVjal94OZSscdM3nWgCae7ufk8uHOHraZ7//fIG0 sqf5rMSqwk/MBeTZJUUpFOYAedu8KliCrHK0maibcieYv81yfLX7jzFLzqqTvIb5HynU gOdeTmLSqpUWiw4v718sUxBpORrQJNJHWQWiCa8YQPjX2FlN1mW33D/oLhCQEJHSt8yJ k2Rg== X-Gm-Message-State: AO0yUKXD/r6ScVkz9dlt9TbfO1Af4X5pc4yEi2R2AccSo7wdej/LMVpY FCMa/M9zi/qRcXkkgbJAZW18+A== X-Google-Smtp-Source: AK7set8MAKGtAJfRBzth2RwJktNbYgil74EBvmW5Y0angGul8GEsD5uFGsz1IMJ6sMeAjaaC79mNlA== X-Received: by 2002:a17:902:c40d:b0:19e:6760:3a5d with SMTP id k13-20020a170902c40d00b0019e67603a5dmr27221502plk.18.1678393340629; Thu, 09 Mar 2023 12:22:20 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id lg13-20020a170902fb8d00b0019f0eb40b93sm17412plb.146.2023.03.09.12.22.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 12:22:20 -0800 (PST) Date: Thu, 9 Mar 2023 12:22:18 -0800 From: Stephen Hemminger To: "Dumitrescu, Cristian" Cc: "Jangra, Yogesh" , "dev@dpdk.org" , "R, Kamalakannan" , "Suresh Narayane, Harshad" Subject: Re: [PATCH] app/testpmd: fix closing softnic port before ethdev ports Message-ID: <20230309122218.5ba9e848@hermes.local> In-Reply-To: References: <20230309144249.1199517-1-yogesh.jangra@intel.com> <20230309083109.01baaebb@hermes.local> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 Thu, 9 Mar 2023 17:19:59 +0000 "Dumitrescu, Cristian" wrote: > > -----Original Message----- > > From: Stephen Hemminger > > Sent: Thursday, March 9, 2023 4:31 PM > > To: Jangra, Yogesh > > Cc: dev@dpdk.org; Dumitrescu, Cristian ; R, > > Kamalakannan ; Suresh Narayane, Harshad > > > > Subject: Re: [PATCH] app/testpmd: fix closing softnic port before ethdev ports > > > > On Thu, 9 Mar 2023 14:42:49 +0000 > > Yogesh Jangra wrote: > > > > > + /* > > > + * SoftNIC runs on the sevice core, it uses the resources from > > > + * the testpmd application. When we run quit command, the > > testpmd > > > + * application stops ethdev ports first, SoftNIC will try to > > > + * access the port and sometimes that result in segmentation > > > + * error. So first closing the SoftNIC port. > > > + */ > > > + RTE_ETH_FOREACH_DEV(pt_id) { > > > + if (!strcmp(ports[pt_id].dev_info.driver_name, > > "net_softnic")) { > > > + stop_port(pt_id); > > > + close_port(pt_id); > > > + } > > > + } > > > + > > > > NAK > > No driver specific hacks please. > > > > Instead fix the driver design or bug please. > > Hi Stephen, > > This is not a Soft NIC driver-specific hack, this is required for working around some of the ethdev drivers that don't implement the stop() API correctly and free up the device queues or some other internal resources on stop() instead of close(). > > The Soft NIC is a meta-device that sits on top of other "physical" ethdev devices, so when the Soft NIC device continues to poll the queues of those physical devices after their queues have been freed, the Soft NIC will get a segfault. This fix is required to protect against this sort of incorrect driver behavior by simply stopping the Soft NIC devices first. > > We already have several driver specific branches in the test-pmd for e.g. LAG or virtual devices; IMO this small change falls in the same category and it should get accepted. > > Please let us know if this makes sense to you? > > Regards, > Cristian If the application has to do this then something is wrong with the architecture. You aren't propagating state changes through in a safe manner. Other applications will have same issue. If LAG or virtual devices have similar problems then a generic solution is needed.