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 851A342B13; Mon, 15 May 2023 14:34:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 14AA740687; Mon, 15 May 2023 14:34:11 +0200 (CEST) Received: from mail-vs1-f49.google.com (mail-vs1-f49.google.com [209.85.217.49]) by mails.dpdk.org (Postfix) with ESMTP id 2D32140395 for ; Mon, 15 May 2023 14:34:10 +0200 (CEST) Received: by mail-vs1-f49.google.com with SMTP id ada2fe7eead31-435fff402d0so6414482137.1 for ; Mon, 15 May 2023 05:34:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684154049; x=1686746049; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=PAsugsyhKadP9Y8x/V0mtygIekWm1p7OVoniIQntYus=; b=cxeJmGcvBtrZxc8UrWgU3/BhU1wrl92rGvrzYsH21SFr7hYcTVtM2/5esxgfRG4oYH hd6CDMMzS47mbQ0G06UkAepP1VqDzupY+mWOceQQ+R8fn42R2PdYfzldrvWrGl5dihQo MAJbj3xu7AA7bsHDi7DQsyDXryHpbjn+MWunLPnC5n1usqqUsLzuo3yiTVzVgAbnAtBy 5280c4xtjpIuNGycGyWxC2wmH+VmFJnBzO6sdNWMCxbz5NSNji0aiNgWriQ5x1E1QV9N S/r8Ddhxp1JQ6HiLY2yS6x/RWCpfkuLAKldpa8tWdumjQsjcwA30UaERXC4muQedpvBh dy8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684154049; x=1686746049; 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=PAsugsyhKadP9Y8x/V0mtygIekWm1p7OVoniIQntYus=; b=Kwt1fALlkzT9D6jOZbB1TgHJc+3YS0XlobLkxhhIcJhXqw5PiR06g9Rhft/etxhLoT roC+t0VRQTQsoOyXQ7E+pBBApUQ9KgN/1lEQ4H+CHsRMubgQusvGXvqfQWCG2nQ74WXE 5mUozG0OFFpy8VOkbl217JaOTSZG5LnHBC6DaUzdIzQzb0bDO/XCNEU4H2FCzZsCEBB/ /9Mkv5XeykqCuTAG3gcTbDn+xf5hcDsXFKtqL9gAed2/7XxbCyIYt2OChoUyGAOmaRBR NGQJyzImRXwhxydGP/VUGHxUluNXsxhVWYFLsvLNzFz/5t8lvnlnQTVhCmwS9wka9Y5q a67Q== X-Gm-Message-State: AC+VfDyDMvLqyfEhOdByDa9wQjJbAafRu9bt58FLdvkFjgCtJtUuwy9r upHZgmP3Y4iTl/mZJBu50tOeyyvi6ewb5ifMNNrX5RbsXtsI+oox X-Google-Smtp-Source: ACHHUZ7/iA1P+ldCX5esG5V6TMeEbQvIaZ9G4TPhbFL45pqgMuOPzbUiK3Gh2+dMVpkxKJWn1gTkTQQjGDaVhbw9iEw= X-Received: by 2002:a67:be18:0:b0:42f:fc44:be5d with SMTP id x24-20020a67be18000000b0042ffc44be5dmr13924668vsq.27.1684154049358; Mon, 15 May 2023 05:34:09 -0700 (PDT) MIME-Version: 1.0 References: <20230511081641.6693-1-mattias.ronnblom@ericsson.com> <20230511082415.6720-1-mattias.ronnblom@ericsson.com> <7c0013e1-d11b-2ad0-04b9-73be426d4719@ericsson.com> <98CBD80474FA8B44BF855DF32C47DC35D8790C@smartserver.smartshare.dk> In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35D8790C@smartserver.smartshare.dk> From: Jerin Jacob Date: Mon, 15 May 2023 18:03:43 +0530 Message-ID: Subject: Re: [PATCH v3] eventdev: avoid non-burst shortcut for variable-size bursts To: =?UTF-8?Q?Morten_Br=C3=B8rup?= Cc: =?UTF-8?Q?Mattias_R=C3=B6nnblom?= , jerinj@marvell.com, hofors@lysator.liu.se, dev@dpdk.org 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 Fri, May 12, 2023 at 7:26=E2=80=AFPM Morten Br=C3=B8rup wrote: > > > From: Mattias R=C3=B6nnblom [mailto:mattias.ronnblom@ericsson.com] > > Sent: Friday, 12 May 2023 15.15 > > > > On 2023-05-12 13:59, Jerin Jacob wrote: > > > On Thu, May 11, 2023 at 2:00=E2=80=AFPM Mattias R=C3=B6nnblom > > > wrote: > > >> > > >> Use non-burst event enqueue and dequeue calls from burst enqueue and > > >> dequeue only when the burst size is compile-time constant (and equal > > >> to one). > > >> > > >> Signed-off-by: Mattias R=C3=B6nnblom > > >> > > >> --- > > >> > > >> v3: Actually include the change v2 claimed to contain. > > >> v2: Wrap builtin call in __extension__, to avoid compiler warnings i= f > > >> application is compiled with -pedantic. (Morten Br=C3=B8rup) > > >> --- > > >> lib/eventdev/rte_eventdev.h | 4 ++-- > > >> 1 file changed, 2 insertions(+), 2 deletions(-) > > >> > > >> diff --git a/lib/eventdev/rte_eventdev.h b/lib/eventdev/rte_eventdev= .h > > >> index a90e23ac8b..a471caeb6d 100644 > > >> --- a/lib/eventdev/rte_eventdev.h > > >> +++ b/lib/eventdev/rte_eventdev.h > > >> @@ -1944,7 +1944,7 @@ __rte_event_enqueue_burst(uint8_t dev_id, uint= 8_t > > port_id, > > >> * Allow zero cost non burst mode routine invocation if > > application > > >> * requests nb_events as const one > > >> */ > > >> - if (nb_events =3D=3D 1) > > >> + if (__extension__(__builtin_constant_p(nb_events)) && nb_eve= nts =3D=3D > > 1) > > > > > > "Why" part is not clear from the commit message. Is this to avoid > > > nb_events read if it is built-in const. > > > > The __builtin_constant_p() is introduced to avoid having the compiler > > generate a conditional branch and two different code paths in case > > nb_elem is a run-time variable. > > > > In particular, this matters if nb_elems is run-time variable and varies > > between 1 and some larger value. > > > > I should have mention this in the commit message. > > > > A very slight performance improvement. It also makes the code better > > match the comment, imo. Zero cost for const one enqueues, but no impact > > non-compile-time-constant-length enqueues. > > > > Feel free to ignore. > > > > > If so, check should be following. Right? > > > > > > if (__extension__((__builtin_constant_p(nb_events)) && nb_events =3D= =3D 1) > > > || nb_events =3D=3D 1) > > @Mattias: You missed the second part of this comparison, also catching nb= _events =3D=3D 1 with non-constant nb_events. > > @Jerin: Such a change has no effect, compared to the original code. Yes. That was the reason for I was skipping __builtin_constant_p in the initial version.