From patchwork Thu Jun 8 07:25:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?546L5b+X5a6P?= X-Patchwork-Id: 128385 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4EAF442C5A; Thu, 8 Jun 2023 09:26:02 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CFF8F40A84; Thu, 8 Jun 2023 09:26:01 +0200 (CEST) Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by mails.dpdk.org (Postfix) with ESMTP id 69B6740042 for ; Thu, 8 Jun 2023 09:26:00 +0200 (CEST) Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-65055aa4ed7so112827b3a.3 for ; Thu, 08 Jun 2023 00:26:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1686209159; x=1688801159; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Q9Oov6lndIhXhfpJkME4Ns4Z2HT/cPoNvTKxUCitmJQ=; b=bmd0s+1iZPGsyvA5GpQ9MVQKpANAMLu1PE9Evn9o1fKyp+/HMJNbA6m0j1Uj+/ZS8C 6fspj8S6dk5yXQySs71fAqO5UNsWW8xEDBTluoQIa14vn1SbhuYzTfnlqeyy6nlmgr47 w3pmkloRsu3rIcfJucFKqAwuMNs9WeKqAnMUikbmv451SY4I/KPl9SoPPOo8Vszg+3cN f4HavP6CiQ0U/8ERzXPZ867gGqNe8RbJAO9oNs29laCxMiQ7WVIx0QqPGL8QFH8t42QJ UpnCMNh4kH7Te+FKo/aBriVSWOD+5InfwnPwfYyYHvIjUEFjzLFTahdTEL4hL67rHAMv 6fvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686209159; x=1688801159; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Q9Oov6lndIhXhfpJkME4Ns4Z2HT/cPoNvTKxUCitmJQ=; b=Aqy0K/c9d6ErrCehoux4hlSzPbWzQLathNtX0Bx4nSOmXpF0i5JXGqth+CxfRxgMpa pPUJY/azn0z9W5AMKUCV0NFcfluoDUE2p3pWbPdAh1HqoYTHtW5txzUqMYi36JptvLcO e4lA/3C8qEA9OUUTTAdBXOorZ+C1FdY4iFOy8BYM4+9W28u7jjp07Jjj1KCqG+qqWQT/ sguWyTPPouYmeMzO/AOqeXUOD1AJXtXJEz+GpIZ5pk0qmwvidVqaU7TvAbmLrbfWF9mj xj8z4ruUq7ExZ82myW7THvCC5bXUI/lYHZECISSfFaWD0D5K7m72WrJqnosOB5r7E8OG m0ug== X-Gm-Message-State: AC+VfDwcALiUXLLizguP8RkvJgcRwuygWMbWjnS2NWDF+oBIafdy19RH OZ+rOPANcIcorenQapbeGwkRhw5bIwf07/Jezvo= X-Google-Smtp-Source: ACHHUZ77bLGVpy1C0xocbKNMEY/Yiqz3Y6NeUmYgZat3fECNVlYelJ/oUJ7m58StM32Y4sq+cInKTQ== X-Received: by 2002:a05:6a00:218e:b0:654:9d3a:f96f with SMTP id h14-20020a056a00218e00b006549d3af96fmr5265246pfi.4.1686209159261; Thu, 08 Jun 2023 00:25:59 -0700 (PDT) Received: from C02D70YZMD6R.bytedance.net ([203.208.167.146]) by smtp.gmail.com with ESMTPSA id m23-20020aa79017000000b006410f4f3ecdsm477896pfo.83.2023.06.08.00.25.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 00:25:58 -0700 (PDT) From: Zhihong Wang To: dev@dpdk.org, anatoly.burakov@intel.com, david.marchand@redhat.com, qi.z.zhang@intel.com Cc: Zhihong Wang Subject: [PATCH v2] eal/linux: register mp hotplug callback after memory init Date: Thu, 8 Jun 2023 15:25:53 +0800 Message-Id: <20230608072553.72421-1-wangzhihong.wzh@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20230531065506.63021-1-wangzhihong.wzh@bytedance.com> References: <20230531065506.63021-1-wangzhihong.wzh@bytedance.com> MIME-Version: 1.0 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 Secondary would crash if it tries to handle mp requests before memory init, since globals such as eth_dev_shared_data_lock are not accessible to it at this moment. v2: add signed-off-by Signed-off-by: Zhihong Wang Acked-by: Anatoly Burakov --- lib/eal/linux/eal.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c index ae323cd492..a74d564597 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -1058,12 +1058,6 @@ rte_eal_init(int argc, char **argv) } } - /* register multi-process action callbacks for hotplug */ - if (eal_mp_dev_hotplug_init() < 0) { - rte_eal_init_alert("failed to register mp callback for hotplug"); - return -1; - } - if (rte_bus_scan()) { rte_eal_init_alert("Cannot scan the buses for devices"); rte_errno = ENODEV; @@ -1221,6 +1215,12 @@ rte_eal_init(int argc, char **argv) return -1; } + /* register multi-process action callbacks for hotplug after memory init */ + if (eal_mp_dev_hotplug_init() < 0) { + rte_eal_init_alert("failed to register mp callback for hotplug"); + return -1; + } + if (rte_eal_tailqs_init() < 0) { rte_eal_init_alert("Cannot init tail queues for objects"); rte_errno = EFAULT;