On Thu, Feb 16, 2023 at 09:28:17AM +0800, fengchengwen wrote: > add cc maintainer > > On 2023/2/13 20:44, Chengwen Feng wrote: > > The spinlock should unlock when clock_gettime() failed. This patch > > fixes it by invoking clock_gettime() before lock. > > > > Fixes: 26021a715067 ("eal/bsd: support alarm API") > > Cc: sta...@dpdk.org > > > > Signed-off-by: Chengwen Feng <fengcheng...@huawei.com> > > --- > > lib/eal/freebsd/eal_alarm.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/lib/eal/freebsd/eal_alarm.c b/lib/eal/freebsd/eal_alarm.c > > index 1023c32937..1a3e6c0aad 100644 > > --- a/lib/eal/freebsd/eal_alarm.c > > +++ b/lib/eal/freebsd/eal_alarm.c > > @@ -171,12 +171,12 @@ eal_alarm_callback(void *arg __rte_unused) > > struct timespec now; > > struct alarm_entry *ap; > > > > - rte_spinlock_lock(&alarm_list_lk); > > - ap = LIST_FIRST(&alarm_list); > > - > > if (clock_gettime(CLOCK_TYPE_ID, &now) < 0) > > return; > > > > + rte_spinlock_lock(&alarm_list_lk); > > + ap = LIST_FIRST(&alarm_list); > > + > > while (ap != NULL && timespec_cmp(&now, &ap->time) >= 0) { > > ap->executing = 1; > > ap->executing_id = pthread_self(); > >
Acked-by: Bruce Richardson <bruce.richard...@intel.com>