* vmsplice bad address
@ 2011-03-03 13:01 Guillaume Dargaud
2011-03-07 9:35 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 3+ messages in thread
From: Guillaume Dargaud @ 2011-03-03 13:01 UTC (permalink / raw)
To: Linuxppc-dev
Hello all,
I'm trying to use the vmsplice/splice combination to so socket writes in zero-copy mode since it seems to be the big
bottle neck in my application.
Here's a simplified code:
// This buffer is actually outside kernel space,
// in reserved contiguous physical memory (custom kernel compilation)
#define BUFFER_PHY_BASE 0x7000000
#define BUFFER_SIZE 0x1000000
memfd=open("/dev/mem", O_RDWR | O_SYNC)
Base=(unsigned char*)mmap(0, BUFFER_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, memfd, BUFFER_PHY_BASE);
sockfd = socket(AF_INET, SOCK_STREAM, 0)
int pfd[2]; pipe(pfd);
struct iovec iov;
iov.iov_base=Base;
iov.iov_len=BUFFER_SIZE;
printf("Pipe %d/%d, base:0x%x, size:0x%x\n", pfd[0], pfd[1], iov.iov_base, iov.iov_len);
vmsplice(pfd[1], &iov, 1, SPLICE_F_GIFT)
splice(pfd[0], NULL, sockfd, NULL, BUFFER_SIZE, SPLICE_F_MOVE)
I get the following:
Pipe 6/7, base:0x480cf000, size:0x1000000
vmsplice: Bad address
Any idea what is wrong in my use of vmsplice ?
Thanks
--
Guillaume Dargaud
http://www.gdargaud.net/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: vmsplice bad address
2011-03-03 13:01 vmsplice bad address Guillaume Dargaud
@ 2011-03-07 9:35 ` Benjamin Herrenschmidt
2011-03-24 14:34 ` Guillaume Dargaud
0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2011-03-07 9:35 UTC (permalink / raw)
To: Guillaume Dargaud; +Cc: Linuxppc-dev
On Thu, 2011-03-03 at 14:01 +0100, Guillaume Dargaud wrote:
> Hello all,
> I'm trying to use the vmsplice/splice combination to so socket writes in zero-copy mode since it seems to be the big
> bottle neck in my application.
>
> Here's a simplified code:
>
> // This buffer is actually outside kernel space,
> // in reserved contiguous physical memory (custom kernel compilation)
> #define BUFFER_PHY_BASE 0x7000000
> #define BUFFER_SIZE 0x1000000
> memfd=open("/dev/mem", O_RDWR | O_SYNC)
> Base=(unsigned char*)mmap(0, BUFFER_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, memfd, BUFFER_PHY_BASE);
>
> sockfd = socket(AF_INET, SOCK_STREAM, 0)
>
> int pfd[2]; pipe(pfd);
>
> struct iovec iov;
> iov.iov_base=Base;
> iov.iov_len=BUFFER_SIZE;
> printf("Pipe %d/%d, base:0x%x, size:0x%x\n", pfd[0], pfd[1], iov.iov_base, iov.iov_len);
> vmsplice(pfd[1], &iov, 1, SPLICE_F_GIFT)
> splice(pfd[0], NULL, sockfd, NULL, BUFFER_SIZE, SPLICE_F_MOVE)
>
> I get the following:
> Pipe 6/7, base:0x480cf000, size:0x1000000
> vmsplice: Bad address
>
>
> Any idea what is wrong in my use of vmsplice ?
I'm not completely surprised ... I wouldn't expect vmsplice to work
on /dev/mem ... No struct page backing the memory for example.
Ben.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: vmsplice bad address
2011-03-07 9:35 ` Benjamin Herrenschmidt
@ 2011-03-24 14:34 ` Guillaume Dargaud
0 siblings, 0 replies; 3+ messages in thread
From: Guillaume Dargaud @ 2011-03-24 14:34 UTC (permalink / raw)
To: linuxppc-dev
On Monday 07 March 2011 10:35:44 Benjamin Herrenschmidt wrote:
> I'm not completely surprised ... I wouldn't expect vmsplice to work
> on /dev/mem ... No struct page backing the memory for example.
So how would that work to do zero-copy ?
Somebody gave me a hint of marking the memory regions as iomem, do a ioremap then mmap and vmsplice but that's a
mouthful...
--
Guillaume Dargaud
http://www.gdargaud.net/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-03-24 14:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-03 13:01 vmsplice bad address Guillaume Dargaud
2011-03-07 9:35 ` Benjamin Herrenschmidt
2011-03-24 14:34 ` Guillaume Dargaud
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).