vhost: suppress error if numa is not available

Message ID 1533830978-23518-1-git-send-email-i.maximets@samsung.com (mailing list archive)
State Superseded, archived
Delegated to: Maxime Coquelin
Headers
Series vhost: suppress error if numa is not available |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Ilya Maximets Aug. 9, 2018, 4:09 p.m. UTC
  It's a common case that 'get_mempolicy' fails on systems
without NUMA support. No need to flag an error in log for
this situation.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
---
 lib/librte_vhost/vhost.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Tiwei Bie Aug. 10, 2018, 3:03 a.m. UTC | #1
[PATCH] vhost: suppress error if numa is not available

s/numa/NUMA/

Otherwise check-git-log.sh [1] will complain:

Wrong headline lowercase:
        vhost: suppress error if numa is not available

Apart from that,

Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>

[1] https://github.com/DPDK/dpdk/blob/11a1f847d281/devtools/check-git-log.sh#L109

Thanks

On Thu, Aug 09, 2018 at 07:09:38PM +0300, Ilya Maximets wrote:
> It's a common case that 'get_mempolicy' fails on systems
> without NUMA support. No need to flag an error in log for
> this situation.
> 
> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
> ---
>  lib/librte_vhost/vhost.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c
> index 3c9be10..91026b3 100644
> --- a/lib/librte_vhost/vhost.c
> +++ b/lib/librte_vhost/vhost.c
> @@ -8,6 +8,7 @@
>  #include <stdint.h>
>  #include <stdlib.h>
>  #ifdef RTE_LIBRTE_VHOST_NUMA
> +#include <numa.h>
>  #include <numaif.h>
>  #endif
>  
> @@ -480,7 +481,7 @@ rte_vhost_get_numa_node(int vid)
>  	int numa_node;
>  	int ret;
>  
> -	if (dev == NULL)
> +	if (dev == NULL || numa_available() != 0)
>  		return -1;
>  
>  	ret = get_mempolicy(&numa_node, NULL, 0, dev,
> -- 
> 2.7.4
>
  
Ilya Maximets Aug. 10, 2018, 7:24 a.m. UTC | #2
On 10.08.2018 06:03, Tiwei Bie wrote:
> 
> [PATCH] vhost: suppress error if numa is not available
> 
> s/numa/NUMA/
> 
> Otherwise check-git-log.sh [1] will complain:
> 
> Wrong headline lowercase:
>         vhost: suppress error if numa is not available

Sure. Thanks for pointing that. I'll send v2.

> 
> Apart from that,
> 
> Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
> 
> [1] https://github.com/DPDK/dpdk/blob/11a1f847d281/devtools/check-git-log.sh#L109
> 
> Thanks
> 
> On Thu, Aug 09, 2018 at 07:09:38PM +0300, Ilya Maximets wrote:
>> It's a common case that 'get_mempolicy' fails on systems
>> without NUMA support. No need to flag an error in log for
>> this situation.
>>
>> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
>> ---
>>  lib/librte_vhost/vhost.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c
>> index 3c9be10..91026b3 100644
>> --- a/lib/librte_vhost/vhost.c
>> +++ b/lib/librte_vhost/vhost.c
>> @@ -8,6 +8,7 @@
>>  #include <stdint.h>
>>  #include <stdlib.h>
>>  #ifdef RTE_LIBRTE_VHOST_NUMA
>> +#include <numa.h>
>>  #include <numaif.h>
>>  #endif
>>  
>> @@ -480,7 +481,7 @@ rte_vhost_get_numa_node(int vid)
>>  	int numa_node;
>>  	int ret;
>>  
>> -	if (dev == NULL)
>> +	if (dev == NULL || numa_available() != 0)
>>  		return -1;
>>  
>>  	ret = get_mempolicy(&numa_node, NULL, 0, dev,
>> -- 
>> 2.7.4
>>
> 
>
  

Patch

diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c
index 3c9be10..91026b3 100644
--- a/lib/librte_vhost/vhost.c
+++ b/lib/librte_vhost/vhost.c
@@ -8,6 +8,7 @@ 
 #include <stdint.h>
 #include <stdlib.h>
 #ifdef RTE_LIBRTE_VHOST_NUMA
+#include <numa.h>
 #include <numaif.h>
 #endif
 
@@ -480,7 +481,7 @@  rte_vhost_get_numa_node(int vid)
 	int numa_node;
 	int ret;
 
-	if (dev == NULL)
+	if (dev == NULL || numa_available() != 0)
 		return -1;
 
 	ret = get_mempolicy(&numa_node, NULL, 0, dev,