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 547B042B8E; Wed, 24 May 2023 16:50:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 496B540ED8; Wed, 24 May 2023 16:50:18 +0200 (CEST) Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by mails.dpdk.org (Postfix) with ESMTP id 95C50400EF for ; Wed, 24 May 2023 16:50:16 +0200 (CEST) Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-64d1a0d640cso776428b3a.1 for ; Wed, 24 May 2023 07:50:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1684939816; x=1687531816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=39b+Va/xZlKzrMHAPggdwgZi0NlvWXUbPMksoyLy7uo=; b=Ayl5E4upXzW2MLwvViPaQpyELLiM0veufv/b/A0NaHKcb8FNdg+KmXLzuWSnL1IA++ vy8ZWKdn3p9BtY2BxwVgIzVX/L2Hz8gOGD6D342ELw64hK+u385ISRpjAi0Vc7klLDDH n1gP027fPZRbwTbP5OsHgVl/rqvNQR4ZYwuSlofmSSWCnKZvb+E0v/2iND/OG9U8Ezdt w67WJhAnzB/RwvQLjnnrfTJHAMb7c/upOwcaiapBr4D8jzTE9g13Pisx+RmUGZku69Vl iH7HP7DCiZeoEU0o3BXi8ERPwMaDBkE1GdbhuzKDYqP9DS5oT4czSiwtcdWMecq/+9Mo sDOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684939816; x=1687531816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=39b+Va/xZlKzrMHAPggdwgZi0NlvWXUbPMksoyLy7uo=; b=RHPepI6f9Rd88tF+9X7xA6oDMsCZAikf3v25z8Z659Mv70OE0YX7Y6BqYGKztkwe64 VBTK6zPtBCOo7GPLnjBVo4Cs+hU30N1VyBCbAbhLzmfY5ZyQSU4zKsUZ1PGPELHm8MPi t6AI7rve1IeDiSYmfEFNYplzMn/dhF0n4KLT+ya9CjUCxXktRhxBTB7fsEvbTBXQb0FK R4LIFZtHoHt4noghCHPGt0BPCHKv6YFgLQpIIh/UWvuMLisZk6jRp+YGaI24DSyMTNJn ZnSyUDiOPHQkGEyOzhnrySCjtXlegwQ+xK0cSZiV064+Hr1Lz0sxznI76JyYtwJL0AuO Cn2Q== X-Gm-Message-State: AC+VfDx/o0m5uWXj2IWZ+unzgLssfNEjM2gFvZrQyxCjprMGKnUFaUta 2mOmOH8LNYstdxWiLvCFUhieqg== X-Google-Smtp-Source: ACHHUZ7+sfW3gvuiZ3Lc1VcXltXm/sNYQLr585OcKuyNqTkJAI2WC40Txo4ZJcil5/lPHBOHF6/GmA== X-Received: by 2002:a05:6a00:13a9:b0:63d:2f13:200 with SMTP id t41-20020a056a0013a900b0063d2f130200mr3399690pfg.16.1684939815777; Wed, 24 May 2023 07:50:15 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id a24-20020a62e218000000b00642f1e03dc1sm7711158pfi.174.2023.05.24.07.50.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 07:50:15 -0700 (PDT) Date: Wed, 24 May 2023 07:50:13 -0700 From: Stephen Hemminger To: Cc: , , , , Subject: Re: [PATCH] common/mlx5: adjust fork call with the new kernel API Message-ID: <20230524075013.3c2f7b6e@hermes.local> In-Reply-To: <20230524120140.416144-1-erezf@nvidia.com> References: <20230524120140.416144-1-erezf@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 Wed, 24 May 2023 15:01:40 +0300 wrote: > From: Erez Ferber > > While doing process fork() the operating system remaps all the parent > process's memory to the address space of the child process and activates > the Copy-on-Write mechanics - it duplicates physical pages once memory > writing happens in the child process. Sometimes memory duplication is > not allowed - for example, if the page contains hardware queue > descriptors. To handle similar issues the rdma-core library should be > prepared for forking. > > The ibv_fork_init() prepares the library to track all the related memory > and prevent it from forking using madvise() system API. This approach > allows fork, but not all the memory is forked to the child process and, > application should care not to touch pages where the parent application > allocated the rdma-core objects. > > The newer kernels propose an option of copy-on-fork for DMA pages and > tracking all the memory and disabling it for the forking is no longer > needed. The new API routine ibv_is_fork_initialized() should be involved > to decide if library initialization for forking is required. > > Fixes: 0e83b8e536 ("net/mlx5: move rdma-core calls to separate file") > Cc: stable@dpdk.org > Signed-off-by: Erez Ferber I don't think DPDK applications should fork(), and lots other parts of the shared huge pages will break if an application does this.