* [dpdk-dev] [PATCH] examples/distributor: fix missing "; " in debug macro
@ 2015-06-05 16:01 Bruce Richardson
2015-06-05 20:45 ` Thomas Monjalon
2015-06-22 20:36 ` Thomas Monjalon
0 siblings, 2 replies; 7+ messages in thread
From: Bruce Richardson @ 2015-06-05 16:01 UTC (permalink / raw)
To: dev
The macro to turn on additional debug output when the app was compiled
with "-DDEBUG" was missing a ";".
Fixes: 07db4a975094 ("examples/distributor: new sample app")
Signed-off-by: Anbarasan Murugesan <anbarasanx.murugesan@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
examples/distributor/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/distributor/main.c b/examples/distributor/main.c
index ae3e7b3..972bddb 100644
--- a/examples/distributor/main.c
+++ b/examples/distributor/main.c
@@ -57,7 +57,7 @@
#ifdef DEBUG
#define LOG_LEVEL RTE_LOG_DEBUG
#define LOG_DEBUG(log_type, fmt, args...) do { \
- RTE_LOG(DEBUG, log_type, fmt, ##args) \
+ RTE_LOG(DEBUG, log_type, fmt, ##args); \
} while (0)
#else
#define LOG_LEVEL RTE_LOG_INFO
--
2.4.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH] examples/distributor: fix missing "; " in debug macro
2015-06-05 16:01 [dpdk-dev] [PATCH] examples/distributor: fix missing "; " in debug macro Bruce Richardson
@ 2015-06-05 20:45 ` Thomas Monjalon
2015-06-08 10:58 ` Bruce Richardson
2015-06-22 20:36 ` Thomas Monjalon
1 sibling, 1 reply; 7+ messages in thread
From: Thomas Monjalon @ 2015-06-05 20:45 UTC (permalink / raw)
To: dev
2015-06-05 17:01, Bruce Richardson:
> The macro to turn on additional debug output when the app was compiled
> with "-DDEBUG" was missing a ";".
It shows that such dead code is almost never tested.
It would be saner if this command would return no result:
git grep 'ifdef.*DEBUG' examples
examples/distributor/main.c:#ifdef DEBUG
examples/l3fwd-acl/main.c:#ifdef L3FWDACL_DEBUG
examples/l3fwd-acl/main.c:#ifdef L3FWDACL_DEBUG
examples/l3fwd-acl/main.c:#ifdef L3FWDACL_DEBUG
examples/l3fwd-acl/main.c:#ifdef L3FWDACL_DEBUG
examples/packet_ordering/main.c:#ifdef DEBUG
examples/vhost/main.c:#ifdef DEBUG
examples/vhost/main.h:#ifdef DEBUG
examples/vhost_xen/main.c:#ifdef DEBUG
examples/vhost_xen/main.h:#ifdef DEBUG
There is no good reason to not use CONFIG_RTE_LOG_LEVEL to trigger debug build.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH] examples/distributor: fix missing "; " in debug macro
2015-06-05 20:45 ` Thomas Monjalon
@ 2015-06-08 10:58 ` Bruce Richardson
2015-06-10 0:33 ` Stephen Hemminger
2015-06-22 20:53 ` Thomas Monjalon
0 siblings, 2 replies; 7+ messages in thread
From: Bruce Richardson @ 2015-06-08 10:58 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
On Fri, Jun 05, 2015 at 10:45:04PM +0200, Thomas Monjalon wrote:
> 2015-06-05 17:01, Bruce Richardson:
> > The macro to turn on additional debug output when the app was compiled
> > with "-DDEBUG" was missing a ";".
>
> It shows that such dead code is almost never tested.
> It would be saner if this command would return no result:
> git grep 'ifdef.*DEBUG' examples
> examples/distributor/main.c:#ifdef DEBUG
> examples/l3fwd-acl/main.c:#ifdef L3FWDACL_DEBUG
> examples/l3fwd-acl/main.c:#ifdef L3FWDACL_DEBUG
> examples/l3fwd-acl/main.c:#ifdef L3FWDACL_DEBUG
> examples/l3fwd-acl/main.c:#ifdef L3FWDACL_DEBUG
> examples/packet_ordering/main.c:#ifdef DEBUG
> examples/vhost/main.c:#ifdef DEBUG
> examples/vhost/main.h:#ifdef DEBUG
> examples/vhost_xen/main.c:#ifdef DEBUG
> examples/vhost_xen/main.h:#ifdef DEBUG
>
> There is no good reason to not use CONFIG_RTE_LOG_LEVEL to trigger debug build.
>
I agree and disagree.
I agree it would be good if we had a standard way of setting up
a DEBUG build that would make it easier to test and pick up on this sort of things.
I disagree that the compile time log level is the way to do this. The log level
at compile time specifies the default log level only, the actual log level is
controllable at runtime. Having the default log level also affect what kind of
build is done, e.g. with -O0 rather than -O3, introduces an unnecessary dependency.
Setting the default log level to 5 and changing it to 9 at runtime should be
the same as setting the default to 9.
/Bruce
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH] examples/distributor: fix missing "; " in debug macro
2015-06-08 10:58 ` Bruce Richardson
@ 2015-06-10 0:33 ` Stephen Hemminger
2015-06-22 20:53 ` Thomas Monjalon
1 sibling, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2015-06-10 0:33 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev
On Mon, 8 Jun 2015 11:58:10 +0100
Bruce Richardson <bruce.richardson@intel.com> wrote:
> On Fri, Jun 05, 2015 at 10:45:04PM +0200, Thomas Monjalon wrote:
> > 2015-06-05 17:01, Bruce Richardson:
> > > The macro to turn on additional debug output when the app was compiled
> > > with "-DDEBUG" was missing a ";".
> >
> > It shows that such dead code is almost never tested.
> > It would be saner if this command would return no result:
> > git grep 'ifdef.*DEBUG' examples
> > examples/distributor/main.c:#ifdef DEBUG
> > examples/l3fwd-acl/main.c:#ifdef L3FWDACL_DEBUG
> > examples/l3fwd-acl/main.c:#ifdef L3FWDACL_DEBUG
> > examples/l3fwd-acl/main.c:#ifdef L3FWDACL_DEBUG
> > examples/l3fwd-acl/main.c:#ifdef L3FWDACL_DEBUG
> > examples/packet_ordering/main.c:#ifdef DEBUG
> > examples/vhost/main.c:#ifdef DEBUG
> > examples/vhost/main.h:#ifdef DEBUG
> > examples/vhost_xen/main.c:#ifdef DEBUG
> > examples/vhost_xen/main.h:#ifdef DEBUG
> >
> > There is no good reason to not use CONFIG_RTE_LOG_LEVEL to trigger debug build.
> >
> I agree and disagree.
>
> I agree it would be good if we had a standard way of setting up
> a DEBUG build that would make it easier to test and pick up on this sort of things.
>
> I disagree that the compile time log level is the way to do this. The log level
> at compile time specifies the default log level only, the actual log level is
> controllable at runtime. Having the default log level also affect what kind of
> build is done, e.g. with -O0 rather than -O3, introduces an unnecessary dependency.
> Setting the default log level to 5 and changing it to 9 at runtime should be
> the same as setting the default to 9.
>
> /Bruce
One good way is to use something like:
#ifdef DEBUG
#define LOG_DEBUG(log_type, fmt, args...) do { \
- RTE_LOG(DEBUG, log_type, fmt, ##args) \
+ RTE_LOG(DEBUG, log_type, fmt, ##args); \
} while (0)
#else
#define LOG_LEVEL RTE_LOG_INFO
#define LOG_DEBUG(log_type, fmt, args...) if (0) { \
RTE_LOG(DEBUG, log_type, fmt, ##args); \
} else
#endif
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH] examples/distributor: fix missing "; " in debug macro
2015-06-08 10:58 ` Bruce Richardson
2015-06-10 0:33 ` Stephen Hemminger
@ 2015-06-22 20:53 ` Thomas Monjalon
2015-06-23 16:00 ` Bruce Richardson
1 sibling, 1 reply; 7+ messages in thread
From: Thomas Monjalon @ 2015-06-22 20:53 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev
2015-06-08 11:58, Bruce Richardson:
> On Fri, Jun 05, 2015 at 10:45:04PM +0200, Thomas Monjalon wrote:
> > It shows that such dead code is almost never tested.
> > It would be saner if this command would return no result:
> > git grep 'ifdef.*DEBUG' examples
> > examples/distributor/main.c:#ifdef DEBUG
> > examples/l3fwd-acl/main.c:#ifdef L3FWDACL_DEBUG
> > examples/l3fwd-acl/main.c:#ifdef L3FWDACL_DEBUG
> > examples/l3fwd-acl/main.c:#ifdef L3FWDACL_DEBUG
> > examples/l3fwd-acl/main.c:#ifdef L3FWDACL_DEBUG
> > examples/packet_ordering/main.c:#ifdef DEBUG
> > examples/vhost/main.c:#ifdef DEBUG
> > examples/vhost/main.h:#ifdef DEBUG
> > examples/vhost_xen/main.c:#ifdef DEBUG
> > examples/vhost_xen/main.h:#ifdef DEBUG
> >
> > There is no good reason to not use CONFIG_RTE_LOG_LEVEL to trigger debug build.
> >
> I agree and disagree.
>
> I agree it would be good if we had a standard way of setting up
> a DEBUG build that would make it easier to test and pick up on this sort of things.
>
> I disagree that the compile time log level is the way to do this. The log level
> at compile time specifies the default log level only, the actual log level is
> controllable at runtime. Having the default log level also affect what kind of
> build is done, e.g. with -O0 rather than -O3, introduces an unnecessary dependency.
> Setting the default log level to 5 and changing it to 9 at runtime should be
> the same as setting the default to 9.
Setting CONFIG_RTE_LOG_LEVEL to 9 means we don't care about performance
degradation due to debug log branches. So it is necessarily a debug build.
Then the default log level must be set by the application.
The EAL default set from CONFIG_RTE_LOG_LEVEL is a last chance default in
case the application doesn't care about it.
Maybe it won't convince you but anyway, it's not important here because the
example applications don't use the DEBUG flag for anything else than the logs.
That's why I think these flags must be removed.
Please check "git grep 'ifdef.*DEBUG' examples".
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH] examples/distributor: fix missing "; " in debug macro
2015-06-22 20:53 ` Thomas Monjalon
@ 2015-06-23 16:00 ` Bruce Richardson
0 siblings, 0 replies; 7+ messages in thread
From: Bruce Richardson @ 2015-06-23 16:00 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
On Mon, Jun 22, 2015 at 10:53:25PM +0200, Thomas Monjalon wrote:
> 2015-06-08 11:58, Bruce Richardson:
> > On Fri, Jun 05, 2015 at 10:45:04PM +0200, Thomas Monjalon wrote:
> > > It shows that such dead code is almost never tested.
> > > It would be saner if this command would return no result:
> > > git grep 'ifdef.*DEBUG' examples
> > > examples/distributor/main.c:#ifdef DEBUG
> > > examples/l3fwd-acl/main.c:#ifdef L3FWDACL_DEBUG
> > > examples/l3fwd-acl/main.c:#ifdef L3FWDACL_DEBUG
> > > examples/l3fwd-acl/main.c:#ifdef L3FWDACL_DEBUG
> > > examples/l3fwd-acl/main.c:#ifdef L3FWDACL_DEBUG
> > > examples/packet_ordering/main.c:#ifdef DEBUG
> > > examples/vhost/main.c:#ifdef DEBUG
> > > examples/vhost/main.h:#ifdef DEBUG
> > > examples/vhost_xen/main.c:#ifdef DEBUG
> > > examples/vhost_xen/main.h:#ifdef DEBUG
> > >
> > > There is no good reason to not use CONFIG_RTE_LOG_LEVEL to trigger debug build.
> > >
> > I agree and disagree.
> >
> > I agree it would be good if we had a standard way of setting up
> > a DEBUG build that would make it easier to test and pick up on this sort of things.
> >
> > I disagree that the compile time log level is the way to do this. The log level
> > at compile time specifies the default log level only, the actual log level is
> > controllable at runtime. Having the default log level also affect what kind of
> > build is done, e.g. with -O0 rather than -O3, introduces an unnecessary dependency.
> > Setting the default log level to 5 and changing it to 9 at runtime should be
> > the same as setting the default to 9.
>
> Setting CONFIG_RTE_LOG_LEVEL to 9 means we don't care about performance
> degradation due to debug log branches. So it is necessarily a debug build.
> Then the default log level must be set by the application.
> The EAL default set from CONFIG_RTE_LOG_LEVEL is a last chance default in
> case the application doesn't care about it.
>
> Maybe it won't convince you but anyway, it's not important here because the
> example applications don't use the DEBUG flag for anything else than the logs.
> That's why I think these flags must be removed.
> Please check "git grep 'ifdef.*DEBUG' examples".
>
For checking if the app cares about performance, I would check the
__optimize__ define rather than having a specific DEBUG macro, or using the
DEFAULT_LOG_LEVEL setting.
/Bruce
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH] examples/distributor: fix missing "; " in debug macro
2015-06-05 16:01 [dpdk-dev] [PATCH] examples/distributor: fix missing "; " in debug macro Bruce Richardson
2015-06-05 20:45 ` Thomas Monjalon
@ 2015-06-22 20:36 ` Thomas Monjalon
1 sibling, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2015-06-22 20:36 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev
2015-06-05 17:01, Bruce Richardson:
> The macro to turn on additional debug output when the app was compiled
> with "-DDEBUG" was missing a ";".
>
> Fixes: 07db4a975094 ("examples/distributor: new sample app")
>
> Signed-off-by: Anbarasan Murugesan <anbarasanx.murugesan@intel.com>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Applied, thanks
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-06-23 16:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-05 16:01 [dpdk-dev] [PATCH] examples/distributor: fix missing "; " in debug macro Bruce Richardson
2015-06-05 20:45 ` Thomas Monjalon
2015-06-08 10:58 ` Bruce Richardson
2015-06-10 0:33 ` Stephen Hemminger
2015-06-22 20:53 ` Thomas Monjalon
2015-06-23 16:00 ` Bruce Richardson
2015-06-22 20:36 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).