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 442F143F6B; Thu, 2 May 2024 20:26:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C0FDC402B2; Thu, 2 May 2024 20:26:06 +0200 (CEST) Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by mails.dpdk.org (Postfix) with ESMTP id 6534040299 for ; Thu, 2 May 2024 20:26:05 +0200 (CEST) Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-5f415fd71f8so6529441a12.3 for ; Thu, 02 May 2024 11:26:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1714674364; x=1715279164; 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=Z4HyRXSNJ5J5U2v3yxDWfPOobGVeavodJTTYMQLDD2I=; b=DddtTdy3xkT3f9m9+NuJ9Z91GeTgXyPv46LXYjnG8QlScwU0Wd3vgTe7oI0WioHmGq CCbQWldutkN6XGCdGluFyV4U8cwoZMZ8psz+w0/xoJVb6WmSRzcUZvaZx6ppa4duu2Sc n2CA7mJRbEO9Usb8qZAa04+ylA0GXHxlrS+6Eq1wDDikL2e5m9TpZ2Ww0p1xN1Qwg0CT Q/Vlu+3D4TcDiusBDOHlRdLwUQHhVgH2YYm0V8fnL25bEkkxsUCiVXZAWPnsDzqncOnD zR2M701d38CZcQPJx1ln6TME9Qjji2K+cD0gBKBL18ooAWhHaCf46gLtbCggaqb6KprA Hgpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714674364; x=1715279164; 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=Z4HyRXSNJ5J5U2v3yxDWfPOobGVeavodJTTYMQLDD2I=; b=CvdT/67lyo94Mal42Cs3P0RAdL7KuzRvrhsgXumOGag4BGJDKJfYFR5T2VyeFy6xAf 3n/k8lS375Q+HN+87AXBrtxcAf1M0NQl+ev2THKxCGwlGKWPMfPL5QYoRviOkgmVChkW 7Oq5VScSprhQy1PShpT+/5PHE8hhQYz8+CwHpLwMsZvUVsiHSKhSBKjZyhh0qSN0V7uj Z12ce1JsJCSBBJjM13sWeaGye15PFym4PPQUE2BfpUuWg7ZAEsxI0niQp26Tesi/MAXN Q/opEt14eGuYKfQzmulZP7PnV2+owfQ2CsqHTflaMo47jUi5ZnzX4nxZit6I07751+UK o+Jw== X-Forwarded-Encrypted: i=1; AJvYcCXJOKrSZpGBkkFdmrtct/OqcTCzEiPNmRTFuNjbD6bUqlAqIF3V5Hhh2qHptvJwAjlW95eNP+AJqsZvBOY= X-Gm-Message-State: AOJu0YyYB+iuTs3RscdPGO/zfb/1zjtJBastRVPTHeTlN6msSKBNOW0o tykBhqfjX2AUscCZK3bCx4ihKgi66c8lSOQ73m8mMhkuZ4ASXlFTCzqZfHS6c48= X-Google-Smtp-Source: AGHT+IFzm2DIjOxzbPAZLs8vGiJ4QALyqr31irogpAj6vRbfDlCfBqBmJUURsTi2onDRtY/wkJD+Iw== X-Received: by 2002:a17:902:f792:b0:1eb:5403:b16 with SMTP id q18-20020a170902f79200b001eb54030b16mr739098pln.0.1714674364336; Thu, 02 May 2024 11:26:04 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d11-20020a170903208b00b001e7b8c21ebesm1619543plc.225.2024.05.02.11.26.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 11:26:04 -0700 (PDT) Date: Thu, 2 May 2024 11:26:02 -0700 From: Stephen Hemminger To: Mattias =?UTF-8?B?UsO2bm5ibG9t?= Cc: Ferruh Yigit , "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: <20240502112602.27d55fb8@hermes.local> In-Reply-To: <758132fe-fc44-4c06-8e54-c0439f3a693f@lysator.liu.se> References: <20240425174617.2126159-1-ferruh.yigit@amd.com> <20240426143848.2280689-1-ferruh.yigit@amd.com> <108e0c40-33e7-4eed-83de-eaedee454480@lysator.liu.se> <7e5dd3cd-ea50-4aea-a350-d88f46854172@amd.com> <422dd5a6-4ed6-4ae5-b613-b22a7cf6f77d@amd.com> <758132fe-fc44-4c06-8e54-c0439f3a693f@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 Thu, 2 May 2024 19:37:28 +0200 Mattias R=C3=B6nnblom wrote: > >=20 > > Do we need to declare count as '_Atomic', I wasn't planning to make > > variable _Atomic. This way assignment won't introduce any memory barrie= r. > > =20 >=20 > To use atomics in DPDK, the current requirements seems to be to use=20 > RTE_ATOMIC(). That macro expands to _Atomic in enable_stdatomic=3Dtrue=20 > builds, and nothing otherwise. >=20 > Carefully crafted code using atomics will achieved the same performance=20 > and be more correct than the non-atomic variant. However, in practice, I= =20 > think the non-atomic variant is very likely to produce the desired result= s. You are confusing atomic usage for thread safety, with the necessity of compiler barriers.=20 Stats should not be volatile.