From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id BECC3A0562; Thu, 2 Apr 2020 17:48:07 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 28C001BDAC; Thu, 2 Apr 2020 17:48:07 +0200 (CEST) Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by dpdk.org (Postfix) with ESMTP id 8DFEB2BCE for ; Thu, 2 Apr 2020 17:48:05 +0200 (CEST) Received: by mail-pf1-f194.google.com with SMTP id r14so1911292pfl.12 for ; Thu, 02 Apr 2020 08:48:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8af0Tp4quxmCDdXioI9wR1+aOwWFIpD7/iJV4ITEfW8=; b=PhBNrSTk58zCpONq/bwBxdmSHUBmwlEtBfcchSBiM3N4tIxbdUXsmAg2m9TbdP/j6R WgjwphVnR924gAxpZg2kUrMZ8kSyOUGUQOKTqdo+JFdCatjw5nHtMhUwsHuzEKiSO+lM pVFj+zJ8pJaWM4AYn+ILnaZoql1Q4Fmrt3R1wUA1LIrEc2RRj+FBnW7eBsSBMzreEqhx HwrUvaZk65PeDIAQFHmtepKpNns3+1rSAtmiRPuPZI9aEOaq77j9l5bXBCrktsseNoR1 IaicZlgXNPuM7fRmzHXemcCx7GAdMhEwe4kjfvMNbtbhk1Sz6L1m0dVUPr9vZTXDEDdS Wjrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8af0Tp4quxmCDdXioI9wR1+aOwWFIpD7/iJV4ITEfW8=; b=UN/pQNuJoAZThVVLC6vEUOaa8cfEAKH7aUjN5+ehPg262N2SGayl/8GM+HzeSOXGzi pqCLmJtaaoBfUEWOuiCbA/5Sd1kfpD2694c1gZGGPquwONTfzMCWNp67fIox/mB21+Zf Iw5ScxhFIQz8/DvqztgxUSqPgtScv6Vwz5Bl7w5rGelGLDUCCqI4OsPC5TpxKS4Wwihi rs+NYQcPeo0YwjrilYWZRQN2GPcP5rBzXUjTLty+IQQjwOGR587YRnPrhJdITXZtkgkW sdaijkkTXzJQIOJzO0CJwuay+J3a+sAExcSX1IiCwHwC3xrS7FOkUFX9wlPg34bayCRz EXGg== X-Gm-Message-State: AGi0PubiVONNBd6P4q6yXgq+JvyCtNVdyQ16MxEA1grTjoOVPYem9tkm OlgUZcNlXoQyYMlHcXPYcpEzNQ== X-Google-Smtp-Source: APiQypJgLwJv3nTbX4A6DL+7cfWeX2SoSdYZd5qjw4uqglT230ylHTXs+PX0vo3bG+p48w+ZxRuwNQ== X-Received: by 2002:aa7:99cd:: with SMTP id v13mr3764349pfi.106.1585842484681; Thu, 02 Apr 2020 08:48:04 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id o3sm3588808pgk.21.2020.04.02.08.48.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 08:48:04 -0700 (PDT) Date: Thu, 2 Apr 2020 08:47:56 -0700 From: Stephen Hemminger To: Joyce Kong Cc: maxime.coquelin@redhat.com, tiwei.bie@intel.com, zhihong.wang@intel.com, thomas@monjalon.net, jerinj@marvell.com, yinan.wang@intel.com, honnappa.nagarahalli@arm.com, gavin.hu@arm.com, nd@arm.com, dev@dpdk.org Message-ID: <20200402084756.2dc243ae@hermes.lan> In-Reply-To: <20200402025753.31420-2-joyce.kong@arm.com> References: <20200402025753.31420-1-joyce.kong@arm.com> <20200402025753.31420-2-joyce.kong@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2 1/2] virtio: one way barrier for split vring used idx X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, 2 Apr 2020 10:57:52 +0800 Joyce Kong wrote: > - (vq)->vq_used_cons_idx)) > +static inline uint16_t > +virtqueue_nused(struct virtqueue *vq) vq is unmodified and should be const > +{ > + uint16_t idx; > + if (vq->hw->weak_barriers) { Put blank line between declaration and if statement > +/* x86 prefers to using rte_smp_rmb over __atomic_load_n as it reports > + * a slightly better perf, which comes from the saved branch by the compiler. > + * The if and else branches are identical with the smp and cio barriers both > + * defined as compiler barriers on x86. > + */ Do not put comments on left margin (except in function prolog). > +#ifdef RTE_ARCH_X86_64 > + idx = vq->vq_split.ring.used->idx; > + rte_smp_rmb(); > +#else > + idx = __atomic_load_n(&(vq)->vq_split.ring.used->idx, > + __ATOMIC_ACQUIRE); > +#endif > + } else { > + idx = vq->vq_split.ring.used->idx; > + rte_cio_rmb(); > + } > + return (idx - vq->vq_used_cons_idx); Parenthesis around arguments to return are unnecessary. BSD code likes it, Linux style does not. > +} This kind of arch specific code is hard to maintain. Does it really make that much difference.