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 C09D642503; Tue, 5 Sep 2023 12:15:19 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2AA9B40DCF; Tue, 5 Sep 2023 12:15:19 +0200 (CEST) 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 C3A0640289 for ; Tue, 5 Sep 2023 12:15:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693908917; 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=dvBrJlU3El8Tn+/umHhNdGFcHsWMhM1jTXSglZ+jal4=; b=C+DYwNZs/7e3wWRM4/GDFNd8Cgz1Q5qhdcJlmWhkddw2ft+qFwWR8j+TKHmjNd75rJyVgd 6hAWc+mMScnK0zdJgvYn0bh1Nyg0u9uf0g54eh70LWBJS11tsXAtSJwEoScD8u+OgIy5E/ y1phUoq84oNKjRPmnY6AhWhZU1lZPnA= Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-536-MtdF4pnrMAy-IE4jVEpIQg-1; Tue, 05 Sep 2023 06:15:15 -0400 X-MC-Unique: MtdF4pnrMAy-IE4jVEpIQg-1 Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-500af1b3b20so2437513e87.3 for ; Tue, 05 Sep 2023 03:15:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693908914; x=1694513714; 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=dvBrJlU3El8Tn+/umHhNdGFcHsWMhM1jTXSglZ+jal4=; b=GsexpMQOGaQ3BfTlDio6fbD8ExNJXCcN6BLkW3bBxQAfs3tlPMwSOtil+nujYHXWhe Dm9x27ri2O60HHDcToaD2XVpDk/ZSMs2o1dRDFYLS0/xJfUwoxdsuW0EGPvttOaGRcTb RCJg+/QCNP22kV3JTmssXe6OCw+hKbzydYVRWdZaqcOOYnHbLudDI/DUTaeT8W2PYe+T ngpqj2p/pi/UWuwldcW8+ZcTiXXkU4JHthJDxJE8hYJR/2OJCJfDbdGHEA7AiezPrC3P /bA8VLhtd3nIhbjXlRIWBAQsohuC9vwSikcKMKsUUZRPFoqyAnSUr6KET+z1eJikc1gb +v3Q== X-Gm-Message-State: AOJu0Yz5/9nbXpq09TXywJOpJYYA81MzBd/3JDu9gmx4PF7xxauvMhoK F2ssH3laFK5zscvn+cA0CoSxgo4pXCQNsxiNbRlzPyCgB+G7GJuCXP8zzpb2kadCSzw8DsjwSku YWDVkCfep+RjNGycgaSE= X-Received: by 2002:a05:6512:a88:b0:500:b53f:fbc2 with SMTP id m8-20020a0565120a8800b00500b53ffbc2mr10141887lfu.26.1693908914373; Tue, 05 Sep 2023 03:15:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG/3FskU3ya4k5WfT38dHFyfhk6fbbqEzDKKRUVdGiTo5Wp8oUZvNLxnpThLWeSbMbZYLAjLrc1I6YrGNtROg4= X-Received: by 2002:a05:6512:a88:b0:500:b53f:fbc2 with SMTP id m8-20020a0565120a8800b00500b53ffbc2mr10141857lfu.26.1693908914003; Tue, 05 Sep 2023 03:15:14 -0700 (PDT) MIME-Version: 1.0 References: <20230830103303.2428995-1-artemyko@nvidia.com> <20230904082455.3864024-1-artemyko@nvidia.com> <20230905100553.0b6518ca@sovereign> In-Reply-To: From: David Marchand Date: Tue, 5 Sep 2023 12:15:02 +0200 Message-ID: Subject: Re: [PATCH v2] eal: fix memory initialization deadlock To: Artemy Kovalyov Cc: Dmitry Kozlyuk , "dev@dpdk.org" , "NBU-Contact-Thomas Monjalon (EXTERNAL)" , Ophir Munk , "stable@dpdk.org" , Anatoly Burakov , =?UTF-8?Q?Morten_Br=C3=B8rup?= , Stephen Hemminger 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 On Tue, Sep 5, 2023 at 11:05=E2=80=AFAM Artemy Kovalyov wrote: > > > > + /* memory_hotplug_lock is taken in rte_eal_init(), so it= 's > > > + * safe to call thread-unsafe version. > > > + */ > > > > Nit: the lock is really taken in rte_eal_memory_init(). > > Probably "The lock is held during initialization, so..." > > would more robust against code changes and differences between platform= s. > > It was previously located differently, but in the current version, it has= been shifted to rte_eal_init(). It might be worth noting this to ensure th= at if there are further code changes in the future, the locking problem bec= omes more apparent. We had discussed this in the bug report. One option to explore is lock annotations. One note thought: those annotations do not get inherited in called code. So some special care is needed to maintain/annotate all code leading to the locations where the locks do matter. Quick example with rte_memseg_list_walk: https://github.com/david-marchand/dpdk/commit/mem_annotations And clang catches a deadlock: https://github.com/david-marchand/dpdk/actions/runs/6082842080/job/16501450= 978#step:19:816 --=20 David Marchand