x86: don't exclude time.c from scanning
cover x86: don't exclude time.c from scanning
1: x86/time: address Misra C:2012 rule 8.3
2: x86/time: don't exclude from Eclair scanning
https://gitlab.com/xen-project/hardware/xen-staging/-/pipelines/2543286982
Jan
PATCH 1/2 x86/time: address Misra C:2012 rule 8.3
Before we can enable scanning of time.c, it needs to be clean wrt blocking rules. Bring boot_tsc_stamp's definition in line with its declaration. For get_s_time_fixed() go a little farther and move it to the x86 header (the function only exists in x86) and do, along with correcting the parameter name, the u64 -> uint64_t a little more widely than strictly necessary.
xen/arch/x86/include/asm/time.h +2 -0
@@ -13,6 +13,8 @@ static inline cycles_t get_cycles(void)return rdtsc_ordered (); } +s_time_t get_s_time_fixed (uint64_t at_tsc); + unsigned long mktime (unsigned int year, unsigned int mon, unsigned int day, unsigned int hour,
xen/arch/x86/time.c +3 -3
@@ -95,7 +95,7 @@ static u32 pit_stamp32;static bool __read_mostly using_pit;/* Boot timestamp, filled in head.S */ -u64 __initdata boot_tsc_stamp; +uint64_t __initdata boot_tsc_stamp;/* Per-socket TSC_ADJUST values, for secondary cores/threads to sync to. */ static uint64_t *__read_mostly tsc_adjust;
@@ -1656,10 +1656,10 @@ static unsigned long get_wallclock_time(* System Time ***************************************************************************/ -s_time_t get_s_time_fixed (u64 at_tsc) +s_time_t get_s_time_fixed (uint64_t at_tsc) {const struct cpu_time *t = &this_cpu (cpu_time); -u64 tsc, delta; +uint64_t tsc, delta;if ( at_tsc ) tsc = at_tsc;
xen/include/xen/time.h +0 -1
@@ -33,7 +33,6 @@ struct vcpu;typedef int64_t s_time_t ;#define PRI_stime PRId64 -s_time_t get_s_time_fixed (u64 at_tick);s_time_t get_s_time (void );unsigned long get_localtime (struct domain *d);uint64_t get_localtime_us (struct domain *d);
Re: [PATCH 1/2] x86/time: address Misra C:2012 rule 8.3
Quoted 8 lines · Jan Beulich
Before we can enable scanning of
time.c, it needs to be clean wrt blocking rules. Bring boot_tsc_stamp's definition in line with its declaration. Forget_s_time_fixed()go a little farther and move it to the x86 header (the function only exists in x86) and do, along with correcting the parameter name, the u64 ->uint64_ta little more widely than strictly necessary.Signed-off-by Jan Beulich <[email protected]>
Quoted 47 lines
xen/arch/x86/include/asm/time.h +2
-0@@ -13,6 +13,8 @@ static inline cycles_t get_cycles(void)return rdtsc_ordered (); } +s_time_t get_s_time_fixed (uint64_t at_tsc); + unsigned long mktime (unsigned int year, unsigned int mon, unsigned int day, unsigned int hour,xen/arch/x86/time.c +1
-1@@ -95,7 +95,7 @@ static u32 pit_stamp32;static bool __read_mostly using_pit;/* Boot timestamp, filled in head.S */ -u64 __initdata boot_tsc_stamp; +uint64_t __initdata boot_tsc_stamp;/* Per-socket TSC_ADJUST values, for secondary cores/threads to sync to. */
staticuint64_t*__read_mostlytsc_adjust;xen/arch/x86/time.c +2
-2@@ -1656,10 +1656,10 @@ static unsigned long get_wallclock_time(* System Time ***************************************************************************/ -s_time_t get_s_time_fixed (u64 at_tsc) +s_time_t get_s_time_fixed (uint64_t at_tsc) {const struct cpu_time *t = &this_cpu (cpu_time); -u64 tsc, delta; +uint64_t tsc, delta;if ( at_tsc )tsc = at_tsc;xen/include/xen/time.h +0
-1@@ -33,7 +33,6 @@ struct vcpu;typedef int64_t s_time_t ;#define PRI_stime PRId64 -s_time_t get_s_time_fixed (u64 at_tick);s_time_t get_s_time (void );unsigned long get_localtime (struct domain *d);uint64_t get_localtime_us (struct domain *d);
Signature · 4 lines
Nicola Vetrini, B.Sc. Software Engineer BUGSENG (https://bugseng.com) LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253
PATCH 2/2 x86/time: don't exclude from Eclair scanning
In reply to Jan BeulichThe justification is wrong, and the file hence shouldn't really be excluded.
automation/eclair_analysis/ECLAIR/deviations.ecl +0 -5
@@ -214,11 +214,6 @@ const-qualified." -doc_end -doc_begin="The following file is imported from Linux: ignore for now." --file_tag+={adopted_time_r8_3,"^xen/arch/x86/time\\.c$"} --config=MC3A2.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_time_r8_3)))&&(any_area(any_loc(file(^xen/include/xen/time\\.h$)))||any_area(any_loc(file(^xen/arch/x86/include/asm/setup\\.h$))))"} --doc_end - --doc_begin="The following file is imported from Linux: ignore for now." -file_tag+={adopted_cpu_idle_r8_3,"^xen/arch/x86/acpi/cpu_idle\\.c$"} -config=MC3A2.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_cpu_idle_r8_3)))&&any_area(any_loc(file(^xen/include/xen/pmstat\\.h$)))"} -doc_end
Re: [PATCH 2/2] x86/time: don't exclude from Eclair scanning
Quoted 5 lines · Jan Beulich
The justification is wrong, and the file hence shouldn't really be excluded.
Signed-off-by Jan Beulich <[email protected]>
Thanks for addressing this
Quoted 17 lines
automation/eclair_analysis/ECLAIR/deviations.ecl +0
-0@@ -214,11 +214,6 @@ const-qualified." -doc_end -doc_begin="The following file is imported from Linux: ignore fornow."
--file_tag+={adopted_time_r8_3,"^xen/arch/x86/time\\.c$"} --config=MC3A2.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_time_r8_3)))&&(any_area(any_loc(file(^xen/include/xen/time\\.h$)))||any_area(any_loc(file(^xen/arch/x86/include/asm/setup\\.h$))))"} --doc_end
-
--doc_begin="The following file is imported from Linux: ignore for
now."
-file_tag+={adopted_cpu_idle_r8_3,"^xen/arch/x86/acpi/cpu_idle\\.c$"}-config=MC3A2.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_cpu_idle_r8_3)))&&any_area(any_loc(file(^xen/include/xen/pmstat\\.h$)))"}
-doc_end
Signature · 4 lines
Nicola Vetrini, B.Sc. Software Engineer BUGSENG (https://bugseng.com) LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253
Quoted 4 lines · Jan Beulich
1: x86/time: address Misra C:2012 rule 8.3
2: x86/time: don't exclude from Eclair scanninghttps://gitlab.com/xen-project/hardware/xen-staging/-/pipelines/2543286982
With the quick R-b from Nicola (thanks much!), what's you're view towards including this in 4.22?
Jan
Quoted 8 lines · Jan Beulich
Quoted 4 lines · Jan Beulich
1: x86/time: address Misra C:2012 rule 8.3
2: x86/time: don't exclude from Eclair scanninghttps://gitlab.com/xen-project/hardware/xen-staging/-/pipelines/2543286982
With the quick R-b from Nicola (thanks much!), what's you're view towards including this in 4.22?
I am okay with having it in 4.22:
Thanks.
~ Oleksii