From patchwork Tue Jan 17 17:08:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 1727604 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NxFhx5tNMz23fp for ; Wed, 18 Jan 2023 04:08:33 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 83B0F40C03; Tue, 17 Jan 2023 17:08:31 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 83B0F40C03 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eNBin_qexpow; Tue, 17 Jan 2023 17:08:30 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id AB5374010D; Tue, 17 Jan 2023 17:08:29 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org AB5374010D Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7BE77C0033; Tue, 17 Jan 2023 17:08:29 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0EF99C002D for ; Tue, 17 Jan 2023 17:08:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id D02EA4011F for ; Tue, 17 Jan 2023 17:08:27 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org D02EA4011F X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Vt_rjc0mvW5Y for ; Tue, 17 Jan 2023 17:08:27 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org C4C714010D Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by smtp2.osuosl.org (Postfix) with ESMTPS id C4C714010D for ; Tue, 17 Jan 2023 17:08:26 +0000 (UTC) Received: (Authenticated sender: i.maximets@ovn.org) by mail.gandi.net (Postfix) with ESMTPSA id C8DD91C0005; Tue, 17 Jan 2023 17:08:23 +0000 (UTC) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Tue, 17 Jan 2023 18:08:27 +0100 Message-Id: <20230117170827.3000242-1-i.maximets@ovn.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Cc: Ilya Maximets Subject: [ovs-dev] [PATCH] sparse: Fix numa.h for libnuma >= 2.0.13. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Current numa.h header for sparse re-defines functions in a way that breaks the header from libnuma 2.0.13+, because the original issue was fixed in that version: https://github.com/numactl/numactl/commit/25dcde021dd4f1a1dcac2ba0094f1cb441a2e4a5 Sparse errors as a result: lib/netdev-afxdp.c: note: in included file (through include/sparse/numa.h): /usr/include/numa.h:346:26: error: macro "numa_get_interleave_mask_compat" passed 1 arguments, but takes just 0 /usr/include/numa.h:376:26: error: macro "numa_get_membind_compat" passed 1 arguments, but takes just 0 /usr/include/numa.h:406:26: error: macro "numa_get_run_node_mask_compat" passed 1 arguments, but takes just 0 /usr/include/numa.h:347:1: error: Expected ; at end of declaration /usr/include/numa.h:347:1: error: got { /usr/include/numa.h:351:9: error: 'tp' has implicit type It's hard to adjust defines to work with both versions of a header. Just defining all the functions we actually use in OVS instead and not including the original header. Fixes: e8568993e062 ("netdev-afxdp: NUMA-aware memory allocation for XSK related memory.") Signed-off-by: Ilya Maximets Reviewed-by: David Marchand --- include/sparse/numa.h | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/include/sparse/numa.h b/include/sparse/numa.h index 3691a0eaf..a185972e3 100644 --- a/include/sparse/numa.h +++ b/include/sparse/numa.h @@ -18,10 +18,21 @@ #error "Use this header only with sparse. It is not a correct implementation." #endif -/* Avoid sparse warning: non-ANSI function declaration of function" */ -#define numa_get_membind_compat() numa_get_membind_compat(void) -#define numa_get_interleave_mask_compat() numa_get_interleave_mask_compat(void) -#define numa_get_run_node_mask_compat() numa_get_run_node_mask_compat(void) +#ifndef __NUMA_H_SPARSE +#define __NUMA_H_SPARSE 1 -/* Get actual definitions for us to annotate and build on. */ -#include_next +/* Avoid sparse warning "non-ANSI function declaration of function" with + * libnuma < 2.0.13. */ + +struct bitmask { + unsigned long size; + unsigned long *maskp; +}; + +int numa_available(void); +struct bitmask *numa_allocate_nodemask(void); +void numa_bitmask_free(struct bitmask *); +void numa_set_localalloc(void); +void numa_set_preferred(int node); + +#endif /* for sparse. */