Linux DTrace development list
 help / color / mirror / Atom feed
From: Kris Van Hees <kris.van.hees@oracle.com>
To: Nick Alcock <nick.alcock@oracle.com>
Cc: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com,
	kris.van.hees@oracle.com
Subject: Re: [PATCH v2 1/2] translators: support 6.10
Date: Tue, 18 Jun 2024 23:32:48 -0400	[thread overview]
Message-ID: <ZnJRYDRrlwAsNRr7@oracle.com> (raw)
In-Reply-To: <20240607184155.316904-1-nick.alcock@oracle.com>

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@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

  parent reply	other threads:[~2024-06-19  3:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-07 18:41 [PATCH v2 1/2] translators: support 6.10 Nick Alcock
2024-06-07 18:41 ` [PATCH v2 2/2] dlibs: pregenerated translators for 6.10 Nick Alcock
2024-06-13 12:22   ` [DTrace-devel] " Alan Maguire
2024-06-14 12:25     ` Alan Maguire
2024-06-19 13:23       ` Nick Alcock
2024-06-19  3:32 ` Kris Van Hees [this message]
2024-06-19 12:41   ` [PATCH v2 1/2] translators: support 6.10 Nick Alcock
2024-06-19 13:15   ` Nick Alcock
2024-06-20 17:54     ` Kris Van Hees
2024-06-19 13:21 ` [PATCH v3] " Nick Alcock
2024-06-20 17:55   ` Kris Van Hees

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZnJRYDRrlwAsNRr7@oracle.com \
    --to=kris.van.hees@oracle.com \
    --cc=dtrace-devel@oss.oracle.com \
    --cc=dtrace@lists.linux.dev \
    --cc=nick.alcock@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox