[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT PATCH 2/2] lib/uklock: Disable debug logging for semaphores



It's fine with me. Thanks for the reviews!

Costin

On 3/13/19 1:16 PM, Yuri Volchkov wrote:
> Hi,
> 
> I will just add a few lines, to the commit message saying that our
> per-module debug message enabling does not work here because most of the
> prints are in the header files. If you do not mind.
> 
> Reviewed-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx>
> 
> Cheers, Yuri.
> 
> Costin Lupu <costin.lupu@xxxxxxxxx> writes:
> 
>> 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®.