Hide Forgot
When I updated one of my installs to Fedora 24 I found that the xen hypervisor would no longer boot, but the hypervisor from the same code compiled under Fedora 23 would boot. I haven't traced where exactly the problem is, but I have narrowed it down to the tree-coalesce-vars option as if I add -fno-tree-coalesce-vars to the CFLAGS then the resulting hypervisor will boot again.
Can you find out which object file is problematic (do a binary search between objects compiled with -O0 and normal option set (or -fno-tree-coalesce-vars and normal options))? Then see if -fno-inline still reproduces it, or if inlining is needed for the problem reproduction? Then one can use __attribute__((optimize (0))) on selected functions to find the problematic function.
Created attachment 1144907 [details] file with the compile issue I traced the compile issue to the xen/arch/x86/usercopy.c in the xen-4.6.1 code, which shows the failure on the __copy_to_user_ and __copy_from_user_ll functions. I have attached the result of running cpp on the usercopy.c file.
What gcc options are used to compile this file?
When building xen the standard build line is gcc -O2 -fomit-frame-pointer -m64 -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs -DNDEBUG -I/home/michael/xen/xen-4.6.1/xen/include -I/home/michael/xen/xen-4.6.1/xen/include/asm-x86/mach-generic -I/home/michael/xen/xen-4.6.1/xen/include/asm-x86/mach-default -msoft-float -fno-stack-protector -fno-exceptions -Wnested-externs -DHAVE_GAS_VMX -DHAVE_GAS_EPT -DHAVE_GAS_FSGSBASE -mno-red-zone -mno-sse -fpic -fno-asynchronous-unwind-tables -DGCC_HAS_VISIBILITY_ATTRIBUTE -fno-builtin -fno-common -Werror -Wredundant-decls -Wno-pointer-arith -pipe -g -D__XEN__ -include /home/michael/xen/xen-4.6.1/xen/include/xen/config.h -nostdinc -DCONFIG_SHADOW_PAGING -DHAS_ACPI -DHAS_GDBSX -DHAS_PASSTHROUGH -DHAS_MEM_ACCESS -DHAS_MEM_PAGING -DHAS_MEM_SHARING -DHAS_PCI -DHAS_IOPORTS -DHAS_PDX -MMD -MF .usercopy.o.d -c usercopy.c -o usercopy.o which results in a xen hypervisor which crashes. The build with -fno-tree-coalesce-vars added after -O2 works.
Thanks, tracking this upstream: PR70593
Now gcc-6.1.1-2.fc24 has made the build repositories, I have tried building xen without adding -fno-tree-coalesce-vars and the resulting hypervisor boots successfully, so I consider this bug fixed.