[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT/LIBLWIP PATCH] Adopt to latest libuklock, libukmpi changes
Hi Simon, You can remove the uk_pr_debug() call. It make the code more consistent with the other changes. Besides that, it even triggers a checkpatch warning. You may do that when pushing upstream. Other than that, the patch looks good, Reviewed-by: Costin Lupu <costin.lupu@xxxxxxxxx> On 5/8/19 12:54 PM, Simon Kuenzer wrote: > lwip's semaphores are implemented based on semphores provided by > libuklock and lwip's mailboxes are implemented based on mailboxes > provided by libukmpi. The API of both have changed recently; > originally with commit a48d634 ("lib/uklock: Use timeout equal to 0 > for trying down a semaphore"): A passed timeout of `0` is now > immediately returning instead of blocking the current thread until the > according event happened. > > This patch also depends on the Unikraft patch 734930 ("lib/ukmpi: > Provide blocking uk_mbox_recv()"): > https://patchwork.unikraft.org/patch/734930/ > > Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx> > --- > mailbox.c | 15 +++++++++++---- > semaphore.c | 18 +++++++++++++----- > 2 files changed, 24 insertions(+), 9 deletions(-) > > diff --git a/mailbox.c b/mailbox.c > index 6fb5fda..9bc34d8 100644 > --- a/mailbox.c > +++ b/mailbox.c > @@ -130,10 +130,17 @@ u32_t sys_arch_mbox_fetch(sys_mbox_t *mbox, void **msg, > u32_t timeout) > > UK_ASSERT(sys_mbox_valid(mbox)); > > - nsret = uk_mbox_recv_to(mbox->mbox, msg, > - ukarch_time_msec_to_nsec((__nsec) timeout)); > - if (unlikely(nsret == __NSEC_MAX)) > - return SYS_ARCH_TIMEOUT; > + if (timeout == 0) { > + nsret = ukplat_monotonic_clock(); > + uk_mbox_recv(mbox->mbox, msg); > + nsret = ukplat_monotonic_clock() - nsret; > + } else { > + nsret = uk_mbox_recv_to(mbox->mbox, msg, > + ukarch_time_msec_to_nsec((__nsec) > + timeout)); > + if (unlikely(nsret == __NSEC_MAX)) > + return SYS_ARCH_TIMEOUT; > + } > return (u32_t) ukarch_time_nsec_to_msec(nsret); > } > > diff --git a/semaphore.c b/semaphore.c > index 16da316..e962d4b 100644 > --- a/semaphore.c > +++ b/semaphore.c > @@ -85,10 +85,18 @@ u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout) > { > __nsec nsret; > > - nsret = uk_semaphore_down_to(&sem->sem, > - ukarch_time_msec_to_nsec((__nsec) > - timeout)); > - if (unlikely(nsret == __NSEC_MAX)) > - return SYS_ARCH_TIMEOUT; > + uk_pr_debug("sys_arch_sem_wait(%p, %"PRIu32")\n", sem, timeout); > + if (timeout == 0) { > + nsret = ukplat_monotonic_clock(); > + uk_semaphore_down(&sem->sem); > + nsret = ukplat_monotonic_clock() - nsret; > + } else { > + nsret = uk_semaphore_down_to(&sem->sem, > + ukarch_time_msec_to_nsec((__nsec) > + timeout)); > + if (unlikely(nsret == __NSEC_MAX)) > + return SYS_ARCH_TIMEOUT; > + } > + > return (u32_t) ukarch_time_nsec_to_msec(nsret); > } > _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |