Bug 257264 - graphics/drm-fbsd13-kmod: Fails to build after LinuxKPI update: linux/kref.h:118:2: error: format specifies type 'char *' but the argument has type 'int'
Summary: graphics/drm-fbsd13-kmod: Fails to build after LinuxKPI update: linux/kref.h:...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-x11 (Nobody)
URL:
Keywords: needs-patch, regression
Depends on:
Blocks:
 
Reported: 2021-07-19 05:45 UTC by rkoberman
Modified: 2021-08-19 10:09 UTC (History)
9 users (show)

See Also:
bugzilla: maintainer-feedback? (x11)
koobs: maintainer-feedback? (manu)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rkoberman 2021-07-19 05:45:16 UTC
Since the commits on 17-Jul to update the linuxkpi to support iwlwifi and other issues, drm-fbsd13-kmod will no longer build. make buildworld also fails while building the kernel module, as well with the same issues with strings.

From UPDATING:
20210718:
	Bump __FreeBSD_version to 1300512 after merging LinuxKPI, OFED,
	net80211, and driver changes in order to support building
	Intel wireless iwlwifi drivers.  This is especially needed for
	drm-kmod which needs updates after this.

It reads like this was committed with knowledge that it would likely break buildkernel on STABLE. Huh! I hope I'm misreading this as STABLE should not get updates which are known will break the kernel for may users. 

Error from log:
cc  -O2 -pipe -fno-strict-aliasing '-DKBUILD_MODNAME="linuxkpi_gplv2"' -DLINUXKPI_VERSION=50000 -DCONFIG_DRM_AMDGPU_CIK -DCONFIG_DRM_AMDGPU_SI -DCONFIG_DRM_AMD_DC -DCONFIG_DRM_AMD_DC_FBC -DCONFIG_DRM_AMD_POWERPLAY -DCONFIG_DRM_I915_ALPHA_SUPPORT -DCONFIG_DRM_I915_FORCE_PROBE='"*"' -DCONFIG_DRM_I915_CAPTURE_ERROR -DCONFIG_DRM_I915_SPIN_REQUEST=5 -DCONFIG_DRM_I915_USERFAULT_AUTOSUSPEND=250 -DCONFIG_DRM_LOAD_EDID_FIRMWARE -DCONFIG_DRM_MIPI_DSI -DCONFIG_DRM_PANEL_ORIENTATION_QUIRKS -DCONFIG_DRM_VMWGFX_FBCON -DCONFIG_DRM_FBDEV_EMULATION -DCONFIG_DRM_FBDEV_OVERALLOC=100 -DCONFIG_DRM_LEGACY -DCONFIG_DRM_VM -DCONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG -DCONFIG_BACKLIGHT_CLASS_DEVICE -DCONFIG_DMI -DCONFIG_FB -DCONFIG_MTRR -DCONFIG_PCI -DCONFIG_PM -DCONFIG_SMP -DCONFIG_ACPI -DCONFIG_ACPI_SLEEP -DCONFIG_AGP -DCONFIG_X86 -DCONFIG_X86_PAT -DCONFIG_64BIT -DCONFIG_AS_MOVNTDQA -DCONFIG_COMPAT -DCONFIG_X64_64 -DCONFIG_DRM_AMD_DC_DCN1_0 -DCONFIG_DRM_AMD_DC_DCN1_01 -DCONFIG_DRM_AMD_DC_DCN2_0 -DCONFIG_DRM_AMD_DC_DSC_SUPPORT  -Werror -D_KERNEL -DKLD_MODULE -nostdinc  -I/usr/ports/graphics/drm-fbsd13-kmod/work/drm-kmod-drm_v5.4.92_3/include -I/usr/ports/graphics/drm-fbsd13-kmod/work/drm-kmod-drm_v5.4.92_3/linuxkpi/dummy/include -I/usr/ports/graphics/drm-fbsd13-kmod/work/drm-kmod-drm_v5.4.92_3/linuxkpi/gplv2/include -I/usr/src/sys/compat/linuxkpi/common/include -include /usr/ports/graphics/drm-fbsd13-kmod/work/drm-kmod-drm_v5.4.92_3/obj/usr/ports/graphics/drm-fbsd13-kmod/work/drm-kmod-drm_v5.4.92_3/linuxkpi/opt_global.h -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -fno-common  -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-prefix-map=./machine=/usr/src/sys/amd64/include -fdebug-prefix-map=./x86=/usr/src/sys/x86/include     -MD  -MF.depend.linux_compat.o -MTlinux_compat.o -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error=tautological-compare -Wno-error=empty-body -Wno-error=parentheses-equality -Wno-error=unused-function -Wno-error=pointer-sign -Wno-error=shift-negative-value -Wno-address-of-packed-member -Wno-format-zero-length -Wno-pointer-arith   -mno-aes -mno-avx  -std=iso9899:1999 -c /usr/ports/graphics/drm-fbsd13-kmod/work/drm-kmod-drm_v5.4.92_3/linuxkpi/gplv2/src/linux_compat.c -o linux_compat.o
In file included from /usr/ports/graphics/drm-fbsd13-kmod/work/drm-kmod-drm_v5.4.92_3/linuxkpi/gplv2/src/linux_compat.c:10:
In file included from /usr/ports/graphics/drm-fbsd13-kmod/work/drm-kmod-drm_v5.4.92_3/linuxkpi/gplv2/include/linux/pci.h:10:
In file included from /usr/src/sys/compat/linuxkpi/common/include/linux/pci.h:55:
In file included from /usr/src/sys/compat/linuxkpi/common/include/linux/dmapool.h:37:
In file included from /usr/ports/graphics/drm-fbsd13-kmod/work/drm-kmod-drm_v5.4.92_3/linuxkpi/gplv2/include/linux/device.h:4:
In file included from /usr/src/sys/compat/linuxkpi/common/include/linux/device.h:36:
In file included from /usr/ports/graphics/drm-fbsd13-kmod/work/drm-kmod-drm_v5.4.92_3/linuxkpi/gplv2/include/linux/kobject.h:4:
In file included from /usr/src/sys/compat/linuxkpi/common/include/linux/kobject.h:37:
/usr/src/sys/compat/linuxkpi/common/include/linux/kref.h:118:2: error: implicit declaration of function '__stringify' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        WARN_ON(release == NULL);
        ^
/usr/src/sys/compat/linuxkpi/common/include/linux/kernel.h:128:7: note: expanded from macro 'WARN_ON'
                    __stringify(cond), __FILE__, __LINE__);     \
                    ^
In file included from /usr/ports/graphics/drm-fbsd13-kmod/work/drm-kmod-drm_v5.4.92_3/linuxkpi/gplv2/src/linux_compat.c:10:
In file included from /usr/ports/graphics/drm-fbsd13-kmod/work/drm-kmod-drm_v5.4.92_3/linuxkpi/gplv2/include/linux/pci.h:10:
In file included from /usr/src/sys/compat/linuxkpi/common/include/linux/pci.h:55:
In file included from /usr/src/sys/compat/linuxkpi/common/include/linux/dmapool.h:37:
In file included from /usr/ports/graphics/drm-fbsd13-kmod/work/drm-kmod-drm_v5.4.92_3/linuxkpi/gplv2/include/linux/device.h:4:
In file included from /usr/src/sys/compat/linuxkpi/common/include/linux/device.h:36:
In file included from /usr/ports/graphics/drm-fbsd13-kmod/work/drm-kmod-drm_v5.4.92_3/linuxkpi/gplv2/include/linux/kobject.h:4:
In file included from /usr/src/sys/compat/linuxkpi/common/include/linux/kobject.h:37:
/usr/src/sys/compat/linuxkpi/common/include/linux/kref.h:118:2: error: format specifies type 'char *' but the argument has type 'int' [-Werror,-Wformat]
        WARN_ON(release == NULL);
        ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/compat/linuxkpi/common/include/linux/kernel.h:128:7: note: expanded from macro 'WARN_ON'
                    __stringify(cond), __FILE__, __LINE__);     \
                    ^~~~~~~~~~~~~~~~~
2 errors generated.
*** Error code 1

Stop.
make[3]: stopped in /usr/ports/graphics/drm-fbsd13-kmod/work/drm-kmod-drm_v5.4.92_3/linuxkpi
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/graphics/drm-fbsd13-kmod/work/drm-kmod-drm_v5.4.92_3
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/graphics/drm-fbsd13-kmod
*** Error code 1

Stop.
make: stopped in /usr/ports/graphics/drm-fbsd13-kmod
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2021-07-19 06:22:15 UTC
This (likely) may have been reported, and possibly already resolved upstream [1]. If that is the case please identify the issue / PR / commit references so we can add them here.

[1] https://github.com/freebsd/drm-kmod/issues
Comment 2 rkoberman 2021-07-19 06:44:47 UTC
(In reply to Kubilay Kocak from comment #1)
No issue but a pull request was entered by bz@ earlier today. There has been no commit or comment at this time.
Comment 3 rkoberman 2021-07-19 06:47:23 UTC
Correction! It was committed upstream in git. Don't see any indication of a commit to stable/13 or the port.
Comment 4 Bjoern A. Zeeb freebsd_committer freebsd_triage 2021-07-19 16:03:15 UTC
See my answer on the mailing list.

https://lists.freebsd.org/archives/freebsd-stable/2021-July/000136.html


This is external code which cannot be updated before the kernel change is done as __FreeBSD_version would not have been known.

If you are tracking latest main or stable you'll always encounter this race.
The pull request is upstream and people will incorporate that once they get to it.
In the mean time you can apply that locally.

/bz
Comment 5 Niclas Zeising freebsd_committer freebsd_triage 2021-07-20 11:14:45 UTC
The problem is, as has been reported on the mailing lists, the patch does not apply straight away.

We are working on a fix for this.
Comment 6 Bjoern A. Zeeb freebsd_committer freebsd_triage 2021-07-20 12:56:22 UTC
(In reply to Niclas Zeising from comment #5)

But that means that linuxkpi wasn't kept in synch between master and whatever is used on 13.  When 13 was branched my understanding from manu was linuxkpi for the drm for 13 and head "are the same" and all old legacy was removed.   That is the reason I only merged to 13.  And that was the reason that last time I had prepared the patch for 14 and 13 so that only the __FreeBSD_version would need to be updated.

I am sorry if I misunderstood.
Comment 7 Niclas Zeising freebsd_committer freebsd_triage 2021-07-20 13:31:25 UTC
(In reply to Bjoern A. Zeeb from comment #6)

They were the same at branch point, but not everything is possible to MFC (at least that was the case on FreeBSD 12), and we still have different versions of drm-kmod on FreeBSD 13 and 14, which requires different stuff in lkpi.  Remember that drm-kmod on 13 must currently work on both 13.0-RELEASE and stable.
Comment 8 Bjoern A. Zeeb freebsd_committer freebsd_triage 2021-07-20 13:47:21 UTC
(In reply to Niclas Zeising from comment #7)

So what the actual issue with:

https://github.com/freebsd/drm-kmod/pull/80 (which I assumed was already cherry-picked) + https://github.com/freebsd/drm-kmod/pull/95 (which fixes the __FreeBSD_version checks for 13) on either 13.0-RELEASE or 13-STABLE?
Comment 9 Vladimir Kondratyev freebsd_committer freebsd_triage 2021-07-20 14:32:22 UTC
(In reply to Bjoern A. Zeeb from comment #8)

> So what the actual issue with

There is another one issue: drm-kmod binary compiled on 13-RELEASE does not work on 13-STABLE kernel anymore. That makes 13.0->13.1 binary upgrade with pkg impossible until 13.0-EOL. That issue is not related to current PR as moving __stringify() between includes does not change KBI
Comment 10 Bjoern A. Zeeb freebsd_committer freebsd_triage 2021-07-20 16:31:51 UTC
(In reply to Vladimir Kondratyev from comment #9)

It seems the port build issue got sorted, which is good.  So people on stable can build their drm-kmod again along with their kernels.



The KPI problem is indeed an issue.  I wouldn't want to rule out that something broke the KPI which is relevant to drm-kmod (with my MFCs other otherwise).

Do you have a (recent--after port update) pkg somewhere which was build on 13.0-RELEASE?  We can probably take that part to email.
Comment 11 rkoberman 2021-07-20 23:27:37 UTC
Latest port builds but won't install. 

First, the old dummy files for cpu.h and stringif.h are no longer created, but no longer exist. Then the files firmware.[ch], kconfig.h, kobject.h, and linux_device.c are not present in the stage directory or the work/drm-fbsd13-kmod_v5.4.92_5 directory.

This is on 13.0-STABLE FreeBSD 13.0-STABLE #0 stable/13-n246075-27693a604a7 built on June 21, 2021.
Comment 12 Vladimir Kondratyev freebsd_committer freebsd_triage 2021-07-20 23:37:18 UTC
(In reply to Bjoern A. Zeeb from comment #10)
> Do you have a (recent--after port update) pkg somewhere which was build on 13.0-RELEASE?  We can probably take that part to email.

pkg install drm-fbsd13-kmod being executed on any 13.x machine installs package built on 13.0-RELEASE

It is appeared that commit 04456f7118 which broke KBI precedes your commits.
It adds some fields to struct pci_dev which are required by newer versions of drm-kmod. That means that we have 2 options: Revert all breaking commits and stick to drm-kmod 5.4 on 13.x forever or break 13.x->13.x+1 binary upgrade over and over again.
Comment 13 O. Hartmann 2021-07-21 10:21:08 UTC
Today, 21st of July, 12:10 o'clock MEST, kernel build still fails even with today upgraded ports tree and recent 13-STABLE sources. It turn out, that still an adequate fixed port for drm-kmod is not present in the ports tree, although the reported adaptions in the kernel sources have been made.


When will the upgrade drm-kmod port be commited?
Comment 14 Vladimir Kondratyev freebsd_committer freebsd_triage 2021-07-21 13:41:57 UTC
drm-fbsd13-kmod-5.4.92.g20210720 builds for me just fine in 13-STABLE jail staying at commit 801a4bcab69f (CommitDate: 2021-07-20 22:43:52 +0000)
Comment 15 Emmanuel Vadot freebsd_committer freebsd_triage 2021-07-21 16:47:46 UTC
It build fine but I have not updated the plist correctly to work with the SRC options (that install the sources). Will fix that tonight.
Comment 16 commit-hook freebsd_committer freebsd_triage 2021-07-21 18:42:08 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=64530a54dfb567887d9ad739508bf094d29baa01

commit 64530a54dfb567887d9ad739508bf094d29baa01
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2021-07-21 18:39:26 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2021-07-21 18:40:14 +0000

    graphics/drm-fbsd13-kmod: Fix plist for SOURCE option

    PR:     257264

 graphics/drm-fbsd13-kmod/Makefile  |  1 +
 graphics/drm-fbsd13-kmod/pkg-plist | 10 +++-------
 2 files changed, 4 insertions(+), 7 deletions(-)
Comment 17 rkoberman 2021-07-21 21:09:29 UTC
Just a quick update to confirm that I was able to build the kernel without any issues. The last patch seems to have done the trick. This is on a stable/13 system from sources updated after the linuxkpi commits on Saturday.
Comment 18 Ali Abdallah 2021-08-19 10:09:34 UTC
Any reason why this wasn't committed to 2021Q3 port tree?