netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* af_packet.c flush_dcache_page
@ 2007-10-31 14:08 Patrick McHardy
  2007-10-31 22:57 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Patrick McHardy @ 2007-10-31 14:08 UTC (permalink / raw)
  To: Linux Netdev List

I'm currently adding mmap support to af_netlink based on the
af_packet implementation and I'm wondering about this code in
tpacket_rcv():

         h->tp_status = status;
         smp_mb();

         {
                 struct page *p_start, *p_end;
                 u8 *h_end = (u8 *)h + macoff + snaplen - 1;

                 p_start = virt_to_page(h);
                 p_end = virt_to_page(h_end);
                 while (p_start <= p_end) {
                         flush_dcache_page(p_start);
                         p_start++;
                 }
         }

Shouldn't the flushing be done in reverse order to make sure
that the page containing tp_status is flushed last and userspace
doesn't start looking at following pages before all dcache entries
are flushed?

A related question: Documentation/cachetlb.txt mentions that
flushing also needs to be done for reading of shared+writable
mapped pages, so it seems like we also need to call flush_dcache_page 
before the tp_status check earlier in that function and packet_poll().

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

end of thread, other threads:[~2007-11-01 16:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2007-11-01 16:27     ` Evgeniy Polyakov

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