compress/isal: fix getting information about CPU
PATCH 1/1 compress/isal: fix getting information about CPU
This patch adds query about CPU features
--- drivers/compress/isal/isal_compress_pmd_ops.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/compress/isal/isal_compress_pmd_ops.c +12 -4
@@ -135,10 +135,18 @@ isal_comp_pmd_info_get(struct rte_compressdev *dev __rte_unused, {if (dev_info !=NULL ) { dev_info->capabilities = isal_pmd_capabilities; - dev_info->feature_flags =RTE_COMPDEV_FF_CPU_AVX512 | -RTE_COMPDEV_FF_CPU_AVX2 | -RTE_COMPDEV_FF_CPU_AVX | -RTE_COMPDEV_FF_CPU_SSE ; + +/* Check CPU for supported vector instruction and set +* feature_flags +*/ +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F )) + dev_info->feature_flags |=RTE_COMPDEV_FF_CPU_AVX512 ; +else if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 )) + dev_info->feature_flags |=RTE_COMPDEV_FF_CPU_AVX2 ; +else if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX )) + dev_info->feature_flags |=RTE_COMPDEV_FF_CPU_AVX ; +else + dev_info->feature_flags |=RTE_COMPDEV_FF_CPU_SSE ; } }
Signature · 1 line
2.7.4
Hi Fiona/Lee,
Could you please review this patch.
Thanks,
Akhil
Quoted 37 lines · Tomasz Cel
This patch adds query about CPU features
Fixes 53a9baa98c36 ("compress/isal: add basic PMD ops")Signed-off-by Tomasz Cel <[email protected]>--- drivers/compress/isal/isal_compress_pmd_ops.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)drivers/compress/isal/isal_compress_pmd_ops.c +12
-4@@ -135,10 +135,18 @@ isal_comp_pmd_info_get(struct rte_compressdev *dev __rte_unused, {if (dev_info !=NULL ) { dev_info->capabilities = isal_pmd_capabilities; - dev_info->feature_flags =RTE_COMPDEV_FF_CPU_AVX512 | -RTE_COMPDEV_FF_CPU_AVX2 | -RTE_COMPDEV_FF_CPU_AVX | -RTE_COMPDEV_FF_CPU_SSE ; + +/* Check CPU for supported vector instruction and set +* feature_flags +*/ +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F )) + dev_info->feature_flags |=RTE_COMPDEV_FF_CPU_AVX512 ; +else if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 )) + dev_info->feature_flags |=RTE_COMPDEV_FF_CPU_AVX2 ; +else if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX )) + dev_info->feature_flags |=RTE_COMPDEV_FF_CPU_AVX ; +else + dev_info->feature_flags |=RTE_COMPDEV_FF_CPU_SSE ; } }
Hi Tomasz,
This patch makes sense to check does the CPU have the capability of certain instructions before
Adding it to the dev_info flags. I think one more addition should be made in isal_compress_pmd.c
When checking what compression level should be used , decided by the AVX instructions available, it previously used the Rte_cpu_get_flag_enabled() function, however, I don’t believe that is needed any more since it will now be checked beforehand, it would be doing twice the work. When the driver now needs to decide the compression level it should now just check the feature_flags set below. Perhaps a V2 could be sent with this addition. Regards,
Lee.
Quoted 43 lines
Review
Quoted 11 lines
This patch adds query about CPU features
Fixes 53a9baa98c36 ("compress/isal: add basic PMD ops")Signed-off-by Tomasz Cel <[email protected]>--- drivers/compress/isal/isal_compress_pmd_ops.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)(quoted diff) +0
-0
b/drivers/compress/isal/isal_compress_pmd_ops.cdrivers/compress/isal/isal_compress_pmd_ops.c isal_comp_pmd_info_get(struct
Quoted 4 lines
index 7b91849..fe99959 100644
drivers/compress/isal/isal_compress_pmd_ops.c +0
-0@@ -135,10 +135,18 @@ isal_comp_pmd_info_get(struct
rte_compressdev*dev__rte_unused,drivers/compress/isal/isal_compress_pmd_ops.c isal_comp_pmd_info_get(struct rte_compressdev *dev __rte_unused,
Quoted 13 lines
drivers/compress/isal/isal_compress_pmd_ops.c +6
-4{if (dev_info !=NULL ) { dev_info->capabilities = isal_pmd_capabilities; - dev_info->feature_flags =RTE_COMPDEV_FF_CPU_AVX512 | -RTE_COMPDEV_FF_CPU_AVX2 | -RTE_COMPDEV_FF_CPU_AVX | -RTE_COMPDEV_FF_CPU_SSE ; + +/* Check CPU for supported vector instruction and set +* feature_flags +*/ +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F )) + dev_info->feature_flags |=
RTE_COMPDEV_FF_CPU_AVX512;drivers/compress/isal/isal_compress_pmd_ops.c isal_comp_pmd_info_get(struct · line 145
Quoted 2 lines
drivers/compress/isal/isal_compress_pmd_ops.c +2
-0+else if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 )) + dev_info->feature_flags |=
RTE_COMPDEV_FF_CPU_AVX2;drivers/compress/isal/isal_compress_pmd_ops.c isal_comp_pmd_info_get(struct · line 147
Quoted 2 lines
drivers/compress/isal/isal_compress_pmd_ops.c +2
-0+else if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX )) + dev_info->feature_flags |=
RTE_COMPDEV_FF_CPU_AVX;drivers/compress/isal/isal_compress_pmd_ops.c isal_comp_pmd_info_get(struct · line 149
Quoted 2 lines
drivers/compress/isal/isal_compress_pmd_ops.c +2
-0+else + dev_info->feature_flags |=
RTE_COMPDEV_FF_CPU_SSE;Quoted 3 lines
drivers/compress/isal/isal_compress_pmd_ops.c +0
-0} }
Daly, Lee
Acked-byHi Tomasz,
After some testing I can now see the approach in your patch in the best method for getting the CPU info.
Rgds,
Lee.
Quoted 11 lines
-----Original Message-----
From: Daly, Lee
Sent: Wednesday, March 27, 2019 3:01 PM
To: Akhil Goyal <[email protected]>; Cel, TomaszX <[email protected]>; [email protected]
Cc: [email protected]; Trahe, Fiona <[email protected]>
Subject: RE: [dpdk-dev] [PATCH] compress/isal: fix getting information about CPUHi Tomasz,
Quoted 21 lines
This patch makes sense to check does the CPU have the capability of
certain instructions before Adding it to thedev_infoflags. I think one more addition should be made inisal_compress_pmd.cWhen checking what compression level should be used , decided by the AVX instructions available, it previously used theRte_cpu_get_flag_enabled()function, however, I don’t believe that is needed any more since it will now be checked beforehand, it would be doing twice the work.
When the driver now needs to decide the compression level it should now just check thefeature_flagsset below. Perhaps a V2 could be sent with this addition.
Regards,
Lee.Quoted 7 lines
Quoted 7 lines
This patch adds query about CPU features
Fixes 53a9baa98c36 ("compress/isal: add basic PMD ops")Signed-off-by Tomasz Cel <[email protected]>---
Akhil Goyal
AppliedQuoted 29 lines · Lee
Hi Tomasz,
After some testing I can now see the approach in your patch in the best method for getting the CPU info.
Rgds,
Lee.Quoted 25 lines
-----Original Message-----
From: Daly, Lee
Sent: Wednesday, March 27, 2019 3:01 PM
To: Akhil Goyal <[email protected]>; Cel, TomaszX <[email protected]>; [email protected]
Cc: [email protected]; Trahe, Fiona <[email protected]>
Subject: RE: [dpdk-dev] [PATCH] compress/isal: fix getting information about CPUHi Tomasz,
This patch makes sense to check does the CPU have the capability of
certain instructions before Adding it to thedev_infoflags. I think one more addition should be made inisal_compress_pmd.cWhen checking what compression level should be used , decided by the AVX instructions available, it previously used theRte_cpu_get_flag_enabled()function, however, I don’t believe that is needed any more since it will now be checked beforehand, it would be doing twice the work.
When the driver now needs to decide the compression level it should now just check thefeature_flagsset below. Perhaps a V2 could be sent with this addition.
Regards,
Lee.
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
This patch adds query about CPU features
Fixes 53a9baa98c36 ("compress/isal: add basic PMD ops")Signed-off-by Tomasz Cel <[email protected]>---
Acked-by Lee Daly <[email protected]>
Applied to dpdk-next-crypto
Thanks.