From: Steve Rottinger <steve@pentek.com>
To: Jens Axboe <jens.axboe@oracle.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: splice methods in character device driver
Date: Wed, 13 May 2009 12:59:14 -0400 [thread overview]
Message-ID: <4A0AFC62.3090002@pentek.com> (raw)
In-Reply-To: <20090511192253.GH4694@kernel.dk>
Thanks! This really helped me to progress using this interface. My
current problem
is passing in the pages into splice_to_pipe. The pages are associated
with a PCI BAR,
not main memory. I'm wondering if this could be a problem? Within my
driver, I use
ioremap() to map in the desired PCI BAR space; then, use virt_to_page()
to generate the
page table, based on the address returned from ioremap(). I can see
the correct pages
being received on the other end (by instrumenting the splice_to_file()
routine). However,
the data in the resulting outfile does not match the data contained
within in my PCI BAR. I
see that splice_to_file() uses kmap_atomic() to mapping in the page,
before performing a
memcpy. Is this going to be valid on an page that doesn't reside in
main memory?
Jens Axboe wrote:
> On Mon, May 11 2009, Steve Rottinger wrote:
>
>> Hi,
>>
>> Has anyone successfully implemented the splice() method's in a character
>> device driver?
>> I'm having a tough time finding any existing drivers that implement
>> these method's, which
>> I can use as an example. Specifically, it is unclear to me, as to how I
>> need to set up .ops
>> in the splice_pipe_desc, when using splice_to_pipe().
>> My ultimate goal is to use splice to move data from a high speed data
>> acquisition device,
>> which has a buffer in PCI space to disk without the need for going
>> through block memory.
>>
>
> I implemented ->splice_write() for /dev/null for testing purposes, but I
> doubt that you'll find much inspiration there.
>
> To use splice_to_pipe(), basically all you need to do is provide some
> way of stuffing the data pages in question into a struct page *pages[].
> See fs/splice.c:vmsplice_to_pipe(), for instance. Then you need to
> provide a way to ensure that these pages can be settled if they need to
> be accessed. Splice doesn't require that the IO is completed on the
> pages before they are put in the pipe, that's part of the power of the
> design. So if your design is allocating the pages in the ->splice_read()
> handler and initiating IO to these pages, then you need to provide a
> suitable ->confirm() hook that can wait on this IO to complete if
> needed. ->map() and ->unmap() can typically use the generic functions,
> ditto ->release(). You can implement ->steal() easily if you use the
> method of dynamically allocating pages for each IO instead of reusing
> them.
>
> So it should not be very hard, your best inspiration is likely to be
> found in fs/splice.c itself.
>
>
next prev parent reply other threads:[~2009-05-13 16:59 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-11 14:40 splice methods in character device driver Steve Rottinger
2009-05-11 19:22 ` Jens Axboe
2009-05-13 16:59 ` Steve Rottinger [this message]
2009-06-03 21:32 ` Leon Woestenberg
2009-06-04 7:32 ` Jens Axboe
2009-06-04 13:20 ` Steve Rottinger
2009-06-12 19:21 ` Leon Woestenberg
2009-06-12 19:59 ` Jens Axboe
2009-06-12 20:45 ` Steve Rottinger
2009-06-16 11:59 ` Jens Axboe
2009-06-16 15:06 ` Steve Rottinger
2009-06-16 18:24 ` [RFC][PATCH] add support for shrinking/growing a pipe (Was "Re: splice methods in character device driver") Jens Axboe
2009-06-16 18:28 ` splice methods in character device driver Jens Axboe
2009-06-06 21:25 ` Leon Woestenberg
2009-06-08 7:05 ` Jens Axboe
2009-06-12 22:05 ` Leon Woestenberg
2009-06-13 7:26 ` Jens Axboe
2009-06-13 20:04 ` Leon Woestenberg
2009-06-16 11:57 ` Jens Axboe
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=4A0AFC62.3090002@pentek.com \
--to=steve@pentek.com \
--cc=jens.axboe@oracle.com \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox