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 B259B42362; Wed, 11 Oct 2023 16:58:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 56CCF402DA; Wed, 11 Oct 2023 16:58:08 +0200 (CEST) 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 238C340279 for ; Wed, 11 Oct 2023 16:58:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697036286; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XuCTfAUoGUY9f0jQDuIVcmfd1mFkKKSvJFARwtYCikc=; b=iaCnSjYQ7uZU2yNxyUYvPTct3OhaGFWrIR8ULHfCnzYAU4MPck/G44s3KUQN0jfTjAQCwo lca2vSQGDvNaN5awUjx5BguEeH1ifkcdiSE6mHbtYbGyDEQAPaBnWmaosQwXSAbQdSiUmu ZrbMV6p/iad9RssMvc5o5i6WvUDy4DY= Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-513-DOlZJuuwMmir22SIenvsHg-1; Wed, 11 Oct 2023 10:58:03 -0400 X-MC-Unique: DOlZJuuwMmir22SIenvsHg-1 Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2c038a1e2f6so60951501fa.3 for ; Wed, 11 Oct 2023 07:58:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697036282; x=1697641082; h=content-transfer-encoding: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=XuCTfAUoGUY9f0jQDuIVcmfd1mFkKKSvJFARwtYCikc=; b=PY+JDYF35jACy3EaplVnMEG31Yb0wQhmtsT5dkMtCBg56QAXgnREtbTbNzansKOhMZ qbAYr7Y6eh2FHvDjtqA74YwFsEyb6mi7RUeH0w0M/it7fBgbKeBVgjik2cHUMAgD/QA+ kNfilrTf3Xy0j7g1ILieXvFAUl0rHuHtL/DJ7c8RLzv9Tl4cEdq+aCSMu7aIyiWeK/Vt K7rkaOdJ46A7O6P9Cc4/GE770OjQY2l3cjXJr/Ij9m84esPc8lbsk60btLkKWb3Hk3B5 B1cl5rdVsjp9JZmpUBKYaP+7osYM9clRl5HuViAc3rGg5Rn2XCja2hODrTUkwFoZFmdE 4XPQ== X-Gm-Message-State: AOJu0Yz3ZqWspGlO9rXexBA0JqjRgrWL09zkmVdE1VPGgjY6grMSfYQr LyoeCjGnPAFxhUdVVyJGbs9tojbB81Z0yeioilkFwEJ4azxJ4zU26E877AJS/tQOz0qgcLqPfXX TMSzl+wbow/wzyCVQh4I= X-Received: by 2002:a2e:8241:0:b0:2bc:dab2:c7dc with SMTP id j1-20020a2e8241000000b002bcdab2c7dcmr18735556ljh.47.1697036281949; Wed, 11 Oct 2023 07:58:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF4uDsRePzVWRq7mCp3cj3ODoezWZXio2S2KZerJl0oRE1hyT1IfSJVP8M/uPmXfPXrmJEEbgv02oGzLLXQjPw= X-Received: by 2002:a2e:8241:0:b0:2bc:dab2:c7dc with SMTP id j1-20020a2e8241000000b002bcdab2c7dcmr18735546ljh.47.1697036281624; Wed, 11 Oct 2023 07:58:01 -0700 (PDT) MIME-Version: 1.0 References: <20230922073825.351453-2-mattias.ronnblom@ericsson.com> <20230928073056.359356-1-mattias.ronnblom@ericsson.com> <20230928073056.359356-2-mattias.ronnblom@ericsson.com> <0c8eaf05-8dc7-4462-a893-2b7019d24fae@lysator.liu.se> <909e0363-365a-4250-85ba-43c8715642a3@lysator.liu.se> In-Reply-To: <909e0363-365a-4250-85ba-43c8715642a3@lysator.liu.se> From: David Marchand Date: Wed, 11 Oct 2023 16:57:50 +0200 Message-ID: Subject: Re: [PATCH v5 1/3] lib: introduce dispatcher library To: =?UTF-8?Q?Mattias_R=C3=B6nnblom?= Cc: =?UTF-8?Q?Mattias_R=C3=B6nnblom?= , dev@dpdk.org, Jerin Jacob , techboard@dpdk.org, harry.van.haaren@intel.com, Peter Nilsson , Heng Wang , Naga Harish K S V , Pavan Nikhilesh , Gujjar Abhinandan S , Erik Gabriel Carrillo , Shijith Thotton , Hemant Agrawal , Sachin Saxena , Liang Ma , Peter Mccarthy , Zhirun Yan X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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 Mon, Oct 9, 2023 at 6:50=E2=80=AFPM Mattias R=C3=B6nnblom wrote: [snip] > >>>> +static int > >>>> +evd_set_service_runstate(struct rte_dispatcher *dispatcher, int sta= te) > >>>> +{ > >>>> + int rc; > >>>> + > >>>> + rc =3D rte_service_component_runstate_set(dispatcher->servic= e_id, > >>>> + state); > >>>> + > >>>> + if (rc !=3D 0) { > >>>> + RTE_EDEV_LOG_ERR("Unexpected error %d occurred while= setting " > >>>> + "service component run state to %d\= n", rc, > >>>> + state); > >>>> + RTE_ASSERT(0); > >>> > >>> Why not propagating the error to callers? > >>> > >>> > >> > >> The root cause would be a programming error, hence an assertion is mor= e > >> appropriate way to deal with the situation. > > > > Without building RTE_ENABLE_ASSERT (disabled by default), the code > > later in this function will still be executed. > > > > If RTE_ASSERT() is not the way to assure a consistent internal library > state, what is? RTE_VERIFY()? The usual way in DPDK is to use RTE_VERIFY or rte_panic with the error mess= age. There is also libc assert(). RTE_ASSERT is more of a debug macro since it is under a build option. But by making the library "panic" on some assertion, I have followup commen= ts: - what is the point of returning an int for rte_dispatcher_start() / rte_dispatcher_stop()? - rte_dispatcher_start() and rte_dispatcher_stop() (doxygen) documentation needs updating, as they can't return anything but 0. --=20 David Marchand