[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 4/7] add nspin_sleep function to time manager
On Wed, Apr 04, 2018 at 03:50:51PM +0000, Pawel Wieczorkiewicz wrote: > From: Paul Semel <phentex@xxxxxxxxx> Missing commit log? > Signed-off-by: Paul Semel <phentex@xxxxxxxxx> > > cr https://code.amazon.com/reviews/CR-836539 > --- > common/time.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/common/time.c b/common/time.c > index c80bc11..db28d78 100644 > --- a/common/time.c > +++ b/common/time.c > @@ -106,6 +106,24 @@ int gettimeofday(struct timeval *tp) > return 0; > } > > +#if defined(__i386__) > +static inline void nspin_sleep(uint32_t t) > +#else > +static inline void nspin_sleep(uint64_t t) > +#endif > +{ > +#if defined(__i386__) > + uint32_t curr = since_boot_time(); > + uint32_t end = curr + t; > +#else > + uint64_t curr = since_boot_time(); > + uint64_t end = curr + t; > +#endif Again same comment as before regarding the 32 vs 64bit types. You would probably want something like: if ( end < curr ) panic("end value overflows counter\n"); > + > + while ( curr < end ) > + curr = since_boot_time(); And you likely want this to be: while ( end < since_boot_time() ) asm volatile ("pause"); I'm actually trying to add a "pause" instruction helper in: https://marc.info/?l=xen-devel&m=152241364510840 Thanks, Roger. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |