From patchwork Sat Jan 4 01:33:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 64198 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A0B72A04DD; Sat, 4 Jan 2020 02:34:02 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F38031D515; Sat, 4 Jan 2020 02:33:53 +0100 (CET) Received: from mail-pj1-f67.google.com (mail-pj1-f67.google.com [209.85.216.67]) by dpdk.org (Postfix) with ESMTP id 820A11D501 for ; Sat, 4 Jan 2020 02:33:51 +0100 (CET) Received: by mail-pj1-f67.google.com with SMTP id kx11so5205449pjb.4 for ; Fri, 03 Jan 2020 17:33:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Q1ASW5G4GyNaqPRmx2JfkXHsJxMS+tbeKnlEF3gNxPw=; b=U1/AXaHLius3ILKn4DgrhlLInsyN1ntcQ3ilgwo9QCZg6znx1NZXreCPqCqyBaPQOP s/dX+VO4i3Lhb2LY4dHBLrRIS9skkQpcj/1tEsGyDGE6OuHXBK58f5CdYxOLi6mjD+FN oqMtaLUPG0BTIvgUqxWb86pvDjpZjQYJn8Rzv4IlvwjpW9aUlyNdm0upHvWnsgsp15HV WWZ107Ur5jiaOR7CoC6OeWBjzk4GRNFdo9MKdrbXl0iLnguHahPghNj/unJtTu/6uMa0 M6VcQ7EtXgon/sdTkhMvZPQ1afeoH5PF8+dkRO1J2tGqWtMfCLhdwX08FOWSxjTllw2f FPIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Q1ASW5G4GyNaqPRmx2JfkXHsJxMS+tbeKnlEF3gNxPw=; b=rJIVyyRBdWt0FoGaVGF2Cpl3weXsVdLn5WHGjrFUrC1rwRInCskfD0M3frExkh7xUv 5MOnIhidoyqPma/sHsTtcnAeEzM0i9beCTLGYWxRyjWJCBrs8ntyfPP54AeWpfHy3RHC fDofZYAlb2brAIT4GkpIPiVa9vn8LkUXF+a40qc3RU/5u7DlgJrmr+fwifPVTfR6RF2+ +WyDYYzVhgoAB63ejz8p/M3ERUGI1BKK82/qkK5WuzgCXXZmeWGkPzthlvLyc3NHJ2T6 7c8MTyDy+2cnfASelw5CEdJqUlpXhZbfR3TJ7iSBVepjZqR3JPYmOJ6qaL3rt25FtFY6 fe0A== X-Gm-Message-State: APjAAAUnLpU8KL1RhFGGlr9gms2UNFMMLavxodTxFj0VZSXzfZDJvFcu 9I3KepiDDJevf1r9kPTPT/FJI8DrMiA= X-Google-Smtp-Source: APXvYqxI+jjti10YNdtycxEBvt3ZV+DaWzExoTXXOtezARveLUosThWaJZXX8QNE18wGMYnvgFz7kQ== X-Received: by 2002:a17:90a:c697:: with SMTP id n23mr29277840pjt.37.1578101630298; Fri, 03 Jan 2020 17:33:50 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id j6sm16212934pjv.10.2020.01.03.17.33.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 17:33:49 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Fri, 3 Jan 2020 17:33:28 -0800 Message-Id: <20200104013341.19809-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200104013341.19809-1-stephen@networkplumber.org> References: <20200104013341.19809-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 01/14] eal: log: close on cleanup X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When application calls rte_eal_cleanup on shutdown, the DPDK log should be closed and cleaned up. Fixes: af75078fece3 ("first public release") Signed-off-by: Stephen Hemminger --- lib/librte_eal/common/eal_common_log.c | 12 ++++++++++++ lib/librte_eal/common/eal_private.h | 13 +++++++++++++ lib/librte_eal/linux/eal/eal.c | 1 + lib/librte_eal/linux/eal/eal_log.c | 14 ++++++++++++++ 4 files changed, 40 insertions(+) diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c index c0efd5214fa9..64d6e20947ed 100644 --- a/lib/librte_eal/common/eal_common_log.c +++ b/lib/librte_eal/common/eal_common_log.c @@ -463,3 +463,15 @@ eal_log_set_default(FILE *default_log) "Debug dataplane logs available - lower performance\n"); #endif } + +/* + * Called by envrionment-specific cleanup function. + */ +void +eal_log_cleanup(void) +{ + if (default_log_stream) { + fclose(default_log_stream); + default_log_stream = NULL; + } +} diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h index 8a9d493f0c54..fdd942d71a36 100644 --- a/lib/librte_eal/common/eal_private.h +++ b/lib/librte_eal/common/eal_private.h @@ -90,6 +90,12 @@ int rte_eal_memzone_init(void); */ void eal_log_set_default(FILE *default_log); +/** + * Common log cleanup function (private to eal). + * Closes the default log stream. Called from rte_eal_cleanup(). + */ +void eal_log_cleanup(void); + /** * Fill configuration with number of physical and logical processors * @@ -151,6 +157,13 @@ int rte_eal_timer_init(void); */ int rte_eal_log_init(const char *id, int facility); +/** + * Close the default log stream + * + * This function is private to EAL. + */ +void rte_eal_log_cleanup(void); + /** * Save the log regexp for later */ diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c index c4233ec3c8ac..a3381fd01a23 100644 --- a/lib/librte_eal/linux/eal/eal.c +++ b/lib/librte_eal/linux/eal/eal.c @@ -1327,6 +1327,7 @@ rte_eal_cleanup(void) rte_service_finalize(); rte_mp_channel_cleanup(); eal_cleanup_config(&internal_config); + rte_eal_log_cleanup(); return 0; } diff --git a/lib/librte_eal/linux/eal/eal_log.c b/lib/librte_eal/linux/eal/eal_log.c index 9d02dddbed33..e1adbc91637a 100644 --- a/lib/librte_eal/linux/eal/eal_log.c +++ b/lib/librte_eal/linux/eal/eal_log.c @@ -37,8 +37,16 @@ console_log_write(__attribute__((unused)) void *c, const char *buf, size_t size) return ret; } +static int +console_log_close(__attribute__((unused)) void *c) +{ + closelog(); + return 0; +} + static cookie_io_functions_t console_log_func = { .write = console_log_write, + .close = console_log_close, }; /* @@ -60,3 +68,9 @@ rte_eal_log_init(const char *id, int facility) return 0; } + +void +rte_eal_log_cleanup(void) +{ + eal_log_cleanup(); +} From patchwork Sat Jan 4 01:33:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 64199 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E8AA8A04DD; Sat, 4 Jan 2020 02:34:11 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B50CE1D523; Sat, 4 Jan 2020 02:33:55 +0100 (CET) Received: from mail-pj1-f68.google.com (mail-pj1-f68.google.com [209.85.216.68]) by dpdk.org (Postfix) with ESMTP id E361C1D50F for ; Sat, 4 Jan 2020 02:33:52 +0100 (CET) Received: by mail-pj1-f68.google.com with SMTP id j11so5213857pjs.1 for ; Fri, 03 Jan 2020 17:33:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3V/PyXSkQ6Kas8dlVEV3BLmfn15GIMCv9VsMg2bfyJs=; b=jz5IbWjMd1rD9zr02sHJQLIyFp33F2XJtuZjMXzZwKH0+gC4dI+NOCaft+zRS5TxjB HIiE+DXIF7Gcwvi1eGViG6RNWnLAraGk99oJBLfixG382Szo4eXrNVtxZmW8mKigWwrI tD/OBG3FMI3+2NtVed2eab7DdEYEtCvKcuz2HTfvV6n5Hv+H7WonXipIXXFMATZsHNC7 g+jOYuCnwRVWBeHRifg+kQTDi4rFxvOWYiDPrSQejTQQKI2s0+wEZfUSGAxmX40LxGgU QEpxFsWelwrEEw/RP7ULb0VTnMg389u0mBsfEtAO+5np6KOyeDrsz+RW7IYQ1oy81B3Y NtoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3V/PyXSkQ6Kas8dlVEV3BLmfn15GIMCv9VsMg2bfyJs=; b=tgA7+W1n4fnlZWozChnHedrej1XiAIu9B18Tx+f/vfSNnYQXoduVNgyBoR8kvA8cSm 4uLhShNAqzAD1fKnhx7nVI3GGP+cpFCxbPlXlzWc1agjdnKuG2PnHQeMBPe5K1DOLbbQ pn1U3yQ6QPvEAyfeyBvYdmBOxU1U67AkGGYNGV5JvCw+fmgSHaWI4by+2Lh+PfES3G/X HZGIJgkCVA5nacKJHkGfO+Xt812OvUofLq8iDTxlvJqpKpAkRSzgWaT/+6rXic1GSou/ 4ZvlODFPOQGf2gjs3chmryT1cYijeoANskFX/MqP+hj8fSLXqS8x0pSyWoyH0m75mYAX oMZw== X-Gm-Message-State: APjAAAW2Rd7GxPuQ6yEXjyJ4lDZtC5gd0TLT/N+aydC79CynC2q5WDqo 0TdZpxH1mQ4hcek3PrgKbhBAUy7phW0= X-Google-Smtp-Source: APXvYqz/4B6dcrEOjTP4J5LL4FRSpoiPvjfsDXFhvltcAMdU/J+jVdSMyIPRn1tKW3CIid8ZcFicpw== X-Received: by 2002:a17:902:ff07:: with SMTP id f7mr52011920plj.12.1578101631658; Fri, 03 Jan 2020 17:33:51 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id j6sm16212934pjv.10.2020.01.03.17.33.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 17:33:50 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , olivier.matz@6wind.com Date: Fri, 3 Jan 2020 17:33:29 -0800 Message-Id: <20200104013341.19809-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200104013341.19809-1-stephen@networkplumber.org> References: <20200104013341.19809-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 02/14] eal: log: free dynamic state on cleanup X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When rte_eal_cleanup is called, free all the memory associated with dynamic log levels and types. Fixes: c1b5fa94a46f ("eal: support dynamic log types") Cc: olivier.matz@6wind.com Signed-off-by: Stephen Hemminger --- lib/librte_eal/common/eal_common_log.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c index 64d6e20947ed..7583bdc57619 100644 --- a/lib/librte_eal/common/eal_common_log.c +++ b/lib/librte_eal/common/eal_common_log.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "eal_private.h" @@ -54,7 +55,7 @@ struct log_cur_msg { }; struct rte_log_dynamic_type { - const char *name; + char *name; uint32_t loglevel; }; @@ -470,8 +471,23 @@ eal_log_set_default(FILE *default_log) void eal_log_cleanup(void) { + struct rte_eal_opt_loglevel *opt_ll, *tmp; + size_t i; + if (default_log_stream) { fclose(default_log_stream); default_log_stream = NULL; } + + TAILQ_FOREACH_SAFE(opt_ll, &opt_loglevel_list, next, tmp) { + free(opt_ll->pattern); + free(opt_ll); + } + + for (i = 0; i < rte_logs.dynamic_types_len; i++) + free(rte_logs.dynamic_types[i].name); + + rte_logs.dynamic_types_len = 0; + free(rte_logs.dynamic_types); + rte_logs.dynamic_types = NULL; } From patchwork Sat Jan 4 01:33:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 64200 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id BB8BAA04DD; Sat, 4 Jan 2020 02:34:20 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7A01E1D52A; Sat, 4 Jan 2020 02:33:57 +0100 (CET) Received: from mail-pj1-f68.google.com (mail-pj1-f68.google.com [209.85.216.68]) by dpdk.org (Postfix) with ESMTP id 05C171D517 for ; Sat, 4 Jan 2020 02:33:54 +0100 (CET) Received: by mail-pj1-f68.google.com with SMTP id a6so5214834pjh.2 for ; Fri, 03 Jan 2020 17:33:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EP80VzQGIYIUwGQ04eiy90tGLwHtyt0B/Qq0yuZ5rd8=; b=P913u1JLQZgE5IJJJGBF4E5+JiMKTeCcWjQrOLw1zFvk+5Nt25laESt1r/8nAwp8/N k+YazdWfokzxdj8KHiQq5riDiurVxPtRR+ImwdPmTUv4WATdBHHa2EaPMxNYUMROLtLx ohxLx0igMAT5WQ/cB2I5DCYeHgshBxr0HwwaDL4uXecXL6kFVx9lM05+lFwZ+bcYxS7F dQsf/ZN5QyvfOt7PWVC7KPMB9+/ymVlkn96fTmnq8FFKsy4Y2faFGFHOQYPVIN2Xu6UZ aY/oaX475KTCW3Bpp3U842hrJrSw9yXGAWxxDKy6ZcDEISt3SLrWsHkncDoNdQC6M+os NwIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EP80VzQGIYIUwGQ04eiy90tGLwHtyt0B/Qq0yuZ5rd8=; b=Hv8yb30kUfSRo9oVnu+nThPUemlS094iCVD2RkZepL7WjqFhBfrtgEIHUfVjbiMdr9 dRSBC/8TyaK0msgOZJkBgb+QxKuuM1f/LY6jGBrC5WmM/Lj24VuehiVsv8IIkx7d6mr2 dG8UUbIaZEyjboh0L8reDST9DneYONZlInt5cVn7BOWxXrYQVTH3sUpH0e6bqgCeJUNa 9S5UUObyP1Hm/MHz2V86OwEZeqzsQV8pM89jm6nMrXxf+PlP3Yl5/Q0CZao2HcIo6Yax gCvi/6TX9A5FE+GMHlChWfU2v57K4rflPaQjv75GcwEh/+xQPn2qKj+CQb9qsYvF8Kk+ AvRg== X-Gm-Message-State: APjAAAVdx9YzYvq7LgsDqMdrtEaanCpztrrmhKiPOwl2uSJg/KdFGA2O dh2xKYuUwIywyd8SlrEdBIgv45aoaRw= X-Google-Smtp-Source: APXvYqxNIBLRXyQXlVi5AxrMbai+uWmRAeVhhrEF/w8d4AA7CuEwZSurJnoLr8qNvroo1d6xfGcw5g== X-Received: by 2002:a17:90a:3a86:: with SMTP id b6mr30012224pjc.96.1578101632859; Fri, 03 Jan 2020 17:33:52 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id j6sm16212934pjv.10.2020.01.03.17.33.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 17:33:52 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Fri, 3 Jan 2020 17:33:30 -0800 Message-Id: <20200104013341.19809-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200104013341.19809-1-stephen@networkplumber.org> References: <20200104013341.19809-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 03/14] eal: alarm: close timerfd on eal cleanup X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Calling rte_eal_cleanup() should cause DPDK to cleanup all outstanding resources including file descriptors. Signed-off-by: Stephen Hemminger --- lib/librte_eal/common/eal_private.h | 7 +++++++ lib/librte_eal/linux/eal/eal.c | 1 + lib/librte_eal/linux/eal/eal_alarm.c | 11 +++++++++++ 3 files changed, 19 insertions(+) diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h index fdd942d71a36..38682e79827c 100644 --- a/lib/librte_eal/common/eal_private.h +++ b/lib/librte_eal/common/eal_private.h @@ -202,6 +202,13 @@ int rte_eal_intr_init(void); */ int rte_eal_alarm_init(void); +/** + * Cleanup alarm resources. + * + * This function is private to EAL. + */ +void rte_eal_alarm_cleanup(void); + /** * Function is to check if the kernel module(like, vfio, vfio_iommu_type1, * etc.) loaded. diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c index a3381fd01a23..a1b928820b11 100644 --- a/lib/librte_eal/linux/eal/eal.c +++ b/lib/librte_eal/linux/eal/eal.c @@ -1325,6 +1325,7 @@ rte_eal_cleanup(void) if (rte_eal_process_type() == RTE_PROC_PRIMARY) rte_memseg_walk(mark_freeable, NULL); rte_service_finalize(); + rte_eal_alarm_cleanup(); rte_mp_channel_cleanup(); eal_cleanup_config(&internal_config); rte_eal_log_cleanup(); diff --git a/lib/librte_eal/linux/eal/eal_alarm.c b/lib/librte_eal/linux/eal/eal_alarm.c index 0924c9205c84..e6aeee933ece 100644 --- a/lib/librte_eal/linux/eal/eal_alarm.c +++ b/lib/librte_eal/linux/eal/eal_alarm.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -72,6 +73,16 @@ rte_eal_alarm_init(void) return -1; } +void +rte_eal_alarm_cleanup(void) +{ + if (intr_handle.fd == -1) + return; + + close(intr_handle.fd); + intr_handle.fd = -1; +} + static void eal_alarm_callback(void *arg __rte_unused) { From patchwork Sat Jan 4 01:33:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 64201 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A4643A04DD; Sat, 4 Jan 2020 02:34:31 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A96E91D538; Sat, 4 Jan 2020 02:33:59 +0100 (CET) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by dpdk.org (Postfix) with ESMTP id 4DE251D51D for ; Sat, 4 Jan 2020 02:33:55 +0100 (CET) Received: by mail-pg1-f196.google.com with SMTP id b137so24142447pga.6 for ; Fri, 03 Jan 2020 17:33:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Oyl74YOTBn8D11KizXfAhLy6Ct8Bthw2Jprwg24xr5I=; b=TOQ99Qq7IEae0o6a4LQtZe5/wekTNGm+PUFupWvSm8ii9LxBswPjgkYTZosEQRy7Yt fqw6KQwM29sp1LRZytcWooy8fx9Xyf3zPfg2GD4pEzzabCqb7YOivd1OKePVrBb26Nyb U9LbTsEjbZuG8Z7G54TL+6hxByFr85hfqAU5hOYueQMZxlNwKymgQqith9Z1NuPdndRw JCLX+0yr7Z6cjw6awSCxtn7+jv++F14ikR69XEi065+02h3d+ufDeQZ3+0B6pMbGx9He bnmbIbR9H0ilazcMlEwWkBDofhgzUHb5ed7sJg1VGkEP3ab6JQ1cpMM+HmKI/BHDe8rL J9ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Oyl74YOTBn8D11KizXfAhLy6Ct8Bthw2Jprwg24xr5I=; b=DHuLQdEfDjPIYO7iAcpe6O+D+luqYvO7AqHIjOtpdxNVE3fXs6KlSccpXC/DtH7aC7 KDVTjaIBcqpmz1Zs7xMmseWAvXF6Tfb+CNYw3S2rmgcL+MlM3x3i7DAsKPuFBsUrWdOj WCqFfcGp+ddCoX9VycwxidzrVRODBsYMGSTyk2386c5KWNnFD0abMgm0ZOkKZVroIR9x Nl6tTuFVNtOXOHu61mEATRzIAxByje8G0uO0EO5QcKGP2Kv8TEood7OJ/v+oSXZIDPVU jZ2AePeM8XFbIfkbOLCW+45yDzPvCt6krt6vnjOWI0ucqCOz1JEgF2Aw//o73FVJtQxW thAg== X-Gm-Message-State: APjAAAU0PekuYQNGGB4fg5rInhcKjB3zZ0EYyV2z36fhA3DxRSM/WsnT PVm4oND77d/DokITSK3pgK3VU0bvn1Q= X-Google-Smtp-Source: APXvYqwqgJ28J3YpoYbgMbOk7LU7pVBW8CCRVjMTKDB1w0oWw03ieDiLEX03X+ZLSHskpDfDOom1zA== X-Received: by 2002:a63:444c:: with SMTP id t12mr96474455pgk.433.1578101634089; Fri, 03 Jan 2020 17:33:54 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id j6sm16212934pjv.10.2020.01.03.17.33.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 17:33:53 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Fri, 3 Jan 2020 17:33:31 -0800 Message-Id: <20200104013341.19809-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200104013341.19809-1-stephen@networkplumber.org> References: <20200104013341.19809-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 04/14] eal: cleanup threads X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When rte_eal_cleanup is called it should stop all the child threads and close the pipes between threads. Signed-off-by: Stephen Hemminger Acked-by: Aaron Conole --- lib/librte_eal/linux/eal/eal.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c index a1b928820b11..d98a2afe85da 100644 --- a/lib/librte_eal/linux/eal/eal.c +++ b/lib/librte_eal/linux/eal/eal.c @@ -1319,11 +1319,24 @@ mark_freeable(const struct rte_memseg_list *msl, const struct rte_memseg *ms, int rte_eal_cleanup(void) { + int i; + /* if we're in a primary process, we need to mark hugepages as freeable * so that finalization can release them back to the system. */ if (rte_eal_process_type() == RTE_PROC_PRIMARY) rte_memseg_walk(mark_freeable, NULL); + + RTE_LCORE_FOREACH_SLAVE(i) { + pthread_cancel(lcore_config[i].thread_id); + pthread_join(lcore_config[i].thread_id, NULL); + + close(lcore_config[i].pipe_master2slave[0]); + close(lcore_config[i].pipe_master2slave[1]); + close(lcore_config[i].pipe_slave2master[0]); + close(lcore_config[i].pipe_slave2master[1]); + } + rte_service_finalize(); rte_eal_alarm_cleanup(); rte_mp_channel_cleanup(); From patchwork Sat Jan 4 01:33:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 64202 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3B3C2A04DD; Sat, 4 Jan 2020 02:34:39 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 881091D522; Sat, 4 Jan 2020 02:34:01 +0100 (CET) Received: from mail-pj1-f68.google.com (mail-pj1-f68.google.com [209.85.216.68]) by dpdk.org (Postfix) with ESMTP id EB2CB1D527 for ; Sat, 4 Jan 2020 02:33:56 +0100 (CET) Received: by mail-pj1-f68.google.com with SMTP id bg7so5353288pjb.5 for ; Fri, 03 Jan 2020 17:33:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xxeb7t92o0tojQKq8wkvvjXExuQ6Ub6YujsdRzIxFg4=; b=v1qMLsBhDhC37cSK+qTrMVjrJglb9YyQUKwBoE+2VM3XdLPDipB8JwftwK1B9CxVaG 8eDLCTh9lpVDvK/2itTwPBvBcvNgXhXqtKtwzGwxdmSk0PjngbpRzl7rTkwsKgVHxWki Cds8g87Yn5IlE0VJX66YXNjVlTmt5Byz1ulp+bbQ65HO0SZfEBNNbxB/AA9DCWuEwnMm xiT03xzX6Nrbq3bRD4j0cJBPDa1EIYCifZvRgfgBFuNx1ABqjdpjMHYe9wv3nabhhvw+ 4I0u5PXal3GYuxIcvFmClDma8rMOp/eeWdWVASyQHNNX5FTKVdAfsvqRtyJN07dJHaG9 kvQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xxeb7t92o0tojQKq8wkvvjXExuQ6Ub6YujsdRzIxFg4=; b=p1SShmXfmnO8urV4v0S14ohpEDOZnZTMvI3uLKL10ZwyexhLQgsQ/i4Y+iM745RrOY 6NBr7MSNozvIRX8dBAeyg6NmhcYQWlS/pn6MOqXDli3fTSM++10pNROIQzaTrrN/AovT kjAuwm+IP4FLdhztKisbHKJhKCJ44Z6k8e4QYiBKsTdsY/hwP16iHtmAPXk5UbpyORsn hj08Nruo+eSQe3HQHergPI7X/J0zSyqpEu8j1CE9ACH3ZEi46JeY5kmui2tjIIQ7Q9FX nds/96mm6ye0RFxrvTXAz/GkumRNFO1be+Y2rVq9gDWsHW1RSsLzlwYsWlvpHpcqxN1X Avkw== X-Gm-Message-State: APjAAAXxKfutFuW4DF8WhTFz+6UiGo/wMZPPiBZj1Wj6kOdZDPs9kS5v uZAyWU7Rqez8qTKMM2ivK4AArvduSio= X-Google-Smtp-Source: APXvYqxYB1V54HgGPSIOfnW0TdWNBowG3U6D093xpScwwXubv50DrfpdMLDlyBuJa/ET/Kqnt1Ht1g== X-Received: by 2002:a17:902:b611:: with SMTP id b17mr95245830pls.210.1578101635544; Fri, 03 Jan 2020 17:33:55 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id j6sm16212934pjv.10.2020.01.03.17.33.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 17:33:54 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Fri, 3 Jan 2020 17:33:32 -0800 Message-Id: <20200104013341.19809-6-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200104013341.19809-1-stephen@networkplumber.org> References: <20200104013341.19809-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 05/14] eal: intr: cleanup resources X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When rte_eal_cleanup is called the interrupt thread and associated resources should be cleaned up. Signed-off-by: Stephen Hemminger --- lib/librte_eal/common/eal_private.h | 10 ++++++++++ lib/librte_eal/linux/eal/eal.c | 1 + lib/librte_eal/linux/eal/eal_interrupts.c | 9 +++++++++ 3 files changed, 20 insertions(+) diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h index 38682e79827c..c62f35d3ac0f 100644 --- a/lib/librte_eal/common/eal_private.h +++ b/lib/librte_eal/common/eal_private.h @@ -191,6 +191,16 @@ int rte_eal_tailqs_init(void); */ int rte_eal_intr_init(void); +/** + * Cleanup interrupt handling. + * + * This function is private to EAL. + * + * @return + * 0 on success, negative on error + */ +void rte_eal_intr_cleanup(void); + /** * Init alarm mechanism. This is to allow a callback be called after * specific time. diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c index d98a2afe85da..eb95f4f0c317 100644 --- a/lib/librte_eal/linux/eal/eal.c +++ b/lib/librte_eal/linux/eal/eal.c @@ -1338,6 +1338,7 @@ rte_eal_cleanup(void) } rte_service_finalize(); + rte_eal_intr_cleanup(); rte_eal_alarm_cleanup(); rte_mp_channel_cleanup(); eal_cleanup_config(&internal_config); diff --git a/lib/librte_eal/linux/eal/eal_interrupts.c b/lib/librte_eal/linux/eal/eal_interrupts.c index 14ebb108cee9..fa08ac4171bd 100644 --- a/lib/librte_eal/linux/eal/eal_interrupts.c +++ b/lib/librte_eal/linux/eal/eal_interrupts.c @@ -1137,6 +1137,15 @@ rte_eal_intr_init(void) return ret; } +void +rte_eal_intr_cleanup(void) +{ + pthread_cancel(intr_thread); + pthread_join(intr_thread, NULL); + close(intr_pipe.readfd); + close(intr_pipe.writefd); +} + static void eal_intr_proc_rxtx_intr(int fd, const struct rte_intr_handle *intr_handle) { From patchwork Sat Jan 4 01:33:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 64203 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1C232A04DD; Sat, 4 Jan 2020 02:34:48 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 98CE21D544; Sat, 4 Jan 2020 02:34:03 +0100 (CET) Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by dpdk.org (Postfix) with ESMTP id 40F461D527 for ; Sat, 4 Jan 2020 02:33:58 +0100 (CET) Received: by mail-pf1-f194.google.com with SMTP id p14so24242956pfn.4 for ; Fri, 03 Jan 2020 17:33:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PsbFGiuqVzUnCaOerMQu4RnG5MXl0k+UnOHZoH5rQdc=; b=pbTl2Jr2GGVwBUC37wEggvcyMm7BS6bS4nVku+RJvj/i+v4TPMi2zl00tPT+O/4CE0 Oix8oQsWl+jGFq4IkxdcBGYXyUPe6mu4KZoE4H2lpgb7GMfOh7+WVT6RPGWI8gl+2Jfl KTPuvBm8ryW/m0uRBHBtYYwfaAN9BIH66pyLoxEygmFTY82bxujH5jDrSvys3R1ets4S vn764lAmZ/N0yBOp6gbYwyje5ZQeUf2Lg5HY0oIcQSYvqAnePFbTRw+OwfHx8G/Wqux7 zzlMMEZG0Vf61VAXgdeyb5Epjhm0R0V8CjUlvFef9fzXRXt/LzDI2KzqFQxO4dlzK6UU jBaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PsbFGiuqVzUnCaOerMQu4RnG5MXl0k+UnOHZoH5rQdc=; b=kPlAmNQSOZpe49WtYJKVjisDVZXpv+5LbUL9qlltstHhNUJpKAw9HzXzgMglI0zmPt YO6KGWkQ++aQaIQR/CaWpg+6+TjXlLwWp5HJASkYi7CoweBz8WdALg/Shk0u9ZpqfAv/ ITcszVl4ovLLB8kFOudnANxB1iddZPt+5hH/RBcxgxl6s0xg1/h8E35+3ua0R4wGdl9z zoqeDKe5eBOiIZ8qHxHKjE4pU7qTV3379Qctrs/CnipkizKlhKtlsT4V5+yndC3ppNDi odxolBwkSebXy6MI4pwFQbPTKTbbS13hiK/t8u6MS5cPpFNoVxsC/8ii3QwsK+l1oIgc xOnA== X-Gm-Message-State: APjAAAWHobFMWTQspWXHxhvjswisOmKpvPg6uUYSPP0oOw3fZxTpVFE0 bezmDqvtBFoLrzbk8RyHjxv4mfBIu6I= X-Google-Smtp-Source: APXvYqzdWTH3WXCDnSteZkKMfL046ixZryY8gj0Z/wmSC2d8Ym9bEh27Sylb5S6nLMzOGs+Zwpj43Q== X-Received: by 2002:a63:1908:: with SMTP id z8mr99875054pgl.350.1578101636864; Fri, 03 Jan 2020 17:33:56 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id j6sm16212934pjv.10.2020.01.03.17.33.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 17:33:56 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , qi.z.zhang@intel.com, stable@dpdk.org Date: Fri, 3 Jan 2020 17:33:33 -0800 Message-Id: <20200104013341.19809-7-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200104013341.19809-1-stephen@networkplumber.org> References: <20200104013341.19809-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 06/14] eal: mp: end the multiprocess thread during cleanup X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When rte_eal_cleanup is called, all control threads should exit. For the mp thread, this best handled by closing the mp_socket and letting the thread see that. This also fixes potential problems where the mp_socket gets another hard error, and the thread runs away repeating itself by reading the same error. Fixes: 85d6815fa6d0 ("eal: close multi-process socket during cleanup") Cc: qi.z.zhang@intel.com Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger Acked-by: Anatoly Burakov --- lib/librte_eal/common/eal_common_proc.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c index 935e8fefeba8..f369d8bf6dd8 100644 --- a/lib/librte_eal/common/eal_common_proc.c +++ b/lib/librte_eal/common/eal_common_proc.c @@ -276,8 +276,17 @@ read_msg(struct mp_msg_internal *m, struct sockaddr_un *s) msgh.msg_control = control; msgh.msg_controllen = sizeof(control); +retry: msglen = recvmsg(mp_fd, &msgh, 0); + + /* zero length message means socket was closed */ + if (msglen == 0) + return 0; + if (msglen < 0) { + if (errno == EINTR) + goto retry; + RTE_LOG(ERR, EAL, "recvmsg failed, %s\n", strerror(errno)); return -1; } @@ -305,7 +314,7 @@ read_msg(struct mp_msg_internal *m, struct sockaddr_un *s) RTE_LOG(ERR, EAL, "invalid received data length\n"); return -1; } - return 0; + return msglen; } static void @@ -376,10 +385,8 @@ mp_handle(void *arg __rte_unused) struct mp_msg_internal msg; struct sockaddr_un sa; - while (1) { - if (read_msg(&msg, &sa) == 0) - process_msg(&msg, &sa); - } + while (read_msg(&msg, &sa) > 0) + process_msg(&msg, &sa); return NULL; } From patchwork Sat Jan 4 01:33:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 64204 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id ED0B5A04DD; Sat, 4 Jan 2020 02:34:55 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A30DC1D54A; Sat, 4 Jan 2020 02:34:05 +0100 (CET) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by dpdk.org (Postfix) with ESMTP id 809AD1D535 for ; Sat, 4 Jan 2020 02:33:59 +0100 (CET) Received: by mail-pg1-f196.google.com with SMTP id k3so24154316pgc.3 for ; Fri, 03 Jan 2020 17:33:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=T5LXB1s2UIxR34Xe2jU+wA9i8ygptxAvHQpIZVUagwo=; b=cK66938/ByAJwYxyIApqtg+/aP18KNQaZzKj9rzuNnjoSsTuSQkf7Q+7n6utactIVA /7k9EIlGo1zeVhwmhwMsmn75fdQnANnpmakEyL3fUVRcL8LUUk4psgqsGa3LRJqb1qFF XuF/fzAmruyaNwGD+QQXozrA4qAkDzxqlagVgKdMA63YFKj36tbzpoD4rkjIon6bf92b emc5yX+HT/SH76I0T16nI7TTi57Xsn57vCARyEs7OW4zCoKrPIrn1g2VCDyNOHziiFUA hizal5xPyL9M8BHNAHyXE8lXcfRqAFmXKAnGO0oLgjV8oLYp92d6dOpVCp9AYwhuLn6K cI5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=T5LXB1s2UIxR34Xe2jU+wA9i8ygptxAvHQpIZVUagwo=; b=PD99Jc+ApUlmY7h2wk7lzuU9AaG0pTOdnxNkob1EMR8duH7dI40CObkirQDI3q/JUg kkZZlSONOi5CL1UUa7C/s/fJI0Mkrb0VxHGtQWiL+oawqaQC0Gj5tCP6SkHnTf30UtWG Y2J3y/T5PZ3WdkfogxwLzmRsA9FimfXudeOOv3Y9fJbzp6EKn4YbU6M7IXD85Z9v0QRD YxSNgRlOCDOU0uhtQIV+sQFUai/bzKrdK5rng3KbSHeaM5dJKFIl6ollOP/1YRIkxphe zbjPbdCuIF2N4IVJQfcOKq7eg1ja2AsVnf03PNZKWcVOslnc0WcVNtzAOIotwl0QSb9B g66A== X-Gm-Message-State: APjAAAXTeEdvTpQbxUTib0IbGSxhrgbfuOq5K6vS7oOStKwwxWiP1bUD aLDugFqwin9Vwk0Au/rjqT2icXGVHzA= X-Google-Smtp-Source: APXvYqzxjzcmTnP0eJaixr/giorA1QWAWnHZXRphLNa/Fb+u3wvi61ute3fhsKvV3uH75QQLLza0mw== X-Received: by 2002:a63:534d:: with SMTP id t13mr94905828pgl.89.1578101638256; Fri, 03 Jan 2020 17:33:58 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id j6sm16212934pjv.10.2020.01.03.17.33.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 17:33:57 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Fri, 3 Jan 2020 17:33:34 -0800 Message-Id: <20200104013341.19809-8-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200104013341.19809-1-stephen@networkplumber.org> References: <20200104013341.19809-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 07/14] eal: interrupts close epoll fd on shutdown X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Use pthread callbacks to ensure that the epoll fd is closed when rte_eal_cleanup is called. Signed-off-by: Stephen Hemminger --- lib/librte_eal/linux/eal/eal_interrupts.c | 26 ++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/lib/librte_eal/linux/eal/eal_interrupts.c b/lib/librte_eal/linux/eal/eal_interrupts.c index fa08ac4171bd..ae4d3ae3ed60 100644 --- a/lib/librte_eal/linux/eal/eal_interrupts.c +++ b/lib/librte_eal/linux/eal/eal_interrupts.c @@ -1032,6 +1032,19 @@ eal_intr_handle_interrupts(int pfd, unsigned totalfds) } } + +/** + * Callback at end of intr_thread loop or if thread is cancelled + * that closes the epoll file descriptor + */ +static void +eal_intr_thread_close(void *arg) +{ + int pfd = (int)(unsigned long)arg; + + close(pfd); +} + /** * It builds/rebuilds up the epoll file descriptor with all the * file descriptors being waited on. Then handles the interrupts. @@ -1061,6 +1074,12 @@ eal_intr_thread_main(__rte_unused void *arg) if (pfd < 0) rte_panic("Cannot create epoll instance\n"); + /* close pfd on thread exit or cancel_pop + * see man page for restrictions on this macro. + */ + pthread_cleanup_push(eal_intr_thread_close, + (void *)(unsigned long)pfd); + pipe_event.data.fd = intr_pipe.readfd; /** * add pipe fd into wait list, this pipe is used to @@ -1100,11 +1119,8 @@ eal_intr_thread_main(__rte_unused void *arg) /* serve the interrupt */ eal_intr_handle_interrupts(pfd, numfds); - /** - * when we return, we need to rebuild the - * list of fds to monitor. - */ - close(pfd); + /* close pfd and rebuild the list */ + pthread_cleanup_pop(1); } } From patchwork Sat Jan 4 01:33:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 64205 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6AD39A04DD; Sat, 4 Jan 2020 02:35:04 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8B4A41D553; Sat, 4 Jan 2020 02:34:07 +0100 (CET) Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by dpdk.org (Postfix) with ESMTP id C863E1D53B for ; Sat, 4 Jan 2020 02:34:00 +0100 (CET) Received: by mail-pj1-f66.google.com with SMTP id t101so5355403pjb.4 for ; Fri, 03 Jan 2020 17:34:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1zc6+AhRV1YcnqJbDgE6FqrfBVK0tAQVQ4bkQbZ/oEM=; b=hr4FaV8w/6Qk47oNO1X3zurVzUwZVkc3P+HFYnk9she948GHRiVw4sa0BeyogQ21Dz YQ7J+t9Rq2aAxjlnBLhU88QN5LTEKZR7tCsANUDroIzwhEs7XxaoaDMTVbDkNswjbfyz DzvhEYb8OxARVw//BCRhN8IW1rgmULym0nXOrKdMpGNUv1u13faubOlfE5BXSLB4P4zu J60a9vc1rK6MHUiMXMjH0XPEcA/JlhvjL9C0nwf+741jashqw8wVAt2Kle9q12UElNP9 Hwc4ikDaUrW4QQk/1p35s3Mgg3bdHU7xFAWUTLsY7ANGLUCQvxahvqyguZY3LUYD58aq zb4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1zc6+AhRV1YcnqJbDgE6FqrfBVK0tAQVQ4bkQbZ/oEM=; b=MF13VdtjFQWQc2Hpz+W30RfgHQpAwYNJD71u8oQf2D95/z0M9rJMgFiu2OQYBhk10E jmHAqpq318ZfMytn5m23SRpsiPRwQymm+dDRB2kEUir0dE0LKThiD+5prHdlqe1qn24g qQVHXXCqlU0ufHOKwsY6cXbaZa/i9YtfspKMRS0hhLbT7kpCilGLPyhLNTn2oo6cEnVR txPR2QU9vC9E/nbsSTEBlyGOFnBzXY2I7B9+G+FuhgiMRxBjBBX4KSbSFHOrG5+ErTEu m5AcGIriV/QiJxDtqapAej8F7c5lWpNuVCosZtHcF9vMLFjmrKzmUDjFBG0SfUnYH40p pokg== X-Gm-Message-State: APjAAAWqDen5D1Cdv51o62bP7QHmqRYopZ4hg8OIDgNRbyGYmxdagp9V nO/Kyh3TIaNC7lvy2TnFasZBbUg088Y= X-Google-Smtp-Source: APXvYqxUAMTLnZ4o6d1Jk10QG2oJ7dhF8t4pj50ymuVtRG1E/ODdBJkANwBVrlvTzl2k75Ep4KFh7g== X-Received: by 2002:a17:902:694c:: with SMTP id k12mr81952362plt.329.1578101639574; Fri, 03 Jan 2020 17:33:59 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id j6sm16212934pjv.10.2020.01.03.17.33.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 17:33:58 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , anatoly.burakov@intel.com, stable@dpdk.org Date: Fri, 3 Jan 2020 17:33:35 -0800 Message-Id: <20200104013341.19809-9-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200104013341.19809-1-stephen@networkplumber.org> References: <20200104013341.19809-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 08/14] eal: vfio: cleanup the mp sync handle X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When rte_eal_cleanup is called the rte_mp_action for VFIO should be freed. Fixes: edf73dd33072 ("ipc: handle unsupported IPC in action register") Cc: anatoly.burakov@intel.com Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger Acked-by: Anatoly Burakov --- lib/librte_eal/linux/eal/eal.c | 3 +++ lib/librte_eal/linux/eal/eal_vfio.h | 1 + lib/librte_eal/linux/eal/eal_vfio_mp_sync.c | 8 ++++++++ 3 files changed, 12 insertions(+) diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c index eb95f4f0c317..9ad81378f23c 100644 --- a/lib/librte_eal/linux/eal/eal.c +++ b/lib/librte_eal/linux/eal/eal.c @@ -1338,6 +1338,9 @@ rte_eal_cleanup(void) } rte_service_finalize(); +#ifdef VFIO_PRESENT + vfio_mp_sync_cleanup(); +#endif rte_eal_intr_cleanup(); rte_eal_alarm_cleanup(); rte_mp_channel_cleanup(); diff --git a/lib/librte_eal/linux/eal/eal_vfio.h b/lib/librte_eal/linux/eal/eal_vfio.h index cb2d35fb1206..bf7408a897a7 100644 --- a/lib/librte_eal/linux/eal/eal_vfio.h +++ b/lib/librte_eal/linux/eal/eal_vfio.h @@ -132,6 +132,7 @@ int vfio_has_supported_extensions(int vfio_container_fd); int vfio_mp_sync_setup(void); +void vfio_mp_sync_cleanup(void); #define EAL_VFIO_MP "eal_vfio_mp_sync" diff --git a/lib/librte_eal/linux/eal/eal_vfio_mp_sync.c b/lib/librte_eal/linux/eal/eal_vfio_mp_sync.c index 5f2a5fc1d94e..b8ae9c65892e 100644 --- a/lib/librte_eal/linux/eal/eal_vfio_mp_sync.c +++ b/lib/librte_eal/linux/eal/eal_vfio_mp_sync.c @@ -120,4 +120,12 @@ vfio_mp_sync_setup(void) return 0; } +void +vfio_mp_sync_cleanup(void) +{ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return; + + rte_mp_action_unregister(EAL_VFIO_MP); +} #endif From patchwork Sat Jan 4 01:33:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 64206 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5814DA04DD; Sat, 4 Jan 2020 02:35:12 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 648281D559; Sat, 4 Jan 2020 02:34:09 +0100 (CET) Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by dpdk.org (Postfix) with ESMTP id 34E091D501 for ; Sat, 4 Jan 2020 02:34:02 +0100 (CET) Received: by mail-pf1-f194.google.com with SMTP id w62so24241631pfw.8 for ; Fri, 03 Jan 2020 17:34:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MHI7cMSENo7lqn4JRd+oFBhYEul5nwsPPh9M0DElZJQ=; b=GuZpvgS1XtKyFb7sBpuC5sA4TwOyE155UaGra+gYsDHoLsyWx5V7ESm7F6DwbcJvaD Z2+Zewhxx8u4g9keiwD/EUBLcHBqxptJJaH+FWZc5fGVvZNqxaIXn+GgcArvZHoBudr0 dO4TckhhQs61SV4Y7xKbm1c7R9lz7TX6EE51/TCrHjVSB9OOvblhQshQgsM3Bc/I66SX YIxSyPe8OqgbbyfSf/RqWmw4Q7DbO2T/92PUXlYCWgpIs8b9fdqFuGjLQFRENnS/A9yU VO0mm/5ZXdwPSW6DuGO4FOoOvsYbJ0i5Z+6JeiQpysKXK5wvQLwP3/96QEg+xYZy4Cek B6BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MHI7cMSENo7lqn4JRd+oFBhYEul5nwsPPh9M0DElZJQ=; b=R5vI7mKkLdQSSJIbMuWBtBWvRNc5ly6VWNTz0Sy1puygN+kbJx8tqADUyK5b3uRqen NHT1GEqABKB4kiM7+ZUuABtLXdfLbDTltP8zzVyb2h10Uj0MaI/sScl9ZhzpDy+QsFLq LBYfs6tUfw4IDkGD3osRPvndBtqHD21pLT79k5cC+PW30BCAQ5DZiDAp8SBw+4p1o3tS GH4DARN/vtCiD+AtznlzKG6JDqSXa/ogYaBjqkmH7gv86Qc6a3lVZFWo2F90SqxNhmm6 6DQqTcvavLKAhCFo3mN7GsUefWeeUNc3EfpH6Wyzo6qZtHUCLceyPT4++Q5Tg7t5S+nN pZuw== X-Gm-Message-State: APjAAAV6NAqEDWPZxZQXjuaCyo9wfrvLaiZhi/cP7wTkJbIWzC/UzzxI BGAjkp7S/9ppiMPRFHUSAyaEVfsZdRw= X-Google-Smtp-Source: APXvYqzCM6POP9CkV21C0CYvQe7TSaqfHVl63b/g1xhPYkwtuxlS9u3P8MhStb0Kw3KO+/wfvrKYqQ== X-Received: by 2002:a63:b642:: with SMTP id v2mr97510905pgt.126.1578101640844; Fri, 03 Jan 2020 17:34:00 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id j6sm16212934pjv.10.2020.01.03.17.33.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 17:34:00 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Fri, 3 Jan 2020 17:33:36 -0800 Message-Id: <20200104013341.19809-10-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200104013341.19809-1-stephen@networkplumber.org> References: <20200104013341.19809-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 09/14] eal: close mem config on cleanup X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Resolves file descriptor left open after rte_eal_cleanup. Signed-off-by: Stephen Hemminger Acked-by: Anatoly Burakov --- lib/librte_eal/linux/eal/eal.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c index 9ad81378f23c..e5c2a24322e9 100644 --- a/lib/librte_eal/linux/eal/eal.c +++ b/lib/librte_eal/linux/eal/eal.c @@ -1346,6 +1346,12 @@ rte_eal_cleanup(void) rte_mp_channel_cleanup(); eal_cleanup_config(&internal_config); rte_eal_log_cleanup(); + + if (mem_cfg_fd != -1) { + close(mem_cfg_fd); + mem_cfg_fd = -1; + } + return 0; } From patchwork Sat Jan 4 01:33:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 64207 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3EA8DA04DD; Sat, 4 Jan 2020 02:35:20 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 195CA1C0B6; Sat, 4 Jan 2020 02:34:11 +0100 (CET) Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by dpdk.org (Postfix) with ESMTP id 6CBB31D540 for ; Sat, 4 Jan 2020 02:34:03 +0100 (CET) Received: by mail-pl1-f196.google.com with SMTP id b22so19616059pls.12 for ; Fri, 03 Jan 2020 17:34:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5SbRrlbd1L2WS6lePAGc0pDNaSt2ZIUzCyVTIi9ZU5g=; b=G6ekjBjVTafPLUJoKmLqLZsYDg5SaOXh7YJmFdEDHZ5VyPxh/QVL05B0aV+7BSrni4 oo057wHFNNZdThItpofcQautD5wIKEtLxEas5s/1oghEYn6KVNp1rFmJ9WB2WvJRQk/P 9khXGjnAx5MzdUuDSkS87m/R7jlnop/8MuDKdWQLaD4bOyVwr3jr1DJdN5/CjtAA9873 gLpfrogiz0HYQdnSZeLOxLUE0pX+ksWbZ7ciTtV19hgomLZqKZI92ey/I9T7VCmye+jJ XSCyBBv2eAMrYlecFk1cA7LhZVBBrmQnfGX2IujchtxElcLhHvQ0X/37v6ZX88qdfHRb G7JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5SbRrlbd1L2WS6lePAGc0pDNaSt2ZIUzCyVTIi9ZU5g=; b=pKng8Yhru3X5i7UlKYrbjMXIlQa4zhx++Jn9QRrp5HsSbF+2iqv3+lvfP7oximBC5B E8UaWNTkT+kUwhCb0wyz3+HP+83UNp4dNT4gUmJEpnDPf9BMQAflspz/8OXW28sMW1nZ 6EQQYjeMdzsbqdzjo+bGePrrIMjJ0OnmRfVOXeWgOY+2dN4MWBoechdrwheNK6Tn4FQX wloD0Ot2BB+DQmRDjntEXm8sRgaLW+KtxmRUkCLcchbUzJbCsECezQ9+/G8cJz0NCcSF SQybNa7CwtmvEKloE+Cm8dZhKZ67fqXhWWLTJUbl5jiQc9nOSyacpemVUlFkWfx0LKWN 8ESw== X-Gm-Message-State: APjAAAVuFsh9hnq/s+xCMH0/hHoxKQrI+TLnZ7WgBTBdvdREjYLNUmJD r6bFRRUAlFL1dRNkX82kxX5Lo9tYlZc= X-Google-Smtp-Source: APXvYqx6QdNwxe+ARMi/tZZ9PfLqwlTPb4Dac8dwDxang7VupulXE184S5oFHzvz+MxoJxiEFv5cXQ== X-Received: by 2002:a17:902:a505:: with SMTP id s5mr69453949plq.244.1578101642278; Fri, 03 Jan 2020 17:34:02 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id j6sm16212934pjv.10.2020.01.03.17.34.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 17:34:01 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , pascal.mazon@6wind.com, stable@dpdk.org Date: Fri, 3 Jan 2020 17:33:37 -0800 Message-Id: <20200104013341.19809-11-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200104013341.19809-1-stephen@networkplumber.org> References: <20200104013341.19809-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 10/14] tap: close netlink socket on device close X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The netlink socket for flow creation was left open and never closed. Fixes: bf7b7f437b49 ("net/tap: create netdevice during probing") Cc: pascal.mazon@6wind.com Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger --- drivers/net/tap/rte_eth_tap.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index a13d8d50d7d7..d293dd8eeed5 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -1035,6 +1035,11 @@ tap_dev_close(struct rte_eth_dev *dev) &internals->remote_initial_flags); } + if (internals->nlsk_fd != -1) { + close(internals->nlsk_fd); + internals->nlsk_fd = -1; + } + if (internals->ka_fd != -1) { close(internals->ka_fd); internals->ka_fd = -1; @@ -2406,7 +2411,7 @@ rte_pmd_tap_remove(struct rte_vdev_device *dev) TAP_LOG(DEBUG, "Closing %s Ethernet device on numa %u", tuntap_types[internals->type], rte_socket_id()); - if (internals->nlsk_fd) { + if (internals->nlsk_fd != -1) { tap_flow_flush(eth_dev, NULL); tap_flow_implicit_flush(internals, NULL); tap_nl_final(internals->nlsk_fd); From patchwork Sat Jan 4 01:33:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 64208 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C6839A04DD; Sat, 4 Jan 2020 02:35:31 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 42DA21D55D; Sat, 4 Jan 2020 02:34:13 +0100 (CET) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by dpdk.org (Postfix) with ESMTP id 07E8A1D548 for ; Sat, 4 Jan 2020 02:34:05 +0100 (CET) Received: by mail-pg1-f196.google.com with SMTP id 6so24152328pgk.0 for ; Fri, 03 Jan 2020 17:34:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UzpwGaFD1a8sIn4IGdBsPyohrZzhEIRlfOR5b6UrJzc=; b=kLiqD0Q2kPVP1k2rK4hUARfyFt441Evfdcf98xoiljhIAaGR8YdCcKOuIa9KqsYalx JbkojIzJjoatJseZqdnjpbtfWpeWMSj69/yabHMdlf5JIjhAuQjUJm5T0dLNSakDo4D3 1Ro7qTdnoJrOh9sVO0SKvL3eMhFU3oEhTrn/NIy2Pq3vNefWa6Hb/W3a/u6O+k0p24mq nazGvPb59T/sfjBYO0pMZu/9ZWKbGX1jx5tON69iYRJyV5Xe8f0LtXiJQjnHhWETAskl cpUHBSh2rk+pqbDu0nb1T5c/dW8C8+FRaJ/+gUs9qJNN8ZgX3F41/4+c3+XxyVZBUefG EDaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UzpwGaFD1a8sIn4IGdBsPyohrZzhEIRlfOR5b6UrJzc=; b=j+nTudaSzy1yqKtPfyufcwxXwyS7Q8h1lPuMksYiQY/hb+T0jyp7EvmfiYDcIv4Wb7 Yb5Jwd68wQua1j87bf8YgN6jAkiq82LlBh2NnR2qeYi0JtgYNshwYoZyBF86yYViMsh7 eurOF6PeHX2w0TWIrs3/aIuoQ6zDDKrxpoGXkI4onnlz5w7QfQsXXgvMabE4mX4nB9FJ 7RBYicS0b4bN0LtAQXkb9H+hjiBdJ+G3a4CuBJvrNCcES10qdrKp/9XzaotCYc2FP5wS 78fjd7U1+/9yKyeHnhB/AJloXI6qUw41h7/rXISZslIu78hfzco1+jIzm/igrE59XGht NYMA== X-Gm-Message-State: APjAAAVqpaJPN8d0BBzfwgh9IJ+jIskGjDZRnnyaomAB+gY5W7kQx4s+ X6N7dvDAYCcVfz8oc0/SyO5bI/rivrk= X-Google-Smtp-Source: APXvYqyGad+0+RNeegqBrkD5NZULBKYd2To2faBJo2CE2ejxUJTxUfW82+B/u/Y1S0AwdolDOfFpeA== X-Received: by 2002:a63:6b07:: with SMTP id g7mr82309858pgc.243.1578101643852; Fri, 03 Jan 2020 17:34:03 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id j6sm16212934pjv.10.2020.01.03.17.34.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 17:34:03 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Fri, 3 Jan 2020 17:33:38 -0800 Message-Id: <20200104013341.19809-12-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200104013341.19809-1-stephen@networkplumber.org> References: <20200104013341.19809-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 11/14] eal: cleanup plugins data X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When rte_eal_cleanup is called walk through the list of shared objects loaded, and close them and free the data structure. Signed-off-by: Stephen Hemminger --- lib/librte_eal/common/eal_common_options.c | 12 ++++++++++++ lib/librte_eal/common/eal_options.h | 1 + lib/librte_eal/linux/eal/eal.c | 1 + 3 files changed, 14 insertions(+) diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index a7f9c5f9bdfa..58c364d896f8 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -308,6 +308,18 @@ eal_plugins_init(void) return 0; } +void +eal_plugins_cleanup(void) +{ + struct shared_driver *solib, *tmp; + + TAILQ_FOREACH_SAFE(solib, &solib_list, next, tmp) { + if (solib->lib_handle) + dlclose(solib->lib_handle); + free(solib); + } +} + /* * Parse the coremask given as argument (hexadecimal string) and fill * the global configuration (core role and core count) with the parsed diff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h index 9855429e5813..67d3ba0d4491 100644 --- a/lib/librte_eal/common/eal_options.h +++ b/lib/librte_eal/common/eal_options.h @@ -84,5 +84,6 @@ int eal_check_common_options(struct internal_config *internal_cfg); void eal_common_usage(void); enum rte_proc_type_t eal_proc_type_detect(void); int eal_plugins_init(void); +void eal_plugins_cleanup(void); #endif /* EAL_OPTIONS_H */ diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c index e5c2a24322e9..9a00a3ed43ab 100644 --- a/lib/librte_eal/linux/eal/eal.c +++ b/lib/librte_eal/linux/eal/eal.c @@ -1344,6 +1344,7 @@ rte_eal_cleanup(void) rte_eal_intr_cleanup(); rte_eal_alarm_cleanup(); rte_mp_channel_cleanup(); + eal_plugins_cleanup(); eal_cleanup_config(&internal_config); rte_eal_log_cleanup(); From patchwork Sat Jan 4 01:33:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 64209 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 196A4A04DD; Sat, 4 Jan 2020 02:35:41 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EBA1A1D56E; Sat, 4 Jan 2020 02:34:14 +0100 (CET) Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by dpdk.org (Postfix) with ESMTP id D974A1D54F for ; Sat, 4 Jan 2020 02:34:06 +0100 (CET) Received: by mail-pl1-f193.google.com with SMTP id y8so19609206pll.13 for ; Fri, 03 Jan 2020 17:34:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LlyC1Z1TT0HIqDsd8sET7tu3nOmVbmNuMi3nCCphs1o=; b=DRfDNndF3slKSoQ0AmxrCgoQSh9hctvsdzzMpneE6qh7Ggi2jpJETBYDwo7DbCqioC XXbykqVmHvNM/USbJSNVtmvc4MS3rqfEDT0kZvABCef+H/bBE2gKE05P/53bYBdwNY6d 2ozzU5OlCFNZOJWHh+f9M8BSQw9OvWxwtrS6Mr8cLroKpkaGClMj9vhQrLGnjOPT3so0 uMHeRhwv/qU7BZFfAwzW5rmHfi10tkpDgQ5QC43KCx6JJ+szfeuL+3JccLWTWUPHCQKt m0PDKezvs+dzFiG9v/62Hh/FyTYK6B/qlsJYyOx/XynaGnsnVSpZGEh/iztvy99JcajZ 5p4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LlyC1Z1TT0HIqDsd8sET7tu3nOmVbmNuMi3nCCphs1o=; b=ugCN0lt7KrcWGsC7j4/hi9BBLOwe2lnusaicOBzvADGqTA32Tp2GNuZ9+FS8lDF78/ m8OvM8dfOwmonvCFvzCh3yp5X6j76RPqDacOofCtrY8zsPxk8wu0iZlC5lqG3+DJN5mI nOgkUm6we8TbSqbWLoT0EyUI06bG33SjrZ2jDZKgWQQTdspK92J8S/3/p+CnVOTWQcs3 4jPvAHD90WHzjPAFVd4lUHluLdlg3bNq3PCJUf0hw7ijDe8h7YQ+xo+/uS6m3EM7q/VE 5kwSY6GIWPcRnsk9LinpGZJZDlw8MEtkPgLCjqvTXcDpYt3ghHW4Mi391os4raZMUnmP Iv8Q== X-Gm-Message-State: APjAAAVci8txcOco8V9Rs08Xf9bjm4eOvKfc7pH89VN3YyJMBQGvnQN5 wNDmpqst2PK27dyfw1ESqSXN9l7k6To= X-Google-Smtp-Source: APXvYqxUVxdtubENO7bt9fiNEXeM8zJsjckU7HqUjzWkkaNOIwT4lZ4PXHqvCTnxcPdusQObKdAW9A== X-Received: by 2002:a17:902:6ac2:: with SMTP id i2mr93799290plt.221.1578101645565; Fri, 03 Jan 2020 17:34:05 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id j6sm16212934pjv.10.2020.01.03.17.34.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 17:34:04 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Fri, 3 Jan 2020 17:33:39 -0800 Message-Id: <20200104013341.19809-13-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200104013341.19809-1-stephen@networkplumber.org> References: <20200104013341.19809-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 12/14] ethdev: raise priority of old driver warning X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The priority of the message about drivers not using new (correct) behaviour on close was debug. And debug messages are typically surpressed and never seen. Raise the priority so that broken drivers are visible and hopefully get developers to fix. Signed-off-by: Stephen Hemminger Acked-by: Thomas Monjalon --- lib/librte_ethdev/rte_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 6e9cb243ea80..545687dbc5c9 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -1717,7 +1717,7 @@ rte_eth_dev_close(uint16_t port_id) rte_eth_dev_release_port(dev); return; } - RTE_ETHDEV_LOG(DEBUG, "Port closing is using an old behaviour.\n" + RTE_ETHDEV_LOG(NOTICE, "Port closing is using an old behaviour.\n" "The driver %s should migrate to the new behaviour.\n", dev->device->driver->name); /* old behaviour: only free queue arrays */ From patchwork Sat Jan 4 01:33:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 64210 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E205BA04DD; Sat, 4 Jan 2020 02:35:49 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 670C21D579; Sat, 4 Jan 2020 02:34:16 +0100 (CET) Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by dpdk.org (Postfix) with ESMTP id 2150C1D556 for ; Sat, 4 Jan 2020 02:34:08 +0100 (CET) Received: by mail-pg1-f194.google.com with SMTP id b9so24133243pgk.12 for ; Fri, 03 Jan 2020 17:34:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QQG5FyzbJ/i5NIOOidQ6T4VEeXPduNZODErhbfaJRh4=; b=0WGk7K5l77plyTfzAJRrXmsodUOY5g6EkDnYKK/Lvpud8QVG84nOvB6+CuobRml2K5 bzfFmPdAsCoVyIFJFdj4YNyai8d3v9gPQzDVQ3UfMTx2hJ+rJp1Q0HWuIFDniS14H9RG o4ggYdybT2lfnnUZLoOGBgQpwZsjNUY03lx/2Reg90GyGq0Q2GyA5La9v6Nn0DjLoCB5 ilEdK6Be8quT7DBcc4jEkbdNRimc5ddJO0RA/TdOmOgX9fzSi3uuF8DV1u7bpdxyyjST tEs/h1RB5ptb07P80drF9PguNjA+T2Oze3lOfOTqY1PaVbF/iKOOVP8r6FCEXXCIETjI Xzug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QQG5FyzbJ/i5NIOOidQ6T4VEeXPduNZODErhbfaJRh4=; b=tEILolCVUesFdKa3uBt3/k2K63Jd44S4Kok2hu0tYdotT99JkbsT+5yay7B6EDwakp G0iRXo2HemTn1hvp42kEMR7vhos9Z1TGxOaZF/oJVBbLTF30ih33CGT9zLZdAhT8UHsX kh4OZA7ABg3QweIXfN5eHsRpDwqdqtSiF243LuNGfh8g7enC5Yut+/LC4vTM1Wga9Zp3 a1pFGdragkSNjMIABxO5+8iDAxF14Bl/yLZ1jZ4hBF3dJ+ACKq7NH4c3CZKjeB90ea3s WhfgOY4RN5DhAHrZDcyViw8oasJAC0eEMW7yFvQ/Re+0h2XBHUnJY4F+Kv33BsCq+mWy gvVQ== X-Gm-Message-State: APjAAAWKM9WzOC3q4aTcOS0G/fdQ4vxRDaAwhKTyaTL3SPG5lfyllne3 Q+yvXbQgLU8AQLEaQBuijoBN/7Mk9sA= X-Google-Smtp-Source: APXvYqz8OEvGkSkDXCYv0OrIBSsNnTn0RhYqcdV2fIiuu/MoLltRuE1T47K3mbkabFkC/9VmdXihmg== X-Received: by 2002:a63:753:: with SMTP id 80mr91742223pgh.95.1578101646893; Fri, 03 Jan 2020 17:34:06 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id j6sm16212934pjv.10.2020.01.03.17.34.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 17:34:06 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Fri, 3 Jan 2020 17:33:40 -0800 Message-Id: <20200104013341.19809-14-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200104013341.19809-1-stephen@networkplumber.org> References: <20200104013341.19809-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 13/14] eal: hotplug: cleanup multiprocess resources X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When rte_eal_cleanup is called, hotplug should unregister the resources associated with the multi-process server. Signed-off-by: Stephen Hemminger --- lib/librte_eal/common/hotplug_mp.c | 5 +++++ lib/librte_eal/common/hotplug_mp.h | 6 ++++++ lib/librte_eal/linux/eal/eal.c | 1 + 3 files changed, 12 insertions(+) diff --git a/lib/librte_eal/common/hotplug_mp.c b/lib/librte_eal/common/hotplug_mp.c index ee791903b3b7..a390c01fd41c 100644 --- a/lib/librte_eal/common/hotplug_mp.c +++ b/lib/librte_eal/common/hotplug_mp.c @@ -463,3 +463,8 @@ int eal_mp_dev_hotplug_init(void) return 0; } + +void eal_mp_dev_hotplug_cleanup(void) +{ + rte_mp_action_unregister(EAL_DEV_MP_ACTION_REQUEST); +} diff --git a/lib/librte_eal/common/hotplug_mp.h b/lib/librte_eal/common/hotplug_mp.h index 8fcf9b52e24c..4848446c852d 100644 --- a/lib/librte_eal/common/hotplug_mp.h +++ b/lib/librte_eal/common/hotplug_mp.h @@ -37,6 +37,12 @@ struct eal_dev_mp_req { int eal_mp_dev_hotplug_init(void); +/** + * Unregister all mp action callbacks for hotplug. + */ +void +eal_mp_dev_hotplug_cleanup(void); + /** * This is a synchronous wrapper for secondary process send * request to primary process, this is invoked when an attach diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c index 9a00a3ed43ab..ef04defbeaa4 100644 --- a/lib/librte_eal/linux/eal/eal.c +++ b/lib/librte_eal/linux/eal/eal.c @@ -1343,6 +1343,7 @@ rte_eal_cleanup(void) #endif rte_eal_intr_cleanup(); rte_eal_alarm_cleanup(); + eal_mp_dev_hotplug_cleanup(); rte_mp_channel_cleanup(); eal_plugins_cleanup(); eal_cleanup_config(&internal_config); From patchwork Sat Jan 4 01:33:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 64211 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4A3F6A04DD; Sat, 4 Jan 2020 02:35:57 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2EC4B1D57E; Sat, 4 Jan 2020 02:34:18 +0100 (CET) Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by dpdk.org (Postfix) with ESMTP id 546661D556 for ; Sat, 4 Jan 2020 02:34:09 +0100 (CET) Received: by mail-pl1-f196.google.com with SMTP id a6so18895876plm.3 for ; Fri, 03 Jan 2020 17:34:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zUaUfoxGHH+ys9CECpeiQUF0L2MGdSRHCXxhmb6J+TY=; b=OcsjPhXiinKARjDHxw9fnSpEpA7+sJLm579e/fa16PzGgF5vZH2F/+qwuTNsU2sN0b sRVRWMzlOd5PZB0MWjf1HB0KgSWWoNiVAPAYqyP0lbTs0wtPKCs4XfD1FhkhZ+v8mrdJ YIAS/uh+5kwj5l5AyKwjEDzIpZNKdNGrnCv++D78JtiNqsGZ/PL6GML7pYJPJ2D+rLVk Ekgsb7CVJidbFFr+s8G7CId3Lyxn7q5KkhqKE2RUQDo6xX5As/j1unA39bPN0OfIaljK 8MCDHOzg32zZy545uh9NFlFbRd91gJMWsddjUpenklZIeVASLzpGnzSACn4AfYhJ2Jrb Ibwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zUaUfoxGHH+ys9CECpeiQUF0L2MGdSRHCXxhmb6J+TY=; b=m4OLbBZMvTnvYtUh/euYOpn/lQ9eDFiMZkfM1qiiJ/EqH6MMQCrEE+yKU2+eF2eV3Y 4KJeWT9TR6+/4XngskYc7Ib1nKtiMBkiPjGeT3YiYMBYef/lXUObfZX3s/20Y3teYLXp Zk17csnTlTVNuZ7Ogcv0nxyyUdFt0LBpclDdGBgZqlWWry6tC+5tJogdm22ja0jnZBL9 GcpJB3hZTuS9m5CmCR+GGV22IOIr0esKg6I3J1zMBT9HyGOomKhgxFiYVXLzcCDsYCFs d5yZUxcs0ZgM28RE1AfpZxxvtdcvyIav5xKur8EZSZMYzrA+x2vNLXD8NRfSzK1q7QuW ajRg== X-Gm-Message-State: APjAAAVicP/mplCbaJNLKoy6/Hxr21MFlPqo0ROGDpMggKt9PZiXxVLl Mzj99NRyvpB3PeLXrvxdiFgjWTFd49w= X-Google-Smtp-Source: APXvYqxc+7ZNGnm7jemvuUPOzkaGIV+OYsX745XAJ3LuI/8f9NWRKQO5HIOO9aULjEkqZ/apU20QSQ== X-Received: by 2002:a17:902:b901:: with SMTP id bf1mr94118872plb.283.1578101648112; Fri, 03 Jan 2020 17:34:08 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id j6sm16212934pjv.10.2020.01.03.17.34.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 17:34:07 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Fri, 3 Jan 2020 17:33:41 -0800 Message-Id: <20200104013341.19809-15-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200104013341.19809-1-stephen@networkplumber.org> References: <20200104013341.19809-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 14/14] eal: malloc: cleanup mp resources X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The mp action resources in malloc should be cleaned up via rte_eal_cleanup. Signed-off-by: Stephen Hemminger Acked-by: Anatoly Burakov --- lib/librte_eal/common/malloc_heap.c | 6 ++++++ lib/librte_eal/common/malloc_heap.h | 3 +++ lib/librte_eal/common/malloc_mp.c | 12 ++++++++++++ lib/librte_eal/common/malloc_mp.h | 3 +++ lib/librte_eal/linux/eal/eal.c | 1 + 5 files changed, 25 insertions(+) diff --git a/lib/librte_eal/common/malloc_heap.c b/lib/librte_eal/common/malloc_heap.c index 842eb9de75a1..13c673f363a9 100644 --- a/lib/librte_eal/common/malloc_heap.c +++ b/lib/librte_eal/common/malloc_heap.c @@ -1362,3 +1362,9 @@ rte_eal_malloc_heap_init(void) /* add all IOVA-contiguous areas to the heap */ return rte_memseg_contig_walk(malloc_add_seg, NULL); } + +void +rte_eal_malloc_heap_cleanup(void) +{ + unregister_mp_requests(); +} diff --git a/lib/librte_eal/common/malloc_heap.h b/lib/librte_eal/common/malloc_heap.h index 772736b53f3c..ffad1b61e246 100644 --- a/lib/librte_eal/common/malloc_heap.h +++ b/lib/librte_eal/common/malloc_heap.h @@ -100,6 +100,9 @@ malloc_socket_to_heap_id(unsigned int socket_id); int rte_eal_malloc_heap_init(void); +void +rte_eal_malloc_heap_cleanup(void); + #ifdef __cplusplus } #endif diff --git a/lib/librte_eal/common/malloc_mp.c b/lib/librte_eal/common/malloc_mp.c index 1f212f834993..a9a9e8a45221 100644 --- a/lib/librte_eal/common/malloc_mp.c +++ b/lib/librte_eal/common/malloc_mp.c @@ -749,3 +749,15 @@ register_mp_requests(void) } return 0; } + +void +unregister_mp_requests(void) +{ + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { + rte_mp_action_unregister(MP_ACTION_REQUEST); + } else { + rte_mp_action_unregister(MP_ACTION_SYNC); + rte_mp_action_unregister(MP_ACTION_ROLLBACK); + rte_mp_action_unregister(MP_ACTION_RESPONSE); + } +} diff --git a/lib/librte_eal/common/malloc_mp.h b/lib/librte_eal/common/malloc_mp.h index 2b86b76f6848..fb3d18c4e458 100644 --- a/lib/librte_eal/common/malloc_mp.h +++ b/lib/librte_eal/common/malloc_mp.h @@ -63,6 +63,9 @@ struct malloc_mp_req { int register_mp_requests(void); +void +unregister_mp_requests(void); + int request_to_primary(struct malloc_mp_req *req); diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c index ef04defbeaa4..c660f6fac3f2 100644 --- a/lib/librte_eal/linux/eal/eal.c +++ b/lib/librte_eal/linux/eal/eal.c @@ -1344,6 +1344,7 @@ rte_eal_cleanup(void) rte_eal_intr_cleanup(); rte_eal_alarm_cleanup(); eal_mp_dev_hotplug_cleanup(); + rte_eal_malloc_heap_cleanup(); rte_mp_channel_cleanup(); eal_plugins_cleanup(); eal_cleanup_config(&internal_config);