[dpdk-dev] [PATCH] vhost: change mbuf allocation logs to debug

Yuanhan Liu yuanhan.liu at linux.intel.com
Thu Mar 30 03:49:34 CEST 2017

On Wed, Mar 29, 2017 at 10:45:55PM +0000, Legacy, Allain wrote:
> > -----Original Message-----
> > From: Yuanhan Liu [mailto:yuanhan.liu at linux.intel.com]
> > Sent: Wednesday, March 29, 2017 3:02 AM
> <...>
> > 
> > OTOH, it's still good to have RTE_LOG_ONCE. It explicitly tells you something
> > is wrong, then you could dump those stats for more info.
> Has the implementation of something like RTE_LOG_ONCE been discussed before?  

No. It's just something comes to my mind after saw your patch.

> Do you have a proposal on what you would find acceptable as an implementation that considers multiples threads, multiple devices, multiple logs per file, etc.?

No, that would be way to complex. Something I thought of is quite
simple (like what Linux kernel does):

	#define RTE_LOG_ONCE(...)	do {	\
		static int warned;		\
		if (!warned) {			\
			RTE_LOG(...);		\
			warned = 1;		\
		}				\
	} while (0)

And yes, I know it's far away from being perfect (and accurate, regarding
to multiple devices and so on as you mentioned). Even though, I think
it's much better than showing nothing when something goes wrong.


More information about the dev mailing list