DPDK usage discussions
 help / color / mirror / Atom feed
* [dpdk-users] Redirect DPDK log?
@ 2016-09-14 21:08 John Ousterhout
  2016-09-14 21:24 ` Matthew Hall
  0 siblings, 1 reply; 5+ messages in thread
From: John Ousterhout @ 2016-09-14 21:08 UTC (permalink / raw)
  To: users

Is there a mechanism in DPDK that can interpose on the log output? I see
the function rte_openlog_stream to specify a different FILE* for output,
but that isn't quite general enough. I'd like for a method in my
application to receive all of the log messages, so I can wrap them
appropriately and then add them to an application-specific log. Does such a
hooking mechanism exist?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-users] Redirect DPDK log?
  2016-09-14 21:08 [dpdk-users] Redirect DPDK log? John Ousterhout
@ 2016-09-14 21:24 ` Matthew Hall
  2016-09-15  0:52   ` John Ousterhout
  0 siblings, 1 reply; 5+ messages in thread
From: Matthew Hall @ 2016-09-14 21:24 UTC (permalink / raw)
  To: John Ousterhout; +Cc: users

On Wed, Sep 14, 2016 at 02:08:27PM -0700, John Ousterhout wrote:
> Is there a mechanism in DPDK that can interpose on the log output? I see
> the function rte_openlog_stream to specify a different FILE* for output,
> but that isn't quite general enough. I'd like for a method in my
> application to receive all of the log messages, so I can wrap them
> appropriately and then add them to an application-specific log. Does such a
> hooking mechanism exist?

http://www.gnu.org/software/libc/manual/html_node/String-Streams.html

Matthew.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-users] Redirect DPDK log?
  2016-09-14 21:24 ` Matthew Hall
@ 2016-09-15  0:52   ` John Ousterhout
  2016-09-15  6:49     ` Thomas Monjalon
  2016-09-15 18:06     ` Александр Киселев
  0 siblings, 2 replies; 5+ messages in thread
From: John Ousterhout @ 2016-09-15  0:52 UTC (permalink / raw)
  To: Matthew Hall; +Cc: users

At first I thought this approach (fmemopen) might work, but now I'm not so
sure. The problem is that fmemopen doesn't provide any sort of notification
when it adds data to the buffer. My application can use a polling approach
where it occasionally checks to see if data has been added, but this has a
serious flaw. Some of the DPDK functions, such as rte_eal_init, can panic
in the face of severe errors: they write information to the log and then
exit the application. In a situation like this, the application will not
have a chance to check for the log messages and relay them onto the
appropriate place, so the log data will be dropped and the application will
exit without leaving behind any information about what happened.

If there were a way to intercept calls to rte_panic, then I could take that
opportunity to flush information from the fmemopen buffer, but I don't see
a way to do that...?

-John-

On Wed, Sep 14, 2016 at 2:24 PM, Matthew Hall <mhall@mhcomputing.net> wrote:

> On Wed, Sep 14, 2016 at 02:08:27PM -0700, John Ousterhout wrote:
> > Is there a mechanism in DPDK that can interpose on the log output? I see
> > the function rte_openlog_stream to specify a different FILE* for output,
> > but that isn't quite general enough. I'd like for a method in my
> > application to receive all of the log messages, so I can wrap them
> > appropriately and then add them to an application-specific log. Does
> such a
> > hooking mechanism exist?
>
> http://www.gnu.org/software/libc/manual/html_node/String-Streams.html
>
> Matthew.
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-users] Redirect DPDK log?
  2016-09-15  0:52   ` John Ousterhout
@ 2016-09-15  6:49     ` Thomas Monjalon
  2016-09-15 18:06     ` Александр Киселев
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2016-09-15  6:49 UTC (permalink / raw)
  To: John Ousterhout; +Cc: users, Matthew Hall

Hi,

2016-09-14 17:52, John Ousterhout:
> On Wed, Sep 14, 2016 at 2:24 PM, Matthew Hall <mhall@mhcomputing.net> wrote:
> > On Wed, Sep 14, 2016 at 02:08:27PM -0700, John Ousterhout wrote:
> > > 
> > > Is there a mechanism in DPDK that can interpose on the log output? I see
> > > the function rte_openlog_stream to specify a different FILE* for output,
> > > but that isn't quite general enough. I'd like for a method in my
> > > application to receive all of the log messages, so I can wrap them
> > > appropriately and then add them to an application-specific log. Does
> > such a
> > > hooking mechanism exist?
> >
> > http://www.gnu.org/software/libc/manual/html_node/String-Streams.html
> 
> At first I thought this approach (fmemopen) might work, but now I'm not so
> sure. The problem is that fmemopen doesn't provide any sort of notification
> when it adds data to the buffer. My application can use a polling approach
> where it occasionally checks to see if data has been added, but this has a
> serious flaw. Some of the DPDK functions, such as rte_eal_init, can panic
> in the face of severe errors: they write information to the log and then
> exit the application. In a situation like this, the application will not
> have a chance to check for the log messages and relay them onto the
> appropriate place, so the log data will be dropped and the application will
> exit without leaving behind any information about what happened.
> 
> If there were a way to intercept calls to rte_panic, then I could take that
> opportunity to flush information from the fmemopen buffer, but I don't see
> a way to do that...?

The same issues were discussed here recently:
	http://dpdk.org/ml/archives/dev/2016-August/044940.html
In short, yes we should have a log hook or custom handler,
and yes, the panics/exit must be removed.

You are welcome to work on such improvement.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-users] Redirect DPDK log?
  2016-09-15  0:52   ` John Ousterhout
  2016-09-15  6:49     ` Thomas Monjalon
@ 2016-09-15 18:06     ` Александр Киселев
  1 sibling, 0 replies; 5+ messages in thread
From: Александр Киселев @ 2016-09-15 18:06 UTC (permalink / raw)
  To: John Ousterhout; +Cc: users

Hi, John.

Take a look at
http://man7.org/linux/man-pages/man3/fopencookie.3.html

2016-09-15 3:52 GMT+03:00 John Ousterhout <ouster@cs.stanford.edu>:

> At first I thought this approach (fmemopen) might work, but now I'm not so
> sure. The problem is that fmemopen doesn't provide any sort of notification
> when it adds data to the buffer.



--
Alexander Kiselev

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-09-15 18:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-14 21:08 [dpdk-users] Redirect DPDK log? John Ousterhout
2016-09-14 21:24 ` Matthew Hall
2016-09-15  0:52   ` John Ousterhout
2016-09-15  6:49     ` Thomas Monjalon
2016-09-15 18:06     ` Александр Киселев

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).