Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1592101imm; Wed, 26 Sep 2018 22:28:41 -0700 (PDT) X-Google-Smtp-Source: ACcGV60dvejgPW/6wnL2TvNjuJ7wpEZE4swa2EXlv/gzJ7JFcUvb+1naEc2YFtS4tWgOnq/DeZHf X-Received: by 2002:a17:902:6b44:: with SMTP id g4-v6mr9174181plt.50.1538026121299; Wed, 26 Sep 2018 22:28:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538026121; cv=none; d=google.com; s=arc-20160816; b=ooLQlM4eJ/GxTlB2NIZWXkCgoljyNmtq8FzQ7gv1A/Dh74/xFhD+pIiRidV+/3oHTM ZF6DAk0nMfHmvGbcCsSk08AU26YRf4pIyJp9i0B3pGJ714RCAER7ifpagR41/47eFl6m XSFRl+mkgJCttyqy8R4uE3KOW5MdJ3kRUlxOowZooxl6Tb339qix1DP+YYzKpgTPPEoR LaHA8NRJaaJEVCw517ur6e2PTigzfK/3A6clcjhs4O9lefYqr+tZL0I5GG3IrXRuX2Pz S6BR4G94d3NkezeJxoOVYzx0Hwj2S2Dn2BXDf/qgLsh80V2UDXptgU8ZEIwaX28WUlgr yaEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=xeybLmueVE2Lmg5S+NM6TIUNt3ztS+XPRmVypuq06Aw=; b=i/cOQEiHteQzajqM0TJO1NPXYDC0RcJNnWYzdBBeznyaPXUGQSNEdGY+q6DrmL0NEK 1k8DC57ZlepHjvRza2D1UZmb2h/mtNyRxpBYErNTyqCKx5yOEwVejfHad85+6elCq0F7 7s+ZgOJbMsq1DI/iOunaLxbpTODMxYa+8nVudHN/OfDbeB0GH5+Tph7lO2YZpw1UbRqJ O3SNjWWKiv9L+QHIAoSuSonhGvP9HDf24MnERgGOHcyrU32iJMjf+Y3lvA2qPUI7HxOP 5hwJyHHNJmrhqsAXjb0y/9hedD7c6FdGf/yK3DQrcbaKXgRmFpp6A2y5tHyVI+TpNnQm VOoQ== 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 p24-v6si1003363plr.510.2018.09.26.22.28.26; Wed, 26 Sep 2018 22:28:41 -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 S1727108AbeI0Loo (ORCPT + 99 others); Thu, 27 Sep 2018 07:44:44 -0400 Received: from smtp2200-217.mail.aliyun.com ([121.197.200.217]:44605 "EHLO smtp2200-217.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726599AbeI0Lon (ORCPT ); Thu, 27 Sep 2018 07:44:43 -0400 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.07488097|-1;CH=green;FP=0|0|0|0|0|-1|-1|-1;HT=e02c03273;MF=ren_guo@c-sky.com;NM=1;PH=DS;RN=20;RT=20;SR=0;TI=SMTPD_---.CwPENKx_1538026058; Received: from localhost(mailfrom:ren_guo@c-sky.com fp:SMTPD_---.CwPENKx_1538026058) by smtp.aliyun-inc.com(10.147.41.138); Thu, 27 Sep 2018 13:27:38 +0800 Date: Thu, 27 Sep 2018 13:27:38 +0800 From: Guo Ren To: Peter Zijlstra Cc: akpm@linux-foundation.org, arnd@arndb.de, daniel.lezcano@linaro.org, davem@davemloft.net, gregkh@linuxfoundation.org, jason@lakedaemon.net, marc.zyngier@arm.com, mark.rutland@arm.com, mchehab+samsung@kernel.org, robh@kernel.org, robh+dt@kernel.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, devicetree@vger.kernel.org, c-sky_gcc_upstream@c-sky.com, gnu-csky@mentor.com, green.hu@gmail.com, palmer@sifive.com Subject: Re: [PATCH V5 06/30] csky: Cache and TLB routines Message-ID: <20180927052737.GA28407@guoren> References: <7cd7abcd2acf5c61435589338ff80a75a13173ca.1537789737.git.ren_guo@c-sky.com> <20180925072407.GA6999@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180925072407.GA6999@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 25, 2018 at 09:24:07AM +0200, Peter Zijlstra wrote: > On Mon, Sep 24, 2018 at 10:36:22PM +0800, Guo Ren wrote: > > diff --git a/arch/csky/abiv1/inc/abi/cacheflush.h b/arch/csky/abiv1/inc/abi/cacheflush.h > > new file mode 100644 > > index 0000000..f0de49c > > --- /dev/null > > +++ b/arch/csky/abiv1/inc/abi/cacheflush.h > > @@ -0,0 +1,43 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > +// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd. > > + > > +#ifndef __ABI_CSKY_CACHEFLUSH_H > > +#define __ABI_CSKY_CACHEFLUSH_H > > + > > +#include > > +#include > > +#include > > + > > +#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 > > +extern void flush_dcache_page(struct page *); > > + > > +#define flush_cache_mm(mm) cache_wbinv_all() > > +#define flush_cache_page(vma,page,pfn) cache_wbinv_all() > > +#define flush_cache_dup_mm(mm) cache_wbinv_all() > > + > > +#define flush_cache_range(mm,start,end) cache_wbinv_range(start, end) > ^^^ should be vma Yes, I'll change it to: #define flush_cache_range(mm,start,end) cache_wbinv_all() I'll improve it later after test. > > > +#endif /* __ABI_CSKY_CACHEFLUSH_H */ > > > > diff --git a/arch/csky/abiv1/inc/abi/tlb.h b/arch/csky/abiv1/inc/abi/tlb.h > > new file mode 100644 > > index 0000000..6d461f3 > > --- /dev/null > > +++ b/arch/csky/abiv1/inc/abi/tlb.h > > @@ -0,0 +1,12 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > +// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd. > > + > > +#ifndef __ABI_CSKY_TLB_H > > +#define __ABI_CSKY_TLB_H > > + > > +#define tlb_start_vma(tlb, vma) \ > > + do { \ > > + if (!tlb->fullmm) \ > > + cache_wbinv_all(); \ > > + } while (0) > > +#endif /* __ABI_CSKY_TLB_H */ > > That should be: > > if (!tlb->fullmm) > flush_cache_range(vma, vma->vm_start, vma->vm_end); > > Because as per the whole abiv1 vs abiv2, you don't need write back > invalidation for v2 at all, also, you only need to invalidate the vma > range, no reason to shoot everything down. > > Also, I'll be shortly removing this: > > https://lkml.kernel.org/r/20180913092812.071989585@infradead.org Ok, I'll follow the rules. > > > diff --git a/arch/csky/abiv2/inc/abi/cacheflush.h b/arch/csky/abiv2/inc/abi/cacheflush.h > > new file mode 100644 > > index 0000000..756beb7 > > --- /dev/null > > +++ b/arch/csky/abiv2/inc/abi/cacheflush.h > > @@ -0,0 +1,40 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > + > > +#ifndef __ABI_CSKY_CACHEFLUSH_H > > +#define __ABI_CSKY_CACHEFLUSH_H > > + > > +/* Keep includes the same across arches. */ > > +#include > > + > > +/* > > + * The cache doesn't need to be flushed when TLB entries change when > > + * the cache is mapped to physical memory, not virtual memory > > + */ > > +#define flush_cache_all() do { } while (0) > > +#define flush_cache_mm(mm) do { } while (0) > > +#define flush_cache_dup_mm(mm) do { } while (0) > > +#define flush_cache_range(vma, start, end) do { } while (0) > ^^^ like here.. #define flush_cache_range(vma, start, end) \ do { \ if (vma->vm_flags & VM_EXEC) \ icache_inv_all(); \ } Hmm ? I'll improve it later after test. Best Regards Guo Ren