[Bug rtl-optimization/60947] New: [4.9 Regression] Unable to handle kernel paging request (linux kernel 2.6.28.9) with gcc 4.9 release
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60947 Bug ID: 60947 Summary: [4.9 Regression] Unable to handle kernel paging request (linux kernel 2.6.28.9) with gcc 4.9 release Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: yufan8.chen at gmail dot com Target: arm-none-linux-gnueabi Created attachment 32670 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32670&action=edit kernel oops message When running linux kernel (2.6.28.9) compiled by gcc 4.9.0, I got "unable to handle kernel paging request" on snd_pcm_hw_constraints_init(). Then I tried to debug it and found that: int snd_pcm_hw_constraints_init(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_hw_constraints *constrs = &runtime->hw_constraints; int k, err; for (k = SNDRV_PCM_HW_PARAM_FIRST_MASK; k <=SNDRV_PCM_HW_PARAM_LAST_MASK; k++) { //printk("1234567\n"); snd_mask_any(constrs_mask(constrs, k)); } ... } When I added a "printk()" statement in the for loop, the kernel could work correctly, otherwise it couldn't. The gcc command: arm-linux-gcc -Wp,-MD,sound/core/.pcm_native.o.d -nostdinc -isystem /opt/Mozart3_Toolchain/arm-eabi-uclibc/usr/lib/gcc/arm-buildroot-linux-uclibcgnueabi/4.9.0/include -D__KERNEL__ -Iinclude -I/home/blackjack/MyGit/CEO_Project/mozart_kernel/arch/arm/include -include include/linux/autoconf.h -mlittle-endian -Iarch/arm/mach-mozart/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Os -marm -fno-omit-frame-pointer -mapcs -mno-sched-prolog -mabi=aapcs-linux -mno-thumb-interwork -D__LINUX_ARM_ARCH__=5 -march=armv5te -mtune=arm9tdmi -msoft-float -Uarm -Wframe-larger-than=0 -fno-stack-protector -fno-omit-frame-pointer -fno-optimize-sibling-calls -Wdeclaration-after-statement -Wno-pointer-sign -fwrapv -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(pcm_native)" -D"KBUILD_MODNAME=KBUILD_STR(snd_pcm)" -c -o sound/core/pcm_native.o sound/core/pcm_native.c
[Bug rtl-optimization/60947] [4.9 Regression] Unable to handle kernel paging request (linux kernel 2.6.28.9) with gcc 4.9 release
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60947 --- Comment #1 from YuFan --- Created attachment 32671 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32671&action=edit kernel source code
[Bug rtl-optimization/60947] [4.9 Regression] Unable to handle kernel paging request (linux kernel 2.6.28.9) with gcc 4.9 release
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60947 --- Comment #3 from YuFan --- Created attachment 32673 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32673&action=edit the assembly code of modifying pcm_native.c with printk()
[Bug rtl-optimization/60947] [4.9 Regression] Unable to handle kernel paging request (linux kernel 2.6.28.9) with gcc 4.9 release
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60947 --- Comment #2 from YuFan --- Created attachment 32672 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32672&action=edit the assembly code of originial pcm_native.c
[Bug rtl-optimization/60947] [4.9/4.10 Regression] Unable to handle kernel paging request (linux kernel 2.6.28.9) with gcc 4.9 release
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60947 --- Comment #5 from YuFan --- (In reply to Andrew Pinski from comment #4) > Could there be an out of bounds access in that loop? I traced the code, and the following code is equal to the original one with replacing inline functions. In C code, there would be no possibility to get an out of bounds access. #SNDRV_PCM_HW_PARAM_FIRST_MASK 0 #SNDRV_PCM_HW_PARAM_LAST_MASK 2 for (k = SNDRV_PCM_HW_PARAM_FIRST_MASK; k <= SNDRV_PCM_HW_PARAM_LAST_MASK; k++) { memset(&constrs->masks[k - SNDRV_PCM_HW_PARAM_FIRST_MASK], 0xff, SNDRV_MASK_SIZE * sizeof(u_int32_t)); } > Can you try adding -fno-vrp? I supposed you mean -fno-tree-vrp. I tried it but still has the same issue. The following assembly code snippet is the same as the original one without -fno-tree-vrp === snd_pcm_hw_constraints_init: @ args = 0, pretend = 0, frame = 0 @ frame_needed = 1, uses_anonymous_args = 0 movip, sp stmfdsp!, {r4, r5, r6, r7, r8, r9, r10, fp, ip, lr, pc} subfp, ip, #4 subsp, sp, #20 ldrr8, [r0, #112] addr3, r8, #232 addr4, r8, #328 .L1062: movr0, r3 movr1, #255 movr2, #8 blmemset addr3, r0, #32 cmpr3, r4 bne.L1062 movr3, #0 movr2, r8 movr5, r3 movr4, #12 mvnlr, #0 ===
[Bug rtl-optimization/60947] [4.9/4.10 Regression] Unable to handle kernel paging request (linux kernel 2.6.28.9) with gcc 4.9 release
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60947 --- Comment #7 from YuFan --- (In reply to Richard Biener from comment #6) > Please provide preprocessed source of pcm_native.c Hi, Please check the attachment: "kernel source code".
[Bug rtl-optimization/60947] [4.9/4.10 Regression] Unable to handle kernel paging request (linux kernel 2.6.28.9) with gcc 4.9 release
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60947 --- Comment #9 from YuFan --- Created attachment 32674 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32674&action=edit pcm_native.i
[Bug rtl-optimization/60947] [4.9/4.10 Regression] Unable to handle kernel paging request (linux kernel 2.6.28.9) with gcc 4.9 release
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60947 --- Comment #10 from YuFan --- After more tests, I figure out the issue is caused by the commit: SVN revision: r206552 | amker | 2014-01-11 17:33:39 +0800 (六, 11 1月 2014) | 7 lines * tree-ssa-loop-ivopts.c (iv_ca_narrow): New parameter. Start narrowing with START. Apply candidate-use pair and check overall cost in narrowing. (iv_ca_prune): Pass new argument.
[Bug rtl-optimization/60947] [4.9/4.10 Regression] Unable to handle kernel paging request (linux kernel 2.6.28.9) with gcc 4.9 release
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60947 --- Comment #11 from YuFan --- any update? Do I need to provide other information?
[Bug rtl-optimization/60947] [4.9/4.10 Regression] Unable to handle kernel paging request (linux kernel 2.6.28.9) with gcc 4.9 release
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60947 --- Comment #19 from YuFan --- After patching the memset.S, it works correctly. Thanks a lot.