RE: [RFC PATCH v1 00/57] Boot-time page size selection for arm64
From: Michael Kelley
Date: Thu Dec 05 2024 - 13:52:45 EST
From: Petr Tesarik <ptesarik@xxxxxxxx> Sent: Thursday, December 5, 2024 9:20 AM
>
> Hi Ryan,
>
> On Thu, 17 Oct 2024 13:32:43 +0100
> Ryan Roberts <ryan.roberts@xxxxxxx> wrote:
>
> > On 17/10/2024 13:27, Petr Tesarik wrote:
> > > On Mon, 14 Oct 2024 11:55:11 +0100
> > > Ryan Roberts <ryan.roberts@xxxxxxx> wrote:
> > >
> > >> [...]
> > >> The series is arranged as follows:
> > >>
> > >> - patch 1: Add macros required for converting non-arch code to support
> > >> boot-time page size selection
> > >> - patches 2-36: Remove PAGE_SIZE compile-time constant assumption from all
> > >> non-arch code
> > >
> > > I have just tried to recompile the openSUSE kernel with these patches
> > > applied, and I'm running into this:
> > >
> > > CC arch/arm64/hyperv/hv_core.o
> > > In file included from ../arch/arm64/hyperv/hv_core.c:14:0:
> > > ../include/linux/hyperv.h:158:5: error: variably modified ‘reserved2’ at file scope
> > > u8 reserved2[PAGE_SIZE - 68];
> > > ^~~~~~~~~
> > >
> > > It looks like one more place which needs a patch, right?
> >
> > As mentioned in the cover letter, so far I've only converted enough to get the
> > defconfig *image* building (i.e. no modules). If you are compiling a different
> > config or compiling the modules for defconfig, you will likely run into these
> > types of issues.
> >
> > That said, I do have some patches to fix Hyper-V, which Michael Kelley was kind
> > enough to send me.
> >
> > I understand that Suse might be able to help with wider performance testing - if
> > that's the reason you are trying to compile, you could send me your config and
> > I'll start working on fixing up other drivers?
>
> This project was de-prioritised for some time, but I have just returned
> to it, and one of our test systems uses a Mellanox 5 NIC, which did not build.
>
> If you still have time to work on your patch series, please, can you
> look into enabling MLX5_CORE_EN?
>
> Oh, and have you rebased the series to 6.12 yet?
>
FWIW, here's what I hacked together to compile and run the mlx5 driver in
a Hyper-V VM. This was against a 6.11 kernel code base.
Michael
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
index d894a88fa9f2..d0b381df074c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
@@ -66,9 +66,10 @@ struct fw_page {
enum {
MLX5_MAX_RECLAIM_TIME_MILI = 5000,
- MLX5_NUM_4K_IN_PAGE = PAGE_SIZE / MLX5_ADAPTER_PAGE_SIZE,
};
+#define MLX5_NUM_4K_IN_PAGE ((int)(PAGE_SIZE / MLX5_ADAPTER_PAGE_SIZE))
+
static u32 get_function(u16 func_id, bool ec_function)
{
return (u32)func_id | (ec_function << 16);
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index ba875a619b97..2d39ba77b591 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -255,12 +255,14 @@ enum {
MLX5_NON_FP_BFREGS_PER_UAR,
MLX5_MAX_BFREGS = MLX5_MAX_UARS *
MLX5_NON_FP_BFREGS_PER_UAR,
- MLX5_UARS_IN_PAGE = PAGE_SIZE / MLX5_ADAPTER_PAGE_SIZE,
- MLX5_NON_FP_BFREGS_IN_PAGE = MLX5_NON_FP_BFREGS_PER_UAR * MLX5_UARS_IN_PAGE,
MLX5_MIN_DYN_BFREGS = 512,
MLX5_MAX_DYN_BFREGS = 1024,
};
+
+#define MLX5_UARS_IN_PAGE ((int)(PAGE_SIZE / MLX5_ADAPTER_PAGE_SIZE))
+#define MLX5_NON_FP_BFREGS_IN_PAGE ((int)(MLX5_NON_FP_BFREGS_PER_UAR * MLX5_UARS_IN_PAGE))
+
enum {
MLX5_MKEY_MASK_LEN = 1ull << 0,
MLX5_MKEY_MASK_PAGE_SIZE = 1ull << 1,