Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make of 5.10.60.1 fails #7558

Closed
1 of 2 tasks
tadam98 opened this issue Oct 17, 2021 · 8 comments
Closed
1 of 2 tasks

make of 5.10.60.1 fails #7558

tadam98 opened this issue Oct 17, 2021 · 8 comments

Comments

@tadam98
Copy link

tadam98 commented Oct 17, 2021

Version

Microsoft Verion 2200.258

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

5.10.60.1

Distro Version

Ubuntu 18.04

Other Software

No response

Repro Steps

cd /usr/src &&
TAGVERNUM=5.10.60.1 &&
TAGVER=linux-msft-wsl-${TAGVERNUM} &&
sudo git clone -b ${TAGVER}
https://github.com/microsoft/WSL2-Linux-Kernel.git
${TAGVERNUM}-microsoft-standard &&
cd ${TAGVERNUM}-microsoft-standard

Copy in your current kernel configuration

$ sudo cp /proc/config.gz config.gz
$ sudo gunzip config.gz
$ sudo mv config .config
sudo make clean && sudo make -j 8 && sudo make modules_install -j 12 && sudo make install -j 8

Expected Behavior

no errors during make

Actual Behavior

CC drivers/md/dm-target.o
drivers/hv/dxgkrnl/dxgmodule.c:392:39: error: initializer element is not constant
const int DXGK_VMBUS_VERSION_OFFSET = DXGK_VMBUS_CHANNEL_ID_OFFSET +
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hv/dxgkrnl/dxgmodule.c:395:41: error: initializer element is not constant
const int DXGK_VMBUS_VGPU_LUID_OFFSET = DXGK_VMBUS_VERSION_OFFSET +
^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hv/dxgkrnl/dxgmodule.c:398:41: error: initializer element is not constant
const int DXGK_VMBUS_GUESTCAPS_OFFSET = DXGK_VMBUS_VERSION_OFFSET +
^~~~~~~~~~~~~~~~~~~~~~~~~
AR drivers/vhost/built-in.a
CC fs/btrfs/ulist.o
scripts/Makefile.build:280: recipe for target 'drivers/hv/dxgkrnl/dxgmodule.o' failed
make[3]: *** [drivers/hv/dxgkrnl/dxgmodule.o] Error 1
scripts/Makefile.build:497: recipe for target 'drivers/hv/dxgkrnl' failed
make[2]: *** [drivers/hv/dxgkrnl] Error 2
scripts/Makefile.build:497: recipe for target 'drivers/hv' failed
make[1]: *** [drivers/hv] Error 2
log.txt
log.html.txt

Diagnostic Logs

No response

@benhillis
Copy link
Member

@tyhicks - any idea?

@tyhicks
Copy link
Collaborator

tyhicks commented Oct 18, 2021

@tadam98 @benhillis the Microsoft Dxgkrnl driver is relying on undefined behavior in C that triggers a build failure in older GCC releases (prior to GCC 8.1). Details can be found in the upstream GCC bugzilla.

Ubuntu 18.04 shipped with GCC 7.5.0. We (Microsoft) build WSL2 kernels with GCC 9.3.0 so we didn't notice this issue.

A quick workaround that's only been build-tested (I can't guarantee that this works) would be:

diff --git a/drivers/hv/dxgkrnl/dxgmodule.c b/drivers/hv/dxgkrnl/dxgmodule.c
index 11226c2b8b7b..1601a721a72f 100644
--- a/drivers/hv/dxgkrnl/dxgmodule.c
+++ b/drivers/hv/dxgkrnl/dxgmodule.c
@@ -410,16 +410,16 @@ const struct file_operations dxgk_fops = {
  */
 
 /* vGPU VM bus channel instance ID */
-const int DXGK_VMBUS_CHANNEL_ID_OFFSET = 192;
+#define DXGK_VMBUS_CHANNEL_ID_OFFSET 192
 /* DXGK_VMBUS_INTERFACE_VERSION (u32) */
-const int DXGK_VMBUS_VERSION_OFFSET    = DXGK_VMBUS_CHANNEL_ID_OFFSET +
-                                         sizeof(guid_t);
+#define DXGK_VMBUS_VERSION_OFFSET      (DXGK_VMBUS_CHANNEL_ID_OFFSET + \
+                                       sizeof(guid_t))
 /* Luid of the virtual GPU on the host (struct winluid) */
-const int DXGK_VMBUS_VGPU_LUID_OFFSET  = DXGK_VMBUS_VERSION_OFFSET +
-                                         sizeof(u32);
+#define DXGK_VMBUS_VGPU_LUID_OFFSET    (DXGK_VMBUS_VERSION_OFFSET + \
+                                       sizeof(u32))
 /* The guest writes its capavilities to this adderss */
-const int DXGK_VMBUS_GUESTCAPS_OFFSET  = DXGK_VMBUS_VERSION_OFFSET +
-                                         sizeof(u32);
+#define DXGK_VMBUS_GUESTCAPS_OFFSET    (DXGK_VMBUS_VERSION_OFFSET + \
+                                       sizeof(u32))
 
 struct dxgk_vmbus_guestcaps {
        union {

I'll work with the author of our dxgkrnl driver to get this fixed properly for the next WSL2 kernel update.

@tadam98
Copy link
Author

tadam98 commented Oct 18, 2021

I have installed gcc 9.4 following the instructions at:
https://gist.github.com/alexandreelise/192a63e287018ddfc896bbcb70b219d4

It could be that your compilation tests did not have what I selected in the sudo make menuconfig. Thus I attached my menu config as well.
dot.config.txt
I am trying to add webcam support following:
https://zenn-dev.translate.goog/pinto0309/articles/0723ae46501beb?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=iw&_x_tr_pto=nui
Which was done on ubuntu 20.04 while mine is 18.04

The below errors also happen. See attached terminal log.

Z:\home\mickey\Documents\make.log.txt (2 hits)
Line 487: arch/x86/kvm/hyperv.c:1574:1: error: the frame size of 1032 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
Line 492: arch/x86/kvm/hyperv.c:1667:1: error: the frame size of 1096 bytes is larger than 1024 bytes [-Werror=frame-larger-than=
make.log.txt
]
After the update to gcc 9.4 only one error happened. But the module is still problematic. Best is to make sure it compiles with gcc 7.5 for all.

@tadam98 tadam98 closed this as completed Oct 18, 2021
@tadam98
Copy link
Author

tadam98 commented Oct 19, 2021

Not sure how it got closed. Maybe I pressed the wrong button.

@tadam98 tadam98 reopened this Oct 19, 2021
@tyhicks
Copy link
Collaborator

tyhicks commented Oct 19, 2021

Hey @tadam98 - The issues that you're reporting under arch/x86/kvm/hyperv.c are not reproducible using Ubuntu 18.04's GCC 7.5.0 using the production WSL2 config file.

I'm unable to support patched or reconfigured kernels at this time. You could likely disable CONFIG_KVM_WERROR to workaround the problem you're seeing.

We've got a fix in the works for your original report, though. :)

@tadam98
Copy link
Author

tadam98 commented Oct 20, 2021

CONFIG_KVM_WERROR=y is set in the original /proc/config.gz than came with the distribution.
config.gz
Thus I am unsure how it complies without an error at your end.
CONFIG_KVM_WERROR=y is not present in /proc/config.gz of the distribution for window 10 ! It is only present in the distribution of windows 11. Thus, in my humble opinion it is not an support issue of a modified kernel as the original config.gz fails compilation as it is distributed :) kinldy re-take a look.

For now I am good. You can close the ticket after you decided whether CONFIG_KVM_WERROR needs to be attended.
Thank you for your help/

When commented as you suggested, compilation completed successfully.

This is the config section from config.gz
.# end of Firmware Drivers

CONFIG_HAVE_KVM=y
CONFIG_HAVE_KVM_IRQCHIP=y
CONFIG_HAVE_KVM_IRQFD=y
CONFIG_HAVE_KVM_IRQ_ROUTING=y
CONFIG_HAVE_KVM_EVENTFD=y
CONFIG_KVM_MMIO=y
CONFIG_KVM_ASYNC_PF=y
CONFIG_HAVE_KVM_MSI=y
CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT=y
CONFIG_KVM_VFIO=y
CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT=y
CONFIG_KVM_COMPAT=y
CONFIG_HAVE_KVM_IRQ_BYPASS=y
CONFIG_HAVE_KVM_NO_POLL=y
CONFIG_KVM_XFER_TO_GUEST_WORK=y
CONFIG_VIRTUALIZATION=y
CONFIG_KVM=y
CONFIG_KVM_WERROR=y
CONFIG_KVM_INTEL=y
CONFIG_KVM_AMD=y
# CONFIG_KVM_MMU_AUDIT is not set
CONFIG_AS_AVX512=y
CONFIG_AS_SHA1_NI=y
CONFIG_AS_SHA256_NI=y
CONFIG_AS_TPAUSE=y

When doing the sudo make install I got the following message:
Consult /var/lib/dkms/nvidia/470.57.02/build/make.log for more information.

DKMS make.log for nvidia-470.57.02 for kernel 5.10.60.1-microsoft-standard-WSL2+ (x86_64)
Wed Oct 20 11:24:06 IDT 2021
make[2]: warning: -jN forced in submake: disabling jobserver mode.
Makefile:18: /Kbuild: No such file or directory
make[2]: *** No rule to make target '/Kbuild'.  Stop.

But nvidia-smi reports the latest drivers installed in the underlying windows 11 Insider host:
NVIDIA-SMI 510.00 Driver Version: 510.06 CUDA Version: 11.6

@tyhicks
Copy link
Collaborator

tyhicks commented Nov 10, 2021

The Dxgkrnl build failure is fixed by 5.10.74.3.

Copy link
Contributor

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants