On Fri, Mar 3, 2023 at 4:53 PM Andreas Gruenbacher <agrue...@redhat.com> wrote:
> diff --git a/dlm_controld/plock.c b/dlm_controld/plock.c
> index 39bdd1f6..588bcaaa 100644
> --- a/dlm_controld/plock.c
> +++ b/dlm_controld/plock.c
> @@ -8,6 +8,7 @@
>
>  #include "dlm_daemon.h"
>  #include <linux/dlm_plock.h>
> +#include <sys/sdt.h>
>
>  /* FIXME: remove this once everyone is using the version of
>   * dlm_plock.h which defines it */
> @@ -211,6 +212,11 @@ static uint64_t dt_usec(const struct timeval *start, 
> const struct timeval *stop)
>  static void plock_print_start_waiter(const struct lockspace *ls,
>                                      struct lock_waiter *w)
>  {
> +       const struct dlm_plock_info *info = &w->info;
> +
> +       DTRACE_PROBE7(dlm_controld, plock_wait_begin, info->number, w, 
> info->start,
> +                     info->end, info->nodeid, info->pid, info->owner);
> +
>         log_plock(ls, "state waiter start %llx %p %llx-%llx %d/%u/%llx",
>                   (unsigned long long)w->info.number,
>                   w,

An additional question I have about those events is which information
to log. We need to be able to identify which inode the request is for
(info->number), the locking range (info->start and info->end), whether
it is read or write lock, and which context in the kernel the request
refers to (this seems to be info->owner, but I'm not entirely sure
about that). The pid may be interesting as well, but are w or
info->nodeid really useful? We should try to avoid exposing
unnecessary implementation details like the addresses of objects
inside dlm_controld.

> @@ -223,6 +229,10 @@ static void plock_print_start_waiter(const struct 
> lockspace *ls,
>  static void plock_print_end_waiter(const struct lockspace *ls,
>                                    const struct lock_waiter *w)
>  {
> +       const struct dlm_plock_info *info = &w->info;
> +
> +       DTRACE_PROBE2(dlm_controld, plock_wait_end, info->number, w);
> +
>         log_plock(ls, "state waiter end %llx %p",
>                   (unsigned long long)w->info.number, w);
>  }
> @@ -230,6 +240,9 @@ static void plock_print_end_waiter(const struct lockspace 
> *ls,
>  static void plock_print_start_plock(const struct lockspace *ls, uint64_t 
> number,
>                                     const struct posix_lock *po)
>  {
> +       DTRACE_PROBE8(dlm_controld, plock_lock_begin, number, po, po->ex, 
> po->start,
> +                     po->end, po->nodeid, po->pid, po->owner);
> +
>         log_plock(ls, "state plock start %llx %p %s %llx-%llx %d/%u/%llx",
>                   (unsigned long long)number,
>                   po,
> @@ -243,6 +256,8 @@ static void plock_print_start_plock(const struct 
> lockspace *ls, uint64_t number,
>  static void plock_print_end_plock(const struct lockspace *ls, uint64_t 
> number,
>                                   const struct posix_lock *po)
>  {
> +       DTRACE_PROBE1(dlm_controld, pock_lock_end, po);
> +
>         log_plock(ls, "state plock end %llx %p",
>                   (unsigned long long)number, po);
>  }
> --
> 2.39.0
>

Thanks,
Andreas

Reply via email to