From patchwork Fri Sep 2 16:49:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chetan L X-Patchwork-Id: 113170 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A8FDDB6F72 for ; Sat, 3 Sep 2011 02:49:54 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753471Ab1IBQtt (ORCPT ); Fri, 2 Sep 2011 12:49:49 -0400 Received: from mail-yw0-f46.google.com ([209.85.213.46]:56752 "EHLO mail-yw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753424Ab1IBQts (ORCPT ); Fri, 2 Sep 2011 12:49:48 -0400 Received: by ywf7 with SMTP id 7so2316869ywf.19 for ; Fri, 02 Sep 2011 09:49:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=b3kmrLXZDOPXJ1XXHd6ePi6xUcrbGZCB8RnBQcjrGvc=; b=HzFZWBe+7ril9EByZZZkBlpli/RK8eUvOpwZ7ekfBVItlk6wXtT+QJZi22f+HNPb5N YhlrMruO7DXFZ3kzUaPUHi+AeugI5YEjxypNRUMsqY04UQHjkiKnh007WAXQAR3tpwsG RbZ+1tPJTbhUqFD1PwThkAHAWUVqRg1JWNi3M= MIME-Version: 1.0 Received: by 10.68.1.226 with SMTP id 2mr2049078pbp.49.1314982187729; Fri, 02 Sep 2011 09:49:47 -0700 (PDT) Received: by 10.68.57.42 with HTTP; Fri, 2 Sep 2011 09:49:47 -0700 (PDT) In-Reply-To: <20110902153147.GB29025@philter> References: <20110505141107.GC30443@orbit.nwl.cc> <1314961686-30870-1-git-send-email-phil.sutter@viprinet.com> <20110902153147.GB29025@philter> Date: Fri, 2 Sep 2011 12:49:47 -0400 Message-ID: Subject: Re: FW: [PATCH] af_packet: flush complete kernel cache in packet_sendmsg From: chetan loke To: Phil Sutter Cc: linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux@arm.linux.org.uk, davem@davemloft.net Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Fri, Sep 2, 2011 at 11:31 AM, Phil Sutter wrote: > So far we haven't noticed problems in that direction. I just tried some > explicit test: having tcpdump print local timestamps (not the pcap-ones) > on every received packet, activating icmp_echo_ignore_all and pinging > the host on a dedicated line. I expected to sometimes see a second > difference between the two timestamps, as like with sending from time to > time a packet should get "lost" in the cache, and then occur to > userspace after the next one arrived. Maybe my test is broken, or RX is > indeed unaffected. > You will need high traffic rate. If interested, you could try pktgen(with varying packet-load). Keep the packet-payload under 1500 bytes (don't send jumbo frames) unless you have the following fix: commit cc9f01b246ca8e4fa245991840b8076394f86707 Your Tx path is working because flush_cache_call gets triggered before flush_dcache_page. On the Rx path, since you don't have that workaround, you will eventually(it's just a matter of time) see this problem. Or, delete your patch and try this workaround (in __packet_get/set_status) and you may be able to cover both Tx and Rx paths. default: @@ -437,13 +445,19 @@ static int __packet_get_status(struct packet_sock *po, void *frame) smp_rmb(); + kw_extra_cache_flush(); + h.raw = frame; switch (po->tp_version) { case TPACKET_V1: - flush_dcache_page(pgv_to_page(&h.h1->tp_status)); + #ifndef ENABLE_CACHEPROB_WORKAROUND + flush_dcache_page(pgv_to_page(&h.h1->tp_status)); + #endif return h.h1->tp_status; case TPACKET_V2: - flush_dcache_page(pgv_to_page(&h.h2->tp_status)); + #ifndef ENABLE_CACHEPROB_WORKAROUND + flush_dcache_page(pgv_to_page(&h.h2->tp_status)); + #endif return h.h2->tp_status; case TPACKET_V3: default: > Greetings and thanks for the hints, Phil Chetan Loke --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 2ea3d63..35d71dc 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -412,11 +412,19 @@ static void __packet_set_status(struct packet_sock *po, void *frame, int status) switch (po->tp_version) { case TPACKET_V1: h.h1->tp_status = status; - flush_dcache_page(pgv_to_page(&h.h1->tp_status)); + #ifndef ENABLE_CACHEPROB_WORKAROUND + flush_dcache_page(pgv_to_page(&h.h1->tp_status)); + #else + kw_extra_cache_flush(); + endif break; case TPACKET_V2: h.h2->tp_status = status; - flush_dcache_page(pgv_to_page(&h.h2->tp_status)); + #ifndef ENABLE_CACHEPROB_WORKAROUND + flush_dcache_page(pgv_to_page(&h.h2->tp_status)); + #else + kw_extra_cache_flush(); + #endif break; case TPACKET_V3: