Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions mk/linux_kbuild.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,24 @@ KDIR ?= /lib/modules/$(KVER)/build
export KDIR KVER


EXTRA_CPPFLAGS += -I$(TOPPATH)/src/include -I$(BUILDPATH)/include \
cppflags-y += -I$(TOPPATH)/src/include -I$(BUILDPATH)/include \
-I$(BUILDPATH) -I$(TOPPATH)/$(CURRENT) -D__ci_driver__
ifdef NDEBUG
EXTRA_CPPFLAGS += -DNDEBUG
cppflags-y += -DNDEBUG
endif
ifndef MMAKE_LIBERAL
EXTRA_CFLAGS += -Werror
ccflags-y += -Werror
endif # MMAKE_LIBERAL

# TODO Address these in the source code.
EXTRA_CFLAGS += -Wno-missing-prototypes -Wno-missing-declarations
ccflags-y += -Wno-missing-prototypes -Wno-missing-declarations

ifdef W_NO_STRING_TRUNCATION
EXTRA_CFLAGS += -Wno-stringop-truncation
ccflags-y += -Wno-stringop-truncation
endif

ifndef NDEBUG
EXTRA_CFLAGS += -g
ccflags-y += -g
endif

HAVE_EFCT ?=
Expand All @@ -53,45 +53,45 @@ HAVE_CNS_EFCT := $(or $(and $(wildcard $(X3_NET_PATH)/include/linux/net/xilinx/x
endif

ifeq ($(or $(filter 1, $(HAVE_KERNEL_EFCT) $(HAVE_CNS_EFCT)),0),1)
EXTRA_CFLAGS += -DCI_HAVE_EFCT_AUX=1
ccflags-y += -DCI_HAVE_EFCT_AUX=1
ifneq ($(HAVE_CNS_EFCT),0)
EXTRA_CFLAGS += -I$(X3_NET_PATH)/include
ccflags-y += -I$(X3_NET_PATH)/include
endif
else
ifneq ($(HAVE_EFCT),1)
EXTRA_CFLAGS += -DCI_HAVE_EFCT_AUX=0
ccflags-y += -DCI_HAVE_EFCT_AUX=0
else
$(error Unable to build Onload with EFCT or AUX bus support)
endif
endif

HAVE_EF10CT ?= 1
ifeq ($(HAVE_EF10CT),0)
EXTRA_CFLAGS += -DCI_HAVE_EF10CT=0
ccflags-y += -DCI_HAVE_EF10CT=0
else
EXTRA_CFLAGS += -DCI_HAVE_EF10CT=1
ccflags-y += -DCI_HAVE_EF10CT=1
endif

HAVE_SDCI ?= 0
ifeq ($(HAVE_SDCI),1)
EXTRA_CFLAGS += -DCI_HAVE_SDCI=1
ccflags-y += -DCI_HAVE_SDCI=1
else
EXTRA_CFLAGS += -DCI_HAVE_SDCI=0
ccflags-y += -DCI_HAVE_SDCI=0
endif

HAVE_SFC ?= 1
ifeq ($(HAVE_SFC),1)
EXTRA_CFLAGS += -DCI_HAVE_SFC=1
ccflags-y += -DCI_HAVE_SFC=1
else
EXTRA_CFLAGS += -DCI_HAVE_SFC=0
ccflags-y += -DCI_HAVE_SFC=0
endif

TRANSPORT_CONFIG_OPT_HDR ?= ci/internal/transport_config_opt_extra.h
EXTRA_CFLAGS += -DTRANSPORT_CONFIG_OPT_HDR='<$(TRANSPORT_CONFIG_OPT_HDR)>'
ccflags-y += -DTRANSPORT_CONFIG_OPT_HDR='<$(TRANSPORT_CONFIG_OPT_HDR)>'

EXTRA_CFLAGS += $(MMAKE_CFLAGS) $(EXTRA_CPPFLAGS)
EXTRA_AFLAGS += $(EXTRA_CPPFLAGS)
ccflags-y += $(MMAKE_CFLAGS) $(cppflags-y)
asflags-y += $(cppflags-y)

ifdef M_NO_OUTLINE_ATOMICS
EXTRA_CFLAGS += -mno-outline-atomics
ccflags-y += -mno-outline-atomics
endif
2 changes: 1 addition & 1 deletion mk/platform/linux.mk
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CFLAGS_KERNEL :=
endif

ifdef CONFIG_ARM64
EXTRA_CFLAGS += -mcmodel=large
ccflags-y += -mcmodel=large
endif

# To build without -g set CONFIG_DEBUG_INFO to empty string
Expand Down
10 changes: 9 additions & 1 deletion src/driver/linux_net/drivers/net/ethernet/sfc/debugfs.c
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is part of the sfc Linux net driver which is managed in a separate project so we would make changes there. Linux 6.15 build compatibility changes have already been made in the net driver so this particular change is no longer needed since 2b28cf9, thanks!

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
#include "ef100_vdpa.h"
#include "mcdi_filters.h"
#endif
#ifdef EFX_HAVE_TRY_LOOKUP_NOPERM
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes to src/driver/linux_net/* need to go via the AMD net driver team, as we consume the driver unmodified from them. We'll work internally to get this kernel supported with them, and then import a new version of the net driver to the Onload repository.

#include <linux/namei.h>
#endif


/* Parameter definition bound to a structure - each file has one of these */
Expand Down Expand Up @@ -84,10 +87,15 @@ static struct file_operations efx_debugfs_file_ops = {
*/
void efx_fini_debugfs_child(struct dentry *dir, const char *name)
{
struct qstr child_name = QSTR_INIT(name, strlen(name));
struct dentry *child;

#ifdef EFX_HAVE_TRY_LOOKUP_NOPERM
child = try_lookup_noperm(&QSTR(name), dir);
#else
struct qstr child_name = QSTR_INIT(name, strlen(name));

child = d_hash_and_lookup(dir, &child_name);
#endif
if (!IS_ERR_OR_NULL(child)) {
/* If it's a "regular" file, free its parameter binding */
if (S_ISREG(child->d_inode->i_mode))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ EFX_HAVE_NET_RPS_H file include/net/rps.h
EFX_HAVE_IP_TUNNEL_FLAGS_TO_BE16 symbol ip_tunnel_flags_to_be16 include/net/ip_tunnels.h
EFX_NEED_TIME64_TO_TM nsymbol time64_to_tm include/linux/time.h
EFX_HAVE_ASSIGN_STR_NO_SRC_ARG custom
EFX_HAVE_TRY_LOOKUP_NOPERM symbol try_lookup_noperm include/linux/namei.h
" | grep -E -v -e '^#' -e '^$' | sed 's/[ \t][ \t]*/:/g'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ override CONFIG_SFC_DRIVERLINK :=
override CONFIG_SFC_VDPA :=

# For CONFIG_SFC_TRACING includes via linux <include/trace/define_trace.h>
EXTRA_CFLAGS += -I$(src)
ccflags-y += -I$(src)

ifdef EFX_FOR_UPSTREAM
# match UNIFDEF_DEFINES in export.sh
Expand Down Expand Up @@ -89,7 +89,7 @@ sfc-siena-$(CONFIG_SFC_DUMP) += dump.o
obj-$(CONFIG_SFC_SIENA) += sfc-siena.o
ifndef EFX_UPSTREAM
ifndef EFX_DISABLE_GRO
EXTRA_CFLAGS += -DEFX_USE_GRO
ccflags-y += -DEFX_USE_GRO
endif
ifdef KERNELRELEASE
# Kernel build
Expand Down
5 changes: 5 additions & 0 deletions src/driver/linux_net/scripts/kernel_compat_funcs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,11 @@ cc-disable-warning = $(call try-run,\
$(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -xc /dev/null -o "$$TMP",-Wno-$(strip $(1)))
endif
ccflags-y = -Werror $(call cc-disable-warning, unused-but-set-variable)

CC_VERSION_TEXT = $(shell LC_ALL=C $(CC) --version 2>/dev/null | head -n 1)
ifneq ($(findstring clang,$(CC_VERSION_TEXT)),)
ccflags-y += -Wno-error=format-truncation
endif
'

# Ensure it looks like a build tree and we can build a module
Expand Down
4 changes: 2 additions & 2 deletions src/driver/linux_onload/mmake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ obj-m := $(IP_TARGET)
ifeq ($(ARCH),powerpc)
# RHEL5/PPC requires you to pass this, because by default its userspace
# is 32-bit, but its kernel was built with a 64-bit compiler!
EXTRA_CFLAGS+= -m64
ccflags-y+= -m64
endif

ifeq ($(ARCH),arm64)
# HACK: to circumvent build error on newever gcc/kernels on ARM (?)
EXTRA_CFLAGS+= -Wno-error=discarded-qualifiers
ccflags-y+= -Wno-error=discarded-qualifiers
endif

onload-objs := $(IP_TARGET_SRCS:%.c=%.o)
Expand Down
5 changes: 4 additions & 1 deletion src/driver/linux_resource/kernel_compat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ EFRM_HAVE_ALLOC_FILE_PSEUDO symbol alloc_file_pseudo include/linux/file.h
EFRM_NET_HAS_PROC_INUM member struct_net proc_inum include/net/net_namespace.h
EFRM_NET_HAS_USER_NS member struct_net user_ns include/net/net_namespace.h

EFRM_HAVE_OLD_FAULT memtype struct_vm_operations_struct fault include/linux/mm.h int (*)(struct vm_area_struct *vma, struct vm_fault *vmf)
EFRM_HAVE_OLD_FAULT memtype struct_vm_operations_struct fault include/linux/mm.h int (*)(struct vm_fault *vmf)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like us to understand why this was wrong before changing it. It has been this way for a long time. I appreciate that as this repository doesn't have the history pre-2020, it makes it difficult for external contributors to do that kind of archaeology, so I think this is a task for the AMD team. I'm wondering if when this was written, what was "new" then has become "old" now. I.e. there are potentially three signatures we need to interoperate with, although I'm hoping that the original "old" is now so old that we don't need it.

In summary, I think this change is probably correct, but I want to check history to be sure.

EFRM_HAVE_NEW_FAULT memtype struct_vm_operations_struct fault include/linux/mm.h vm_fault_t (*)(struct vm_fault *vmf)

EFRM_HAVE_SCHED_TASK_H file include/linux/sched/task.h
Expand Down Expand Up @@ -188,6 +188,9 @@ EFRM_HAVE_FOLLOW_PFNMAP_START symbol follow_pfnmap_start include/linux/mm.h
EFRM_HAVE_FOLLOW_PTE symbol follow_pte include/linux/mm.h
EFRM_HAVE_FOLLOW_PTE_VMA symtype follow_pte include/linux/mm.h int(struct vm_area_struct*, unsigned long, pte_t**, spinlock_t**)

EFRM_PAGE_HAS_FOLIO_INDEX member struct_page __folio_index include/linux/mm_types.h
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me.

EFRM_NEED_UNIXCB nsymbol UNIXCB include/net/af_unix.h
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This, and the code that uses it in shrub_socket_kernel.c needs closer inspection. While it might succeed in getting it to compile on recent kernels, we need to be careful about introducing new kernel definitions as they can be fragile to maintain. If there's a way we can avoid that, we'd have a strong preference for that. AMD Onload team to have a look at this.


# TODO move onload-related stuff from net kernel_compat
" | grep -E -v -e '^#' -e '^$' | sed 's/[ \t][ \t]*/:/g'
}
Expand Down
7 changes: 6 additions & 1 deletion src/driver/linux_resource/kernel_compat_funcs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,12 @@ ifndef cc-disable-warning
cc-disable-warning = $(call try-run,\
$(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -xc /dev/null -o "$$TMP",-Wno-$(strip $(1)))
endif
EXTRA_CFLAGS = -Werror $(call cc-disable-warning, unused-but-set-variable)
ccflags-y = -Werror $(call cc-disable-warning, unused-but-set-variable)

CC_VERSION_TEXT = $(shell LC_ALL=C $(CC) --version 2>/dev/null | head -n 1)
ifneq ($(findstring clang,$(CC_VERSION_TEXT)),)
ccflags-y += -Wno-error=format-truncation
endif
'

# Ensure it looks like a build tree and we can build a module
Expand Down
2 changes: 1 addition & 1 deletion src/include/ci/tools/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

/* verifies compile time expression is 0 or positive -
* no-op for runtime expressions */
#if __GNUC__ * 100 + __GNUC_MINOR__ >= 409
#if defined(__clang__) || __GNUC__ * 100 + __GNUC_MINOR__ >= 409
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although we don't officially support clang I'm inclined to recommend taking this fix as it will make life easier for any clang users and seems harmless for everyone else.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the Clang-related changes above are accepted, I’d really appreciate it if you could also include this commit: sheviks@9525ca6.

Clang emits more errors than GCC; adding that commit ensures Clang generates the same autocompat.h as GCC.
This is also harmless for users not using Clang.

Thanks!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @sheviks, I don't think that commit 9525ca6 features in a pull request. Would you mind putting it in one if you'd like our team to review it, please? Thanks!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve committed the change. Please see this commit for details: sheviks@dc0b741
Thank you.

Copy link
Copy Markdown
Author

@sheviks sheviks Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After I committed the patch, GitHub reported conflicts. When I resolved them, GitHub automatically added a merge commit.
Because of that, I found that the commit mentioned in issue #293 (2b28cf9) does not include all ccflags-y changes.
For example:

A grep for EXTRA_CFLAGS on current master still shows quite a few remaining occurrences.
Could you please take another look and make sure the ccflags-y changes are applied consistently?

Alternatively, if you'd prefer, I can review them and submit the fixes here.

Thank you.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reconsidered the approach. Since this PR will be split into smaller merges, I went ahead and committed the ccflags-y changes so they’re ready for review.
Please review and decide on the final merge strategy.

Thanks!

#define CI_BUILD_ASSERT_CONSTANT_NON_NEGATIVE(c) \
do { \
char __CI_BUILD_ASSERT_NAME(__LINE__) \
Expand Down
15 changes: 15 additions & 0 deletions src/lib/ciul/shrub_socket_kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@
#define ANCIENT_KERNEL_HACK
#endif

#ifdef EFRM_NEED_UNIXCB
struct unix_skb_parms {
struct pid *pid; /* skb credentials */
kuid_t uid;
kgid_t gid;
struct scm_fp_list *fp; /* Passed files */
#ifdef CONFIG_SECURITY_NETWORK
u32 secid; /* Security ID */
#endif
u32 consumed;
} __randomize_layout;

#define UNIXCB(skb) (*(struct unix_skb_parms *)&((skb)->cb))
#endif

Comment on lines +24 to +38
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above comment for UNIXCB - Onload team to have a look

int ef_shrub_socket_open(uintptr_t* socket_out)
{
int rc;
Expand Down
3 changes: 1 addition & 2 deletions src/lib/cplane/mmake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ endif

ifdef MMAKE_USE_KBUILD
objd := $(obj)/
EXTRA_CFLAGS += $(CP_INTF_VER_CFLAGS)
ccflags-y += $(CP_INTF_VER_CFLAGS)
else
objd :=
MMAKE_CFLAGS += $(CP_INTF_VER_CFLAGS) -I../..
Expand Down Expand Up @@ -74,4 +74,3 @@ obj-y := $(LIB_OBJS)
include $(TOPPATH)/mk/site/cplane.mk
ccflags-y := $(CP_INTF_VER_CFLAGS)
endif

9 changes: 7 additions & 2 deletions src/lib/kernel_utils/hugetlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,15 @@ oo_hugetlb_page_offset(struct page *page)
* for vanilla, and >= 5.14 for RHEL 9.6) where hugetlb_basepage_index()
* was not present.
*/
#ifdef EFRM_PAGE_HAS_FOLIO_INDEX
pgoff_t index = page->__folio_index;
#else
pgoff_t index = page->index;
#endif
#if defined(EFRM_HAS_FILEMAP_LOCK_HUGETLB_FOLIO) && ! defined(EFRM_HAS_HUGETLB_BASEPAGE_INDEX)
return page->index * PAGE_SIZE;
return index * PAGE_SIZE;
#else
return page->index * OO_HUGEPAGE_SIZE;
return index * OO_HUGEPAGE_SIZE;
Comment on lines +318 to +326
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

#endif
}
EXPORT_SYMBOL(oo_hugetlb_page_offset);