kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* dumping large buffers to file
@ 2015-11-24  6:30 Ramon Fried
  2015-11-24 15:35 ` Nick Krause
  2015-11-24 16:17 ` Valdis.Kletnieks at vt.edu
  0 siblings, 2 replies; 3+ messages in thread
From: Ramon Fried @ 2015-11-24  6:30 UTC (permalink / raw)
  To: kernelnewbies

Hi.
I'm currently debugging a ISP DMA issue in a kernel module.
For debugging, I would like to dump buffers to a file on run time.
The buffers are quite big, 1MB at least.
As saving a file directly from kernel is discouraged, is there any available framework for doing such a thing ?
I can think of numerous ways of transferring the buffer to user space and saving it by a dedicated user process (Netlink, sysfs, char device, etc.)

I just don't want to invent the wheel. How do you do it ?

Thanks.
Ramon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20151124/2f6caeec/attachment.html 

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

* dumping large buffers to file
  2015-11-24  6:30 dumping large buffers to file Ramon Fried
@ 2015-11-24 15:35 ` Nick Krause
  2015-11-24 16:17 ` Valdis.Kletnieks at vt.edu
  1 sibling, 0 replies; 3+ messages in thread
From: Nick Krause @ 2015-11-24 15:35 UTC (permalink / raw)
  To: kernelnewbies

On Tue, Nov 24, 2015 at 1:30 AM, Ramon Fried <ramon.fried@tandemg.com> wrote:
> Hi.
>
> I'm currently debugging a ISP DMA issue in a kernel module.
>
> For debugging, I would like to dump buffers to a file on run time.
>
> The buffers are quite big, 1MB at least.
>
> As saving a file directly from kernel is discouraged, is there any available
> framework for doing such a thing ?
>
> I can think of numerous ways of transferring the buffer to user space and
> saving it by a dedicated user process (Netlink, sysfs, char device, etc.)
>

>
> I just don't want to invent the wheel. How do you do it ?
>
>
>
> Thanks.
>
> Ramon
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
If you can use printk just switch the log level to a log level that
prints to the syslog buffer
for kernel messages. If you have enough space on your partition for
root this shouldn't
be a problem, however if it is them I would recommend sysfs or procfs
exporting as
there better suited for debugging as the others are for user space
applications needing
access to kernel resources indirectly  or device driver user space interaction.
Hope this Helps,
Nick

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

* dumping large buffers to file
  2015-11-24  6:30 dumping large buffers to file Ramon Fried
  2015-11-24 15:35 ` Nick Krause
@ 2015-11-24 16:17 ` Valdis.Kletnieks at vt.edu
  1 sibling, 0 replies; 3+ messages in thread
From: Valdis.Kletnieks at vt.edu @ 2015-11-24 16:17 UTC (permalink / raw)
  To: kernelnewbies

On Tue, 24 Nov 2015 06:30:22 +0000, Ramon Fried said:

> I'm currently debugging a ISP DMA issue in a kernel module.
> For debugging, I would like to dump buffers to a file on run time.
> The buffers are quite big, 1MB at least.

The *other* question is how *often* you plan to do this.  Doing it
once a second is one thing, doing it once a millisecond is another.

> I can think of numerous ways of transferring the buffer to user space and
> saving it by a dedicated user process (Netlink, sysfs, char device, etc.)

sysfs is probably a bad choice due to its 'one attribute per file' rule,
debugfs would be a better approach.  netlink is probably an option, and
it's hard to argue with the simplicity of a char device with a plain
old 'tail -f /dev/my-debug-file > /tmp/debug.out' or similar...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20151124/eb0537a0/attachment.bin 

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

end of thread, other threads:[~2015-11-24 16:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-24  6:30 dumping large buffers to file Ramon Fried
2015-11-24 15:35 ` Nick Krause
2015-11-24 16:17 ` Valdis.Kletnieks at vt.edu

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