Changeset View
Standalone View
sys/sys/vdso.h
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | |||||
#define VDSO_TK_CURRENT_BUSY 0xffffffff | #define VDSO_TK_CURRENT_BUSY 0xffffffff | ||||
#define VDSO_TK_VER_1 0x1 | #define VDSO_TK_VER_1 0x1 | ||||
#define VDSO_TK_VER_CURR VDSO_TK_VER_1 | #define VDSO_TK_VER_CURR VDSO_TK_VER_1 | ||||
#define VDSO_TH_ALGO_1 0x1 | #define VDSO_TH_ALGO_1 0x1 | ||||
#define VDSO_TH_ALGO_2 0x2 | #define VDSO_TH_ALGO_2 0x2 | ||||
#define VDSO_TH_ALGO_3 0x3 | #define VDSO_TH_ALGO_3 0x3 | ||||
#define VDSO_TH_ALGO_4 0x4 | #define VDSO_TH_ALGO_4 0x4 | ||||
struct vdso_fxrng_generation_1 { | |||||
uint32_t fx_vdso_version; /* 1 */ | |||||
uint32_t fx_generation32; | |||||
uint64_t _fx_reserved; | |||||
}; | |||||
kib: Why not use 32bit generation on 64bit arch ? | |||||
Done Inline ActionsWhy use 32bit generation on 64bit arch? The 64 bit counter is canonical and cheap on 64bit, might as well stick with the longer generation there. cem: Why use 32bit generation on 64bit arch? The 64 bit counter is canonical and cheap on 64bit… | |||||
Not Done Inline ActionsI am not convinced that 64bit are useful if 32bit are enough. But regardless, I do not think that fx_generation32 is needed if you provide fx_generation. 32bit read can be done from the proper word of fx_generation (high word on BE). kib: I am not convinced that 64bit are useful if 32bit are enough.
But regardless, I do not think… | |||||
Done Inline ActionsI thought we already discussed that reading 32 bits out of kernel 64 bit atomic write wasn't safe. I'm confused why you propose it now. The generation32 costs nothing; we've already allocated a full cache line. We have 52 bytes to spare. I will leave it as is. cem: I thought we already discussed that reading 32 bits out of kernel 64 bit atomic write wasn't… | |||||
Not Done Inline ActionsWe discussed that reading both high and low words is not safe because we can see inconsistent results without some form of lock. But reading just LSW is fine, even if the write is not 64bit atomic. kib: We discussed that reading both high and low words is not safe because we can see inconsistent… | |||||
_Static_assert(sizeof(struct vdso_fxrng_generation_1) == 16, ""); | |||||
#define vdso_fxrng_generation vdso_fxrng_generation_1 | |||||
/* fx_vdso_version values: */ | |||||
#define VDSO_FXRNG_VER_1 0x1 | |||||
#define VDSO_FXRNG_VER_CURR VDSO_FXRNG_VER_1 | |||||
#ifndef _KERNEL | #ifndef _KERNEL | ||||
struct timespec; | struct timespec; | ||||
struct timeval; | struct timeval; | ||||
struct timezone; | struct timezone; | ||||
int __vdso_clock_gettime(clockid_t clock_id, struct timespec *ts); | int __vdso_clock_gettime(clockid_t clock_id, struct timespec *ts); | ||||
int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz); | int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz); | ||||
int __vdso_gettc(const struct vdso_timehands *vdso_th, u_int *tc); | int __vdso_gettc(const struct vdso_timehands *vdso_th, u_int *tc); | ||||
int __vdso_gettimekeep(struct vdso_timekeep **tk); | int __vdso_gettimekeep(struct vdso_timekeep **tk); | ||||
#endif | #endif | ||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
struct timecounter; | struct timecounter; | ||||
struct vdso_sv_tk { | struct vdso_sv_tk { | ||||
int sv_timekeep_off; | int sv_timekeep_off; | ||||
int sv_timekeep_curr; | int sv_timekeep_curr; | ||||
uint32_t sv_timekeep_gen; | uint32_t sv_timekeep_gen; | ||||
}; | }; | ||||
#ifdef RANDOM_FENESTRASX | |||||
Done Inline ActionsThe prototype definitely does not need the #ifdef around. kib: The prototype definitely does not need the #ifdef around. | |||||
Done Inline ActionsHm, I'm not sure why not. It exists only conditional on option RANDOM_FENESTRASX cem: Hm, I'm not sure why not. It exists only conditional on `option RANDOM_FENESTRASX` | |||||
Done Inline ActionsBut prototype is valid regardless. Also it puts a dependency on the opt_ header before this one. kib: But prototype is valid regardless. Also it puts a dependency on the opt_ header before this… | |||||
Done Inline ActionsThe prototype is not valid if the option isn't present; that's the point. If the option isn't present, using that declaration will eventually result in a link error. It's better to cause a compile error earlier on than a link error at the end of the kernel build, IMO. Opt header is not a concern; opt_global.h already precedes all headers. cem: The prototype is //not// valid if the option isn't present; that's the point.
If the option… | |||||
void fxrng_push_seed_generation(uint64_t gen); | |||||
#endif | |||||
void timekeep_push_vdso(void); | void timekeep_push_vdso(void); | ||||
uint32_t tc_fill_vdso_timehands(struct vdso_timehands *vdso_th); | uint32_t tc_fill_vdso_timehands(struct vdso_timehands *vdso_th); | ||||
/* | /* | ||||
* The cpu_fill_vdso_timehands() function should fill MD-part of the | * The cpu_fill_vdso_timehands() function should fill MD-part of the | ||||
* struct vdso_timehands, which is both machine- and | * struct vdso_timehands, which is both machine- and | ||||
* timecounter-depended. The return value should be 1 if fast | * timecounter-depended. The return value should be 1 if fast | ||||
▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines |
Why not use 32bit generation on 64bit arch ?