From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Stefano Stabellini <stefano.stabellini@citrix.com>,
Ian Campbell <ian.campbell@citrix.com>
Subject: [PATCH v5 3/5] xen: Identify panic and reboot/halt functions as noreturn
Date: Fri, 28 Feb 2014 18:07:52 +0000 [thread overview]
Message-ID: <1393610874-27492-4-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1393610874-27492-1-git-send-email-andrew.cooper3@citrix.com>
On an x86 build (GCC Debian 4.7.2-5), this substantially reduces the size of
.text and .init.text sections.
Experimentally, even in a non-debug build, GCC uses `call` rather than `jmp`
so there should be no impact on any stack trace generation.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Reviewed-by: Jan Beulich <JBeulich@suse.com>
CC: Ian Campbell <ian.campbell@citrix.com>
CC: Stefano Stabellini <stefano.stabellini@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
---
xen/arch/arm/shutdown.c | 2 +-
xen/arch/x86/cpu/mcheck/mce.h | 2 +-
xen/arch/x86/shutdown.c | 2 +-
xen/common/shutdown.c | 2 +-
xen/include/asm-arm/smp.h | 2 +-
xen/include/asm-x86/processor.h | 2 +-
xen/include/xen/lib.h | 2 +-
xen/include/xen/shutdown.h | 8 +++++---
8 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/xen/arch/arm/shutdown.c b/xen/arch/arm/shutdown.c
index 767cc12..adc0529 100644
--- a/xen/arch/arm/shutdown.c
+++ b/xen/arch/arm/shutdown.c
@@ -11,7 +11,7 @@ static void raw_machine_reset(void)
platform_reset();
}
-static void halt_this_cpu(void *arg)
+static void noreturn halt_this_cpu(void *arg)
{
stop_cpu();
}
diff --git a/xen/arch/x86/cpu/mcheck/mce.h b/xen/arch/x86/cpu/mcheck/mce.h
index cbd123d..33bd1ab 100644
--- a/xen/arch/x86/cpu/mcheck/mce.h
+++ b/xen/arch/x86/cpu/mcheck/mce.h
@@ -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 noreturn mc_panic(char *s);
void x86_mc_get_cpu_info(unsigned, uint32_t *, uint16_t *, uint16_t *,
uint32_t *, uint32_t *, uint32_t *, uint32_t *);
diff --git a/xen/arch/x86/shutdown.c b/xen/arch/x86/shutdown.c
index 6143c40..827515d 100644
--- a/xen/arch/x86/shutdown.c
+++ b/xen/arch/x86/shutdown.c
@@ -452,7 +452,7 @@ 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);
}
diff --git a/xen/common/shutdown.c b/xen/common/shutdown.c
index 9bccd34..fadb69b 100644
--- a/xen/common/shutdown.c
+++ b/xen/common/shutdown.c
@@ -17,7 +17,7 @@
bool_t __read_mostly opt_noreboot;
boolean_param("noreboot", opt_noreboot);
-static void maybe_reboot(void)
+static void noreturn maybe_reboot(void)
{
if ( opt_noreboot )
{
diff --git a/xen/include/asm-arm/smp.h b/xen/include/asm-arm/smp.h
index a1de03c..91b1e52 100644
--- a/xen/include/asm-arm/smp.h
+++ b/xen/include/asm-arm/smp.h
@@ -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 noreturn stop_cpu(void);
extern int arch_smp_init(void);
extern int arch_cpu_init(int cpu, struct dt_device_node *dn);
diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h
index 4da545e..498d8a7 100644
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -515,7 +515,7 @@ void show_registers(struct cpu_user_regs *regs);
void show_execution_state(struct cpu_user_regs *regs);
#define dump_execution_state() run_in_exception_handler(show_execution_state)
void show_page_walk(unsigned long addr);
-void fatal_trap(int trapnr, struct cpu_user_regs *regs);
+void noreturn fatal_trap(int trapnr, struct cpu_user_regs *regs);
void compat_show_guest_stack(struct vcpu *, struct cpu_user_regs *, int lines);
diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
index 0d1a5d3..1369b2b 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -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 noreturn panic(const char *format, ...)
__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);
diff --git a/xen/include/xen/shutdown.h b/xen/include/xen/shutdown.h
index 2bee748..f04905b 100644
--- a/xen/include/xen/shutdown.h
+++ b/xen/include/xen/shutdown.h
@@ -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 noreturn dom0_shutdown(u8 reason);
-void machine_restart(unsigned int delay_millisecs);
-void machine_halt(void);
+void noreturn machine_restart(unsigned int delay_millisecs);
+void noreturn machine_halt(void);
void machine_power_off(void);
#endif /* __XEN_SHUTDOWN_H__ */
--
1.7.10.4
next prev parent reply other threads:[~2014-02-28 18:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-28 18:07 [PATCH v5 0/5] Improvements with noreturn Andrew Cooper
2014-02-28 18:07 ` [PATCH v5 1/5] x86/crash: Fix up declaration of do_nmi_crash() Andrew Cooper
2014-02-28 18:07 ` [PATCH v5 2/5] xen/compiler: Replace opencoded __attribute__((noreturn)) Andrew Cooper
2014-02-28 18:07 ` Andrew Cooper [this message]
2014-03-11 11:13 ` [PATCH v5 3/5] xen: Identify panic and reboot/halt functions as noreturn Ian Campbell
2014-02-28 18:07 ` [PATCH v5 4/5] xen: Misc cleanup as a result of the previous patches Andrew Cooper
2014-02-28 18:07 ` [PATCH v5 5/5] xen/x86: Identify reset_stack_and_jump() as noreturn Andrew Cooper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1393610874-27492-4-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=stefano.stabellini@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).