[DTrace-devel] [PATCH v2 1/2] translators: support 6.10

Kris Van Hees kris.van.hees at oracle.com
Wed Jun 19 03:32:48 UTC 2024


This patch breaks generation dlibs for kernels < 6.10...  See bwlow.

On Fri, Jun 07, 2024 at 07:41:54PM +0100, Nick Alcock wrote:
> This changed the block device into a component of an atomic
> flags word (so we need to change the .d.in as well to pull in
> the releavnt #define for the blockdev portion of that flags word).
> 
> See kernel commit 1116b9fa15c09748ae05d2365a305fa22671eb1e.
> 
> Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
> ---
>  libdtrace/io.d.in | 6 +++---
>  libdtrace/io.m4   | 5 +++--
>  2 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/libdtrace/io.d.in b/libdtrace/io.d.in
> index b3da517778264..f44f53f092dce 100644
> --- a/libdtrace/io.d.in
> +++ b/libdtrace/io.d.in
> @@ -1,6 +1,6 @@
>  /*
>   * Oracle Linux DTrace.
> - * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
> + * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved.
>   * Licensed under the Universal Permissive License v 1.0 as shown at
>   * http://oss.oracle.com/licenses/upl.
>   */
> @@ -69,7 +69,7 @@ inline int REQ_SYNC = REQ_SYNC_VAL;
>  define_for_kernel([[__bi_rw]], [[(m4_kver(4,8,0), [[bi_opf]])]], [[bi_rw]])
>  define_for_kernel([[__disk]], [[(m4_kver(5,12,0), [[bi_bdev->bd_disk]]), (m4_kver(4,14,0), [[bi_disk]])]], [[bi_bdev->bd_disk]])
>  define_for_kernel([[__disk_chk]], [[(m4_kver(5,12,0), [[bi_bdev]]), (m4_kver(4,14,0), [[bi_disk]])]], [[bi_bdev]])
> -define_for_kernel([[__bio_partno]], [[(m4_kver(5,12,0), [[bi_bdev->bd_partno]]), (m4_kver(4,14,0), [[bi_partno]])]], [[bi_bdev->bd_part->partno]])
> +define_for_kernel([[__bio_partno]], [[(m4_kver(6,10,0), [[bi_bdev->__bd_flags.counter & BD_PARTNO]]), (m4_kver(5,12,0), [[bi_bdev->bd_partno]]), (m4_kver(4,14,0), [[bi_partno]])]], [[bi_bdev->bd_part->partno]])
>  define_for_kernel([[__bio_part_dev]], [[(m4_kver(5,12,0), [[bi_bdev->bd_dev]]), (m4_kver(5,11,0), [[bi_disk->part_tbl->part[B->bi_partno]->bd_dev]]), (m4_kver(4,14,0), [[bi_disk->part_tbl->part[B->bi_partno]->__dev.devt]])]], [[bi_bdev->bd_part->__dev.devt]])
>  
>  #pragma D binding "1.6.3" translator
> @@ -98,7 +98,7 @@ typedef struct devinfo {
>  } devinfo_t;
>  
>  define_for_kernel([[__bh_bdev_dev]], [[(m4_kver(5,11,0), [[b_bdev->bd_disk->part0->bd_device]])]], [[b_bdev->bd_disk->part0.__dev]])
> -define_for_kernel([[__bdev_partno]], [[(m4_kver(5,11,0), [[bd_partno]])]], [[bd_part->partno]])
> +define_for_kernel([[__bdev_partno]], [[(m4_kver(6,10,0), [[__bd_flags.counter & BD_PARTNO]]), (m4_kver(5,11,0), [[bd_partno]])]], [[bd_part->partno]])
>  #pragma D binding "1.0" translator
>  translator devinfo_t < struct buffer_head *B > {
>  	dev_major = getmajor(B->b_bdev->bd_dev);
> diff --git a/libdtrace/io.m4 b/libdtrace/io.m4
> index e837ef65b86f7..aa406ec375698 100644
> --- a/libdtrace/io.m4
> +++ b/libdtrace/io.m4
> @@ -1,6 +1,6 @@
>  /*
>   * Oracle Linux DTrace.
> - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
> + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
>   * Licensed under the Universal Permissive License v 1.0 as shown at
>   * http://oss.oracle.com/licenses/upl.
>   */
> @@ -11,7 +11,7 @@
>   * to replace those tokens with their values to create the finished io.d.
>   */
>  
> -/* #include <linux/buffer_head.h> */
> +#include <linux/blk_types.h>

This causing a dlib generation failure because this include is not sufficient:

In file included from /home/kvanhees/linux-uek/arch/x86/include/asm/pgtable_types.h:380,
                 from /home/kvanhees/linux-uek/arch/x86/include/asm/processor.h:21,
                 from /home/kvanhees/linux-uek/arch/x86/include/asm/cpufeature.h:5,
                 from /home/kvanhees/linux-uek/arch/x86/include/asm/thread_info.h:59,
                 from /home/kvanhees/linux-uek/include/linux/thread_info.h:60,
                 from /home/kvanhees/linux-uek/include/linux/spinlock.h:60,
                 from /home/kvanhees/linux-uek/include/linux/wait.h:9,
                 from /home/kvanhees/linux-uek/include/linux/wait_bit.h:8,
                 from /home/kvanhees/linux-uek/include/linux/fs.h:6,
                 from /home/kvanhees/linux-uek/include/linux/highmem.h:5,
                 from /home/kvanhees/linux-uek/include/linux/bvec.h:10,
                 from /home/kvanhees/linux-uek/include/linux/blk_types.h:10,
                 from libdtrace/io.m4:14:
/home/kvanhees/linux-uek/include/asm-generic/pgtable-nopud.h:18: warning: "PUD_SHIFT" redefined
   18 | #define PUD_SHIFT       P4D_SHIFT

The cause seems to be that you should add an include of linux/kconfig.h prior
to including linux/blk_types.h.  And in all, including linux/buffer_head.h seems
to be safer because blk_types.h says it shouldn't be included explicitly except
to break include loops.

>  #include <sys/file.h>
>  #if 0
>  #ifndef __USE_UNIX98
> @@ -43,4 +43,5 @@ DEF_REPLACE(O_NOFOLLOW)
>  DEF_REPLACE(O_CLOEXEC)
>  DEF_REPLACE(O_DSYNC)
>  DEF_REPLACE(O_RSYNC)
> +DEF_REPLACE(BD_PARTNO)

Thus reports an error when BD_PARTNO is not defined (and that is the case for
kernels < 6.10).  Wrapping this in #ifdef BD_PARTNO // #endif might be enough
to fix that.

>  #include "io.platform.m4"
> 
> base-commit: 454c6d47bf408415f7eb52ea701779f041aa6957
> -- 
> 2.45.1.275.g567cb0950c



More information about the DTrace-devel mailing list