Re: [PATCH] frv: fix build failure
On 12/03/2017 02:32 PM, Sudip Mukherjee wrote: On Mon, Nov 27, 2017 at 10:25:16AM -0800, Vineet Gupta wrote: +CC linux-arch, Arnd On 11/23/2017 09:17 AM, Alexey Brodkin wrote: Hi Sudip, On Tue, 2017-11-21 at 22:10 +, Sudip Mukherjee wrote: I understand the case/need for adding a weak/common abort() as a quick fix for handling such cases, but perhaps we should not and instead fix the rootcause. In this specific case, Claudiu mentioned that gcc was generating abort due to something like this (flagging a possible divide by zero due to -fno-isolate-erroneous-paths-dereference. a; fn1() { switch (a) case 0: return 1 / a; } Sudeep can you confirm that removing this hacking FRV build to not have this toggle fixes the abort issue. So the offending code needs to be fixed as in the end when that code path is taken system is hosed. The above case that you mentioned is indeed the case here. mpihelp_divrem() in lib/mpi/mpih-div.c has this same divide by zero case. So, what should be the actual fix here? To remove the divide by zero. Or atleast have a __weak abort() defined in common code so all arches benefit from it ! -Vineet
Re: [PATCH] frv: fix build failure
On 12/03/2017 02:32 PM, Sudip Mukherjee wrote: On Mon, Nov 27, 2017 at 10:25:16AM -0800, Vineet Gupta wrote: +CC linux-arch, Arnd On 11/23/2017 09:17 AM, Alexey Brodkin wrote: Hi Sudip, On Tue, 2017-11-21 at 22:10 +, Sudip Mukherjee wrote: I understand the case/need for adding a weak/common abort() as a quick fix for handling such cases, but perhaps we should not and instead fix the rootcause. In this specific case, Claudiu mentioned that gcc was generating abort due to something like this (flagging a possible divide by zero due to -fno-isolate-erroneous-paths-dereference. a; fn1() { switch (a) case 0: return 1 / a; } Sudeep can you confirm that removing this hacking FRV build to not have this toggle fixes the abort issue. So the offending code needs to be fixed as in the end when that code path is taken system is hosed. The above case that you mentioned is indeed the case here. mpihelp_divrem() in lib/mpi/mpih-div.c has this same divide by zero case. So, what should be the actual fix here? To remove the divide by zero. Or atleast have a __weak abort() defined in common code so all arches benefit from it ! -Vineet
Re: [PATCH] frv: fix build failure
On Mon, Nov 27, 2017 at 10:25:16AM -0800, Vineet Gupta wrote: > +CC linux-arch, Arnd > > On 11/23/2017 09:17 AM, Alexey Brodkin wrote: > >Hi Sudip, > > > >On Tue, 2017-11-21 at 22:10 +, Sudip Mukherjee wrote: > I understand the case/need for adding a weak/common abort() as a > quick fix for handling such cases, but perhaps we should not and > instead fix the rootcause. In this specific case, Claudiu mentioned > that gcc was generating abort due to something like this (flagging a > possible divide by zero due to > -fno-isolate-erroneous-paths-dereference. > > a; > > fn1() { > switch (a) > case 0: > return 1 / a; > } > > Sudeep can you confirm that removing this hacking FRV build to not > have this toggle fixes the abort issue. > > So the offending code needs to be fixed as in the end when that code > path is taken system is hosed. The above case that you mentioned is indeed the case here. mpihelp_divrem() in lib/mpi/mpih-div.c has this same divide by zero case. So, what should be the actual fix here? -- Regards Sudip
Re: [PATCH] frv: fix build failure
On Mon, Nov 27, 2017 at 10:25:16AM -0800, Vineet Gupta wrote: > +CC linux-arch, Arnd > > On 11/23/2017 09:17 AM, Alexey Brodkin wrote: > >Hi Sudip, > > > >On Tue, 2017-11-21 at 22:10 +, Sudip Mukherjee wrote: > I understand the case/need for adding a weak/common abort() as a > quick fix for handling such cases, but perhaps we should not and > instead fix the rootcause. In this specific case, Claudiu mentioned > that gcc was generating abort due to something like this (flagging a > possible divide by zero due to > -fno-isolate-erroneous-paths-dereference. > > a; > > fn1() { > switch (a) > case 0: > return 1 / a; > } > > Sudeep can you confirm that removing this hacking FRV build to not > have this toggle fixes the abort issue. > > So the offending code needs to be fixed as in the end when that code > path is taken system is hosed. The above case that you mentioned is indeed the case here. mpihelp_divrem() in lib/mpi/mpih-div.c has this same divide by zero case. So, what should be the actual fix here? -- Regards Sudip
Re: [PATCH] frv: fix build failure
Hi Sudip, On Tue, Nov 21, 2017 at 11:10 PM, Sudip Mukherjeewrote: > The frv defconfig build is failing with the error: > lib/mpi/mpih-div.o: In function `mpihelp_divrem': > mpih-div.c:(.text+0x30c): undefined reference to `abort' > > The function 'abort' was never defined for the frv architecture. > Create 'abort' as is done in other arch like 'arm' and 'unicore32'. Which code needs abort()? When was this build failure introduced? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH] frv: fix build failure
Hi Sudip, On Tue, Nov 21, 2017 at 11:10 PM, Sudip Mukherjee wrote: > The frv defconfig build is failing with the error: > lib/mpi/mpih-div.o: In function `mpihelp_divrem': > mpih-div.c:(.text+0x30c): undefined reference to `abort' > > The function 'abort' was never defined for the frv architecture. > Create 'abort' as is done in other arch like 'arm' and 'unicore32'. Which code needs abort()? When was this build failure introduced? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH] frv: fix build failure
+CC linux-arch, Arnd On 11/23/2017 09:17 AM, Alexey Brodkin wrote: Hi Sudip, On Tue, 2017-11-21 at 22:10 +, Sudip Mukherjee wrote: The frv defconfig build is failing with the error: lib/mpi/mpih-div.o: In function `mpihelp_divrem': mpih-div.c:(.text+0x30c): undefined reference to `abort' The function 'abort' was never defined for the frv architecture. Create 'abort' as is done in other arch like 'arm' and 'unicore32'. Signed-off-by: Sudip Mukherjee--- I'm seeing the same issue building for ARC from today's Linus' tree. With which compiler ? Claudiu implemented __builtin_trap recently so ARC builds should not get abort() but a trap 5 instruction instead. Maybe it worth implementing abort() as a weak function for every arch/platform that doesn't have it explicitly defined? Otherwise we'll end-up with useless code duplication. I understand the case/need for adding a weak/common abort() as a quick fix for handling such cases, but perhaps we should not and instead fix the rootcause. In this specific case, Claudiu mentioned that gcc was generating abort due to something like this (flagging a possible divide by zero due to -fno-isolate-erroneous-paths-dereference. a; fn1() { switch (a) case 0: return 1 / a; } Sudeep can you confirm that removing this hacking FRV build to not have this toggle fixes the abort issue. So the offending code needs to be fixed as in the end when that code path is taken system is hosed. -Vineet
Re: [PATCH] frv: fix build failure
+CC linux-arch, Arnd On 11/23/2017 09:17 AM, Alexey Brodkin wrote: Hi Sudip, On Tue, 2017-11-21 at 22:10 +, Sudip Mukherjee wrote: The frv defconfig build is failing with the error: lib/mpi/mpih-div.o: In function `mpihelp_divrem': mpih-div.c:(.text+0x30c): undefined reference to `abort' The function 'abort' was never defined for the frv architecture. Create 'abort' as is done in other arch like 'arm' and 'unicore32'. Signed-off-by: Sudip Mukherjee --- I'm seeing the same issue building for ARC from today's Linus' tree. With which compiler ? Claudiu implemented __builtin_trap recently so ARC builds should not get abort() but a trap 5 instruction instead. Maybe it worth implementing abort() as a weak function for every arch/platform that doesn't have it explicitly defined? Otherwise we'll end-up with useless code duplication. I understand the case/need for adding a weak/common abort() as a quick fix for handling such cases, but perhaps we should not and instead fix the rootcause. In this specific case, Claudiu mentioned that gcc was generating abort due to something like this (flagging a possible divide by zero due to -fno-isolate-erroneous-paths-dereference. a; fn1() { switch (a) case 0: return 1 / a; } Sudeep can you confirm that removing this hacking FRV build to not have this toggle fixes the abort issue. So the offending code needs to be fixed as in the end when that code path is taken system is hosed. -Vineet
Re: [PATCH] frv: fix build failure
Hi Sudip, On Thu, 2017-11-23 at 23:01 +, Sudip Mukherjee wrote: > Hi Alexey, > > On Thu, Nov 23, 2017 at 05:17:19PM +, Alexey Brodkin wrote: > > > > Hi Sudip, > > > > On Tue, 2017-11-21 at 22:10 +, Sudip Mukherjee wrote: > > > > > > The frv defconfig build is failing with the error: > > > lib/mpi/mpih-div.o: In function `mpihelp_divrem': > > > mpih-div.c:(.text+0x30c): undefined reference to `abort' > > > > > > The function 'abort' was never defined for the frv architecture. > > > Create 'abort' as is done in other arch like 'arm' and 'unicore32'. > > > > > > Signed-off-by: Sudip Mukherjee> > > --- > > > > I'm seeing the same issue building for ARC from today's Linus' tree. > > Maybe it worth implementing abort() as a weak function for every > > arch/platform > > that doesn't have it explicitly defined? Otherwise we'll end-up with > > useless code duplication. > > Do you mean define it for every arch or define it in a common place so > that all arch can use it? Essentially I'd prefer to have just 1 instance of this function. In fact I'd even remove existing implementations in ARM, Unicore32 and M32R and have a generic implementation as this function obviously has nothing arch-specific. > I did a quick try with the attached patch on two different arch, one of > them (m32r) has the 'abort' defined and the other (frv) was failing due > to lack of abort, and they both built without any warnings or errors. Well maybe add call to panic() there as well as it is done for ARM, unicore32 and M32R? > But I am not sure if 'kernel/exit.c' is the right place for it. > Any suggestion? I guess it should be indeed something in "kernel/" and maybe your existing choice of "kernel/exit.c" is not bad. Just send a patch to LKML and you'll get much better guidance on that I guess :) Anyways thanks for looking at this one. -Alexey
Re: [PATCH] frv: fix build failure
Hi Sudip, On Thu, 2017-11-23 at 23:01 +, Sudip Mukherjee wrote: > Hi Alexey, > > On Thu, Nov 23, 2017 at 05:17:19PM +, Alexey Brodkin wrote: > > > > Hi Sudip, > > > > On Tue, 2017-11-21 at 22:10 +, Sudip Mukherjee wrote: > > > > > > The frv defconfig build is failing with the error: > > > lib/mpi/mpih-div.o: In function `mpihelp_divrem': > > > mpih-div.c:(.text+0x30c): undefined reference to `abort' > > > > > > The function 'abort' was never defined for the frv architecture. > > > Create 'abort' as is done in other arch like 'arm' and 'unicore32'. > > > > > > Signed-off-by: Sudip Mukherjee > > > --- > > > > I'm seeing the same issue building for ARC from today's Linus' tree. > > Maybe it worth implementing abort() as a weak function for every > > arch/platform > > that doesn't have it explicitly defined? Otherwise we'll end-up with > > useless code duplication. > > Do you mean define it for every arch or define it in a common place so > that all arch can use it? Essentially I'd prefer to have just 1 instance of this function. In fact I'd even remove existing implementations in ARM, Unicore32 and M32R and have a generic implementation as this function obviously has nothing arch-specific. > I did a quick try with the attached patch on two different arch, one of > them (m32r) has the 'abort' defined and the other (frv) was failing due > to lack of abort, and they both built without any warnings or errors. Well maybe add call to panic() there as well as it is done for ARM, unicore32 and M32R? > But I am not sure if 'kernel/exit.c' is the right place for it. > Any suggestion? I guess it should be indeed something in "kernel/" and maybe your existing choice of "kernel/exit.c" is not bad. Just send a patch to LKML and you'll get much better guidance on that I guess :) Anyways thanks for looking at this one. -Alexey
Re: [PATCH] frv: fix build failure
Hi Alexey, On Thu, Nov 23, 2017 at 05:17:19PM +, Alexey Brodkin wrote: > Hi Sudip, > > On Tue, 2017-11-21 at 22:10 +, Sudip Mukherjee wrote: > > The frv defconfig build is failing with the error: > > lib/mpi/mpih-div.o: In function `mpihelp_divrem': > > mpih-div.c:(.text+0x30c): undefined reference to `abort' > > > > The function 'abort' was never defined for the frv architecture. > > Create 'abort' as is done in other arch like 'arm' and 'unicore32'. > > > > Signed-off-by: Sudip Mukherjee> > --- > > I'm seeing the same issue building for ARC from today's Linus' tree. > Maybe it worth implementing abort() as a weak function for every arch/platform > that doesn't have it explicitly defined? Otherwise we'll end-up with > useless code duplication. Do you mean define it for every arch or define it in a common place so that all arch can use it? I did a quick try with the attached patch on two different arch, one of them (m32r) has the 'abort' defined and the other (frv) was failing due to lack of abort, and they both built without any warnings or errors. But I am not sure if 'kernel/exit.c' is the right place for it. Any suggestion? -- Regards Sudip diff --git a/kernel/exit.c b/kernel/exit.c index af6c245..75ae35a 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -1759,3 +1759,7 @@ COMPAT_SYSCALL_DEFINE5(waitid, return -EFAULT; } #endif + +__weak void abort(void) { + BUG(); +}
Re: [PATCH] frv: fix build failure
Hi Alexey, On Thu, Nov 23, 2017 at 05:17:19PM +, Alexey Brodkin wrote: > Hi Sudip, > > On Tue, 2017-11-21 at 22:10 +, Sudip Mukherjee wrote: > > The frv defconfig build is failing with the error: > > lib/mpi/mpih-div.o: In function `mpihelp_divrem': > > mpih-div.c:(.text+0x30c): undefined reference to `abort' > > > > The function 'abort' was never defined for the frv architecture. > > Create 'abort' as is done in other arch like 'arm' and 'unicore32'. > > > > Signed-off-by: Sudip Mukherjee > > --- > > I'm seeing the same issue building for ARC from today's Linus' tree. > Maybe it worth implementing abort() as a weak function for every arch/platform > that doesn't have it explicitly defined? Otherwise we'll end-up with > useless code duplication. Do you mean define it for every arch or define it in a common place so that all arch can use it? I did a quick try with the attached patch on two different arch, one of them (m32r) has the 'abort' defined and the other (frv) was failing due to lack of abort, and they both built without any warnings or errors. But I am not sure if 'kernel/exit.c' is the right place for it. Any suggestion? -- Regards Sudip diff --git a/kernel/exit.c b/kernel/exit.c index af6c245..75ae35a 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -1759,3 +1759,7 @@ COMPAT_SYSCALL_DEFINE5(waitid, return -EFAULT; } #endif + +__weak void abort(void) { + BUG(); +}
Re: [PATCH] frv: fix build failure
Hi Sudip, On Tue, 2017-11-21 at 22:10 +, Sudip Mukherjee wrote: > The frv defconfig build is failing with the error: > lib/mpi/mpih-div.o: In function `mpihelp_divrem': > mpih-div.c:(.text+0x30c): undefined reference to `abort' > > The function 'abort' was never defined for the frv architecture. > Create 'abort' as is done in other arch like 'arm' and 'unicore32'. > > Signed-off-by: Sudip Mukherjee> --- I'm seeing the same issue building for ARC from today's Linus' tree. Maybe it worth implementing abort() as a weak function for every arch/platform that doesn't have it explicitly defined? Otherwise we'll end-up with useless code duplication. -Alexey
Re: [PATCH] frv: fix build failure
Hi Sudip, On Tue, 2017-11-21 at 22:10 +, Sudip Mukherjee wrote: > The frv defconfig build is failing with the error: > lib/mpi/mpih-div.o: In function `mpihelp_divrem': > mpih-div.c:(.text+0x30c): undefined reference to `abort' > > The function 'abort' was never defined for the frv architecture. > Create 'abort' as is done in other arch like 'arm' and 'unicore32'. > > Signed-off-by: Sudip Mukherjee > --- I'm seeing the same issue building for ARC from today's Linus' tree. Maybe it worth implementing abort() as a weak function for every arch/platform that doesn't have it explicitly defined? Otherwise we'll end-up with useless code duplication. -Alexey
[PATCH] frv: fix build failure
The frv defconfig build is failing with the error: lib/mpi/mpih-div.o: In function `mpihelp_divrem': mpih-div.c:(.text+0x30c): undefined reference to `abort' The function 'abort' was never defined for the frv architecture. Create 'abort' as is done in other arch like 'arm' and 'unicore32'. Signed-off-by: Sudip Mukherjee--- The build log of next-20171121 is at: https://travis-ci.org/sudipm-mukherjee/parport/jobs/305076731 arch/frv/kernel/traps.c | 9 + 1 file changed, 9 insertions(+) diff --git a/arch/frv/kernel/traps.c b/arch/frv/kernel/traps.c index fb08ebe..70f4387 100644 --- a/arch/frv/kernel/traps.c +++ b/arch/frv/kernel/traps.c @@ -633,6 +633,15 @@ void show_backtrace(struct pt_regs *frame, unsigned long sp) } /* end show_backtrace() */ +void abort(void) +{ + BUG(); + + /* if that doesn't kill us, halt */ + panic("Oops failed to kill thread"); +} +EXPORT_SYMBOL(abort); + /*/ /* * initialise traps -- 1.9.1
[PATCH] frv: fix build failure
The frv defconfig build is failing with the error: lib/mpi/mpih-div.o: In function `mpihelp_divrem': mpih-div.c:(.text+0x30c): undefined reference to `abort' The function 'abort' was never defined for the frv architecture. Create 'abort' as is done in other arch like 'arm' and 'unicore32'. Signed-off-by: Sudip Mukherjee --- The build log of next-20171121 is at: https://travis-ci.org/sudipm-mukherjee/parport/jobs/305076731 arch/frv/kernel/traps.c | 9 + 1 file changed, 9 insertions(+) diff --git a/arch/frv/kernel/traps.c b/arch/frv/kernel/traps.c index fb08ebe..70f4387 100644 --- a/arch/frv/kernel/traps.c +++ b/arch/frv/kernel/traps.c @@ -633,6 +633,15 @@ void show_backtrace(struct pt_regs *frame, unsigned long sp) } /* end show_backtrace() */ +void abort(void) +{ + BUG(); + + /* if that doesn't kill us, halt */ + panic("Oops failed to kill thread"); +} +EXPORT_SYMBOL(abort); + /*/ /* * initialise traps -- 1.9.1