From patchwork Wed May 31 06:55:06 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: 127744 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 44F7742BED; Wed, 31 May 2023 08:55:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C125A40ED7; Wed, 31 May 2023 08:55:15 +0200 (CEST) Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) by mails.dpdk.org (Postfix) with ESMTP id E46CD40A82 for ; Wed, 31 May 2023 08:55:13 +0200 (CEST) Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-bad010e1e50so7954377276.1 for ; Tue, 30 May 2023 23:55:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1685516112; x=1688108112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=r3wY8vDknwn9LhAO5B+wFNmxPTuMRfwznotT/ILTHnw=; b=chXCC7nbwCjZ056KQQ6RYPDlZQq6yfJrR7oMtYgg3n5sJ60WsInzaEC+Pc2zEvpAiS Ry7KSAWAuH1FJm/jt4cVf5pgXHMvYhHZHZp7YoNlgGbq9iew2f2d23qHxfuHsqppILAI jJrlUFK8MNM/YReTLa8JiwB7WPaL74RBgvF5ufCnofVKQT1nLDjr/rPwfz0VSYXSbJ6i 6UaABy9DDFpEkFkhhPrHuJmY8y6QjR5NuaWsGGPweaJ07ltA2aV6dvN/iIqDYdv6l+dG eXbKwEvuMJ8jT8uIt7GfXWjUH0QrYJAR3zi3eCwdq5+su5L9YIt9U4iTZU97nL4nOvJA LiUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685516112; x=1688108112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=r3wY8vDknwn9LhAO5B+wFNmxPTuMRfwznotT/ILTHnw=; b=ObV4+obZO7sWq2DkeGE8AGv42nMcSbaPOfZ75VLGfnvomlEXI+Pnp+BIa2kZlFlcUk cX5pmJx4e7ntXXj0UoVu4xTvQM1k1IJ0j+KfJYJ2Phr2dwliI7GO9LzN08LmoB/BKZ7R qpAZ0/V5wbHGLglD/n9SvO31tJU/Cm1uT9QehIcrwI4W/H72V+0ouO+merlVhkcjt6eh XTU80W6ot4XpsHGiMai+bklDvmN6ehE8A45exhHa5EqSSokFb9jjdGC5jq9Ipdf4+QJy FASpQnuVOBF+ZUQ28IXEW2BPXwGO6wwmtAkzzDGu+sYyira8diolcrDrn3xItDNz5s3W 88iA== X-Gm-Message-State: AC+VfDyWtuRNNn8gzO7YygAoKJO71BE+hqWQSEAgkBDrW2y0sJHsprWs XaerFvIAz5HpU8JiphoUEEY5BgaA+f5qheiUDkUFeQ== X-Google-Smtp-Source: ACHHUZ5T8EKT0JKl6XZ75Bdj62293cwsmHDs78+f008iIbSBYWQ49UlnxFG6dzS82VYmZ4a1/uNrsA== X-Received: by 2002:a25:21c2:0:b0:b9e:887f:d09c with SMTP id h185-20020a2521c2000000b00b9e887fd09cmr4708079ybh.18.1685516112592; Tue, 30 May 2023 23:55:12 -0700 (PDT) Received: from C02D70YZMD6R.bytedance.net ([203.208.167.146]) by smtp.gmail.com with ESMTPSA id v4-20020a170902b7c400b001ac38343438sm495671plz.176.2023.05.30.23.55.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 23:55:12 -0700 (PDT) From: Zhihong Wang To: dev@dpdk.org, anatoly.burakov@intel.com, qi.z.zhang@intel.com Cc: Zhihong Wang Subject: [PATCH] eal/linux: register mp hotplug callback after memory init Date: Wed, 31 May 2023 14:55:06 +0800 Message-Id: <20230531065506.63021-1-wangzhihong.wzh@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) 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. 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;