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 79714A0547 for ; Tue, 11 Oct 2022 16:37:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 736B342E52; Tue, 11 Oct 2022 16:37:48 +0200 (CEST) Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) by mails.dpdk.org (Postfix) with ESMTP id 505ED42B7D; Tue, 11 Oct 2022 16:37:46 +0200 (CEST) Received: by mail-qk1-f170.google.com with SMTP id o22so8179217qkl.8; Tue, 11 Oct 2022 07:37:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=0+uTAT7iWV2/HhPJMBxMEIJXsfXBMuHBx+QCQIvke8Q=; b=FRvVkQ8Y7XarCpa4zbbj+LoxdMTbVg2DEsIsTEsR1x4DVbQTvqO43cmWmnNXK7yoVx qwakcqYwrbMvH4Ll/MdVid2QRIR1w0XgKkz34PHoTd8wGwOuDN9s3XInki30egD2y0lY CCmVB9YubIEb921UaF9fLk5hVVduqSG1TL41PPjTzGaO3yF83vob+X5jSqxuuAe5ho0Z glebfhPWUJVrCtEoLnXRWR4WvjXtBYnWoIeqr5vy1jOAUppGJXri0TICQ7olk5ETpWgU 8LzZGfU/BG7ObzPYfa9+/uSy3DDN8j+516vDicfhpYEpHbTHQlRrNDQs/FDFTJEkFmh6 RJvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0+uTAT7iWV2/HhPJMBxMEIJXsfXBMuHBx+QCQIvke8Q=; b=kU4ZteDuG6dGcCWclp9EWcAya7bEav+D26FbFufkiASK0aExI+sGhkB+Tj3KHkhCae ArrFOaaPrsPWBhTbcd8bCTsKI0/kjChdZU6LFItlyVZ7d9YitE/5m3n3SCKujVNHVoLu x6FaE5oo6vSJzZYBhxvhAOW+8Zrgsb0TvYwVqwRYAK3c8nhfIlG3ysc/TQCNE3t+K9zk HTrdhy5zcScqV1LILXcEOq7R+A2ZiUaFEl9yjXyTuaG1BZanK40qJRsy6nPBRebaym6W 08Lt1Esv5NKUaooCPCvNyBJ2fTGxWBk4FmRyBwq3WPLdY1vzwxyyu+/UB659NBcqfTvQ I9aQ== X-Gm-Message-State: ACrzQf10j3hUrbSHJJeD0KV3Raju1bWNtMbZQcSRHrop2GRxr//m9Ck8 ihVO8zjO/JxzYb60So0wxspw4qr8wMnBXSee3So= X-Google-Smtp-Source: AMsMyM54ekEjWoi41Z/q5fQ8HU8g2t/H8STVxjBX4zOqiHGUHdTPg8I84hHxgCtaZN132+3Zgo4k+3v8hSKC/bffxug= X-Received: by 2002:a05:620a:4842:b0:6ee:8c09:d7cf with SMTP id ec2-20020a05620a484200b006ee8c09d7cfmr1055317qkb.662.1665499065691; Tue, 11 Oct 2022 07:37:45 -0700 (PDT) MIME-Version: 1.0 References: <20220921120359.2201131-1-david.marchand@redhat.com> <20220921120359.2201131-6-david.marchand@redhat.com> In-Reply-To: <20220921120359.2201131-6-david.marchand@redhat.com> From: Jerin Jacob Date: Tue, 11 Oct 2022 20:07:19 +0530 Message-ID: Subject: Re: [PATCH 5/8] trace: fix race in debug dump To: David Marchand Cc: dev@dpdk.org, stable@dpdk.org, Jerin Jacob , Sunil Kumar Kori Content-Type: text/plain; charset="UTF-8" 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 Wed, Sep 21, 2022 at 5:35 PM David Marchand wrote: > > trace->nb_trace_mem_list access must be under trace->lock to avoid > races with threads allocating/freeing their trace buffers. > > Fixes: f6b2d65dcd5d ("trace: implement debug dump") > Cc: stable@dpdk.org > > Signed-off-by: David Marchand Acked-by: Jerin Jacob > --- > lib/eal/common/eal_common_trace.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/lib/eal/common/eal_common_trace.c b/lib/eal/common/eal_common_trace.c > index afc4c6dbe5..5280aa7d62 100644 > --- a/lib/eal/common/eal_common_trace.c > +++ b/lib/eal/common/eal_common_trace.c > @@ -255,10 +255,9 @@ trace_lcore_mem_dump(FILE *f) > struct __rte_trace_header *header; > uint32_t count; > > - if (trace->nb_trace_mem_list == 0) > - return; > - > rte_spinlock_lock(&trace->lock); > + if (trace->nb_trace_mem_list == 0) > + goto out; > fprintf(f, "nb_trace_mem_list = %d\n", trace->nb_trace_mem_list); > fprintf(f, "\nTrace mem info\n--------------\n"); > for (count = 0; count < trace->nb_trace_mem_list; count++) { > @@ -269,6 +268,7 @@ trace_lcore_mem_dump(FILE *f) > header->stream_header.lcore_id, > header->stream_header.thread_name); > } > +out: > rte_spinlock_unlock(&trace->lock); > } > > -- > 2.37.3 >