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 1F98D43F06; Sat, 27 Apr 2024 00:57:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 91CD5440AA; Sat, 27 Apr 2024 00:57:17 +0200 (CEST) Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by mails.dpdk.org (Postfix) with ESMTP id 39EAA44095 for ; Sat, 27 Apr 2024 00:57:14 +0200 (CEST) Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1e5715a9ebdso23255785ad.2 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=VpNH1npHb+UqT4ikvg2+mSZpm9B0UQkKU2Jn7wwukEyh6KV57syWEz4k1cXljFYu9L vlGNB2YuM4vjLyXyBGh4IQcZpr+0NdaZ3wYwkIEmpsWgGQulrJJ9d+Ovnia56VnN5ln6 GmPBfH3S+qj5D02PWUS2DWcWBrR0BJoS3MvgS51J8ebqgvBk/j03FZEgAupbnI1FiGpd R87VVfBpvlJ85hrnVcXb5fZeq1orsqtuagnL5q+iUGGvThxxrqPSLSTXQ18xQg+Pd23d 5w642GjbtYcKxt4c3MmI+hvYQG1VVGO/D9fc+WkVeyYBYio16Q8ccHVlJ712Jd7DB4wV vl3g== X-Forwarded-Encrypted: i=1; AJvYcCWnmb5jkEEtEQKNWBMe6AU+nCF3dpY8XGCTCQXFWuuXQsWNPtyt/zfeTSauG75js+19lIpZytmv+dfUCpc= X-Gm-Message-State: AOJu0Yx84rckirtbZKwDBnYP+crwVP4k8UCBGE5VZowMDIA8CXrNcooj q0pxIlS7xcbW7xQgFu00smgSPseKNzxtxAS6Pr2St5bgZ5SDQ2FSu2ThWCGwGEs= 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: 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 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.