From: Ian Campbell Subject: Re: [PATCH 2/2] xen: Identify panic and reboot/halt functions as noreturn Date: Mon, 25 Nov 2013 10:34:39 +0000 Message-ID: <1385375679.22002.13.camel@kazak.uk.xensource.com> References: <1385375142-8216-1-git-send-email-andrew.cooper3@citrix.com> <1385375142-8216-3-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1385375142-8216-3-git-send-email-andrew.cooper3@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: Stefano Stabellini , Tim Deegan , Keir Fraser , Jan Beulich , Xen-devel List-Id: xen-devel@lists.xenproject.org On Mon, 2013-11-25 at 10:25 +0000, Andrew Cooper wrote: > 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 `call` rather than `jmp` so > there should be no impact on any stack trace generation. > > Signed-off-by: Andrew Cooper > CC: Keir Fraser > CC: Jan Beulich > CC: Ian Campbell > CC: Stefano Stabellini > CC: Tim Deegan > > --- > > 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(-) > > diff --git a/xen/arch/arm/shutdown.c b/xen/arch/arm/shutdown.c > index 767cc12..58f1cf1 100644 > --- a/xen/arch/arm/shutdown.c > +++ b/xen/arch/arm/shutdown.c > @@ -11,12 +11,12 @@ 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(); You also tag stop_cpu, are both necessary? Especially for a static function. > } > > -void machine_halt(void) > +void noreturn machine_halt(void) And you also tag halt_this_cpu which machine_halt ends with. > { > 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 noreturn machine_restart(unsigned int delay_millisecs) > { > int timeout = 10; > > diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c > index 6c90fa6..7242331 100644 > --- a/xen/arch/arm/smpboot.c > +++ b/xen/arch/arm/smpboot.c > @@ -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 noreturn stop_cpu(void) > { > local_irq_disable(); > cpu_is_dead = 1;