|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH 2/2] lib/uklock: Disable debug logging for semaphores
When debug logging is enabled, semaphores messages logging can get very
aggressive and flood the output, therefore we leave them disabled by
default. One has to explicitly enable logging again by defining
UK_SEMAPHORE_DEBUG when investigating issues like deadlocks.
Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
lib/uklock/include/uk/semaphore.h | 10 ++++++++++
lib/uklock/semaphore.c | 2 ++
2 files changed, 12 insertions(+)
diff --git a/lib/uklock/include/uk/semaphore.h
b/lib/uklock/include/uk/semaphore.h
index 2513d441..2e82b10f 100644
--- a/lib/uklock/include/uk/semaphore.h
+++ b/lib/uklock/include/uk/semaphore.h
@@ -65,7 +65,9 @@ static inline void uk_semaphore_down(struct uk_semaphore *s)
ukplat_lcpu_restore_irqf(irqf);
}
--s->count;
+#ifdef UK_SEMAPHORE_DEBUG
uk_pr_debug("Decreased semaphore %p to %ld\n", s, s->count);
+#endif
ukplat_lcpu_restore_irqf(irqf);
}
@@ -80,8 +82,10 @@ static inline int uk_semaphore_down_try(struct uk_semaphore
*s)
if (s->count > 0) {
ret = 1;
--s->count;
+#ifdef UK_SEMAPHORE_DEBUG
uk_pr_debug("Decreased semaphore %p to %ld\n",
s, s->count);
+#endif
}
ukplat_lcpu_restore_irqf(irqf);
return ret;
@@ -109,14 +113,18 @@ static inline __nsec uk_semaphore_down_to(struct
uk_semaphore *s,
}
if (s->count > 0) {
s->count--;
+#ifdef UK_SEMAPHORE_DEBUG
uk_pr_debug("Decreased semaphore %p to %ld\n",
s, s->count);
+#endif
ukplat_lcpu_restore_irqf(irqf);
return ukplat_monotonic_clock() - then;
}
ukplat_lcpu_restore_irqf(irqf);
+#ifdef UK_SEMAPHORE_DEBUG
uk_pr_debug("Timed out while waiting for semaphore %p\n", s);
+#endif
return __NSEC_MAX;
}
@@ -128,8 +136,10 @@ static inline void uk_semaphore_up(struct uk_semaphore *s)
irqf = ukplat_lcpu_save_irqf();
++s->count;
+#ifdef UK_SEMAPHORE_DEBUG
uk_pr_debug("Increased semaphore %p to %ld\n",
s, s->count);
+#endif
uk_waitq_wake_up(&s->wait);
ukplat_lcpu_restore_irqf(irqf);
}
diff --git a/lib/uklock/semaphore.c b/lib/uklock/semaphore.c
index c9747100..5b182359 100644
--- a/lib/uklock/semaphore.c
+++ b/lib/uklock/semaphore.c
@@ -5,6 +5,8 @@ void uk_semaphore_init(struct uk_semaphore *s, long count)
s->count = count;
uk_waitq_init(&s->wait);
+#ifdef UK_SEMAPHORE_DEBUG
uk_pr_debug("Initialized semaphore %p with %ld\n",
s, s->count);
+#endif
}
--
2.11.0
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |