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 5AAC543F06 for ; Sat, 27 Apr 2024 00:57:17 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4D3C144095; Sat, 27 Apr 2024 00:57:17 +0200 (CEST) Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by mails.dpdk.org (Postfix) with ESMTP id 1F6604406D for ; Sat, 27 Apr 2024 00:57:14 +0200 (CEST) Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1eab16dcfd8so22837665ad.0 for ; Fri, 26 Apr 2024 15:57:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1714172233; x=1714777033; 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=aea9ApFUooJHO8lImXgNm40LQIMs8Mo09R9gJWkMFGk=; b=v4vtlyj1sqrFeqhQ/ljg5P1xLhv8zEI0jx7HOYPrtNfToyUmqVombag4o4EHEHpI07 2egcjT3RXAnMzYjihA5vJlYEY4cVS1Lj8l2Bhlr1ij6/SO9aiyHIkxKOqVGOtUtcdPuQ /rEnjtzL/HHFiJffqBA0X/UjKlIcj6WZHtyemZzm0CmXS24Ihli/dibdOvomDeCPtkcK obqtmLdSlND6ReBCx7lNz9uo24YolndRY47IcLhaKueQUPjjoLaMGLg8X4+AmOvsyKfI nUrHK1LcOWrsodcJAbLKrbYmuKwoV/jX86OLq71t2yqcZ3Q0ywMlhNr3rLCLJVHBVtvM ox8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714172233; x=1714777033; 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=aea9ApFUooJHO8lImXgNm40LQIMs8Mo09R9gJWkMFGk=; b=Bw9r/SSwalrc1kS/GrsztUKATTyULjFEuVQw1rLYhAE8gbVXTaFKmkreWGQMnMcnLj I+dxLEGg1Dr75ImCIEZSAR7lmj+FmsUJDmsehtjCL3DCuhyjXmGq7RFREo2uvnbzOZC0 8+QUxIDtFOv9o3T7QS+ng9/o3ncJh7QV1dalyaH0vxrXidXsiJL/YFmBTAe4/oECV2cZ 40VYDTDPw1Fp4oEbnQ8jtetxhMG1h23gO3vVMX9KNEObYG1tI00cQqE7ayjuY1NXPzeL Cuzs/UHibB3O64S/PTKnIeAC8aJIKD5R2pTmX4HU/R3eP2E4VAAxZ0FkyZmAWn7MxeHY g8uw== X-Forwarded-Encrypted: i=1; AJvYcCUyEY/MAk7RL9kUSut3T/MpW4mjTtE5u5S7qUSriHUNMMN5K8loh8rhheNFaYDvEYxlvRnue7SlOBhrykSDHZ8= X-Gm-Message-State: AOJu0Yyq853E1K/DzEt8Cler1bnG/Eu+MywUT/V6AJ/ZLl4cQFgg5YU7 1b3OK0R3CV34tH899YN/GT53ZK9SB0YiRn9A2qXmDBk2fO6b8/vkVAvI/XiOr/k= X-Google-Smtp-Source: AGHT+IGHvV6Ykq/oIz//5/hT9b+UUZU6YRi/00077nyfQha/xsk0mx334Gr4nKPMG43MS/h5Ou5/lQ== X-Received: by 2002:a17:902:f64c:b0:1e4:c07b:a8e0 with SMTP id m12-20020a170902f64c00b001e4c07ba8e0mr1341774plg.66.1714172233217; Fri, 26 Apr 2024 15:57:13 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id x5-20020a170902a38500b001e2bfd40b86sm16275326pla.47.2024.04.26.15.57.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 15:57:13 -0700 (PDT) Date: Fri, 26 Apr 2024 15:57:11 -0700 From: Stephen Hemminger To: Morten =?UTF-8?B?QnLDuHJ1cA==?= Cc: "Ferruh Yigit" , "Thomas Monjalon" , "Andrew Rybchenko" , , , Mattias =?UTF-8?B?UsO2bm5ibG9t?= Subject: Re: [PATCH] ethdev: document that stats reset APIs are not thread-safe Message-ID: <20240426155711.368c0755@hermes.local> In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9F3FA@smartserver.smartshare.dk> References: <20240425165308.1078454-1-ferruh.yigit@amd.com> <98CBD80474FA8B44BF855DF32C47DC35E9F3F7@smartserver.smartshare.dk> <20240426081334.1a24577d@hermes.local> <98CBD80474FA8B44BF855DF32C47DC35E9F3FA@smartserver.smartshare.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On Fri, 26 Apr 2024 17:17:25 +0200 Morten Br=C3=B8rup wrote: > > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > > Sent: Friday, 26 April 2024 17.14 > >=20 > > On Fri, 26 Apr 2024 14:20:01 +0200 > > Morten Br=C3=B8rup wrote: > > =20 > > > > From: Ferruh Yigit [mailto:ferruh.yigit@amd.com] > > > > Sent: Thursday, 25 April 2024 18.53 > > > > > > > > Making 'rte_eth_stats_reset()' and 'rte_eth_xstats_reset()' APIs th= read > > > > safe has performance impact on datapath. > > > > > > > > Instead document APIs as not thread safe and add condition for reli= able > > > > stats reset functionality, forwarding should be stopped. =20 > > > > > > I'm not sure stopping forwarding suffices. > > > NIC hardware counters will keep progressing unless RX and TX is stopp= ed at =20 > > NIC level. =20 > > > > > > I don't have any suggestions for a better wording, though. :-( > > > > > > Anyway, better with the patch than without... > > > Acked-by: Morten Br=C3=B8rup > > > =20 > >=20 > > The safest option would be: > > rte_eth_dev_stop > > rte_eth_stats_reset > > rte_eth_dev_start =20 >=20 > Yes, but this will cause packet loss. > Network admins should be able to clear the counters without causing packe= t loss. >=20 Another alternative would be to a "reset zero" approach. When reset is done, capture the current state of all the relevant counters. Record that, and subtract those on next request. Never modify the underlying counters. To make it MT safe, use lock on reset and something super lightweight like seqlock on the stats request side. Might be hard with the size and va= riable length nature of xstats thoug.