Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp312874imm; Thu, 26 Jul 2018 04:09:53 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeHd8EcLP2ZWVYYc9KxSfrSn0IpF0J72ofkSDiU61ahmuJajRi+T+khXaCHjNRikhEzrPlR X-Received: by 2002:a63:e247:: with SMTP id y7-v6mr1489857pgj.231.1532603393034; Thu, 26 Jul 2018 04:09:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532603393; cv=none; d=google.com; s=arc-20160816; b=K2OlciuyxLwZgMS3zosvKye/+BQVOojSRe/KsafXkqPJkpb7uXTZqjacDaKBxtybm+ PG5Gf788DTnjmP1PWIFjgk6t1b3B3LkZ11JB59M53/bbypw00MPi2q8n2CeXMDIaX1R+ QzGeVMdOX7/8Fc3GIuSJMFNtvY1+xdbg2BSFeih7VaAiB7NexuIazYv+0i2xi3weqw0g x8hVdl28k8x3kqr4VBulon83kbQ8Zg9GS+guSkqzaUWjR59EBArN8hqxMMbLCRLJnjDU fWj0UZ6p9b5Um8aK5eGE8G8dslVGpBWxqKL6cfisiGsnKKgOuQEjMJO8EpUIP0Yn6rK+ NdEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=LWPbeOpj+flQYeVz2iC5l+1I/iTauiwuY2jQ5prvcKo=; b=W3hRFNOLk0FZj83buUh2p4N7+NJeGgijC9dAfNtQwpE/F9+8/lkrQs2ovgzG9bXTUK jhncY94ZHfBtLX1FNfGEg4RCEo5QUtBNVSw16r2OTiYspD1rUifaPXk+VcDT/Yx7kN06 zNX2RArHBF7ACuLdy7mS8+c7UPiP3QyeYUcKtWoVy4Z0ySdl40+pTlmrr3+5eZ/XCUJe zv98uyOb3InRMHKN6hKWLegyd9VLS96DkXSzUKVCcN+nukpUmlQOn1LW8wCD9SxJpfJf XcAe+UTL5eqqJcll60CehHyMoytmNcZUtUzzZ1ybOHbTZx2IfwRo0GnJTw/K0g7Zkl5v ZDHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b="Z5/QwCe2"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o12-v6si1173521pgi.112.2018.07.26.04.09.37; Thu, 26 Jul 2018 04:09:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b="Z5/QwCe2"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729342AbeGZMZI (ORCPT + 99 others); Thu, 26 Jul 2018 08:25:08 -0400 Received: from us01smtprelay-2.synopsys.com ([198.182.60.111]:53537 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729074AbeGZMZH (ORCPT ); Thu, 26 Jul 2018 08:25:07 -0400 Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id 9570F10C0F95; Thu, 26 Jul 2018 04:08:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1532603327; bh=ZWG07Ezt5C69b52/CtcMWRzjtnzxyoJmNpqveGyasIg=; h=From:To:Cc:Subject:Date:From; b=Z5/QwCe21g7tfuJlRRFJ3V4sUenYYXqWKGnUFVEjZIfjcWlfIUpAUxGL3/bpSalaf N/ZGa9XKaNxHr0mlAa6svxBMiloD0UwT9YwOcRe5szR92FXKI2p1ZJauSwRMzn+kWM qQ+axv/eaQCye8P2eHDFfnhrgBMUAl11IuvhKJaCNtw3tN88+1QnjrlI9aN22KPkyw zLLF1TNflsmyBfJ2yuFN7CRn8ZkcDm7xMUG7qtJEfi0XDxKYikE9dPAIJjPQcQre1U Ub25ICvDKn8d0WIZxM381eKi6Dp/YitC4+R96U5GazSZwbM0kKkvDho4KhWQWsndqO sy0+T1L60n9kQ== Received: from paltsev-e7480.internal.synopsys.com (paltsev-e7480.internal.synopsys.com [10.121.8.86]) by mailhost.synopsys.com (Postfix) with ESMTP id 0C9715249; Thu, 26 Jul 2018 04:08:45 -0700 (PDT) From: Eugeniy Paltsev To: linux-snps-arc@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Vineet Gupta , Alexey Brodkin , Eugeniy Paltsev Subject: [PATCH 1/2] ARC: setup SMP_CACHE_BYTES and cache_line_size Date: Thu, 26 Jul 2018 14:08:38 +0300 Message-Id: <20180726110839.1915-1-Eugeniy.Paltsev@synopsys.com> X-Mailer: git-send-email 2.14.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As for today we don't setup SMP_CACHE_BYTESi and cache_line_size for ARC, so they are set to L1_CACHE_BYTES by default. L1 line length (L1_CACHE_BYTES) might be easily smaller than L2 line (which is usually the case BTW). This breaks code. For example this breaks ethernet infrastructure on HSDK/AXS103 boards with IOC disabled: Functions which alloc and manage sk_buff packet data area rely on SMP_CACHE_BYTES define. In the result we can share last L2 cache line in sk_buff linear packet data area between DMA buffer and some useful data in other structure. So we can lose this data when we invalidate DMA buffer. sk_buff linear packet data area | | | skb->end skb->tail V | | V V ----------------------------------------------. packet data | | ----------------------------------------------. ---------------------.--------------------------------------------------. SLC line | SLC (L2 cache) line (128B) | ---------------------.--------------------------------------------------. ^ ^ | | These cache lines will be invalidated when we invalidate skb linear packet data area before DMA transaction starting. This leads to issues painful to debug as it reproduces only if (sk_buff->end - sk_buff->tail) < SLC_LINE_SIZE and if we have some useful data right after sk_buff->end. Fix that by hardcode SMP_CACHE_BYTES to max line length we may have. Signed-off-by: Eugeniy Paltsev Signed-off-by: Eugeniy Paltsev --- arch/arc/Kconfig | 1 + arch/arc/include/asm/cache.h | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index 9cf59fc60eab..ee1a38c99197 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig @@ -9,6 +9,7 @@ config ARC def_bool y select ARC_TIMERS + select ARCH_HAS_CACHE_LINE_SIZE select ARCH_HAS_SYNC_DMA_FOR_CPU select ARCH_HAS_SYNC_DMA_FOR_DEVICE select ARCH_HAS_SG_CHAIN diff --git a/arch/arc/include/asm/cache.h b/arch/arc/include/asm/cache.h index 8486f328cc5d..ff7d3232764a 100644 --- a/arch/arc/include/asm/cache.h +++ b/arch/arc/include/asm/cache.h @@ -48,7 +48,9 @@ }) /* Largest line length for either L1 or L2 is 128 bytes */ -#define ARCH_DMA_MINALIGN 128 +#define SMP_CACHE_BYTES 128 +#define cache_line_size() SMP_CACHE_BYTES +#define ARCH_DMA_MINALIGN SMP_CACHE_BYTES extern void arc_cache_init(void); extern char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len); -- 2.14.4