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 9B447A0544; Wed, 8 Jun 2022 12:31:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4719B4069C; Wed, 8 Jun 2022 12:31:57 +0200 (CEST) Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) by mails.dpdk.org (Postfix) with ESMTP id 8EB5D40689 for ; Wed, 8 Jun 2022 12:31:56 +0200 (CEST) Received: by mail-qt1-f179.google.com with SMTP id hf10so14554787qtb.7 for ; Wed, 08 Jun 2022 03:31:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=31GDocr41i6YQ/v23b/4LvnGmG496cSulnQAV4jKlcY=; b=meOj6eZiB7xCWithFewMsqZsKXFqZmJxmBVBPD1XARXnY/yDgXHDl18wmQ7gpNrtZe 0Sxx5Swz/C5xIGdx+qGm4VxuweEPemOMGz0J6zNXiNqRYXpCPoDMJPa9vzRQl2/4px/s 6n8ojIV6B+1tke/QzarUtnp9TL4SzeDa6tS+RQBsonQTC4XQ1fYjonfal+C4IgQlmhdf 4vfIyWo0cVVIWUXf/8AKanMbAZvIO9KkYe+9dwKWkgLkka/AHnIyNd4tLKjDn6qYSEug 01L6r21ax9euLIsfKqx2aUbE61cfwAAAKhhEVjgNFP2/JlTaeKtZX5EOi5ZU3hmJKEom BvyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=31GDocr41i6YQ/v23b/4LvnGmG496cSulnQAV4jKlcY=; b=PTHu9QXR9TflVASZe2aBUsk/0ikRdnRsO49i0S978YWhmcXiuYX8XUZPRYKsJX0h43 UBuo+FCDqpIejV84oDttOcHtUPq6VRdmqQMybVIVLrXNk3FZqBVOwWrxv64NmuPR9+qh xT8H+dHaDM9a11GXexbJNKrcy41lDVVMvKCWi87FlHxMyBrwScL0yGYZwqFDh8Hg8Qru dmWofMRdNCK2nMQoA+w5w6KSChkzr2X9ichz9yOMEdisr7v48UHvDpuAJiY/yuWucYRr z3LMkRzk3LGoUe3p7SH9NDY3cn7gezBReQcjUWBVT6an1gwymHwlKHsjtRe2bDIKwpNL CwBA== X-Gm-Message-State: AOAM530w6Vi4NwHL16R0b7olr6xoE86r+S6Vg1LZFzJd2Lufy3tAGrP6 W2H5hkuuLGy4nELrBwz4vl7cSHnL/4g1e3ZAuUs= X-Google-Smtp-Source: ABdhPJwf6hNxfT/nhzrfstYduFYPdP8hBE0GpaUFD7twyW9m3019QKfe41ifpskfPLkj4Qoq8P6U4bKGRHUm01HIStc= X-Received: by 2002:a05:622a:83:b0:304:f777:1900 with SMTP id o3-20020a05622a008300b00304f7771900mr6866369qtw.410.1654684315901; Wed, 08 Jun 2022 03:31:55 -0700 (PDT) MIME-Version: 1.0 References: <20220607120014.49823-1-fengchengwen@huawei.com> In-Reply-To: <20220607120014.49823-1-fengchengwen@huawei.com> From: Jerin Jacob Date: Wed, 8 Jun 2022 16:01:29 +0530 Message-ID: Subject: Re: [PATCH] eal: fix segment fault when exit trace To: Chengwen Feng Cc: Thomas Monjalon , dpdk-dev , Anatoly Burakov , Jerin Jacob Content-Type: text/plain; charset="UTF-8" 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 Tue, Jun 7, 2022 at 5:36 PM Chengwen Feng wrote: > > Bug scenario: > 1. start testpmd: > dpdk-testpmd -l 4-6 -a 0000:7d:00.0 --trace=.* -- -i > 2. quit testpmd and then observed segment fault: > Bye... > Segmentation fault (core dumped) > > The root cause is that rte_trace_save() and eal_trace_fini() access > the huge pages which were cleanup by rte_eal_memory_detach(). > > This patch moves rte_trace_save() and eal_trace_fini() before > rte_eal_memory_detach() to fix the bug. > > Fixes: dfbc61a2f9a6 ("mem: detach memsegs on cleanup") > Cc: stable@dpdk.org > > Signed-off-by: Chengwen Feng Tested-by: Jerin Jacob > --- > lib/eal/linux/eal.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c > index 1ef263434a..c6f2056197 100644 > --- a/lib/eal/linux/eal.c > +++ b/lib/eal/linux/eal.c > @@ -1266,13 +1266,13 @@ rte_eal_cleanup(void) > vfio_mp_sync_cleanup(); > #endif > rte_mp_channel_cleanup(); > + rte_trace_save(); > + eal_trace_fini(); > /* after this point, any DPDK pointers will become dangling */ > rte_eal_memory_detach(); > eal_mp_dev_hotplug_cleanup(); > rte_eal_malloc_heap_cleanup(); > rte_eal_alarm_cleanup(); > - rte_trace_save(); > - eal_trace_fini(); > eal_cleanup_config(internal_conf); > rte_eal_log_cleanup(); > return 0; > -- > 2.33.0 >