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 68C4B45AD8; Mon, 7 Oct 2024 19:54:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2B31A4026C; Mon, 7 Oct 2024 19:54:12 +0200 (CEST) Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) by mails.dpdk.org (Postfix) with ESMTP id DAC5C4021E for ; Mon, 7 Oct 2024 19:54:10 +0200 (CEST) Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-7e9f998e1e4so1761486a12.1 for ; Mon, 07 Oct 2024 10:54:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1728323650; x=1728928450; darn=dpdk.org; 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=p5aaMmTcWApERqwC/cwe2xVU/EeUuvaYivHtM/I9t3w=; b=Ik7pzaDCz3aJYO2BEhyX0F0hR9fGzzAWIBFSLNZUW8YUPof593fk5oP6uk5pVI2OkX MBAMM+uBAam0Bvg5P8O24mp9JWIf7MzHUHvB9ve3at3Pca1p+T5AZNg1cwMRG+CUeP7H wVj+tzZytFyaKiOlLERAEWIL82D4OHjKEBiHcBDkMYVoEOj20xYaYKn2nlYFwowkzrTJ i/J5noPetscbKh6vU+MRL3jrOOtHyYliU+yv6vIPLPwHEfQswg77zbh7VMHeVzAWiT3w eBL+B6trHAM86xBX2GdjATChfrscSCVs4LwJMCCbpZ9sIxWUfrcCKMyKmxhXQZ2Yxam+ SIcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728323650; x=1728928450; 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=p5aaMmTcWApERqwC/cwe2xVU/EeUuvaYivHtM/I9t3w=; b=r+GQw88LVlaFyYsLc+QsDQ/YNjW9uf1fCfbc6OgNmR/4ngSK+1Vj35W2rAtLupdNM3 805sS69xKaCUGfjuYuzdFSy6haM2cHds9tBXrPgfAg5Foygzg+bBDrM0iO9Tr6cBlub0 pncBnihSUcdvc8hGZJGh6sg7HlIP/1IPpsDP9tMoeV5S2unk28OLGfCs+ODmpxMeB2Nf Tj/UvL8FVend0okIMhBh3CZbCzgUUtJC5/OEeuZVuL7PdffysX8/rj0Lzp4Pr1fuBxoR 6irsbjZGhp7fdYuHc83ms2lpJEGlz9VBJjp/IzcZE9BZ7/XLIqkzA2EGZqibZSXy/1H7 klOQ== X-Gm-Message-State: AOJu0YwdDx/gKsV1q41RZQxRULyk553u0+3OM3V6S3knkfAnL4r/WnZ2 ei/aE9pG0BF3DDSMNN6G6ZUzzJ6H/AdfpVUQ+cUJBDVLZC5VTDte0Hm2hyzplaw= X-Google-Smtp-Source: AGHT+IFM8SCrmSMQ6kBktZPL/hfDyaLJ24WM6Q6Fpnwd5k+19xmxgdY7g8Ozn4ApevUSILbV528xKw== X-Received: by 2002:a05:6a20:9f09:b0:1d4:e4eb:73e2 with SMTP id adf61e73a8af0-1d6dfa35f28mr17591006637.13.1728323650006; Mon, 07 Oct 2024 10:54:10 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f6833cdcsm5299023a12.49.2024.10.07.10.54.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 10:54:09 -0700 (PDT) Date: Mon, 7 Oct 2024 10:54:07 -0700 From: Stephen Hemminger To: hepeng Cc: dev@dpdk.org Subject: Re: [PATCH] mlx5: fix race at mlx5_dev_close Message-ID: <20241007105407.51e6d4c3@hermes.local> In-Reply-To: <20240411061740.16495-1-hepeng.0320@bytedance.com> References: <20240411061740.16495-1-hepeng.0320@bytedance.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 Thu, 11 Apr 2024 14:17:40 +0800 hepeng wrote: > From: "hepeng.0320" > > mlx5_dev_close currently will set priv->sh->port[priv->dev_port - > 1].nl_ih_port_id to RTE_MAX_ETHPORTS to avoid mlx5_dev_interrupt_nl_cb > to use the port's dev_private, because later the rte_eth_dev_close > will free the dev_private and set the pointer to NULL. > > However, since mlx5_dev_interrupt_nl_cb is running in another thread, > I think the race still exists. So perhaps an easy fix is to wait for > 1ms to avoid this race. > > Signed-off-by: hepeng.0320 Not the pest way to handle this. Adding a one second delay on shutdown hurts some availability scenarios. Looks like mlx5 needs a more coordinated shutdown to be safe; adding big delays is not the correct fix.