All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: Tatyana Nikolova
	<tatyana.e.nikolova-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	e1000-rdma-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH RFC rdma-core 1/3] util: Add common code for provider debug
Date: Tue, 17 Jan 2017 13:47:41 -0700	[thread overview]
Message-ID: <20170117204741.GG27528@obsidianresearch.com> (raw)
In-Reply-To: <1484682413-56580-1-git-send-email-tatyana.e.nikolova-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

> +++ b/buildlib/rdma_functions.cmake
> @@ -6,7 +6,7 @@
>  # Global list of pairs of (SHARED STATIC) libary target names
>  set(RDMA_STATIC_LIBS "" CACHE INTERNAL "Doc" FORCE)
>  
> -set(COMMON_LIBS_PIC ccan_pic)
> +set(COMMON_LIBS_PIC ccan_pic util_pic)
>  set(COMMON_LIBS ccan)

Also change COMMON_LIBS to have util

>  # Install a symlink during 'make install'
> diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt
> index 1cda890..fb36103 100644
> +++ b/util/CMakeLists.txt
> @@ -1,3 +1,11 @@
>  publish_internal_headers(util
>    compiler.h
> +  dbg.h
>    )
> +
> +set(C_FILES
> +  dbg.c
> +  )
> +
> +add_library(util_pic ${C_FILES})

Use these two lines instead:

add_library(util STATIC ${C_FILES})
add_library(util_pic STATIC ${C_FILES})

> +#define VERBS_PROVIDER_DBG_MASK  "VERBS_PROVIDER_DBG_MASK"
> +#define VERBS_PROVIDER_DBG_LEVEL "VERBS_PROVIDER_DBG_LEVEL"
> +#define VERBS_PROVIDER_DBG_FILE  "VERBS_PROVIDER_DBG_FILE"

Probably don't need these as #defines

> +#define PRINT_ERR(fmt, ...)								\
> +do {											\
> +	fprintf(stderr, "[%s:%d]" fmt, __func__, __LINE__, ##__VA_ARGS__);		\
> +} while (0)
> +
> +#define PRINT_DBG(dbg_mask, dbg_level, fmt, ...)					\
> +do {											\
> +	if ((rdma_dbg_mask & dbg_mask) && (rdma_dbg_level >= dbg_level))		\
> +		fprintf(stderr, "[%s:%d]" fmt, __func__, __LINE__, ##__VA_ARGS__);	\
> +} while (0)

This could just be LOG_DBG(stderr, ....)

> +
> +#define LOG_DBG(dbg_fp, dbg_mask, dbg_level, fmt, ...)					\
> +do {											\
> +	if ((rdma_dbg_mask & dbg_mask) && (rdma_dbg_level >= dbg_level))		\
> +		fprintf(dbg_fp, "[%s:%d]" fmt, __func__, __LINE__, ##__VA_ARGS__);	\
> +} while (0)
> +
> +#define LOG_DBG_FLUSH(dbg_fp, dbg_mask, dbg_level, fmt, ...)				\
> +do {											\
> +		LOG_DBG(dbg_fp, dbg_mask, dbg_level, fmt, ##__VA_ARGS__);		\
> +		if (dbg_fp != stderr)							\
> +			fflush(dbg_fp);							\
> +} while (0)

Hum, wondering if it is worth retaining this FLUSH behavior or if we
should just have a way to open the log file with line buffering?

This patch should also include man page content please.

I think people will ask for the 'MLX5_DEBUG' style total compile out.
Should we have a --with-debug-log cmake option and disable it by
default?

'setup_debug' should probably happen someplace in verbs, not be in
every driver.

Otherwise looks essentially reasonable to me.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-01-17 20:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-17 19:46 [PATCH RFC rdma-core 1/3] util: Add common code for provider debug Tatyana Nikolova
     [not found] ` <1484682413-56580-1-git-send-email-tatyana.e.nikolova-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-01-17 20:47   ` Jason Gunthorpe [this message]
2017-01-18  5:31   ` Leon Romanovsky
     [not found]     ` <20170118053130.GS32481-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-01-18 16:44       ` Jason Gunthorpe
     [not found]         ` <20170118164444.GA14198-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-01-18 18:31           ` Leon Romanovsky
     [not found]             ` <20170118183104.GH32481-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-01-18 18:44               ` Jason Gunthorpe
     [not found]                 ` <20170118184411.GA5020-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-01-19  8:09                   ` Leon Romanovsky
     [not found]                     ` <20170119080924.GM32481-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-01-19 17:58                       ` Jason Gunthorpe
     [not found]                         ` <20170119175838.GC8109-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-01-22  8:11                           ` Leon Romanovsky
2017-01-18 15:41   ` Yishai Hadas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170117204741.GG27528@obsidianresearch.com \
    --to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=e1000-rdma-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=tatyana.e.nikolova-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.