[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


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Mon, 11 Mar 2019 18:28:42 +0200
  • Cc: Florian.Schmidt@xxxxxxxxx, simon.kuenzer@xxxxxxxxx, yuri.volchkov@xxxxxxxxx, sharan.santhanam@xxxxxxxxx
  • Delivery-date: Mon, 11 Mar 2019 16:29:00 +0000
  • Ironport-phdr: 9a23:lqkrFxxpmGSUnCLXCy+O+j09IxM/srCxBDY+r6Qd0uoWKPad9pjvdHbS+e9qxAeQG9mCs7Qc0qL/iOPJYSQ4+5GPsXQPItRndiQuroEopTEmG9OPEkbhLfTnPGQQFcVGU0J5rTngaRAGUMnxaEfPrXKs8DUcBgvwNRZvJuTyB4Xek9m72/q99pHOfwlEniaxba5vJxiqsAvdsdUbj5F/Iagr0BvJpXVIe+VSxWx2IF+Yggjx6MSt8pN96ipco/0u+dJOXqX8ZKQ4UKdXDC86PGAv5c3krgfMQA2S7XYBSGoWkx5IAw/Y7BHmW5r6ryX3uvZh1CScIMb7S60/Vza/4KdxUBLmiDkJOSM3/m/UjcJ/jqxbrQm9qxBj2YPYfJuYOOZicq7bYNgURXBBXsFUVyFZHI68aJAPD/YAPeZesoLzoUYOrQOjBQKxA+7g1jhIhmTq3a071eQtCwXG3BE4H9ITq3nbsM71OL0KUeCo16bE1y/Db/RP1Dr79YPGcQghrOmRUb9/bMbd00oiGgPfglmOt4DoPSmZ2+oVv2SG4OdsSPijhm0npg1rvDSiyMkhhpPUio8a1FzJ8zhyzpwvKt2iUkF7ZMapEJ5Xty6HKYR7WtgiQ2R0uCYizb0GpIK7cDAKyJs5wx7fbOSKc5aN4h35VeaRJS10i25+eL6lnxay7FOvxvfmVsmzyFpKryxFncfQtn0VyhDe5dWLRuF+80qhwzqDyR7f5+NeLU06jabbLoQuwr80lpodq0TDGSr2lV3qg6+RbUUk5umo6+L9brXiu5+cL5J0hxriPaQ1gMC/Gfk4PRMUU2iB/uSwzKfj8lHhQLVWkv02lbHUsJXbJcQdp665BBRV3p8+5BmhETepztAYkGIDLFJEYxKHk5PpN0vBIf/mC/ezmVOskC1kx/reJL3uHo3NLmTfkLfmZbtz60pcyA0pzdBe/Z1UDKsNLu/vVU/xsdzYDwI2MxCvzubhFtpyyoceVniUDaODLqzSrEeC5vgzLOmUeI8VpDH9JuA+5/7ul3A5g0USfa+z0ZsMcn+4GOhmI0WDbnrqmNgBFHwHvgwgQ+P2jF2NSyVca2ysUKIh/js7Ep6pDZ/fRoCxh7yMxDy7HpxTZmBBDFCAC3Tod5iaVPcKaSOdPNVhnycCVbe/V4Ah0QuhuxTgx7V5M+re4jcYuo771Nhp++3Tkgk/9DxpD8SH0mGBVX90nmQMRzAq3KB/okt9ykmY3Kh+nfNXCdhT6OlSXQsgK5Hc0r8yN9enXwPHf9CSDVqrXNiiKTUwVc4qhc8DZQB6AdrxoArE2n+BBKQJlrrDIIEs7+qI1H/qO8d7jXLbzLQJhEJgWtZFc3eh0P0svzPPDpLExh3K352hcr4RiXbA
  • Ironport-sdr: z9ZtrE0jJOeNX1FAnL8m8Nz+16E13ue/yKcZma47EzZzISyg72FkllUhPxT6KJiYYAIGW5g74W Nzc8y/ZGVitw==
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.