All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen/arm: traps: Fix MISRA C 2012 Rule 8.4 violation
@ 2022-07-05 12:21 Xenia Ragiadakou
  2022-07-05 12:34 ` Bertrand Marquis
  2022-07-05 22:01 ` Julien Grall
  0 siblings, 2 replies; 4+ messages in thread
From: Xenia Ragiadakou @ 2022-07-05 12:21 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Julien Grall, Bertrand Marquis, Volodymyr Babchuk

Add the function prototype of show_stack() in <asm/processor.h> header file
so that it is visible before its definition in traps.c.

Although show_stack() is referenced only in traps.c, it is declared with
external linkage because, during development, it is often called also by
other files for debugging purposes. Declaring it static would increase
development effort. Add appropriate comment

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
---
 xen/arch/arm/include/asm/processor.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/arm/include/asm/processor.h b/xen/arch/arm/include/asm/processor.h
index 4188ec6bfb..c021160412 100644
--- a/xen/arch/arm/include/asm/processor.h
+++ b/xen/arch/arm/include/asm/processor.h
@@ -558,7 +558,9 @@ extern register_t __cpu_logical_map[];
 void panic_PAR(uint64_t par);
 
 void show_execution_state(const struct cpu_user_regs *regs);
+/* Debugging functions are declared with external linkage to aid development. */
 void show_registers(const struct cpu_user_regs *regs);
+void show_stack(const struct cpu_user_regs *regs);
 //#define dump_execution_state() run_in_exception_handler(show_execution_state)
 #define dump_execution_state() WARN()
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] xen/arm: traps: Fix MISRA C 2012 Rule 8.4 violation
  2022-07-05 12:21 [PATCH] xen/arm: traps: Fix MISRA C 2012 Rule 8.4 violation Xenia Ragiadakou
@ 2022-07-05 12:34 ` Bertrand Marquis
  2022-07-05 22:01 ` Julien Grall
  1 sibling, 0 replies; 4+ messages in thread
From: Bertrand Marquis @ 2022-07-05 12:34 UTC (permalink / raw)
  To: Xenia Ragiadakou
  Cc: Xen-devel, Stefano Stabellini, Julien Grall, Volodymyr Babchuk

Hi Xenia,

> On 5 Jul 2022, at 13:21, Xenia Ragiadakou <burzalodowa@gmail.com> wrote:
> 
> Add the function prototype of show_stack() in <asm/processor.h> header file
> so that it is visible before its definition in traps.c.
> 
> Although show_stack() is referenced only in traps.c, it is declared with
> external linkage because, during development, it is often called also by
> other files for debugging purposes. Declaring it static would increase
> development effort. Add appropriate comment
> 
> Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>

Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>

Cheers
Bertrand

> ---
> xen/arch/arm/include/asm/processor.h | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/xen/arch/arm/include/asm/processor.h b/xen/arch/arm/include/asm/processor.h
> index 4188ec6bfb..c021160412 100644
> --- a/xen/arch/arm/include/asm/processor.h
> +++ b/xen/arch/arm/include/asm/processor.h
> @@ -558,7 +558,9 @@ extern register_t __cpu_logical_map[];
> void panic_PAR(uint64_t par);
> 
> void show_execution_state(const struct cpu_user_regs *regs);
> +/* Debugging functions are declared with external linkage to aid development. */
> void show_registers(const struct cpu_user_regs *regs);
> +void show_stack(const struct cpu_user_regs *regs);
> //#define dump_execution_state() run_in_exception_handler(show_execution_state)
> #define dump_execution_state() WARN()
> 
> -- 
> 2.34.1
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xen/arm: traps: Fix MISRA C 2012 Rule 8.4 violation
  2022-07-05 12:21 [PATCH] xen/arm: traps: Fix MISRA C 2012 Rule 8.4 violation Xenia Ragiadakou
  2022-07-05 12:34 ` Bertrand Marquis
@ 2022-07-05 22:01 ` Julien Grall
  2022-07-06  9:07   ` Bertrand Marquis
  1 sibling, 1 reply; 4+ messages in thread
From: Julien Grall @ 2022-07-05 22:01 UTC (permalink / raw)
  To: Xenia Ragiadakou, xen-devel
  Cc: Stefano Stabellini, Bertrand Marquis, Volodymyr Babchuk

Hi Xenia,

On 05/07/2022 13:21, Xenia Ragiadakou wrote:
> Add the function prototype of show_stack() in <asm/processor.h> header file
> so that it is visible before its definition in traps.c.
> 
> Although show_stack() is referenced only in traps.c, it is declared with
> external linkage because, during development, it is often called also by
> other files for debugging purposes. Declaring it static would increase
> development effort. Add appropriate comment
> 
> Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>

With one request below:

Acked-by: Julien Grall <jgrall@amazon.com>

> ---
>   xen/arch/arm/include/asm/processor.h | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/xen/arch/arm/include/asm/processor.h b/xen/arch/arm/include/asm/processor.h
> index 4188ec6bfb..c021160412 100644
> --- a/xen/arch/arm/include/asm/processor.h
> +++ b/xen/arch/arm/include/asm/processor.h
> @@ -558,7 +558,9 @@ extern register_t __cpu_logical_map[];
>   void panic_PAR(uint64_t par);
>   
>   void show_execution_state(const struct cpu_user_regs *regs);
> +/* Debugging functions are declared with external linkage to aid development. */

I agree that those functions are only used for debugging today. But 
there are no reason they can't be used in code in the future.
So I would like this comment to be dropped because it could easily 
become stale.

If the others argue for keeping it, then I think...

>   void show_registers(const struct cpu_user_regs *regs);
> +void show_stack(const struct cpu_user_regs *regs);

... we need a newline here so it is clearer which set of functions you 
are referring to (at the moment one may think that 
dump_execution_state()) is also included.

>   //#define dump_execution_state() run_in_exception_handler(show_execution_state)
>   #define dump_execution_state() WARN()
>   

Cheers,

-- 
Julien Grall


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xen/arm: traps: Fix MISRA C 2012 Rule 8.4 violation
  2022-07-05 22:01 ` Julien Grall
@ 2022-07-06  9:07   ` Bertrand Marquis
  0 siblings, 0 replies; 4+ messages in thread
From: Bertrand Marquis @ 2022-07-06  9:07 UTC (permalink / raw)
  To: Julien Grall
  Cc: Xenia Ragiadakou, xen-devel, Stefano Stabellini, Volodymyr Babchuk

Hi Julien,

> On 5 Jul 2022, at 23:01, Julien Grall <julien@xen.org> wrote:
> 
> Hi Xenia,
> 
> On 05/07/2022 13:21, Xenia Ragiadakou wrote:
>> Add the function prototype of show_stack() in <asm/processor.h> header file
>> so that it is visible before its definition in traps.c.
>> Although show_stack() is referenced only in traps.c, it is declared with
>> external linkage because, during development, it is often called also by
>> other files for debugging purposes. Declaring it static would increase
>> development effort. Add appropriate comment
>> Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
> 
> With one request below:
> 
> Acked-by: Julien Grall <jgrall@amazon.com>
> 
>> ---
>>  xen/arch/arm/include/asm/processor.h | 2 ++
>>  1 file changed, 2 insertions(+)
>> diff --git a/xen/arch/arm/include/asm/processor.h b/xen/arch/arm/include/asm/processor.h
>> index 4188ec6bfb..c021160412 100644
>> --- a/xen/arch/arm/include/asm/processor.h
>> +++ b/xen/arch/arm/include/asm/processor.h
>> @@ -558,7 +558,9 @@ extern register_t __cpu_logical_map[];
>>  void panic_PAR(uint64_t par);
>>    void show_execution_state(const struct cpu_user_regs *regs);
>> +/* Debugging functions are declared with external linkage to aid development. */
> 
> I agree that those functions are only used for debugging today. But there are no reason they can't be used in code in the future.
> So I would like this comment to be dropped because it could easily become stale.

I think if someone is one day using this somewhere else then he should remove the comment but in the current state the comment
would be useful so that the next one going through Misra violations is not trying to fix it.

In the mid-term, if we have a standard way to document violations then the comment should be replaced by it.

> 
> If the others argue for keeping it, then I think...
> 
>>  void show_registers(const struct cpu_user_regs *regs);
>> +void show_stack(const struct cpu_user_regs *regs);
> 
> ... we need a newline here so it is clearer which set of functions you are referring to (at the moment one may think that dump_execution_state()) is also included.

agree

Cheers
Bertrand

> 
>>  //#define dump_execution_state() run_in_exception_handler(show_execution_state)
>>  #define dump_execution_state() WARN()
>>  
> 
> Cheers,
> 
> -- 
> Julien Grall



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-07-06  9:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-05 12:21 [PATCH] xen/arm: traps: Fix MISRA C 2012 Rule 8.4 violation Xenia Ragiadakou
2022-07-05 12:34 ` Bertrand Marquis
2022-07-05 22:01 ` Julien Grall
2022-07-06  9:07   ` Bertrand Marquis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.