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 96868A0032; Sat, 13 Nov 2021 18:29:20 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1955240691; Sat, 13 Nov 2021 18:29:20 +0100 (CET) Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by mails.dpdk.org (Postfix) with ESMTP id 66AF04013F for ; Sat, 13 Nov 2021 18:29:19 +0100 (CET) Received: by mail-pj1-f48.google.com with SMTP id j6-20020a17090a588600b001a78a5ce46aso9677800pji.0 for ; Sat, 13 Nov 2021 09:29:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:subject:message-id:mime-version :content-transfer-encoding; bh=TziZlX9xZMrQUhgHAGLB0VIiaSF/RLos0TeQA0eTY7o=; b=eyJGjowy6oXd8lmhYp3R9QhjJM6V/ROHzGWggp1BfuJ430YGeWNUX8E5/Yn5zfCWF+ enI6pV4QnfKYQr2qgFXMQQ8oShdkpJ19wL10RzNfiUZaXxpZFpDLf5/utjPaVpj+ziqM 422bqzthB5QB6VZiDogq+LEQW781Es+DdG3NVKXntS69SqeAMyjT/DCHnMsZ8TdDgMNX kPb/2v5tAWeWBQw4yO/UohxprwJTRCMjH0Aio/GtJ7q8axDW0vnSsJOSF1D0Zvzv1bS8 BTbLmgLMe3lGzQVJBgM2atA1MrkI1n8DDzz1njpMRmwEI1XcEezeUxmoOckUVHzNDP1d f/Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-transfer-encoding; bh=TziZlX9xZMrQUhgHAGLB0VIiaSF/RLos0TeQA0eTY7o=; b=oFlpw83Ej0YxXhvyoOyPpC4hDWojj6MIDDNdDve4ViJ2yNjZZ+DEDRhTpbBiaDGMvb ydyG5nwWLBx/FIBm5rR6UIZAigISN0rqCTZmth9lFWMoDsi4T+ZbSXnWGEf9syh67vfG LY3jcj197mvFHxT92o9Eo+EKhEtllavZMHMUCzpln9mihRuXOFzSUbXbs+06wwCWz2lR ehXdKhRIiRr9MRvukA/qyYU1/QnJC0d0cMPjQojRiOA90k7u7kbDS1K7M2DBgI4Yo0NS 0CICYaEl15pK9Bmtnl+ukYYVhh9H4aO56g4W3E/+eu6Pmg5ipO35SlSJ9wNPQTllZDZw Ppkg== X-Gm-Message-State: AOAM533HQws69B4OyUoUJ8vw0hcYA1+CInu3cMsOi+265oDIFGDtwcYH ff4SAt6/hGyj9PJtd25HmK6l7aiyUu2Z1A== X-Google-Smtp-Source: ABdhPJzUcIBgXH6dcNU/N+TdlUoGjRF015Rr2OGwnhXCv/YALK+7HYpt228IMCNAEbaIU2dUYVfmqQ== X-Received: by 2002:a17:90b:3908:: with SMTP id ob8mr29358546pjb.57.1636824558113; Sat, 13 Nov 2021 09:29:18 -0800 (PST) Received: from hermes.local (204-195-33-123.wavecable.com. [204.195.33.123]) by smtp.gmail.com with ESMTPSA id c20sm11164919pfl.201.2021.11.13.09.29.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Nov 2021 09:29:17 -0800 (PST) Date: Sat, 13 Nov 2021 09:29:15 -0800 From: Stephen Hemminger To: dev@dpdk.org Subject: test_debug: calling rte_exit() in a forked child Message-ID: <20211113092915.225bbd3f@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 This test looks bogus it is doing something that DPDK as a library really shouldn't allow: /* use fork() to test rte_exit() */ static int test_exit_val(int exit_val) { int pid; int status; /* manually cleanup EAL memory, as the fork() below would otherwise * cause the same hugepages to be free()-ed multiple times. */ rte_service_finalize(); pid = fork(); if (pid == 0) rte_exit(exit_val, __func__); The problem is that rte_exit in the child process will end up calling rte_eal_cleanup(). But rte_eal_init was never called in the forked process it just inherits the state in the child; the service finalize comment hints at the problem. Why does it matter? Well if rte_eal_cleanup ends up trying to do the right thing and cleanup the worker threads it will fail because in the child process, those threads are not related (they are threads in the parent not the child). The question is does rte_exit() have to be allowed for the case where rte_eal_init() never succeeded in that process context? It looks like the eal_init() run_once flag should also be checked int eal_cleanup() to avoid doing cleanup if never initted? Alternatively, rte_exit() could never call eal_cleanup?