From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ferruh.yigit@intel.com>
Received: from mga09.intel.com (mga09.intel.com [134.134.136.24])
 by dpdk.org (Postfix) with ESMTP id 321D0F948
 for <dev@dpdk.org>; Fri, 13 Jan 2017 12:50:11 +0100 (CET)
Received: from fmsmga003.fm.intel.com ([10.253.24.29])
 by orsmga102.jf.intel.com with ESMTP; 13 Jan 2017 03:40:09 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.33,221,1477983600"; d="scan'208";a="808423566"
Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.237.220.38])
 ([10.237.220.38])
 by FMSMGA003.fm.intel.com with ESMTP; 13 Jan 2017 03:40:07 -0800
To: Jerin Jacob <jerin.jacob@caviumnetworks.com>
References: <1482832175-27199-1-git-send-email-jerin.jacob@caviumnetworks.com>
 <1484212646-10338-1-git-send-email-jerin.jacob@caviumnetworks.com>
 <1484212646-10338-16-git-send-email-jerin.jacob@caviumnetworks.com>
 <6bb9980b-f546-38d5-044a-63507510f6a5@intel.com>
 <20170113081641.GA17635@localhost.localdomain>
Cc: dev@dpdk.org, konstantin.ananyev@intel.com, thomas.monjalon@6wind.com,
 bruce.richardson@intel.com, jianbo.liu@linaro.org, viktorin@rehivetech.com,
 santosh.shukla@caviumnetworks.com, John Griffin <john.griffin@intel.com>,
 Fiona Trahe <fiona.trahe@intel.com>,
 Deepak Kumar Jain <deepak.k.jain@intel.com>
From: Ferruh Yigit <ferruh.yigit@intel.com>
Message-ID: <76c8ede9-54bb-51ba-293b-583681616e0a@intel.com>
Date: Fri, 13 Jan 2017 11:40:06 +0000
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101
 Thunderbird/45.6.0
MIME-Version: 1.0
In-Reply-To: <20170113081641.GA17635@localhost.localdomain>
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] [PATCH v3 15/29] crypto/qat: use eal I/O device
 memory read/write API
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 13 Jan 2017 11:50:12 -0000

On 1/13/2017 8:17 AM, Jerin Jacob wrote:
> On Thu, Jan 12, 2017 at 07:09:22PM +0000, Ferruh Yigit wrote:
>> Hi Jerin,
>>
>> On 1/12/2017 9:17 AM, Jerin Jacob wrote:
>> <...>
>>
>>> +#include <rte_io.h>
>>> +
>>>  /* CSR write macro */
>>> -#define ADF_CSR_WR(csrAddr, csrOffset, val) \
>>> -	(void)((*((volatile uint32_t *)(((uint8_t *)csrAddr) + csrOffset)) \
>>> -			= (val)))
>>> +#define ADF_CSR_WR(csrAddr, csrOffset, val)		\
>>> +	rte_write32(val, (((uint8_t *)csrAddr) + csrOffset))
>>
>> For IA, this update introduces an extra compiler barrier (rte_io_wmb()),
>> which is indeed not a must, is this correct?
> 
> AFAIK, Compiler barrier is required for IA. I am not an IA expert, if
> someone thinks it needs to changed then I can fix it in following commit
> in this patch series by making rte_io_wmb() and rte_io_rmb() as empty.
> 
> Let me know.

I don't know, but what I know is this was working for IA without
compiler barrier before.

Bruce or Konstantin can help here.

> 
> AFAIK, Linux kernel code has a barrier in readl/writel for IA.
> 
> Typically we don't use any non relaxed versions in fast path.In fast
> typically all the drivers has explicit write barrier for doorbell write
> and followed by a relaxed version of write. IMO, In any event, it won't
> generate performance regression.
> 
> [dpdk-master] $ git show
> 70c343bdc8c33a51a9db23cd58122bdfc120a58f
> commit 70c343bdc8c33a51a9db23cd58122bdfc120a58f
> Author: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> Date:   Mon Dec 5 06:36:49 2016 +0530
> 
>     eal/x86: define I/O device memory barriers for IA
> 
>     The patch does not provide any functional change for IA.
>     I/O barriers are mapped to existing smp barriers.
> 
>     CC: Bruce Richardson <bruce.richardson@intel.com>
>     CC: Konstantin Ananyev <konstantin.ananyev@intel.com>
>     Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> 
> diff --git a/lib/librte_eal/common/include/arch/x86/rte_atomic.h
> b/lib/librte_eal/common/include/arch/x86/rte_atomic.h
> index 00b1cdf..4eac666 100644
> --- a/lib/librte_eal/common/include/arch/x86/rte_atomic.h
> +++ b/lib/librte_eal/common/include/arch/x86/rte_atomic.h
> @@ -61,6 +61,12 @@ extern "C" {
>  
>  #define rte_smp_rmb() rte_compiler_barrier()
>  
> +#define rte_io_mb() rte_mb()
> +
> +#define rte_io_wmb() rte_compiler_barrier()
> +
> +#define rte_io_rmb() rte_compiler_barrier()
> +
>  /*------------------------- 16 bit atomic operations
>  * -------------------------*/
>  
>  #ifndef RTE_FORCE_INTRINSICS
> 
<...>