Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1825997imm; Mon, 3 Sep 2018 10:25:36 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYiY0Z9HQsXt9hv/9Vy37Gnn+lz4EooudkEXDVWcMDwgDOvx+EMvPLikwezXHM2mJaIahmG X-Received: by 2002:a17:902:820a:: with SMTP id x10-v6mr29481637pln.261.1535995536013; Mon, 03 Sep 2018 10:25:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535995535; cv=none; d=google.com; s=arc-20160816; b=VY3/x2GH6K+mGjI2huj28Bsylh08jGjtzj6omQnBak/bbZgJz47E7CjgmnPTfUksS7 mvFfxujktDdT0wEFM+oyyzMi9rpztnskXg6AlJLvWgI3mv52ObVqLJAtALK+E9WFEiY7 8LVdTWGpGXlgXO9uW4tosDi64j/qb/cPyTgOd+7Yn9H1CKRdRhbWSd0WusvUfG9lZHxz +/bucd2h3/hMMJA4DIxHLC3z2p3oB+oRw6RdbMuFSoy7mw6eMyJOl99odXm83BXtGMQK PN5lsEATIG2277IPjh9iPnEjiZSRWFyHzhSVHUKeMSPN33Rtm+n10LWdgrVF8aCprUz8 0gVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=X/EJoVuwaX57chSWedpAs9Dlf+U4txzewQX38lmKOac=; b=rk/SRCD/aYN1r1wuw1zimMZahkT/luaC0hrI4oRC1ceDFlGpTPPmUGdXA3tKbE+MvI rC60pwlV8Mhx4m/LRF/BJY2M8+B/esQ23BMmUru/ZdC3r1/Gud5jCizyGycVkC+/W+Gm nU4E01BQvtYhZrelASRRYJ9FBmieWCJ+ppirBatHsPaKdicV5jTWDgOGAPFqURLpFBaz JSnm97gxxGZ7AA7flAIhCdPHe26l3xHKML2A+qVpFgaWi6t/v7YcAZYlxLPMO0FAupQ9 0ku6jysgxdl+aYNVzvMU8g+UrOoKbLMQfGPyFjQ6tUvADJ//tDuDAgvCE5aaY/UBPJ1G 1otg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 2-v6si20165699pfd.39.2018.09.03.10.25.21; Mon, 03 Sep 2018 10:25:35 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728908AbeICVoy (ORCPT + 99 others); Mon, 3 Sep 2018 17:44:54 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45416 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728282AbeICVox (ORCPT ); Mon, 3 Sep 2018 17:44:53 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 1F910D0A; Mon, 3 Sep 2018 17:23:46 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eugeniy Paltsev , Vineet Gupta , Sasha Levin Subject: [PATCH 4.14 060/165] ARC: dma [non-IOC] setup SMP_CACHE_BYTES and cache_line_size Date: Mon, 3 Sep 2018 18:55:46 +0200 Message-Id: <20180903165658.137971239@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165655.003605184@linuxfoundation.org> References: <20180903165655.003605184@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eugeniy Paltsev [ Upstream commit eb2777397fd83a4a7eaa26984d09d3babb845d2a ] As for today we don't setup SMP_CACHE_BYTES 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, involving manual cache flushes 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: Vineet Gupta Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/arc/Kconfig | 3 +++ arch/arc/include/asm/cache.h | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig @@ -45,6 +45,9 @@ config ARC select HAVE_KERNEL_GZIP select HAVE_KERNEL_LZMA +config ARCH_HAS_CACHE_LINE_SIZE + def_bool y + config MIGHT_HAVE_PCI bool --- 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);