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 29C6243BEE; Mon, 26 Feb 2024 16:47:06 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D0736402C8; Mon, 26 Feb 2024 16:47:05 +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 D28B940144 for ; Mon, 26 Feb 2024 16:47:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708962424; 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=zfu5qp4dSQ0rWPnAO9HYhg1+KaTNI7WlqveZsE/2r4M=; b=ZkCiAaT+DMT6OanA0vXJRsIwWzBtl51AYQP6OYpoX4WzfNLUpa8X6yDVwHEnzG2B+fQn+d CWsHBIIlbW51lb02StNDiGW9UpCjm/31YRRWfSJQ54+Vb3EirsE9fDYUhjAoc6NlVX3UUX U56GYqcyi6CMzNf7epFfQrSKyEGB36s= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-665-ZH96xHhoOkyW6dzCcuRFgw-1; Mon, 26 Feb 2024 10:47:02 -0500 X-MC-Unique: ZH96xHhoOkyW6dzCcuRFgw-1 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2d22adb2b88so25199421fa.0 for ; Mon, 26 Feb 2024 07:47:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708962421; x=1709567221; 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=zfu5qp4dSQ0rWPnAO9HYhg1+KaTNI7WlqveZsE/2r4M=; b=RwxXY3aoK24CUsRfmBw69LePHxIR6S/dK/hjtwim9NweN4ZOiVB1vy/29Jo+c5LJXR bq2y5y0GZffc+Es5wgwz/olh1N6ZmtC9FvYn+LQoFNFylmQMTm6G7RiX6NgICgNK/8DA dyTDkyLTvSTtVJNDXt/Jsqy3jcvpMXwdoNBBGDM2OWfMto93Fn9k4m5YYXyg/HWJjctw Az26UuRPaGOxMbpvSeIaIcjq5RZ9qMKGugCuC0OB7UkSkL/+2LfjlkVPYt5TJVYRhnJa v5Pj9orNG6odEt2T5maCTfTPTHP8oP6eQ6pBbwDXJSHPUGXCBOZiRVBTuC8r7Yvkjl4L Y5qw== X-Gm-Message-State: AOJu0YxYKG+ukica214u7MYj42sqeAUE5qe+Gw+2lLPNaz/oRlk2g386 2jdSerI0VyPPrpFonO1C4iVrHRDEj4yr+qROgkh9SbsTdn+D+co2M8tuO69qR8lvrs19WR8nr1P OLa2r0bVCc1U+45WWl7IDGvvJlqgSxn8Eeatml+c0JKKW6/+w+hyFvTZogA3PHY55kN1WzmlU9+ b9j+HREImIkcSoUPI= X-Received: by 2002:a2e:b8c7:0:b0:2d2:4ee4:c8a5 with SMTP id s7-20020a2eb8c7000000b002d24ee4c8a5mr4886373ljp.50.1708962421327; Mon, 26 Feb 2024 07:47:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IE6wk4YovQVfXgTC6zO4hzzuJqe8JZLD5FyQIK8yT15bRYKndQTXohuR3oY4MUz7cxJAOB045txBwtEXJK9i20= X-Received: by 2002:a2e:b8c7:0:b0:2d2:4ee4:c8a5 with SMTP id s7-20020a2eb8c7000000b002d24ee4c8a5mr4886353ljp.50.1708962421018; Mon, 26 Feb 2024 07:47:01 -0800 (PST) MIME-Version: 1.0 References: <20231023095520.2864868-1-david.marchand@redhat.com> <20231205094536.2816720-1-david.marchand@redhat.com> <20231205094536.2816720-5-david.marchand@redhat.com> <4668504.U7HbjWM52l@thomas> In-Reply-To: <4668504.U7HbjWM52l@thomas> From: David Marchand Date: Mon, 26 Feb 2024 16:46:49 +0100 Message-ID: Subject: Re: [PATCH v2 5/5] vhost: enhance virtqueue access lock asserts To: Thomas Monjalon Cc: dev@dpdk.org, Eelco Chaudron , Maxime Coquelin , Chenbo Xia , Tyler Retzlaff , Stephen Hemminger 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, Feb 19, 2024 at 11:52=E2=80=AFAM Thomas Monjalon wrote: > > 05/12/2023 10:45, David Marchand: > > +#define VHOST_USER_ASSERT_LOCK(dev, vq, id) do { \ > > + RTE_BUILD_BUG_ON(!vhost_message_handlers[id].lock_all_qps); \ > > + vq_assert_lock(dev, vq); \ > > +} while (0) > > Since "eal: enhance compile-time checks using C11 assert", > it is not allowed to have non-constant check in RTE_BUILD_BUG_ON: > > lib/vhost/vhost_user.c:413:25: note: in expansion of macro 'VHOST_USER_AS= SERT_LOCK' > lib/vhost/vhost_user.c: In function 'vhost_user_set_vring_addr': > lib/eal/include/rte_common.h:518:56: error: expression in static assertio= n is not constant > #define RTE_BUILD_BUG_ON(condition) do { static_assert(!(condition), #c= ondition); } while (0) > > I suppose we can make this check at compile-time with few adjustments. > For -rc1, I am dropping this patch. Iiuc, an array content is not constant (from a compiler pov) unless the elements are integers. I suspect there is some gcc-specific implementation that could work, since with the previous implementation of RTE_BUILD_BUG_ON, this check was working with both gcc and clang... But I could not find how to. I have an alternate solution using enums with the existing macros.. I'll post a new revision. --=20 David Marchand