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 EA1BFA0542; Fri, 16 Dec 2022 09:09:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8A6D540E09; Fri, 16 Dec 2022 09:09:17 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id F026D40685 for ; Fri, 16 Dec 2022 09:09:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671178155; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mSjatFmNV8GZERBK+ImQH/OYnRe/Raup/KF4Tvk1b+4=; b=Pc3MlmdQv/7bWj6K0keMaK17i09/her8g/B1sKmEFJG976LT/oHNn4gnlBglhDFdLRCnT7 usOl/fJaW2ovPBiB+5RCcElxT7wtWtsEU73Hz1k/NErDXjgMmjmrqlG2zudrkGS31epymP Zbr7a+xh9Gb5+GnWhftxXkCqgtvb7Gg= Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-398-pdy8CJVmMeWmXgzZ_K_e1A-1; Fri, 16 Dec 2022 03:09:13 -0500 X-MC-Unique: pdy8CJVmMeWmXgzZ_K_e1A-1 Received: by mail-pg1-f200.google.com with SMTP id 84-20020a630257000000b00477f88d334eso1143983pgc.11 for ; Fri, 16 Dec 2022 00:09:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mSjatFmNV8GZERBK+ImQH/OYnRe/Raup/KF4Tvk1b+4=; b=7HkNAFS2LzPXQ0rnLznJ3CTLzszYSDRhJEQ0ByqmA+R3yZOYoOgJj82lxxwpzvZusA bD1392nfT83vCi6MF7wc2ZZDssYuz1s/bvhvgVslfEeuQqMk1+z+WHmkIOZtoqJsFLqc Z1B48yO0oMN9qJeADIP8zdzTtsgeEu4ZdGJIlmgpozebuGJ6K2U9qgcT1/9mJXzcEJhe adcszPLTMThtvpWcUonYrUSd301fIG+r7oKrt8UGruim+3JrKon0YZmHYlo7ZtV8ts6z NRdKTp5fXxEDqvcMkOMJvtxP6rvQRshKOX7DlJ2Qhmc0UifBH0Lff8glP1sHaa/zVE+m sjLg== X-Gm-Message-State: ANoB5pkBaH6iaSvLHQL3ybGRZw8xb3xqa8ytcWE+3NxoIlZBylVjbVej PQn3YjftMIHgkTriHVgde4CUEO0p5grC9VIAxvxBG5zZLu55GyW5byYTMX80qypw1ME7PV6fZO0 Cxnb6NCnv+cgWmGKZNOo= X-Received: by 2002:a17:902:a418:b0:187:edc:82f3 with SMTP id p24-20020a170902a41800b001870edc82f3mr81020253plq.161.1671178152411; Fri, 16 Dec 2022 00:09:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf5VF+y39LIDfPhsmdbCbU9zZ9OXFAjZSdVUfI0eJ6oCYNE5lezySHlkZDkE3eg03tRhRxylmc/mdzrI1KVLsiw= X-Received: by 2002:a17:902:a418:b0:187:edc:82f3 with SMTP id p24-20020a170902a41800b001870edc82f3mr81020244plq.161.1671178152101; Fri, 16 Dec 2022 00:09:12 -0800 (PST) MIME-Version: 1.0 References: <20200610144506.30505-1-david.marchand@redhat.com> <20200706205234.8040-1-david.marchand@redhat.com> <20200706205234.8040-8-david.marchand@redhat.com> <98CBD80474FA8B44BF855DF32C47DC35D875A7@smartserver.smartshare.dk> <98CBD80474FA8B44BF855DF32C47DC35D875A9@smartserver.smartshare.dk> In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35D875A9@smartserver.smartshare.dk> From: David Marchand Date: Fri, 16 Dec 2022 09:09:00 +0100 Message-ID: Subject: Re: [dpdk-dev] [PATCH v6 07/10] eal: add lcore init callbacks To: =?UTF-8?Q?Morten_Br=C3=B8rup?= Cc: dev@dpdk.org, jerinj@marvell.com, bruce.richardson@intel.com, mdr@ashroe.eu, thomas@monjalon.net, andrew.rybchenko@oktetlabs.ru, ktraynor@redhat.com, ian.stokes@intel.com, i.maximets@ovn.org, olivier.matz@6wind.com, konstantin.ananyev@huawei.com, Neil Horman , mattias.ronnblom@ericsson.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 Morten, On Thu, Dec 15, 2022 at 11:21 AM Morten Br=C3=B8rup wrote: > > > Shouldn't these callbacks be called from the EAL threads too, e.g. > > from eal_thread_loop()? > > > > > > I looks like they are only called from eal_lcore_non_eal_allocate(), > > which is only called from rte_thread_register(). > > > > These should be called for already present lcores on callback > > registration. > > See rte_lcore_callback_register(). > > That is completely useless! They need to be called from the thread itself= , so they have the correct environment, thread local storage, thread id, an= d similar context. If it is broken, please fix it or come with a better implementation. At the time, existing modules were storing their per lcore/thread private info using a local array and dereferencing it using rte_lcore_id() or a criteria of their liking. The callbacks have to be carefully written to explicitly initialise per lcore/thread private info. I thought it was enough, plus nobody objected. Now, some things to consider for this requirement you want to add. If we want an application to be able to register callbacks after rte_eal_init(), we need to wake/interrupt all EAL threads from what they are doing. Once EAL threads enter some job the application gave, they won't reread anything from EAL. Or we could require that callbacks are registered before rte_eal_init(), the init() callback could be called as the last step once all DPDK modules are initialised but before the application calls rte_eal_remote_launch(). But the problem of needing the break EAL threads from what they are doing is also present when we want to call the uninit() callback. And there, I have no good idea. --=20 David Marchand