From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 095D543867;
	Mon,  8 Jan 2024 18:56:02 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 9B9144067C;
	Mon,  8 Jan 2024 18:56:01 +0100 (CET)
Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com
 [209.85.210.178])
 by mails.dpdk.org (Postfix) with ESMTP id 6B046402DF
 for <dev@dpdk.org>; Mon,  8 Jan 2024 18:56:00 +0100 (CET)
Received: by mail-pf1-f178.google.com with SMTP id
 d2e1a72fcca58-6d9af1f52bcso695714b3a.3
 for <dev@dpdk.org>; Mon, 08 Jan 2024 09:56:00 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1704736559;
 x=1705341359; darn=dpdk.org; 
 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=kFcuDEj4OGBAhQ+YTQzQ47Xz/Vi0Kc9TKPsV/+P2RNs=;
 b=tVarxcMxsa+cc4s3DIeBBCnE/0h9wbjK21kgdxQQNsZstmillbqGPI9t/lMmw+sWW3
 uhmYyc34SMcelpr1NlKRvZZi5LEGCkF/sF6+ADKpT8Xu9BaiexowVp9Ot1ViEL/mn5+e
 aWM7q18kesx3MfC0RH10UQtIqe4tO8AUwMSo8oaMGtTL7PyC4wDwamisDZ6qv61qKEcT
 FehJlLl4ZHABLdMf8mGntTuM1KHmV6Qy9pmeuD/Kri5XxF2aokW1+ktHGiIYdGZ7ijTY
 IZoZS9v3nEGRwg2g96mCf0hlGZ1PLw2a4nB1YJ+TOYLBjMfZ4QKwKee2OjYNueNayerb
 4gxQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1704736559; x=1705341359;
 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=kFcuDEj4OGBAhQ+YTQzQ47Xz/Vi0Kc9TKPsV/+P2RNs=;
 b=Arc1ojJCw6aEyYIY/caLGOFPm1WQcg4H/BE6AnEFX2VEEiwvauaonQKjTE97rDqDFF
 clEcBK7TaojWlN1MTUgvJgMyARhJNqabr1UkarHT6TjwhvfvXjwaMhjBj2FM1GxSDL4i
 RxvYeW3sL8LvU+eKK9yLzF7i4FQ3oN8ackvgwA3p1JUni4qB6baF0S2/S3ofKRgZb6Qq
 fnu2Q9ZRZtF173lWv6mzRbZSAPVQ+2ZGvNGF7IY6T7JotUC7wgylIUv3gviZQ6Wh9BZs
 kOHmEYd8/sT7zzwJVcp6gfHmX9H/5Fcbaat1f5vaQGSuU3AL9cOx+DN7thPWaOmblgFn
 e6Ag==
X-Gm-Message-State: AOJu0Yx+4XRznoEcKDHNv+w46oSFlBA7MCN7MsTJozDwIOjzqF+WJHEg
 v0ks5sjsQIOoyIbx/GeUHkI0PHSowY314w==
X-Google-Smtp-Source: AGHT+IEg7NTi2gwjZdBW4VmJKcELEx/Xyt6LWQKzaysLeglksVm84EfJQE7dHZy7/bWd0JledLDOFA==
X-Received: by 2002:a05:6a00:1d08:b0:6d9:b263:8089 with SMTP id
 a8-20020a056a001d0800b006d9b2638089mr1581835pfx.7.1704736559432; 
 Mon, 08 Jan 2024 09:55:59 -0800 (PST)
Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141])
 by smtp.gmail.com with ESMTPSA id
 g11-20020a63564b000000b005c6aa4d4a0dsm135170pgm.45.2024.01.08.09.55.57
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 08 Jan 2024 09:55:58 -0800 (PST)
Date: Mon, 8 Jan 2024 09:55:55 -0800
From: Stephen Hemminger <stephen@networkplumber.org>
To: Konstantin Ananyev <konstantin.ananyev@huawei.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "arshdeep.kaur@intel.com"
 <arshdeep.kaur@intel.com>, "Gowda, Sandesh" <sandesh.gowda@intel.com>,
 Reshma Pattan <reshma.pattan@intel.com>
Subject: Re: Issues around packet capture when secondary process is doing rx/tx
Message-ID: <20240108095555.73bd0f3e@hermes.local>
In-Reply-To: <5c28d2a26f5142c3a509cc8bda2fca75@huawei.com>
References: <20240107175900.1276c0a5@hermes.local>
 <5c28d2a26f5142c3a509cc8bda2fca75@huawei.com>
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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

On Mon, 8 Jan 2024 15:13:25 +0000
Konstantin Ananyev <konstantin.ananyev@huawei.com> wrote:

> > I have been looking at a problem reported by Sandesh
> > where packet capture does not work if rx/tx burst is done in secondary process.
> > 
> > The root cause is that existing rx/tx callback model just doesn't work
> > unless the process doing the rx/tx burst calls is the same one that
> > registered the callbacks.
> > 
> > An example sequence would be:
> > 	1. dumpcap (or pdump) as secondary tells pdump in primary to register callback
> > 	2. secondary process calls rx_burst.
> > 	3. rx_burst sees the callback but it has pointer pdump_rx which is not necessarily
> > 	   at same location in primary and secondary process.
> > 	4. indirect function call in secondary to bad location likely causes crash.  
> 
> As I remember, RX/TX callbacks were never intended to work over multiple processes.
> Right now RX/TX callbacks are private for the process, different process simply should not
> see/execute them.
> I.E. it callbacks list is part of 'struct rte_eth_dev' itself, not the rte_eth_dev.data that is shared
> between processes.
> It should be normal, wehn for the same port/queue you will end-up with different list of callbacks
> for different processes.  
> So, unless I am missing something, I don't see how we can end-up with 3) and 4) from above:
> From my understanding secondary process will never see/call primary's callbacks.
> 
> About pdump itself, it was a while when I looked at it last time, but as I remember to start it to work,
> server process has to call rte_pdump_init() which in terns register PDUMP_MP handler.
> I suppose for the secondary process to act as a 'pdump server' it needs to call rte_pdump_init() itself,
> though I am not sure such option is supported right now. 

Maybe the simplest would be just to make sure that rte_pdump_init() is called
in the process that does rx/tx burst. That might be made to work.
Still won't work for case where there are multiple secondary processes and some
the ethdev ports are used differently in each one, but would work better than now.