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

Re: [PATCH 1/2] x86/time: address Misra C:2012 rule 8.3


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • Date: Thu, 21 May 2026 16:24:51 +0200
  • Arc-authentication-results: i=1; bugseng.com; arc=none smtp.remote-ip=162.55.131.47
  • Arc-message-signature: i=1; d=bugseng.com; s=openarc; a=rsa-sha256; c=relaxed/relaxed; t=1779373492; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:X-Sender:Organization:Content-Type: Content-Transfer-Encoding; bh=2kIBIalVSnUduM9+XigotZF1KqV+aPJCsd7ouGZg7UQ=; b=bAnrFCYgdiEhtlgUR6oZNTLhYBe3C1y0CDZ8sRWD8Y8RkN35nPoh7yG9JNVq8lS8l/Ge 8FSJ/uF4hg3zoBlDbVFOCmasSCSubREGTsJQBHAUWo0lttQbUFg2AD4xvBikIeKmR5kV2 6XoYSoXGA7fBN9gE/UK+e0j/bwoqJGTAASKks561uzYXlYUKX1eWIVQ8tXdt5trE1iL2p 9fYDylh7CusIxphULML42DrcPiu98BusOy2Gq1ZqCGgVpD5iNU2srraRlU8J2zPOXGj00 vFnCZ1fG559eMzVDQ6cO+28FpTnhb2/K5YgNKkJmc7w8YQ7ZLMv8bAL8rqCkC5cDeA4vt yAfQKZbTw4V3tsFR2pvzPFN/8pQiDY9Aw/VDHxm/zsS+bnFngcHznB1jyI4ar1oWVLyvs oVyZwHj5W4u6etNqMZTuQgQhdKwXlMqiOCzONMmJNsM3bOmdWDq33VgNEKrvDr5vhwKUh eBp/qNdCvArEW2hxlCJlHR83zX0JasljVvmMgtFfe20aIcWjCrfVBNgcpcvM4v3rMeiu4 enZk2qtxu91ZOyAbn1i4yvDJT86VrH1ZE12H1Gs8UOvPfPaPWxWOeNBtN2SIwSnrTswmL kLP8KIwMitCCS+S9K65wRGl1cDwuX+XqOGySjxYUdLbApeRyE72Mkl4XQ76JCj8=
  • Arc-seal: i=1; d=bugseng.com; s=openarc; a=rsa-sha256; cv=none; t=1779373492; b=2nJZJvCDfthLX3d/AywBUR82gf+zpaZt+Fjn+/N/jhLvD0mnN1Nu0D+AMW1e7yqDNHnB vRAzuYnzuUII+0W8TSJsLTntHvN3EjXoLZVvNWMDRFiU3A+PBjokLkI0at6FD5O2FspV3 TFA4vP9MJLQA7wqVvCSVRblsq0+xazQO6aUBkOYZV8udEBYaxTrqqwiVmWU+SIDvMau/H F4liOyiVC8GkOU5Gd36O6+9KikKUq8/1XZ9uUdv28fCWP4mSVCqkRRRdk50CkEB9qZWCH j5AMFh2YUO1+n72putv2R2pBNKn+/nBLYzhV1149apiVXsjqJ74FmOpVHBkg/Xb2VgDQI qrILVW98IjzsybiCiAe0CpizqoH1h4Zg0nVEQyUIRZYM1/G516EM1P4V4XdLQYVAp1yP5 AnM9GFk16cY0fXovTA97MgqbkBt5c5vYPaoAofe5Q8LEH1OIkAyYB7INWsz5N9kBE0PpX H0IxjbKtn8fRNXnStJFV3tDUrm86z8RRBFS71xt8Us+2Np0qbJrHmiqFMA0NFY9KOtBwc 9GbBZDijN1j4lrbViOx22oOESb8/f/mDQe2vQ3YBTFScL5B5YTvSZQj1X/vron7oAtSvk 0mrw2BAZCEw9KpYf2B2fw6Cbg+bmYWot8wVZouIAB/f7SobphD/rn154IjaYZ8Y=
  • Authentication-results: eu.smtp.expurgate.cloud; none
  • Authentication-results: bugseng.com; arc=none smtp.remote-ip=162.55.131.47
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>
  • Delivery-date: Thu, 21 May 2026 14:24:59 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2026-05-21 14:26, Jan Beulich wrote:
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.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>


Reviewed-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>

--- a/xen/arch/x86/include/asm/time.h
+++ b/xen/arch/x86/include/asm/time.h
@@ -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,
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -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;
--- a/xen/include/xen/time.h
+++ b/xen/include/xen/time.h
@@ -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);

--
Nicola Vetrini, B.Sc.
Software Engineer
BUGSENG (https://bugseng.com)
LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253



 


Rackspace

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