vdso: Add vdso_data:: Max_cycles
Add vdso_data::max_cycles in preparation to use it to detect potential multiplication overflow. Suggested-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20240325064023.2997-7-adrian.hunter@intel.com
This commit is contained in:
parent
1beb35ec61
commit
d2e58ab5cd
@ -61,6 +61,7 @@ struct vdso_timestamp {
|
|||||||
* @seq: timebase sequence counter
|
* @seq: timebase sequence counter
|
||||||
* @clock_mode: clock mode
|
* @clock_mode: clock mode
|
||||||
* @cycle_last: timebase at clocksource init
|
* @cycle_last: timebase at clocksource init
|
||||||
|
* @max_cycles: maximum cycles which won't overflow 64bit multiplication
|
||||||
* @mask: clocksource mask
|
* @mask: clocksource mask
|
||||||
* @mult: clocksource multiplier
|
* @mult: clocksource multiplier
|
||||||
* @shift: clocksource shift
|
* @shift: clocksource shift
|
||||||
@ -92,6 +93,9 @@ struct vdso_data {
|
|||||||
|
|
||||||
s32 clock_mode;
|
s32 clock_mode;
|
||||||
u64 cycle_last;
|
u64 cycle_last;
|
||||||
|
#ifdef CONFIG_GENERIC_VDSO_OVERFLOW_PROTECT
|
||||||
|
u64 max_cycles;
|
||||||
|
#endif
|
||||||
u64 mask;
|
u64 mask;
|
||||||
u32 mult;
|
u32 mult;
|
||||||
u32 shift;
|
u32 shift;
|
||||||
|
@ -22,10 +22,16 @@ static inline void update_vdso_data(struct vdso_data *vdata,
|
|||||||
u64 nsec, sec;
|
u64 nsec, sec;
|
||||||
|
|
||||||
vdata[CS_HRES_COARSE].cycle_last = tk->tkr_mono.cycle_last;
|
vdata[CS_HRES_COARSE].cycle_last = tk->tkr_mono.cycle_last;
|
||||||
|
#ifdef CONFIG_GENERIC_VDSO_OVERFLOW_PROTECT
|
||||||
|
vdata[CS_HRES_COARSE].max_cycles = tk->tkr_mono.clock->max_cycles;
|
||||||
|
#endif
|
||||||
vdata[CS_HRES_COARSE].mask = tk->tkr_mono.mask;
|
vdata[CS_HRES_COARSE].mask = tk->tkr_mono.mask;
|
||||||
vdata[CS_HRES_COARSE].mult = tk->tkr_mono.mult;
|
vdata[CS_HRES_COARSE].mult = tk->tkr_mono.mult;
|
||||||
vdata[CS_HRES_COARSE].shift = tk->tkr_mono.shift;
|
vdata[CS_HRES_COARSE].shift = tk->tkr_mono.shift;
|
||||||
vdata[CS_RAW].cycle_last = tk->tkr_raw.cycle_last;
|
vdata[CS_RAW].cycle_last = tk->tkr_raw.cycle_last;
|
||||||
|
#ifdef CONFIG_GENERIC_VDSO_OVERFLOW_PROTECT
|
||||||
|
vdata[CS_RAW].max_cycles = tk->tkr_raw.clock->max_cycles;
|
||||||
|
#endif
|
||||||
vdata[CS_RAW].mask = tk->tkr_raw.mask;
|
vdata[CS_RAW].mask = tk->tkr_raw.mask;
|
||||||
vdata[CS_RAW].mult = tk->tkr_raw.mult;
|
vdata[CS_RAW].mult = tk->tkr_raw.mult;
|
||||||
vdata[CS_RAW].shift = tk->tkr_raw.shift;
|
vdata[CS_RAW].shift = tk->tkr_raw.shift;
|
||||||
|
Loading…
Reference in New Issue
Block a user