crypto/virtio: alloc private data by NUMA affinity

Message ID 20190904132151.58885-1-xiao.w.wang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series crypto/virtio: alloc private data by NUMA affinity |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-dpdk_compile success Compile Testing PASS
ci/iol-dpdk_compile_ovs success Compile Testing PASS
ci/iol-dpdk_compile_spdk success Compile Testing PASS
ci/intel-Performance success Performance Testing PASS
ci/mellanox-Performance success Performance Testing PASS

Commit Message

Xiao Wang Sept. 4, 2019, 1:21 p.m. UTC
  It's better to allocate device private data on the same NUMA node with
device, rather than with the main thread. This helps avoid cross-NUMA
access for worker thread.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/crypto/virtio/virtio_cryptodev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Akhil Goyal Oct. 4, 2019, noon UTC | #1
Hi Jay,

Could you please review this change.

Thanks,
Akhil

> 
> It's better to allocate device private data on the same NUMA node with
> device, rather than with the main thread. This helps avoid cross-NUMA
> access for worker thread.
> 
> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> ---
>  drivers/crypto/virtio/virtio_cryptodev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/crypto/virtio/virtio_cryptodev.c
> b/drivers/crypto/virtio/virtio_cryptodev.c
> index f16bdfe57..4af479f54 100644
> --- a/drivers/crypto/virtio/virtio_cryptodev.c
> +++ b/drivers/crypto/virtio/virtio_cryptodev.c
> @@ -1441,7 +1441,7 @@ crypto_virtio_pci_probe(
>  {
>  	struct rte_cryptodev_pmd_init_params init_params = {
>  		.name = "",
> -		.socket_id = rte_socket_id(),
> +		.socket_id = pci_dev->device.numa_node,
>  		.private_data_size = sizeof(struct virtio_crypto_hw)
>  	};
>  	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
> --
> 2.15.1
  
Zhoujian (jay) Oct. 8, 2019, 2:03 a.m. UTC | #2
> -----Original Message-----
> From: Xiao Wang [mailto:xiao.w.wang@intel.com]
> Sent: Wednesday, September 4, 2019 9:22 PM
> To: Zhoujian (jay) <jianjay.zhou@huawei.com>
> Cc: dev@dpdk.org; Xiao Wang <xiao.w.wang@intel.com>
> Subject: [PATCH] crypto/virtio: alloc private data by NUMA affinity
> 
> It's better to allocate device private data on the same NUMA node with device,
> rather than with the main thread. This helps avoid cross-NUMA access for
> worker thread.
> 
> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>

Reviewed-by: Jay Zhou <jianjay.zhou@huawei.com>

> ---
>  drivers/crypto/virtio/virtio_cryptodev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/crypto/virtio/virtio_cryptodev.c
> b/drivers/crypto/virtio/virtio_cryptodev.c
> index f16bdfe57..4af479f54 100644
> --- a/drivers/crypto/virtio/virtio_cryptodev.c
> +++ b/drivers/crypto/virtio/virtio_cryptodev.c
> @@ -1441,7 +1441,7 @@ crypto_virtio_pci_probe(  {
>  	struct rte_cryptodev_pmd_init_params init_params = {
>  		.name = "",
> -		.socket_id = rte_socket_id(),
> +		.socket_id = pci_dev->device.numa_node,
>  		.private_data_size = sizeof(struct virtio_crypto_hw)
>  	};
>  	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
> --
> 2.15.1
  
Zhoujian (jay) Oct. 8, 2019, 2:06 a.m. UTC | #3
> -----Original Message-----
> From: Akhil Goyal [mailto:akhil.goyal@nxp.com]
> Sent: Friday, October 4, 2019 8:00 PM
> To: Zhoujian (jay) <jianjay.zhou@huawei.com>
> Cc: dev@dpdk.org; Xiao Wang <xiao.w.wang@intel.com>
> Subject: RE: [dpdk-dev] [PATCH] crypto/virtio: alloc private data by NUMA
> affinity
> 
> Hi Jay,
> 
> Could you please review this change.
> 
> Thanks,
> Akhil

Hi Akhil,

Sure, sorry for the late response.

Thanks,
Jay

> 
> >
> > It's better to allocate device private data on the same NUMA node with
> > device, rather than with the main thread. This helps avoid cross-NUMA
> > access for worker thread.
> >
> > Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> > ---
> >  drivers/crypto/virtio/virtio_cryptodev.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/crypto/virtio/virtio_cryptodev.c
> > b/drivers/crypto/virtio/virtio_cryptodev.c
> > index f16bdfe57..4af479f54 100644
> > --- a/drivers/crypto/virtio/virtio_cryptodev.c
> > +++ b/drivers/crypto/virtio/virtio_cryptodev.c
> > @@ -1441,7 +1441,7 @@ crypto_virtio_pci_probe(  {
> >  	struct rte_cryptodev_pmd_init_params init_params = {
> >  		.name = "",
> > -		.socket_id = rte_socket_id(),
> > +		.socket_id = pci_dev->device.numa_node,
> >  		.private_data_size = sizeof(struct virtio_crypto_hw)
> >  	};
> >  	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
> > --
> > 2.15.1
  
Akhil Goyal Oct. 9, 2019, 9:40 a.m. UTC | #4
> >
> > It's better to allocate device private data on the same NUMA node with device,
> > rather than with the main thread. This helps avoid cross-NUMA access for
> > worker thread.
> >
> > Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> 
> Reviewed-by: Jay Zhou <jianjay.zhou@huawei.com>
> 
Applied to dpdk-next-crypto

Thanks.
  

Patch

diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c
index f16bdfe57..4af479f54 100644
--- a/drivers/crypto/virtio/virtio_cryptodev.c
+++ b/drivers/crypto/virtio/virtio_cryptodev.c
@@ -1441,7 +1441,7 @@  crypto_virtio_pci_probe(
 {
 	struct rte_cryptodev_pmd_init_params init_params = {
 		.name = "",
-		.socket_id = rte_socket_id(),
+		.socket_id = pci_dev->device.numa_node,
 		.private_data_size = sizeof(struct virtio_crypto_hw)
 	};
 	char name[RTE_CRYPTODEV_NAME_MAX_LEN];