Received: by 2002:a4a:301c:0:0:0:0:0 with SMTP id q28-v6csp502798oof; Tue, 25 Sep 2018 00:25:55 -0700 (PDT) X-Google-Smtp-Source: ACcGV62g6INGKJupm+MWbfjijoamC+LN+Atywu+mZpI8yWjKJ33MbLyHV1GSb7Xnx8sgaVA7Hq+H X-Received: by 2002:a65:4d42:: with SMTP id j2-v6mr2062214pgt.232.1537860355658; Tue, 25 Sep 2018 00:25:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537860355; cv=none; d=google.com; s=arc-20160816; b=bcGo7hurIwuvaOiBhS16fGQ8ISQ+qf2IF7TohquF6j5xCQK2/bVplcWF+I1/tzRr4M UN/XILZE5fPRrydkoHHt2HPW1aFqnaSvjLYdmKHeEa4eSbSVyMpx3qop5TYN7p1xvkGe USBrnPurdubCHijM8Fxnjvxtd26vPC5VfynuGywc3KV2g7ZanOR6woeliM63HYfe0XnW svl05Caf/znhLzyEqUgdIbgx7cuCZnoLPqZWkccH/9GcLMzghG1JriZ4RciTLabTjwgH b5U9QJDkA/qbDyFN5d2R13isBr6lpvFRIk5cUF2WknDCyt6VIFy2oyK9fSl7hN/uHRST LTGw== 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:dkim-signature; bh=xqthDeiSyOLcjqwUUqONFwF/RWTTYVn1S3WPQuE/9A4=; b=qojFyQiKfOenruByBilsMRxSNs7R0XWIo7saCcJ4X+sdgrpT/ARYdEgAvrijAdTILC XhLp99gK+HATCWzjblzTBtyIaf/dXL2mGCOnOdAnE5R6/pobtQVs8Ds25FyUjHk5IWTj 8KTicmQBsgT8HPruIUnEWBXBH7rwzRBSbjhezPR/8DvCH158vFBA5oA7S0JS87k8kVNc tM1oXfN7CeBLC0urDK24edinmf8wotizCbrnAbz1dX/w9cT7XQ9HOAD4jUpYyxxv0qY3 Ie7jL0EGxqMqrg+oWnK8z2zRwqi3XzxqbI3bEunmYHdKnLmy8YQPbtxFmVlgYMyfadES Y/qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=zXsdwN5Q; 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 x27-v6si1792644pff.196.2018.09.25.00.25.39; Tue, 25 Sep 2018 00:25:55 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=zXsdwN5Q; 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 S1728692AbeIYNbJ (ORCPT + 99 others); Tue, 25 Sep 2018 09:31:09 -0400 Received: from merlin.infradead.org ([205.233.59.134]:54710 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726927AbeIYNbJ (ORCPT ); Tue, 25 Sep 2018 09:31:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=xqthDeiSyOLcjqwUUqONFwF/RWTTYVn1S3WPQuE/9A4=; b=zXsdwN5QFPMAclseOLezHk66o mza2SvFiuwGTBfLMoCwolugNge9AOt/TgDhooFpg3OTyHkItSRUOrf5zMj7GmTniAg6eMaiRJ8KXZ dLxIfTwFo9CbEU6WaPVYRFWRjA7qtJ1D8k/VuX5MURvxL81Oq86/GAZjAgWLmhDnRUfX1KTpqYyQ5 36ZyIuApsKHUEBZZ8T/LChVW4RxaS11bnZp0ELMODXm70wmROjUq85EM7B1xBn+IFk5CG/0DWeME0 93lwMdd1ltzguo+e9gzzDRs3lW7U7odf/PS/spyAItfDucz46vfWS5fOYly5qDGJBC+EVEdowAGlK v47EDPhTQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1g4hha-0007kn-Ga; Tue, 25 Sep 2018 07:24:30 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 9A83620289CF9; Tue, 25 Sep 2018 09:24:07 +0200 (CEST) Date: Tue, 25 Sep 2018 09:24:07 +0200 From: Peter Zijlstra To: Guo Ren 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: <20180925072407.GA6999@hirez.programming.kicks-ass.net> References: <7cd7abcd2acf5c61435589338ff80a75a13173ca.1537789737.git.ren_guo@c-sky.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7cd7abcd2acf5c61435589338ff80a75a13173ca.1537789737.git.ren_guo@c-sky.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > +#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 > 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.. > +#endif /* __ABI_CSKY_TLB_H */