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 EC50F43FB2; Tue, 7 May 2024 16:51:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6257E433B9; Tue, 7 May 2024 16:51:32 +0200 (CEST) Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by mails.dpdk.org (Postfix) with ESMTP id 38138433B1 for ; Tue, 7 May 2024 16:51:31 +0200 (CEST) Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1eeabda8590so160995ad.0 for ; Tue, 07 May 2024 07:51:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1715093490; x=1715698290; 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=zxjmCM0oJCiCqXFygQo6B1THbZNWpR/TsNGU/pMppJ8=; b=rdKi52af6yMwUL2dATy9VUnJF2acUAUzDA6A7XrhawxtinScFj+A5FqkfuDN7LuMc/ zH1HGuGpLcCzqTiZeKQFjRyFyEeCui7Ihr8gIBmu+PIMPb2+OLRfCW3EtjjA3J7E6fnz r0B0bYr9iTmeu5tfunHnKEMgh97ugMNlwNTj8SH+vvVcNLCicnMdBJWDkx7Q9E3cb2FV GbhQ1SV6WZQwzOZG1h1AKrFv5pnDpfoxE2/nYDpZxzdBsT0CGLMp0WiK002RVzrISjte qULp0/2t4bnvRHm0Mdm8wbsCr2ThhAIexwO7L66oK+okjKrnk/DegxB92okgL1n4sv2s YLPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715093490; x=1715698290; 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=zxjmCM0oJCiCqXFygQo6B1THbZNWpR/TsNGU/pMppJ8=; b=JaSA2d+lFdGvQJ/k/y/scLRxxabMcwSPp2O2UkEe9MB7nEjI/h2mpknCLW13LP7Eyg JcR9TR1n0oVSS6xBxeSHeLsFc0Xg4m0yi8RjstQonYAP7YUFCWLETSXg3noqJ7OBVGpW 0YEjIJbsPGNZk9qoDumwrC0zMdGPp6zeWxGO1OrsYeOpepN3SQHZJ4lxMhMJLSWYF27X UJSbGoTV8z6V56De6P4djMWBGqCBFs9AGk1qJf2kHW1SeEw6Fs/p9EGc2jFbHsR4ezgv KO0pUBCgwuesU8TfJTWMgPaRY6i0iJiedsiH/h9asOu4E5TfEc/K0wal4lVNI8huBtbZ Z0Ww== X-Forwarded-Encrypted: i=1; AJvYcCUQKwBUTiE2Wnza0V8QhXBdjfhC+Sgd+JeCK9uJREXl3gFaErheelCRThcRWtrDBM/q3ERW+3BgZVTeMtM= X-Gm-Message-State: AOJu0YzbV6kSEDrsVz0icwkAToZ4K+A/aMoFbUb2u6nm9JeCjOy1bc2a 8l0nUYOrR5xPWxp4XlkQKz6novmM3RfPlveZ5hDq7y8LsGTqTmMONmYVOPZV/fA= X-Google-Smtp-Source: AGHT+IHBS/Dcvwcjt6axj+0w+wDIhPtQIlyotX6ooRmyDlHZeNUW90qYTsesJX9x5Q1GlU1tt0/oQw== X-Received: by 2002:a17:903:1108:b0:1e3:c4c2:efa9 with SMTP id n8-20020a170903110800b001e3c4c2efa9mr15519539plh.31.1715093490085; Tue, 07 May 2024 07:51:30 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id x21-20020a170902ea9500b001e510b3e807sm9961222plb.263.2024.05.07.07.51.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 07:51:29 -0700 (PDT) Date: Tue, 7 May 2024 07:51:28 -0700 From: Stephen Hemminger To: Ferruh Yigit Cc: Mattias =?UTF-8?B?UsO2bm5ibG9t?= , "John W. Linville" , Thomas Monjalon , dev@dpdk.org, Mattias =?UTF-8?B?UsO2bm5ibG9t?= , Morten =?UTF-8?B?QnLDuHJ1cA==?= Subject: Re: [RFC v2] net/af_packet: make stats reset reliable Message-ID: <20240507075128.36484b4b@hermes.local> In-Reply-To: References: <20240425174617.2126159-1-ferruh.yigit@amd.com> <20240426143848.2280689-1-ferruh.yigit@amd.com> <108e0c40-33e7-4eed-83de-eaedee454480@lysator.liu.se> <238675d1-b0bb-41df-8338-a1052c1a88c1@lysator.liu.se> 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 Tue, 7 May 2024 14:49:19 +0100 Ferruh Yigit wrote: > On 5/7/2024 8:23 AM, Mattias R=C3=B6nnblom wrote: > > On 2024-04-28 17:11, Mattias R=C3=B6nnblom wrote: =20 > >> On 2024-04-26 16:38, Ferruh Yigit wrote: =20 > >>> For stats reset, use an offset instead of zeroing out actual stats > >>> values, > >>> get_stats() displays diff between stats and offset. > >>> This way stats only updated in datapath and offset only updated in st= ats > >>> reset function. This makes stats reset function more reliable. > >>> > >>> As stats only written by single thread, we can remove 'volatile' > >>> qualifier > >>> which should improve the performance in datapath. > >>> =20 > >> > >> volatile wouldn't help you if you had multiple writers, so that can't > >> be the reason for its removal. It would be more accurate to say it > >> should be replaced with atomic updates. If you don't use volatile and > >> don't use atomics, you have to consider if the compiler can reach the > >> conclusion that it does not need to store the counter value for future > >> use *for that thread*. Since otherwise, I don't think the store > >> actually needs to occur. Since DPDK statistics tend to work, it's > >> pretty obvious that current compilers tend not to reach this conclusio= n. > >> > >> If this should be done 100% properly, the update operation should be a > >> non-atomic load, non-atomic add, and an atomic store. Similarly, for > >> the reset, the offset store should be atomic. > >> > >> Considered the state of the rest of the DPDK code base, I think a > >> non-atomic, non-volatile solution is also fine. > >> > >> (That said, I think we're better off just deprecating stats reset > >> altogether, and returning -ENOTSUP here meanwhile.) > >> =20 > >>> Signed-off-by: Ferruh Yigit > >>> --- > >>> Cc: Mattias R=C3=B6nnblom > >>> Cc: Stephen Hemminger > >>> Cc: Morten Br=C3=B8rup > >>> > >>> This update triggered by mail list discussion [1]. > >>> > >>> [1] > >>> https://inbox.dpdk.org/dev/3b2cf48e-2293-4226-b6cd-5f4dd3969f99@lysat= or.liu.se/ I would prefer that the SW statistics be handled generically by ethdev layers and used by all such drivers. The most complete version of SW stats now is in the virtio driver. If reset needs to be reliable (debatable), then it needs to be done without atomics.