[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v4 3/3] x86/time: avoid reading the platform timer in rendezvous functions
On 29.04.2021 14:53, Roger Pau Monné wrote: > On Thu, Apr 01, 2021 at 11:55:10AM +0200, Jan Beulich wrote: >> Reading the platform timer isn't cheap, so we'd better avoid it when the >> resulting value is of no interest to anyone. >> >> The consumer of master_stime, obtained by >> time_calibration_{std,tsc}_rendezvous() and propagated through >> this_cpu(cpu_calibration), is local_time_calibration(). With >> CONSTANT_TSC the latter function uses an early exit path, which doesn't >> explicitly use the field. While this_cpu(cpu_calibration) (including the >> master_stime field) gets propagated to this_cpu(cpu_time).stamp on that >> path, both structures' fields get consumed only by the !CONSTANT_TSC >> logic of the function. >> >> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> > > Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> Thanks. > Albeit as said on my other email I would prefer performance related > changes like this one to be accompanied with some proof that they > actually make a difference, or else we risk making the code more > complicated for no concrete benefit. I'm not sure that's always sensible or useful. Removing an operation that may take hundreds of clocks is surely not going to make things worse performance-wise. Whether it's measurable in any way with real world workloads is hard to predict. Micro-measurement, as expected, shows an improvement. >> --- a/xen/arch/x86/time.c >> +++ b/xen/arch/x86/time.c >> @@ -52,6 +52,7 @@ unsigned long pit0_ticks; >> struct cpu_time_stamp { >> u64 local_tsc; >> s_time_t local_stime; >> + /* Next field unconditionally valid only when !CONSTANT_TSC. */ > > Could you also mention this is only true for the cpu_time_stamp that's > used in cpu_calibration? > > For ap_bringup_ref master_stime is valid regardless of CONSTANT_TSC. Well, that's precisely why I put "unconditionally" there. I'm not convinced it's helpful to point out ap_bringup_ref in particular, as the comment would then likely not get updated when yet another instance appears which sets the field in all cases. If you have a suggestion on how to word this better without mentioning particular instances of the struct, I'll be happy to consider taking that. Jan
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |