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 AD877424EF; Mon, 4 Sep 2023 13:57:25 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 89A11402BB; Mon, 4 Sep 2023 13:57:25 +0200 (CEST) Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) by mails.dpdk.org (Postfix) with ESMTP id CC65F400EF for ; Mon, 4 Sep 2023 13:57:23 +0200 (CEST) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 5164213893 for ; Mon, 4 Sep 2023 13:57:23 +0200 (CEST) Received: by mail.lysator.liu.se (Postfix, from userid 1004) id 4FE3B13725; Mon, 4 Sep 2023 13:57:23 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on hermod.lysator.liu.se X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=ALL_TRUSTED, AWL, NICE_REPLY_A autolearn=disabled version=3.4.6 X-Spam-Score: -2.2 Received: from [192.168.1.59] (h-62-63-215-114.A163.priv.bahnhof.se [62.63.215.114]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id BF4AD13450; Mon, 4 Sep 2023 13:57:20 +0200 (CEST) Message-ID: <86202387-4424-e4d8-64df-531a580bebd4@lysator.liu.se> Date: Mon, 4 Sep 2023 13:57:19 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH] eal: add cache guard to per-lcore PRNG state To: =?UTF-8?Q?Morten_Br=c3=b8rup?= , thomas@monjalon.net, david.marchand@redhat.com, mattias.ronnblom@ericsson.com, bruce.richardson@intel.com Cc: olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, honnappa.nagarahalli@arm.com, konstantin.v.ananyev@yandex.ru, dev@dpdk.org References: <20230904092632.12675-1-mb@smartsharesystems.com> Content-Language: en-US From: =?UTF-8?Q?Mattias_R=c3=b6nnblom?= In-Reply-To: <20230904092632.12675-1-mb@smartsharesystems.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP 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 2023-09-04 11:26, Morten Brørup wrote: > The per-lcore random state is frequently updated by their individual > lcores, so add a cache guard to prevent CPU cache thrashing. > "to prevent false sharing in case the CPU employs a next-N-lines (or similar) hardware prefetcher" In my world, cache trashing and cache line contention are two different things. Other than that, Acked-by: Mattias Rönnblom > Depends-on: series-29415 ("clarify purpose of empty cache lines") > > Signed-off-by: Morten Brørup > --- > lib/eal/common/rte_random.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/lib/eal/common/rte_random.c b/lib/eal/common/rte_random.c > index 565f2401ce..3df0c7004a 100644 > --- a/lib/eal/common/rte_random.c > +++ b/lib/eal/common/rte_random.c > @@ -18,6 +18,7 @@ struct rte_rand_state { > uint64_t z3; > uint64_t z4; > uint64_t z5; > + RTE_CACHE_GUARD; > } __rte_cache_aligned; > > /* One instance each for every lcore id-equipped thread, and one