Received: by 10.223.148.5 with SMTP id 5csp7895311wrq; Thu, 18 Jan 2018 10:49:43 -0800 (PST) X-Google-Smtp-Source: ACJfBos/P5yo8tZjoPqHhoFtyOOBO5lD59ZJXUQi5RCNJjWiCd3HX5/HGhh4c2nGbn61T7708gBw X-Received: by 10.101.96.67 with SMTP id b3mr13084120pgv.23.1516301383295; Thu, 18 Jan 2018 10:49:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516301383; cv=none; d=google.com; s=arc-20160816; b=uw7Kx14fSGxY2uVTqBcWB7zXlGoXln91hPvFrjr6Iauu9IISk9diSwVmh3tznPh/MV P18BaofTZHXQXuSK499cp5dqUMblbZ8LiSk3dhc0MEbWebUL3OWkBTw0YfSPqT758+M0 P4vd7mKMzJ+tg5b6GD4OSAc1rE8/ugRJr0ZWycJASl9C2UPoQbYWEzRWtxODOYjj2x0X KsfWSCMdcTkpta+VygOh35dVPbqd5z472ojoZfDgvFzx6108r2S5MqNfFelwFMpv1gl+ SaLnV8cn6uOdFldPUDn9OYtmiTlVZLjs0kFMjtjahEj6YvS1B3Ly1c+pGp6FfaFP+6TM VSjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=h++gt2aLjBjN4+xNCquEK91v101JPKT/ZS/SlvDYPxk=; b=VPg/Trj4dxw7etotQl1pi1+tkPQRyyDJuaUuSoQhfazJJIlS7x7TvLvzbk9NF4aFWG bLXofzaqPqA+0T4yfsakY3V1Ehz0OpacQDTFdQ+OLucGqtiX6UM78zT4Ix0KBqfIK70u AotraI6UTwlOWDdrgMoXdM5Xy7itqdg4bq/V1YjbGabPSx0hWR6O+RNwpWb9jDDHZ/xl pjfmIyQUE/AhqSF1gG9z+HOKFNSQ3evgO7pQiX6Wh8FjnO3xag44Tagm7O1GUF2N15ZO 2JIFrcrLDf1MLWj2uqfU14RCofJDAB7LFu8xrOUaZxl0zJiNBVLPKS+lW8ok87YmRyk3 uGPg== 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; dmarc=fail (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 m7si3190321pgr.233.2018.01.18.10.49.28; Thu, 18 Jan 2018 10:49:43 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932813AbeARSsT (ORCPT + 99 others); Thu, 18 Jan 2018 13:48:19 -0500 Received: from us01smtprelay-2.synopsys.com ([198.182.47.9]:50263 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932089AbeARSsR (ORCPT ); Thu, 18 Jan 2018 13:48:17 -0500 Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id 1A7E024E0B67; Thu, 18 Jan 2018 10:48:17 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id F224699D; Thu, 18 Jan 2018 10:48:16 -0800 (PST) Received: from us01wehtc1.internal.synopsys.com (us01wehtc1.internal.synopsys.com [10.12.239.235]) by mailhost.synopsys.com (Postfix) with ESMTP id E914799B; Thu, 18 Jan 2018 10:48:16 -0800 (PST) Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.106) by us01wehtc1.internal.synopsys.com (10.12.239.235) with Microsoft SMTP Server (TLS) id 14.3.266.1; Thu, 18 Jan 2018 10:48:15 -0800 Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.103) by IN01WEHTCB.internal.synopsys.com (10.144.199.105) with Microsoft SMTP Server (TLS) id 14.3.266.1; Fri, 19 Jan 2018 00:18:12 +0530 Received: from [10.10.161.79] (10.10.161.79) by IN01WEHTCA.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.266.1; Fri, 19 Jan 2018 00:18:12 +0530 Subject: Re: [PATCH] ARC: Allow disabling of prefetch operations for debugging purposes To: Alexey Brodkin , "linux-snps-arc@lists.infradead.org" CC: "linux-kernel@vger.kernel.org" References: <20180118134808.40970-1-abrodkin@synopsys.com> From: Vineet Gupta Message-ID: Date: Thu, 18 Jan 2018 10:48:08 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20180118134808.40970-1-abrodkin@synopsys.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.10.161.79] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/18/2018 05:48 AM, Alexey Brodkin wrote: > Signed-off-by: Alexey Brodkin > --- > arch/arc/Kconfig | 5 +++++ > arch/arc/include/asm/processor.h | 11 +++++++++++ > arch/arc/lib/memcpy-archs.S | 16 ++++++++++++++++ > arch/arc/lib/memset-archs.S | 6 ++++++ > 4 files changed, 38 insertions(+) > > diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig > index 9d5fd00d9e91..aa5262e8e43f 100644 > --- a/arch/arc/Kconfig > +++ b/arch/arc/Kconfig > @@ -532,6 +532,11 @@ config ARC_DBG_TLB_PARANOIA > bool "Paranoia Checks in Low Level TLB Handlers" > default n > > +config ARC_DISABLE_PREFETCH > + bool "Disable use of prefetch instructions" > + default n > + help > + Suppresses usage of prefetchw and prealloc instructions. > endif > > config ARC_UBOOT_SUPPORT > diff --git a/arch/arc/include/asm/processor.h b/arch/arc/include/asm/processor.h > index 8ee41e988169..01011c0515d4 100644 > --- a/arch/arc/include/asm/processor.h > +++ b/arch/arc/include/asm/processor.h > @@ -106,6 +106,17 @@ extern unsigned int get_wchan(struct task_struct *p); > */ > #define current_text_addr() ({ __label__ _l; _l: &&_l; }) > > +#ifdef CONFIG_ARC_DISABLE_PREFETCH > +#define ARCH_HAS_PREFETCH > +#define prefetch(x) > + > +#define ARCH_HAS_PREFETCHW > +#define prefetchw(x) > + > +#define ARCH_HAS_SPINLOCK_PREFETCH > +#define spin_lock_prefetch(x) > +#endif /* CONFIG_ARC_DISABLE_PREFETCH */ > + > #endif /* !__ASSEMBLY__ */ > > /* > diff --git a/arch/arc/lib/memcpy-archs.S b/arch/arc/lib/memcpy-archs.S > index d61044dd8b58..0a29d024be01 100644 > --- a/arch/arc/lib/memcpy-archs.S > +++ b/arch/arc/lib/memcpy-archs.S > @@ -41,8 +41,10 @@ > #endif > > ENTRY_CFI(memcpy) > +#ifndef CONFIG_ARC_DISABLE_PREFETCH > prefetch [r1] ; Prefetch the read location > prefetchw [r0] ; Prefetch the write location > +#endif This code is already unreadable and this change is not helping. Can we make some macros "C" / gas style and have the switch inside the macro rather than littering this all over the place please ! > mov.f 0, r2 > ;;; if size is zero > jz.d [blink] > @@ -72,8 +74,10 @@ ENTRY_CFI(memcpy) > lpnz @.Lcopy32_64bytes > ;; LOOP START > LOADX (r6, r1) > +#ifndef CONFIG_ARC_DISABLE_PREFETCH > PREFETCH_READ (r1) > PREFETCH_WRITE (r3) > +#endif > LOADX (r8, r1) > LOADX (r10, r1) > LOADX (r4, r1) > @@ -117,9 +121,13 @@ ENTRY_CFI(memcpy) > lpnz @.Lcopy8bytes_1 > ;; LOOP START > ld.ab r6, [r1, 4] > +#ifndef CONFIG_ARC_DISABLE_PREFETCH > prefetch [r1, 28] ;Prefetch the next read location > +#endif > ld.ab r8, [r1,4] > +#ifndef CONFIG_ARC_DISABLE_PREFETCH > prefetchw [r3, 32] ;Prefetch the next write location > +#endif > > SHIFT_1 (r7, r6, 24) > or r7, r7, r5 > @@ -162,9 +170,13 @@ ENTRY_CFI(memcpy) > lpnz @.Lcopy8bytes_2 > ;; LOOP START > ld.ab r6, [r1, 4] > +#ifndef CONFIG_ARC_DISABLE_PREFETCH > prefetch [r1, 28] ;Prefetch the next read location > +#endif > ld.ab r8, [r1,4] > +#ifndef CONFIG_ARC_DISABLE_PREFETCH > prefetchw [r3, 32] ;Prefetch the next write location > +#endif > > SHIFT_1 (r7, r6, 16) > or r7, r7, r5 > @@ -204,9 +216,13 @@ ENTRY_CFI(memcpy) > lpnz @.Lcopy8bytes_3 > ;; LOOP START > ld.ab r6, [r1, 4] > +#ifndef CONFIG_ARC_DISABLE_PREFETCH > prefetch [r1, 28] ;Prefetch the next read location > +#endif > ld.ab r8, [r1,4] > +#ifndef CONFIG_ARC_DISABLE_PREFETCH > prefetchw [r3, 32] ;Prefetch the next write location > +#endif > > SHIFT_1 (r7, r6, 8) > or r7, r7, r5 > diff --git a/arch/arc/lib/memset-archs.S b/arch/arc/lib/memset-archs.S > index 62ad4bcb841a..343f292d92a0 100644 > --- a/arch/arc/lib/memset-archs.S > +++ b/arch/arc/lib/memset-archs.S > @@ -11,7 +11,9 @@ > #undef PREALLOC_NOT_AVAIL > > ENTRY_CFI(memset) > +#ifndef CONFIG_ARC_DISABLE_PREFETCH > prefetchw [r0] ; Prefetch the write location > +#endif > mov.f 0, r2 > ;;; if size is zero > jz.d [blink] > @@ -48,11 +50,13 @@ ENTRY_CFI(memset) > > lpnz @.Lset64bytes > ;; LOOP START > +#ifndef CONFIG_ARC_DISABLE_PREFETCH > #ifdef PREALLOC_NOT_AVAIL > prefetchw [r3, 64] ;Prefetch the next write location > #else > prealloc [r3, 64] > #endif > +#endif /* CONFIG_ARC_DISABLE_PREFETCH */ > #ifdef CONFIG_ARC_HAS_LL64 > std.ab r4, [r3, 8] > std.ab r4, [r3, 8] > @@ -85,7 +89,9 @@ ENTRY_CFI(memset) > lsr.f lp_count, r2, 5 ;Last remaining max 124 bytes > lpnz .Lset32bytes > ;; LOOP START > +#ifndef CONFIG_ARC_DISABLE_PREFETCH > prefetchw [r3, 32] ;Prefetch the next write location > +#endif > #ifdef CONFIG_ARC_HAS_LL64 > std.ab r4, [r3, 8] > std.ab r4, [r3, 8]