From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 1CC6142FE2;
	Sat,  5 Aug 2023 17:58:32 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 0A27F410EE;
	Sat,  5 Aug 2023 17:58:30 +0200 (CEST)
Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com
 [209.85.210.182])
 by mails.dpdk.org (Postfix) with ESMTP id DB3C140A81
 for <dev@dpdk.org>; Sat,  5 Aug 2023 17:58:28 +0200 (CEST)
Received: by mail-pf1-f182.google.com with SMTP id
 d2e1a72fcca58-68783b2e40bso2113944b3a.3
 for <dev@dpdk.org>; Sat, 05 Aug 2023 08:58:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1691251108;
 x=1691855908; 
 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=oRQolcw6Lwfd2KrtSlgCOpO8fmkY5qlNXjeyWWSU5BE=;
 b=VnIHqR3cXUbB/TfB3dFIf70Mqa52ggBoS2P/DA93dheB2SGup6UsXuNJoxm5I3/s5N
 BWE5NHHH84zkPpPh0/kHpuHkE/i/uTg5B3Sb4ctN1SSx+cIM3D9R32VZ4f0dS+GnaZTu
 FYBborBNXx1NM+IN75UTErl0UokOHySxuA+8/Fk7RgpfB4e/NCxkRt4nQ7Wc86TPQ8Lg
 qhosiPHZoMaUvLs2rjsFjmZ6EJm3KLx0mVQ5qA0JLdp+m2crn14SgRd0M8WduqhRiGzE
 LANyTN4oPrMrOJ13CxQ7XyyZk8GAOlRCOxFb3oLw0nH4JvOBpPVB0ggmtGdh8JzNPWNU
 vIxQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1691251108; x=1691855908;
 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=oRQolcw6Lwfd2KrtSlgCOpO8fmkY5qlNXjeyWWSU5BE=;
 b=V4Wdp8o9hNr90zCv/MuZbTooK1pscEVviMcDxlL1DuSGiev5I5VhlDf/xTWSl8LKgj
 DdxY0Q1tNl5DRX8r4D7xByu/+1YZbc30d15u0xmz65LF2dptdUXHR2ipArFlsTx1IOMC
 6CVicEJvI+i6buGK+Dv8f6AICNQabZzVmCNKzTztbPY7JovYRKY0Ud8B5joqEJn4z7N7
 Npgs+UdU6Enq24DV67wl0xbay4Be028QsE9fG6BkuVrnMbbPHUlpkS+F8GUGknGUyj58
 SdxDv50rQ4cTcBc/JAiLXoZ7vzhS/ZljUN0zoGv1EWMCvYS3wlSXaxCL/CkJj7Gd6pln
 cD+Q==
X-Gm-Message-State: AOJu0YwzSyO3mGlVVZh5u2ea9Rh/+9zoQhUbGKDlQaBOfmJpeLmNbTas
 xi6FFhLXk2o9k1X02yqIZmpX9A==
X-Google-Smtp-Source: AGHT+IHZ26b0CZdVkIJCHi5BFYLolZsfTdAWTrdj3RMqOfjGKt0L/hcrXY0/Vj9Ace/jzuNgchtObQ==
X-Received: by 2002:a05:6a20:3d22:b0:140:a0dc:c834 with SMTP id
 y34-20020a056a203d2200b00140a0dcc834mr480830pzi.24.1691251107793; 
 Sat, 05 Aug 2023 08:58:27 -0700 (PDT)
Received: from hermes.local (204-195-127-207.wavecable.com. [204.195.127.207])
 by smtp.gmail.com with ESMTPSA id
 c21-20020a62e815000000b0066f37665a6asm3301815pfi.117.2023.08.05.08.58.27
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 05 Aug 2023 08:58:27 -0700 (PDT)
Date: Sat, 5 Aug 2023 08:58:25 -0700
From: Stephen Hemminger <stephen@networkplumber.org>
To: Dongdong Liu <liudongdong3@huawei.com>
Cc: <dev@dpdk.org>, <ferruh.yigit@amd.com>, <thomas@monjalon.net>,
 <andrew.rybchenko@oktetlabs.ru>, <stable@dpdk.org>
Subject: Re: [PATCH 4/5] net/hns3: fix TM thread safety risk
Message-ID: <20230805085825.0d6caf26@hermes.local>
In-Reply-To: <20230805083627.8681-5-liudongdong3@huawei.com>
References: <20230805083627.8681-1-liudongdong3@huawei.com>
 <20230805083627.8681-5-liudongdong3@huawei.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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

On Sat, 5 Aug 2023 16:36:26 +0800
Dongdong Liu <liudongdong3@huawei.com> wrote:

> From: Chengwen Feng <fengchengwen@huawei.com>
> 
> The driver-related TM (traffic management) info is implemented through
> the linked list. The following threads are involved in the read and
> write of the TM info:
> 
> 1. main thread: invokes the rte_tm_xxx() API family to modify or read.
> 2. interrupt thread: will read TM info in reset recover process.
> 3. telemetry/proc-info thread: invoke rte_eth_dev_priv_dump() API to
>    read TM info.
> 
> Currently, thread safety protection of TM info is implemented only in
> the following operations:
> 1. some of the rte_tm_xxx() API's implementation.
> 2. reset recover process.
> 
> Thread safety risks may exist in other scenarios, so fix by:
> 1. make sure all the rte_tm_xxx() API's implementations protected by
>    hw.lock.
> 2. make sure rte_eth_dev_priv_dump() API's implementation protected
>    by hw.lock.
> 
> Fixes: c09c7847d892 ("net/hns3: support traffic management")
> Fixes: e4cfe6bb9114 ("net/hns3: dump TM configuration info")
> Cc: stable@dpdk.org

I hope no locking is necessary in the data path.