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 8317B459DA; Thu, 19 Sep 2024 18:00:40 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 325D843387; Thu, 19 Sep 2024 18:00:40 +0200 (CEST) Received: from mail-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.180]) by mails.dpdk.org (Postfix) with ESMTP id ABA7D40A7D for ; Thu, 19 Sep 2024 18:00:38 +0200 (CEST) Received: by mail-oi1-f180.google.com with SMTP id 5614622812f47-3e03974b6a5so516546b6e.3 for ; Thu, 19 Sep 2024 09:00:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726761638; x=1727366438; darn=dpdk.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=krWUNxHZBk34UWIqBOnaoOTNBRMmWDbOaOwofyoyVUs=; b=hYJOrJ0Pw3QqoA8yWSNQr6/qOkTVeplvikqNnS02D4Yvk+BW4taypiGEa4rEGlcV3i XBZZsgXXAS59KQfQxw38iaaRXWL4AfITctOiGP2zJ+oXJDMLaX71q+U5fAea9z+352z0 4paalO8Acj3TWXWnckx+I9wkgvocYsDLyOud3yNEFpoPA3sOElT7D+Qfq/R9HK59KEad D1fXSx8A/C+FEZGFcDNmGR0xNSFcwPJmp9IfK6oFbAtDhDiJuEZtWU5y744AfczuBALy czh1ZXBTfsgRu5jLvx57hqG/fGoUXvy4QuJ4ll0iV8F2pZ+vtxnt+C4TibE74rbEPCCd 4+cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726761638; x=1727366438; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=krWUNxHZBk34UWIqBOnaoOTNBRMmWDbOaOwofyoyVUs=; b=H4GRu1vMzyGSFyf7J6nVHvN63G+fs5VmdzkLwALKTHuXyAnA1iHL1hERotzQvJ9nbZ ZCbpMA/SMXFz6j8prTFx0jYzBJ7GjxhikIx4w9yw4uYk/2qEfKvHxq9iWRHDEZ0B04wG Y7MYwFapbe2PfHTdCFBM9Qyd0zBHZ6ULkpGvn/E8TS5bqZEfcbeqxfZyhXnxkX1MDsBP PMhDi0AsGHgg4V7h9CwwUrIgZO6yYEkRkc9t+yUu3i7Jt3/PSJtd7MmnvC1Ig6U4eBL6 +g3TsaYkCsVWyPaFVCuaRHZX+C4B6NJ7i3BEjJbCZ6G7cw4lwfXZdKCApmLI0rFa9NuU 3aog== X-Forwarded-Encrypted: i=1; AJvYcCVWuGKAcr7xNMoNLtyy5UPCWcaTgX7eVTtiq3ROOeeG4xBzZQA2pTBoZ5HshM/JqwN6QaY=@dpdk.org X-Gm-Message-State: AOJu0YxpWBbbxSm3K+ZmU0G8Mdk8Dx7zPq1LjDIugi3fHZDw54ec4bSb T3zaHl4gPPWPB2iliDwYPNPcGoZx4aXboNKe1Z90sn7XKsvnAJcUFXlcUhSQhmeNmCnWhpb+U83 4IvPOkjeFGWiibOk6IvCGiQaQ0mg= X-Google-Smtp-Source: AGHT+IEpUkAxnD3hMuDo85zsatPfsj1GWBZ9EIhpLLlwgxFCrsvjTJdY5Y77QzZsPgB55kmm/KyIpUIgycBHCLMxvY4= X-Received: by 2002:a05:6808:210e:b0:3e0:4b68:8af with SMTP id 5614622812f47-3e071a7a67cmr19252964b6e.4.1726761637741; Thu, 19 Sep 2024 09:00:37 -0700 (PDT) MIME-Version: 1.0 References: <20240801111120.5380-1-fengchengwen@huawei.com> <20240918064142.32837-1-fengchengwen@huawei.com> In-Reply-To: <20240918064142.32837-1-fengchengwen@huawei.com> From: Jerin Jacob Date: Thu, 19 Sep 2024 21:30:11 +0530 Message-ID: Subject: Re: [PATCH v2] examples/eventdev: fix segment fault with generic pipeline To: Chengwen Feng Cc: thomas@monjalon.net, dev@dpdk.org, pbhagavatula@marvell.com, harry.van.haaren@intel.com, wangchenxingyu@huawei.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 Wed, Sep 18, 2024 at 12:10=E2=80=AFPM Chengwen Feng wrote: > > There was a segmentation fault when executing eventdev_pipeline with > command [1] with ConnectX-5 NIC card: > > 0x000000000079208c in rte_eth_tx_buffer (tx_pkt=3D0x16f8ed300, buffer=3D0= x100, > queue_id=3D11, port_id=3D0) at > ../lib/ethdev/rte_ethdev.h:6636 > txa_service_tx (txa=3D0x17b19d080, ev=3D0xffffffffe500, n=3D4) at > ../lib/eventdev/rte_event_eth_tx_adapter.c:631 > 0x0000000000792234 in txa_service_func (args=3D0x17b19d080) at > ../lib/eventdev/rte_event_eth_tx_adapter.c:666 > 0x00000000008b0784 in service_runner_do_callback (s=3D0x17fffe100, > cs=3D0x17ffb5f80, service_idx=3D2) at > ../lib/eal/common/rte_service.c:405 > 0x00000000008b0ad8 in service_run (i=3D2, cs=3D0x17ffb5f80, > service_mask=3D18446744073709551615, s=3D0x17fffe100, > serialize_mt_unsafe=3D0) at > ../lib/eal/common/rte_service.c:441 > 0x00000000008b0c68 in rte_service_run_iter_on_app_lcore (id=3D2, > serialize_mt_unsafe=3D0) at > ../lib/eal/common/rte_service.c:477 > 0x000000000057bcc4 in schedule_devices (lcore_id=3D0) at > ../examples/eventdev_pipeline/pipeline_common.h:138 > 0x000000000057ca94 in worker_generic_burst (arg=3D0x17b131e80) at > ../examples/eventdev_pipeline/ > pipeline_worker_generic.c:83 > 0x00000000005794a8 in main (argc=3D11, argv=3D0xfffffffff470) at > ../examples/eventdev_pipeline/main.c:449 > > The root cause is that the queue_id (11) is invalid, the queue_id comes > from mbuf.hash.txadapter.txq which may pre-write by NIC driver when > receiving packets (e.g. pre-write mbuf.hash.fdir.hi field). > > Because this example only enabled one ethdev queue, so fixes it by reset > txq to zero in the first worker stage. > > [1] dpdk-eventdev_pipeline -l 0-48 --vdev event_sw0 -- -r1 -t1 -e1 -w ff0 > -s5 -n0 -c32 -W1000 -D > When launch eventdev_pipeline with command [1], event_sw > > Fixes: 81fb40f95c82 ("examples/eventdev: add generic worker pipeline") > Cc: stable@dpdk.org > > Signed-off-by: Chengwen Feng > Signed-off-by: Chenxingyu Wang > Acked-by: Pavan Nikhilesh Applied to dpdk-next-eventdev/for-main. Thanks > > --- > v2: fix check patch and git log issues. > > --- > .mailmap | 1 + > examples/eventdev_pipeline/pipeline_worker_generic.c | 12 ++++++++---- > 2 files changed, 9 insertions(+), 4 deletions(-) > > diff --git a/.mailmap b/.mailmap > index 4a508bafad..cee686e029 100644 > --- a/.mailmap > +++ b/.mailmap > @@ -236,6 +236,7 @@ Cheng Peng > Chengwen Feng > Chenmin Sun > Chenming Chang > +Chenxingyu Wang > Chenxu Di > Chenyu Huang > Cheryl Houser > diff --git a/examples/eventdev_pipeline/pipeline_worker_generic.c b/examp= les/eventdev_pipeline/pipeline_worker_generic.c > index 783f68c91e..831d7fd53d 100644 > --- a/examples/eventdev_pipeline/pipeline_worker_generic.c > +++ b/examples/eventdev_pipeline/pipeline_worker_generic.c > @@ -38,10 +38,12 @@ worker_generic(void *arg) > } > received++; > > - /* The first worker stage does classification */ > - if (ev.queue_id =3D=3D cdata.qid[0]) > + /* The first worker stage does classification and sets tx= q. */ > + if (ev.queue_id =3D=3D cdata.qid[0]) { > ev.flow_id =3D ev.mbuf->hash.rss > % cdata.num_fids; > + rte_event_eth_tx_adapter_txq_set(ev.mbuf, 0); > + } > > ev.queue_id =3D cdata.next_qid[ev.queue_id]; > ev.op =3D RTE_EVENT_OP_FORWARD; > @@ -96,10 +98,12 @@ worker_generic_burst(void *arg) > > for (i =3D 0; i < nb_rx; i++) { > > - /* The first worker stage does classification */ > - if (events[i].queue_id =3D=3D cdata.qid[0]) > + /* The first worker stage does classification and= sets txq. */ > + if (events[i].queue_id =3D=3D cdata.qid[0]) { > events[i].flow_id =3D events[i].mbuf->has= h.rss > % cdata.num_fids; > + rte_event_eth_tx_adapter_txq_set(events[i= ].mbuf, 0); > + } > > events[i].queue_id =3D cdata.next_qid[events[i].q= ueue_id]; > events[i].op =3D RTE_EVENT_OP_FORWARD; > -- > 2.17.1 >