Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp575428imm; Fri, 29 Jun 2018 02:53:04 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJz3MkQL5JLIx4wwrFeLWZVpED6N9emC4DPCZcIGYvDhU5G4Zm9iBWPTxjKoNM0yPkYsY+x X-Received: by 2002:a17:902:8bc6:: with SMTP id r6-v6mr13828287plo.257.1530265984653; Fri, 29 Jun 2018 02:53:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530265984; cv=none; d=google.com; s=arc-20160816; b=jRJAsvFemEQN9ciZ5qZk9DEDMal4Y86WiZ1efXSccdaaBIDz7Ko5A+D/cR/wJpMXsc Ac1v1b/F+/pXj89BhklyZaYv2VRpBoJ4hn+ler13ON/To6iGYP/Z4AvGgousXCESiskT El+/jVpm+NQzp2RktefgXu//v7//5zOaQIdpnFb3AM+y8iDYVZ3JDviSX1KAiAQaNZr8 10LmPHNYray9Y0uBTEvs+hpUH3y6CSh/s8d5P9QKK280lPfxLAIn3+uN1jmzPSzE+qUi kPxTmQFWvX6Yd3NdrtjVSRIG+9wniWWdcNkmeNsp+m2lugNR2qpkymqluH1PHlz70rb5 108A== 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:arc-authentication-results; bh=i12LEJNXe4fP1ipQ/Uq8p+hUeBu0wuOWUkSsz+IGKLI=; b=zTLlU5RkG30S/TTXInTkDem4djAIHb2+C5NOZ194v+cEWA4MnRv4YdkMvnJMzjjxym UTWlzkwJ0iTLHHOmcTQc2kk4iSpMPCj9faNp2xQmzpsyXKNoCCUbm/r1W2w9sEB97dn6 K67kGYo73ZWaaGvrfpTeUckGCzZTB0iCmARo5KIfjJmBAbrU7b1K5d1ZSG9c/ReY5aB0 /t972vXml0G8db2FZh/8vcXAxde8jJGN+3+Rnt9gQ8WfaB1Mk0+/BPw+2QpJWIjGh1Xt dCXhDq1o1SDw1UaFOQK1vPEoq6ohdf5TcXdJ/UXtgzECBNModCwsZPUt1VDviAapHnCZ F/HA== 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 z17-v6si8433273pfn.160.2018.06.29.02.52.50; Fri, 29 Jun 2018 02:53:04 -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 S966046AbeF2Iqc (ORCPT + 99 others); Fri, 29 Jun 2018 04:46:32 -0400 Received: from smtp2200-217.mail.aliyun.com ([121.197.200.217]:46036 "EHLO smtp2200-217.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965835AbeF2Iqa (ORCPT ); Fri, 29 Jun 2018 04:46:30 -0400 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.07976004|-1;CH=green;FP=0|0|0|0|0|-1|-1|-1;HT=e01l07423;MF=ren_guo@c-sky.com;NM=1;PH=DS;RN=3;RT=3;SR=0;TI=SMTPD_---.CJyPqfE_1530261976; Received: from localhost(mailfrom:ren_guo@c-sky.com fp:SMTPD_---.CJyPqfE_1530261976) by smtp.aliyun-inc.com(10.147.41.187); Fri, 29 Jun 2018 16:46:22 +0800 Date: Fri, 29 Jun 2018 16:46:16 +0800 From: Guo Ren To: Greentime Hu Cc: greentime@andestech.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] nds32: To implement these icache invalidation APIs since nds32 cores don't snoop data cache. This issue is found by Guo Ren. Based on the Documentation/core-api/cachetlb.rst and it says: Message-ID: <20180629084615.GA6236@guoren> References: <20180628104927.9130-1-greentime@andestech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180628104927.9130-1-greentime@andestech.com> 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 Thu, Jun 28, 2018 at 06:49:27PM +0800, Greentime Hu wrote: > +void flush_icache_page(struct vm_area_struct *vma, struct page *page) > +{ > + unsigned long flags; > + local_irq_save(flags); > + cpu_cache_wbinval_page((unsigned long)page_address(page), > + vma->vm_flags & VM_EXEC); > + local_irq_restore(flags); > +} > +EXPORT_SYMBOL(flush_icache_page); > + I'm afraid that the page_address(page) will return NULL for non-mapped page. So I use kmap_atomic/kunmap_atomic here. ref: https://github.com/c-sky/csky-linux/blob/master/arch/csky/abiv2/cacheflush.c > +void flush_icache_user_range(struct vm_area_struct *vma, struct page *page, > + unsigned long addr, int len) > +{ > + unsigned long _addr = (unsigned long) page_address(page) + (addr & ~PAGE_MASK); > + flush_icache_range(_addr, _addr + len); > +} The same as above. Guo Ren