Improvements with noreturn
cover Improvements with noreturn
Make better use of noreturn. It allows optimising compilers to produce more efficient code.
George:
I request that this is included for 4.4 - It is no functional change, but quite a nice improvement in terms of code size.
PATCH 1/2 xen/compiler: Replace opencoded __attribute__((noreturn))
Make a formal define for noreturn in compiler.h, and replace opencoded uses of __attribute__((noreturn)).
There is a stale statement in sh_skip_sync(); BUG() now contains unreachable(), removing the justification for having "return 0".
---
I have compile tested this for both arm32 and arm64
--- xen/arch/arm/early_printk.c | 2 +- xen/arch/x86/crash.c | 2 +- xen/arch/x86/mm/shadow/common.c | 1 - xen/arch/x86/shutdown.c | 2 +- xen/include/asm-arm/early_printk.h | 4 ++-- xen/include/xen/compiler.h | 2 ++ xen/include/xen/lib.h | 2 +- xen/include/xen/sched.h | 4 ++-- 8 files changed, 10 insertions(+), 9 deletions(-)
xen/arch/arm/early_printk.c +1 -1
@@ -52,7 +52,7 @@ void __init early_printk(const char *fmt, ...)va_end (args); } -void __attribute__((noreturn))__init +void noreturn__init early_panic (const char *fmt, ...) {va_list args;
xen/arch/x86/crash.c +1 -1
@@ -36,7 +36,7 @@ static unsigned int crashing_cpu; static DEFINE_PER_CPU_READ_MOSTLY(bool_t, crash_save_done);/* This becomes the NMI handler for non-crashing CPUs, when Xen is crashing. */ -void __attribute__((noreturn))do_nmi_crash (struct cpu_user_regs *regs) +void noreturndo_nmi_crash (struct cpu_user_regs *regs) {int cpu =smp_processor_id ();
xen/arch/x86/mm/shadow/common.c +0 -1
@@ -875,7 +875,6 @@ static int sh_skip_sync(struct vcpu *v, mfn_t gl1mfn)SHADOW_ERROR ("gmfn %#lx was OOS but not shadowed as an l1.\n" ,mfn_x (gl1mfn));BUG (); -return 0 ;/* BUG() is no longer __attribute__((noreturn)). */ }
xen/arch/x86/shutdown.c +1 -1
@@ -85,7 +85,7 @@ static inline void kb_wait(void)break ; } -static void __attribute__((noreturn))__machine_halt (void *unused) +static void noreturn__machine_halt (void *unused) {local_irq_disable ();for ( ; ; )
xen/include/asm-arm/early_printk.h +2 -2
@@ -26,7 +26,7 @@void early_printk (const char *fmt, ...) __attribute__((format (printf,1 ,2 ))); -void early_panic (const char *fmt, ...) __attribute__((noreturn)) +void early_panic(const char *fmt, ...) noreturn __attribute__((format (printf, 1, 2)));#else
@@ -35,7 +35,7 @@ static inline __attribute__((format (printf, 1, 2))) void early_printk(const char *fmt, ...) {} -static inline void __attribute__((noreturn)) +static inline void noreturn __attribute__((format (printf,1 ,2 )))early_panic (const char *fmt, ...) {while (1 );}
xen/include/xen/compiler.h +2 -0
@@ -14,6 +14,8 @@#define always_inline __inline__ __attribute__ ((always_inline))#define noinline __attribute__((noinline)) +#define noreturn __attribute__((noreturn)) +#if (!defined(__clang__) && (__GNUC__ ==4 ) && (__GNUC_MINOR__ <5 ))#define unreachable () do {} while (1)#else
xen/include/xen/lib.h +1 -1
@@ -8,7 +8,7 @@#include <xen/string.h> #include <asm/bug.h> -void __bug (char *file,int line) __attribute__((noreturn)); +void __bug(char *file, int line) noreturn;void __warn (char *file,int line);#define BUG_ON (p) do { if (unlikely(p)) BUG(); } while (0)
xen/include/xen/sched.h +2 -2
@@ -578,7 +578,7 @@ void __domain_crash(struct domain *d);* Mark current domain as crashed and synchronously deschedule from the local * processor. This function never returns. */ -void __domain_crash_synchronous (void ) __attribute__((noreturn)); +void __domain_crash_synchronous(void) noreturn;#define domain_crash_synchronous () do { \ printk("domain_crash_sync called from %s:%d\n", __FILE__, __LINE__); \ __domain_crash_synchronous(); \
@@ -589,7 +589,7 @@ void __domain_crash_synchronous(void) __attribute__((noreturn));* the crash occured. If addr is 0, look up address from last extable * redirection. */ -void asm_domain_crash_synchronous (unsigned long addr) __attribute__((noreturn)); +void asm_domain_crash_synchronous(unsigned long addr) noreturn;#define set_current_state (_s) do { current->state = (_s); } while (0)void scheduler_init (void );
Signature · 1 line
1.7.10.4
PATCH 2/2 xen: Identify panic and reboot/halt functions as noreturn
In reply to Andrew CooperOn an x86 build (GCC Debian 4.7.2-5), this reduces the .text size by exactly 4K, and .init.text by 1751 bytes.
Even in a non-debug build, the generated code uses call rather than jmp so there should be no impact on any stack trace generation.
---
I believe I have identified each reasonable ARM function which could be tagged as noreturn, but am not overly familiar with the codebase.
I have compile tested arm32 and arm64
--- xen/arch/arm/shutdown.c | 6 +++--- xen/arch/arm/smpboot.c | 2 +- xen/arch/x86/cpu/mcheck/mce.c | 2 +- xen/arch/x86/cpu/mcheck/mce.h | 2 +- xen/arch/x86/shutdown.c | 6 +++--- xen/common/shutdown.c | 4 ++-- xen/drivers/char/console.c | 2 +- xen/include/asm-arm/smp.h | 2 +- xen/include/xen/lib.h | 2 +- xen/include/xen/shutdown.h | 10 ++++++---- 10 files changed, 20 insertions(+), 18 deletions(-)
xen/arch/arm/shutdown.c +3 -3
@@ -11,12 +11,12 @@ static void raw_machine_reset(void)platform_reset (); } -static void halt_this_cpu (void *arg) +static void noreturnhalt_this_cpu (void *arg) {stop_cpu (); } -void machine_halt (void ) +void noreturnmachine_halt (void ) {watchdog_disable ();console_start_sync ();
@@ -25,7 +25,7 @@ void machine_halt(void)halt_this_cpu (NULL ); } -void machine_restart (unsigned int delay_millisecs) +void noreturnmachine_restart (unsigned int delay_millisecs) {int timeout =10 ;
xen/arch/arm/smpboot.c +1 -1
@@ -310,7 +310,7 @@ void __cpu_disable(void)* scheduler will drop to the idle loop, which will call stop_cpu(). */ } -void stop_cpu (void ) +void noreturnstop_cpu (void ) {local_irq_disable (); cpu_is_dead =1 ;
xen/arch/x86/cpu/mcheck/mce.c +1 -1
@@ -1534,7 +1534,7 @@ static void mc_panic_dump(void)dprintk (XENLOG_ERR ,"End dump mc_info, %x mcinfo dumped\n" , mcinfo_dumpped); } -void mc_panic (char *s) +void noreturnmc_panic (char *s) { is_mc_panic =1 ;console_force_unlock ();
xen/arch/x86/cpu/mcheck/mce.h +1 -1
@@ -57,7 +57,7 @@ int mce_available(struct cpuinfo_x86 *c);unsigned int mce_firstbank (struct cpuinfo_x86 *c);/* Helper functions used for collecting error telemetry */ struct mc_info *x86_mcinfo_getptr (void ); -void mc_panic (char *s); +void mc_panic(char *s) noreturn;void x86_mc_get_cpu_info (unsigned ,uint32_t *,uint16_t *,uint16_t *,uint32_t *,uint32_t *,uint32_t *,uint32_t *);
xen/arch/x86/shutdown.c +3 -3
@@ -92,7 +92,7 @@ static void noreturn __machine_halt(void *unused)halt (); } -void machine_halt (void ) +void noreturnmachine_halt (void ) {watchdog_disable ();console_start_sync ();
@@ -452,12 +452,12 @@ static int __init reboot_init(void) }__initcall (reboot_init); -static void __machine_restart (void *pdelay) +static void noreturn__machine_restart (void *pdelay) {machine_restart (*(unsigned int *)pdelay); } -void machine_restart (unsigned int delay_millisecs) +void noreturnmachine_restart (unsigned int delay_millisecs) {unsigned int i, attempt;enum reboot_type orig_reboot_type = reboot_type;
xen/common/shutdown.c +2 -2
@@ -17,7 +17,7 @@bool_t __read_mostly opt_noreboot;boolean_param ("noreboot" , opt_noreboot); -static void maybe_reboot (void ) +static void noreturnmaybe_reboot (void ) {if ( opt_noreboot ) {
@@ -32,7 +32,7 @@ static void maybe_reboot(void) } } -void dom0_shutdown (u8 reason) +void noreturndom0_shutdown (u8 reason) {switch ( reason ) {
xen/drivers/char/console.c +1 -1
@@ -1038,7 +1038,7 @@ __initcall(debugtrace_init);* ************************************************************** */ -void panic (const char *fmt, ...) +void noreturnpanic (const char *fmt, ...) {va_list args;unsigned long flags;
xen/include/asm-arm/smp.h +1 -1
@@ -15,7 +15,7 @@ DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);#define raw_smp_processor_id () (get_processor_id()) -extern void stop_cpu (void ); +extern void stop_cpu(void) noreturn;extern int arch_smp_init (void );extern int arch_cpu_init (int cpu,struct dt_device_node *dn);
xen/include/xen/lib.h +1 -1
@@ -87,7 +87,7 @@ extern void printk(const char *format, ...) __attribute__ ((format (printf, 1, 2)));extern void guest_printk (const struct domain *d,const char *format, ...) __attribute__ ((format (printf,2 ,3 ))); -extern void panic (const char *format, ...) +extern void panic(const char *format, ...) noreturn __attribute__ ((format (printf, 1, 2)));extern long vm_assist (struct domain *,unsigned int ,unsigned int );extern int __printk_ratelimit (int ratelimit_ms,int ratelimit_burst);
xen/include/xen/shutdown.h +6 -4
@@ -1,13 +1,15 @@#ifndef __XEN_SHUTDOWN_H__#define __XEN_SHUTDOWN_H__ +#include <xen/compiler.h> +/* opt_noreboot: If true, machine will need manual reset on error. */ extern bool_t opt_noreboot; -void dom0_shutdown (u8 reason); +void dom0_shutdown(u8 reason) noreturn; -void machine_restart (unsigned int delay_millisecs); -void machine_halt (void ); -void machine_power_off (void ); +void machine_restart(unsigned int delay_millisecs) noreturn; +void machine_halt(void) noreturn; +void machine_power_off(void) noreturn;#endif /* __XEN_SHUTDOWN_H__ */
Signature · 1 line
1.7.10.4
Re: [PATCH 1/2] xen/compiler: Replace opencoded __attribute__((noreturn))
In reply to Andrew CooperQuoted 9 lines · Andrew Cooper
Make a formal define for noreturn in
compiler.h, and replace opencoded uses of __attribute__((noreturn)).There is a stale statement in
sh_skip_sync();BUG()now containsunreachable(), removing the justification for having "return 0".Signed-off-by Andrew Cooper <[email protected]>CC Keir Fraser <[email protected]>CC Jan Beulich <[email protected]>
Quoted 138 lines
CC Stefano Stabellini <[email protected]>CC Tim Deegan <[email protected]>---
I have compile tested this for both arm32 and arm64
--- xen/arch/arm/early_printk.c | 2 +- xen/arch/x86/crash.c | 2 +- xen/arch/x86/mm/shadow/common.c | 1 - xen/arch/x86/shutdown.c | 2 +- xen/include/asm-arm/early_printk.h | 4 ++-- xen/include/xen/compiler.h | 2 ++ xen/include/xen/lib.h | 2 +- xen/include/xen/sched.h | 4 ++-- 8 files changed, 10 insertions(+), 9 deletions(-)xen/arch/arm/early_printk.c +1
-1@@ -52,7 +52,7 @@ void __init early_printk(const char *fmt, ...)va_end (args); } -void __attribute__((noreturn))__init +void noreturn__init early_panic (const char *fmt, ...) {va_list args;xen/arch/x86/crash.c +1
-1@@ -36,7 +36,7 @@ static unsigned int crashing_cpu; static DEFINE_PER_CPU_READ_MOSTLY(bool_t, crash_save_done);/* This becomes the NMI handler for non-crashing CPUs, when Xen is crashing. */ -void __attribute__((noreturn))do_nmi_crash (struct cpu_user_regs *regs) +void noreturndo_nmi_crash (struct cpu_user_regs *regs) {int cpu =smp_processor_id ();xen/arch/x86/mm/shadow/common.c +0
-1@@ -875,7 +875,6 @@ static int sh_skip_sync(struct vcpu *v, mfn_t gl1mfn)SHADOW_ERROR ("gmfn %#lx was OOS but not shadowed as an l1.\n" ,mfn_x (gl1mfn));BUG (); -return 0 ;/* BUG() is no longer __attribute__((noreturn)). */ }xen/arch/x86/shutdown.c +1
-1@@ -85,7 +85,7 @@ static inline void kb_wait(void)break ; } -static void __attribute__((noreturn))__machine_halt (void *unused) +static void noreturn__machine_halt (void *unused) {local_irq_disable ();for ( ; ; )xen/include/asm-arm/early_printk.h +2
-2@@ -26,7 +26,7 @@void early_printk (const char *fmt, ...) __attribute__((format (printf,1 ,2 ))); -void early_panic (const char *fmt, ...) __attribute__((noreturn)) +void early_panic(const char *fmt, ...) noreturn __attribute__((format (printf, 1, 2)));#else @@ -35,7 +35,7 @@ static inline __attribute__((format (printf, 1, 2))) void early_printk(const char *fmt, ...) {} -static inline void __attribute__((noreturn)) +static inline void noreturn __attribute__((format (printf,1 ,2 )))early_panic (const char *fmt, ...) {while (1 );}xen/include/xen/compiler.h +2
-0@@ -14,6 +14,8 @@#define always_inline __inline__ __attribute__ ((always_inline))#define noinline __attribute__((noinline)) +#define noreturn __attribute__((noreturn)) +#if (!defined(__clang__) && (__GNUC__ ==4 ) && (__GNUC_MINOR__ <5 ))#define unreachable () do {} while (1)#else xen/include/xen/lib.h +1
-1@@ -8,7 +8,7 @@#include <xen/string.h> #include <asm/bug.h> -void __bug (char *file,int line) __attribute__((noreturn)); +void __bug(char *file, int line) noreturn;void __warn (char *file,int line);#define BUG_ON (p) do { if (unlikely(p)) BUG(); } while (0)xen/include/xen/sched.h +2
-2@@ -578,7 +578,7 @@ void __domain_crash(struct domain *d);* Mark current domain as crashed and synchronously deschedule from the local * processor. This function never returns. */ -void __domain_crash_synchronous (void ) __attribute__((noreturn)); +void __domain_crash_synchronous(void) noreturn;#define domain_crash_synchronous () do { \ printk("domain_crash_sync called from %s:%d\n", __FILE__, __LINE__); \ __domain_crash_synchronous(); \@@ -589,7 +589,7 @@ void __domain_crash_synchronous(void) __attribute__((noreturn));* the crash occured. If addr is 0, look up address from last extable * redirection. */ -void asm_domain_crash_synchronous (unsigned long addr) __attribute__((noreturn)); +void asm_domain_crash_synchronous(unsigned long addr) noreturn;#define set_current_state (_s) do { current->state = (_s); } while (0)void scheduler_init (void );
Re: [PATCH 2/2] xen: Identify panic and reboot/halt functions as noreturn
In reply to Andrew CooperQuoted 37 lines · Andrew Cooper
On an x86 build (GCC Debian 4.7.2-5), this reduces the .text size by exactly 4K, and .init.text by 1751 bytes.
Even in a non-debug build, the generated code uses
callrather thanjmpso there should be no impact on any stack trace generation.Signed-off-by Andrew Cooper <[email protected]>CC Keir Fraser <[email protected]>CC Jan Beulich <[email protected]>CC Ian Campbell <[email protected]>CC Stefano Stabellini <[email protected]>CC Tim Deegan <[email protected]>---
I believe I have identified each reasonable ARM function which could be tagged as noreturn, but am not overly familiar with the codebase.
I have compile tested arm32 and arm64
--- xen/arch/arm/shutdown.c | 6 +++--- xen/arch/arm/smpboot.c | 2 +- xen/arch/x86/cpu/mcheck/mce.c | 2 +- xen/arch/x86/cpu/mcheck/mce.h | 2 +- xen/arch/x86/shutdown.c | 6 +++--- xen/common/shutdown.c | 4 ++-- xen/drivers/char/console.c | 2 +- xen/include/asm-arm/smp.h | 2 +- xen/include/xen/lib.h | 2 +- xen/include/xen/shutdown.h | 10 ++++++---- 10 files changed, 20 insertions(+), 18 deletions(-)xen/arch/arm/shutdown.c +0
-0
xen/arch/arm/shutdown.c static void raw_machine_reset(void) · line 16
Quoted 7 lines
xen/arch/arm/shutdown.c +1
-1@@ -11,12 +11,12 @@ static void raw_machine_reset(void)platform_reset (); } -static void halt_this_cpu (void *arg) +static void noreturnhalt_this_cpu (void *arg) {stop_cpu ();
You also tag stop_cpu, are both necessary? Especially for a static function.
xen/arch/arm/shutdown.c static void raw_machine_reset(void) · line 19
Quoted 4 lines
xen/arch/arm/shutdown.c +1
-1} -void machine_halt (void ) +void noreturnmachine_halt (void )
And you also tag halt_this_cpu which machine_halt ends with.
Quoted 25 lines
xen/arch/arm/shutdown.c +1
-1{watchdog_disable ();console_start_sync ();@@ -25,7 +25,7 @@ void machine_halt(void)halt_this_cpu (NULL ); } -void machine_restart (unsigned int delay_millisecs) +void noreturnmachine_restart (unsigned int delay_millisecs) {int timeout =10 ;xen/arch/arm/smpboot.c +1
-1@@ -310,7 +310,7 @@ void __cpu_disable(void)* scheduler will drop to the idle loop, which will call stop_cpu(). */ } -void stop_cpu (void ) +void noreturnstop_cpu (void ) {local_irq_disable (); cpu_is_dead =1 ;
Re: [PATCH 2/2] xen: Identify panic and reboot/halt functions as noreturn
Quoted 48 lines · Ian Campbell
Quoted 37 lines · Andrew Cooper
On an x86 build (GCC Debian 4.7.2-5), this reduces the .text size by exactly 4K, and .init.text by 1751 bytes.
Even in a non-debug build, the generated code uses
callrather thanjmpso there should be no impact on any stack trace generation.Signed-off-by Andrew Cooper <[email protected]>CC Keir Fraser <[email protected]>CC Jan Beulich <[email protected]>CC Ian Campbell <[email protected]>CC Stefano Stabellini <[email protected]>CC Tim Deegan <[email protected]>---
I believe I have identified each reasonable ARM function which could be tagged as noreturn, but am not overly familiar with the codebase.
I have compile tested arm32 and arm64
--- xen/arch/arm/shutdown.c | 6 +++--- xen/arch/arm/smpboot.c | 2 +- xen/arch/x86/cpu/mcheck/mce.c | 2 +- xen/arch/x86/cpu/mcheck/mce.h | 2 +- xen/arch/x86/shutdown.c | 6 +++--- xen/common/shutdown.c | 4 ++-- xen/drivers/char/console.c | 2 +- xen/include/asm-arm/smp.h | 2 +- xen/include/xen/lib.h | 2 +- xen/include/xen/shutdown.h | 10 ++++++---- 10 files changed, 20 insertions(+), 18 deletions(-)xen/arch/arm/shutdown.c +0
-0xen/arch/arm/shutdown.c static void raw_machine_reset(void) · line 16
Quoted 7 lines
xen/arch/arm/shutdown.c +1
-1@@ -11,12 +11,12 @@ static void raw_machine_reset(void)platform_reset (); } -static void halt_this_cpu (void *arg) +static void noreturnhalt_this_cpu (void *arg) {stop_cpu ();You also tag
stop_cpu, are both necessary? Especially for a static function.
Quoted 5 lines
xen/arch/arm/shutdown.c static void raw_machine_reset(void) · line 19
Quoted 4 lines
xen/arch/arm/shutdown.c +1
-1} -void machine_halt (void ) +void noreturnmachine_halt (void )And you also tag
halt_this_cpuwhichmachine_haltends with.
Based on my experience getting x86 to compile with panic alone as noreturn, yes.
machine_halt() certainly as I changed the common function declaration.
~Andrew
Quoted 27 lines
Quoted 26 lines
xen/arch/arm/shutdown.c +1
-1{watchdog_disable ();console_start_sync ();@@ -25,7 +25,7 @@ void machine_halt(void)halt_this_cpu (NULL ); } -void machine_restart (unsigned int delay_millisecs) +void noreturnmachine_restart (unsigned int delay_millisecs) {int timeout =10 ;xen/arch/arm/smpboot.c +1
-1@@ -310,7 +310,7 @@ void __cpu_disable(void)* scheduler will drop to the idle loop, which will call stop_cpu(). */ } -void stop_cpu (void ) +void noreturnstop_cpu (void ) {local_irq_disable (); cpu_is_dead =1 ;
Re: [PATCH 1/2] xen/compiler: Replace opencoded __attribute__((noreturn))
In reply to Andrew CooperQuoted 7 lines · Andrew Cooper
Make a formal define for noreturn in
compiler.h, and replace opencoded uses of __attribute__((noreturn)).There is a stale statement in
sh_skip_sync();BUG()now containsunreachable(), removing the justification for having "return 0".Signed-off-by Andrew Cooper <[email protected]>
Re: [PATCH 2/2] xen: Identify panic and reboot/halt functions as noreturn
In reply to Andrew CooperQuoted 7 lines · Andrew Cooper
On an x86 build (GCC Debian 4.7.2-5), this reduces the .text size by exactly 4K, and .init.text by 1751 bytes.
Even in a non-debug build, the generated code uses
callrather thanjmpso there should be no impact on any stack trace generation.Signed-off-by Andrew Cooper <[email protected]>
Re: [PATCH 1/2] xen/compiler: Replace opencoded __attribute__((noreturn))
In reply to Andrew Cooperxen/arch/arm/early_printk.c void __init early_printk(const char *fmt, ...) · line 58
Quoted 12 lines
Quoted 1 line
Quoted 1 line · Andrew Cooper
xen/arch/arm/early_printk.c +1
-1@@ -52,7 +52,7 @@ void __init early_printk(const char *fmt, ...)va_end (args); } -void __attribute__((noreturn))__init +void noreturn__init early_panic (const char *fmt, ...) {va_list args;
Here and elsewhere - these belong on the declaration of the function (and only there, or else there's pointless redundancy), not the definition (or else the compiler can't take proper action on the respective call sites). Only static functions not needing forward declarations would have the attribute on their definitions.
Jan
Quoted 6 lines · Andrew Cooper
Make better use of noreturn. It allows optimising compilers to produce more efficient code.
George:
I request that this is included for 4.4 - It is no functional change, but quite a nice improvement in terms of code size.
No functional change *if compilers are correct*. If they're not, for any reason, it will be very difficult to actually catch between now and the release.
I'm not inclined to think that a reduction of 6k is a big enough improvement to take the risk at this point.
-George
Quoted 8 lines · George Dunlap
Quoted 6 lines · Andrew Cooper
Make better use of noreturn. It allows optimising compilers to produce more efficient code.
George:
I request that this is included for 4.4 - It is no functional change, but quite a nice improvement in terms of code size.
Quoted 8 lines
No functional change *if compilers are correct*. If they're not, for any reason, it will be very difficult to actually catch between now and the release.
I'm not inclined to think that a reduction of 6k is a big enough improvement to take the risk at this point.
-George
Patch 1 is literally just textual replacement, cleaning up its current uses in the codebase.
Patch 2 applies its use to more functions in the codebase.
While I agree that it is "No functional change if compilers are correct", this kind of paranoia could be applied to any and every patch we consider taking. Anyway, Linux uses it far more than we do at the moment.
As for difficulty to catch regressions, I would disagree. Failures to reboot correctly will not pass the oss test, and the other alternative is failures to crash correctly.
~Andrew
Quoted 20 lines · Andrew Cooper
Quoted 8 lines · George Dunlap
Quoted 6 lines · Andrew Cooper
Make better use of noreturn. It allows optimising compilers to produce more efficient code.
George:
I request that this is included for 4.4 - It is no functional change, but quite a nice improvement in terms of code size.Quoted 8 lines
No functional change *if compilers are correct*. If they're not, for any reason, it will be very difficult to actually catch between now and the release.
I'm not inclined to think that a reduction of 6k is a big enough improvement to take the risk at this point.
-George
Patch 1 is literally just textual replacement, cleaning up its current uses in the codebase.
Quoted 6 lines
Patch 2 applies its use to more functions in the codebase.
While I agree that it is "No functional change if compilers are correct", this kind of paranoia could be applied to any and every patch we consider taking. Anyway, Linux uses it far more than we do at the moment.
But what we're talking about here isn't just changing normal code flow or what-not; we're talking about a fairly niche optimization being applied to functions were it wasn't applied before. I would be willing to bet that "noreturn" has two or three orders of magnitude less usage and testing than anything in the "normal" C standard; that's why I consider it to be a higher risk than a patch which changes code in a "normal" way.
Now sure, it's a fairly tiny risk, but the benefit is pretty tiny too. At the moment I don't see a good reason this can't wait until 4.5.
-George
Quoted 38 lines · George Dunlap
Quoted 22 lines · Andrew Cooper
Quoted 10 lines · George Dunlap
Quoted 8 lines · Andrew Cooper
Make better use of noreturn. It allows optimising compilers to produce more
efficient code.George:
I request that this is included for 4.4 - It is no functional
change, but
quite a nice improvement in terms of code size.Quoted 8 lines
No functional change *if compilers are correct*. If they're not, for any reason, it will be very difficult to actually catch between now and the release.
I'm not inclined to think that a reduction of 6k is a big enough improvement to take the risk at this point.
-George
Patch 1 is literally just textual replacement, cleaning up its current uses in the codebase.
Quoted 6 lines
Patch 2 applies its use to more functions in the codebase.
While I agree that it is "No functional change if compilers are correct", this kind of paranoia could be applied to any and every patch we consider taking. Anyway, Linux uses it far more than we do at the moment.
But what we're talking about here isn't just changing normal code flow or what-not; we're talking about a fairly niche optimization being applied to functions were it wasn't applied before. I would be willing to bet that "noreturn" has two or three orders of magnitude less usage and testing than anything in the "normal" C standard; that's why I consider it to be a higher risk than a patch which changes code in a "normal" way.
Quoted 4 lines
Now sure, it's a fairly tiny risk, but the benefit is pretty tiny too. At the moment I don't see a good reason this can't wait until 4.5.
-George
Ok - I will leave this queued up ready for 4.5 to open for general changes again.