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 C72034246A; Mon, 23 Jan 2023 14:51:07 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 837C140150; Mon, 23 Jan 2023 14:51:07 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 614BE400D4 for ; Mon, 23 Jan 2023 14:51:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674481865; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=EKDlqW6QYKflB4ZSih/mQLxBuqT3t/xTyaNhfiO+Oic=; b=iKDBKDAcsjgaztIl1HIcbauO1rkFGcI/5Hj12VIKC1jkVHiFsstntXpza77U+RpJvMPPXT OSIpJiMlCITem9W5I8+4cKuTD19nCvOnfX8YF3Jd/cCBR6/+2o/15W+xSO9qZ69GfdGxGz B0ymPNzNsUbm7AX6qA+CBmVXFOhv9kI= Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-593-AE_yv6CdOOi4RPigNVQFtw-1; Mon, 23 Jan 2023 08:51:04 -0500 X-MC-Unique: AE_yv6CdOOi4RPigNVQFtw-1 Received: by mail-pj1-f69.google.com with SMTP id g23-20020a17090adb1700b0022bbacff147so2370458pjv.7 for ; Mon, 23 Jan 2023 05:51:04 -0800 (PST) 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=EKDlqW6QYKflB4ZSih/mQLxBuqT3t/xTyaNhfiO+Oic=; b=axWoKVCdS0Xfp8G0fatBBsuMHmvTU+1gEXUhkxgJejKzIva567z7LTjLOiRB+Jsx+v 9zVhpafS84bSKN4jTX3aPuoVn71YbuwAEYFCaapDwiQln5g0xHNyfoPkQM7JCgMf/5QD JtRnDHif6lfXuQdW4tg7Zktp4tH7lvu8wweq6TtBxJd0q4HFwh3Nr4gX7LKyKi/PJu0s ZRU6AFosTrp++/ZbYPuQY64LBmupe5pV+FgaNUHU2e6o0PmwanVL1gHZF/1GE8oVfGrf 3iXZRiC9oEe3riNPGcmQrWG2dHLchuyfn5IpmN7EhXflvT9ojEHxgDP6HlzLdJWahqXT 63Gg== X-Gm-Message-State: AFqh2kq5P2yDN2PlMrODj57ckEmA1fZpViqtucqwSV70qJFXeFrhnrqW 1ydvLlkHgTBdZQSpyoyw+n6/YuVsA/EsH9R/GNdombfOMmRz7OqSnSQRl0BAgyE9hvde6HBo+b+ IXve+1OcCW/K6MhS+VpE= X-Received: by 2002:a17:90a:df06:b0:229:cf3:5348 with SMTP id gp6-20020a17090adf0600b002290cf35348mr2635656pjb.30.1674481863389; Mon, 23 Jan 2023 05:51:03 -0800 (PST) X-Google-Smtp-Source: AMrXdXvwOKMiaWlc0si8/DXYWAeZyU3T9v199JNStDSnysIOyI2Qs2K+XfCu2woWmpKCVJC/0oNJWzuAPg+Fr0cnGGY= X-Received: by 2002:a17:90a:df06:b0:229:cf3:5348 with SMTP id gp6-20020a17090adf0600b002290cf35348mr2635648pjb.30.1674481863105; Mon, 23 Jan 2023 05:51:03 -0800 (PST) MIME-Version: 1.0 References: <20230119103234.841173-1-david.marchand@redhat.com> In-Reply-To: From: David Marchand Date: Mon, 23 Jan 2023 14:50:51 +0100 Message-ID: Subject: Re: [PATCH] graph: fix node shrink To: Jerin Jacob Cc: dev@dpdk.org, stable@dpdk.org, Jerin Jacob , Kiran Kumar K , Nithin Dabilpuram , Pavan Nikhilesh X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" 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 Mon, Jan 23, 2023 at 2:33 PM Jerin Jacob wrote: > > On Thu, Jan 19, 2023 at 4:02 PM David Marchand > wrote: > > > > If the node id check failed, graph_lock was not taken before releasing. > > Thanks for the fix. > > > Why not this oneline fix? > > [main][dpdk.org] $ git diff > diff --git a/lib/graph/node.c b/lib/graph/node.c > index fc6345de07..89cdcf0207 100644 > --- a/lib/graph/node.c > +++ b/lib/graph/node.c > @@ -293,8 +293,8 @@ rte_node_edge_shrink(rte_node_t id, rte_edge_t size) > rte_edge_t rc = RTE_EDGE_ID_INVALID; > struct node *node; > > - NODE_ID_CHECK(id); > graph_spinlock_lock(); > + NODE_ID_CHECK(id); > > STAILQ_FOREACH(node, &node_list, next) { > if (node->id == id) { Other calls to NODE_ID_CHECK input check are done out of the lock. And to keep consistency with the rest of this library code. -- David Marchand