[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 2/2] xen: Identify panic and reboot/halt functions as noreturn



On 25/11/13 10:34, Ian Campbell wrote:
> 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 <andrew.cooper3@xxxxxxxxxx>
>> CC: Keir Fraser <keir@xxxxxxx>
>> CC: Jan Beulich <JBeulich@xxxxxxxx>
>> CC: Ian Campbell <ian.campbell@xxxxxxxxxx>
>> CC: Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>
>> CC: Tim Deegan <tim@xxxxxxx>
>>
>> ---
>>
>> 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.

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

>
>>  {
>>      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;
>


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.