From: Patrick McHardy <kaber@trash.net>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: Re: af_packet.c flush_dcache_page
Date: Thu, 01 Nov 2007 17:10:32 +0100 [thread overview]
Message-ID: <4729FA78.5040702@trash.net> (raw)
In-Reply-To: <20071031.155749.26538335.davem@davemloft.net>
David Miller wrote:
> Instead of answering your questions, I'm going to show you
> how to avoid having to do any of this cache flushing crap :-)
>
> You can avoid having to flush anything as long as the virtual
> addresses on the kernel side are modulo SHMLBA the virtual addresses
> on the userland side.
>
> We have some (decidedly awkward) mechanisms to try and achieve
> this in the kernel, but they are cumbersome and not air tight.
>
> Instead, I would recommend simply that you access the ring
> buffer directly in userspace. This avoids all of the cache
> aliasing issues.
>
> Yes, this means you have to do the ring buffer accesses in
> the context of the user, but it simplifies so much that I think
> it'd be worth it.
I'm probably misunderstanding your suggestion because of my
limited mm knowledge, are you suggesting to do something like
this:
setsockopt(RX_RING, ...):
Allocate ring using get_user_pages, return address to user
tpacket_rcv/netlink_unicast/netlink_broadcast:
for each receiver:
switch_mm(...)
copy data to ring
switch_mm(original mm)
Would this work in softirq context?
> Another option is to use the "copy_to_user_page()" and
> "copy_from_user_page()" interfaces which will do all of
> the necessary cache flushing for you.
>
> Actually it might be nice to convert AF_PACKET's mmap() code
> over to using those things.
That would also require to do the copy in the context of
the user, right?
next prev parent reply other threads:[~2007-11-01 16:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-31 14:08 af_packet.c flush_dcache_page Patrick McHardy
2007-10-31 22:57 ` David Miller
2007-11-01 16:10 ` Patrick McHardy [this message]
2007-11-01 16:27 ` Evgeniy Polyakov
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=4729FA78.5040702@trash.net \
--to=kaber@trash.net \
--cc=davem@davemloft.net \
--cc=netdev@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;
as well as URLs for NNTP newsgroup(s).