[PATCH v2] linux-user: Mark cpu_loop() with noreturn attribute

Philippe Mathieu-Daudé posted 1 patch 2 years, 5 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20211106113916.544587-1-f4bug@amsat.org
linux-user/user-internals.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH v2] linux-user: Mark cpu_loop() with noreturn attribute
Posted by Philippe Mathieu-Daudé 2 years, 5 months ago
cpu_loop() never exits, so mark it with QEMU_NORETURN.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-By: Warner Losh <imp@bsdimp.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
v2:
- rebased
- restricted to linux-user

Supersedes: <20210905000429.1097336-1-f4bug@amsat.org>
---
 linux-user/user-internals.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/linux-user/user-internals.h b/linux-user/user-internals.h
index 661612a088b..c7ad00268af 100644
--- a/linux-user/user-internals.h
+++ b/linux-user/user-internals.h
@@ -65,7 +65,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
                     abi_long arg5, abi_long arg6, abi_long arg7,
                     abi_long arg8);
 extern __thread CPUState *thread_cpu;
-void cpu_loop(CPUArchState *env);
+void QEMU_NORETURN cpu_loop(CPUArchState *env);
 const char *target_strerror(int err);
 int get_osversion(void);
 void init_qemu_uname_release(void);
-- 
2.31.1

Re: [PATCH v2] linux-user: Mark cpu_loop() with noreturn attribute
Posted by Warner Losh 2 years, 5 months ago
On Sat, Nov 6, 2021, 5:39 AM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:

> cpu_loop() never exits, so mark it with QEMU_NORETURN.
>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Reviewed-By: Warner Losh <imp@bsdimp.com>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> v2:
> - rebased
> - restricted to linux-user
>
> Supersedes: <20210905000429.1097336-1-f4bug@amsat.org>
>

Reviewed-by: Warner Losh <imp@bsdimp.com>

bsd-user likely needs similar treatment, no?

---
>  linux-user/user-internals.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/linux-user/user-internals.h b/linux-user/user-internals.h
> index 661612a088b..c7ad00268af 100644
> --- a/linux-user/user-internals.h
> +++ b/linux-user/user-internals.h
> @@ -65,7 +65,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long
> arg1,
>                      abi_long arg5, abi_long arg6, abi_long arg7,
>                      abi_long arg8);
>  extern __thread CPUState *thread_cpu;
> -void cpu_loop(CPUArchState *env);
> +void QEMU_NORETURN cpu_loop(CPUArchState *env);
>  const char *target_strerror(int err);
>  int get_osversion(void);
>  void init_qemu_uname_release(void);
> --
> 2.31.1
>
>
Re: [PATCH v2] linux-user: Mark cpu_loop() with noreturn attribute
Posted by Philippe Mathieu-Daudé 2 years, 5 months ago
On 11/7/21 01:39, Warner Losh wrote:
> 
> 
> On Sat, Nov 6, 2021, 5:39 AM Philippe Mathieu-Daudé <f4bug@amsat.org
> <mailto:f4bug@amsat.org>> wrote:
> 
>     cpu_loop() never exits, so mark it with QEMU_NORETURN.
> 
>     Reviewed-by: Richard Henderson <richard.henderson@linaro.org
>     <mailto:richard.henderson@linaro.org>>
>     Reviewed-By: Warner Losh <imp@bsdimp.com <mailto:imp@bsdimp.com>>
>     Reviewed-by: Bin Meng <bmeng.cn@gmail.com <mailto:bmeng.cn@gmail.com>>
>     Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org
>     <mailto:f4bug@amsat.org>>
>     ---
>     v2:
>     - rebased
>     - restricted to linux-user
> 
>     Supersedes: <20210905000429.1097336-1-f4bug@amsat.org
>     <mailto:20210905000429.1097336-1-f4bug@amsat.org>>
> 
> 
> Reviewed-by: Warner Losh <imp@bsdimp.com <mailto:imp@bsdimp.com>>
> 
> bsd-user likely needs similar treatment, no?

IIUC this thread, not yet (I didn't want to get into your refactor):
https://lore.kernel.org/qemu-devel/CAFEAcA-f=n6XHp5Cj7=tH8NWO1GLA50i34=5GyaHrZELyr0bjw@mail.gmail.com/

Re: [PATCH v2] linux-user: Mark cpu_loop() with noreturn attribute
Posted by Warner Losh 2 years, 5 months ago
On Mon, Nov 8, 2021 at 12:37 AM Philippe Mathieu-Daudé <f4bug@amsat.org>
wrote:

> On 11/7/21 01:39, Warner Losh wrote:
> >
> >
> > On Sat, Nov 6, 2021, 5:39 AM Philippe Mathieu-Daudé <f4bug@amsat.org
> > <mailto:f4bug@amsat.org>> wrote:
> >
> >     cpu_loop() never exits, so mark it with QEMU_NORETURN.
> >
> >     Reviewed-by: Richard Henderson <richard.henderson@linaro.org
> >     <mailto:richard.henderson@linaro.org>>
> >     Reviewed-By: Warner Losh <imp@bsdimp.com <mailto:imp@bsdimp.com>>
> >     Reviewed-by: Bin Meng <bmeng.cn@gmail.com <mailto:bmeng.cn@gmail.com
> >>
> >     Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org
> >     <mailto:f4bug@amsat.org>>
> >     ---
> >     v2:
> >     - rebased
> >     - restricted to linux-user
> >
> >     Supersedes: <20210905000429.1097336-1-f4bug@amsat.org
> >     <mailto:20210905000429.1097336-1-f4bug@amsat.org>>
> >
> >
> > Reviewed-by: Warner Losh <imp@bsdimp.com <mailto:imp@bsdimp.com>>
> >
> > bsd-user likely needs similar treatment, no?
>
> IIUC this thread, not yet (I didn't want to get into your refactor):
>
> https://lore.kernel.org/qemu-devel/CAFEAcA-f=n6XHp5Cj7=tH8NWO1GLA50i34=5GyaHrZELyr0bjw@mail.gmail.com/


I'll add it to my TODO items. I hope to get a small collection of those in
this month before the release after I land the arm bits.

Warner
Re: [PATCH v2] linux-user: Mark cpu_loop() with noreturn attribute
Posted by Philippe Mathieu-Daudé 2 years, 4 months ago
Ping? (patch reviewed)

On 11/6/21 12:39, Philippe Mathieu-Daudé wrote:
> cpu_loop() never exits, so mark it with QEMU_NORETURN.
> 
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Reviewed-By: Warner Losh <imp@bsdimp.com>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> v2:
> - rebased
> - restricted to linux-user
> 
> Supersedes: <20210905000429.1097336-1-f4bug@amsat.org>
> ---
>  linux-user/user-internals.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/linux-user/user-internals.h b/linux-user/user-internals.h
> index 661612a088b..c7ad00268af 100644
> --- a/linux-user/user-internals.h
> +++ b/linux-user/user-internals.h
> @@ -65,7 +65,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
>                      abi_long arg5, abi_long arg6, abi_long arg7,
>                      abi_long arg8);
>  extern __thread CPUState *thread_cpu;
> -void cpu_loop(CPUArchState *env);
> +void QEMU_NORETURN cpu_loop(CPUArchState *env);
>  const char *target_strerror(int err);
>  int get_osversion(void);
>  void init_qemu_uname_release(void);
> 

Re: [PATCH v2] linux-user: Mark cpu_loop() with noreturn attribute
Posted by Laurent Vivier 2 years, 4 months ago
Le 15/12/2021 à 11:55, Philippe Mathieu-Daudé a écrit :
> Ping? (patch reviewed)
> 
> On 11/6/21 12:39, Philippe Mathieu-Daudé wrote:
>> cpu_loop() never exits, so mark it with QEMU_NORETURN.
>>
>> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>> Reviewed-By: Warner Losh <imp@bsdimp.com>
>> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>> v2:
>> - rebased
>> - restricted to linux-user
>>
>> Supersedes: <20210905000429.1097336-1-f4bug@amsat.org>
>> ---
>>   linux-user/user-internals.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/linux-user/user-internals.h b/linux-user/user-internals.h
>> index 661612a088b..c7ad00268af 100644
>> --- a/linux-user/user-internals.h
>> +++ b/linux-user/user-internals.h
>> @@ -65,7 +65,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
>>                       abi_long arg5, abi_long arg6, abi_long arg7,
>>                       abi_long arg8);
>>   extern __thread CPUState *thread_cpu;
>> -void cpu_loop(CPUArchState *env);
>> +void QEMU_NORETURN cpu_loop(CPUArchState *env);
>>   const char *target_strerror(int err);
>>   int get_osversion(void);
>>   void init_qemu_uname_release(void);
>>
> 

Applied to my linux-user-for-7.0 branch.

Thanks,
Laurent