Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp3511410pxb; Wed, 14 Apr 2021 07:11:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxgdxVm6M+nCP/mFbE48O1hlbA3YnsvBPTXr67n4vl+SIEYLWc5DbpDMkoT1JnmPkaUyBK X-Received: by 2002:a65:6a0d:: with SMTP id m13mr38806022pgu.43.1618409475087; Wed, 14 Apr 2021 07:11:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618409475; cv=none; d=google.com; s=arc-20160816; b=tAY7AJGi99k4wU/APiTxlBQycFR++CHBtZb/SSPVW2nWkfZGGDqSagOYsJr9H1nXEs wTsh2jJ2peckrnakLUWKcUoGxA7L0kl/lSugSrM7cLCpd1F5c5WbcgCJdUhwesresL9+ FbBPVZINOGcmh0osm/BMREv3CmkkljzhK64oLCAyRMFcI6NkbxY7ATFjpaK6zc0gju7q 1BzlgCGHOWp12hb9WTxMa2LIsZLpx/3XFmiC69IoycstgeX6eTL4KV2qUPCHcqJh7jcp 0SN14SGrIvGSMogjYun/BAvHYZeHvGokFLPdJ80R0QOLRkUqm1k5RBBFutOdCyeR8GRU FnHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=QS/+Anhaog1jut7G2LhEz3ZTJ179dZ2t9guwL7RRIH4=; b=oYZ9JdmEYgU0aE/ZJQd/6GIhsv0t82yn1ZmfDC8T2cTSDUSoUyjszdLApUr0mhySQp jlwfBo11MhMUm8Pqf3kGqqWB9C1zptISFMfNlEw0kDx7NBAcuBKpLau3qMch75EZDZVW 1ZEIoOI2zBZWGGzB+qUTEGCioBw/4DYFKQy/FvBgNMHlETv7FCLXgjJW6HIHR6kBu61s CBHVIbE3m3+GFTPbdHHfT5JzSm4zlkBF4pItV2Q7Watc76BH5zNyrGuMqOxaBtzkxxtR ZiXL/MDLeEiVyrDbZzyuP2USlQ+g4AI97XsjhgI1DK8VpLIMuAT8W10td4MeT/vgtV7n AVig== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t26si20137524pgu.197.2021.04.14.07.10.59; Wed, 14 Apr 2021 07:11:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348546AbhDNHDj (ORCPT + 99 others); Wed, 14 Apr 2021 03:03:39 -0400 Received: from relay11.mail.gandi.net ([217.70.178.231]:58963 "EHLO relay11.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346947AbhDNHDi (ORCPT ); Wed, 14 Apr 2021 03:03:38 -0400 Received: from [172.16.5.113] (82-65-183-113.subs.proxad.net [82.65.183.113]) (Authenticated sender: alex@ghiti.fr) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 4E84B100006; Wed, 14 Apr 2021 07:03:14 +0000 (UTC) Subject: Re: [PATCH] implement flush_cache_vmap for RISC-V To: Jisheng Zhang , Jiuyang Liu Cc: Palmer Dabbelt , Andrew Waterman , Paul Walmsley , Albert Ou , Andrew Morton , Geert Uytterhoeven , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org References: <20210412000531.12249-1-liu@jiuyang.me> <20210412150817.33f49be8@xhacker.debian> From: Alex Ghiti Message-ID: <18d198ac-7bc0-934d-e1e9-eca01b790d61@ghiti.fr> Date: Wed, 14 Apr 2021 03:03:13 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: <20210412150817.33f49be8@xhacker.debian> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Le 4/12/21 ? 3:08 AM, Jisheng Zhang a ?crit?: > Hi Jiuyang, > > On Mon, 12 Apr 2021 00:05:30 +0000 Jiuyang Liu wrote: > > >> >> This patch implements flush_cache_vmap for RISC-V, since it modifies PTE. >> Without this patch, SFENCE.VMA won't be added to related codes, which >> might introduce a bug in the out-of-order micro-architecture >> implementations. >> >> Signed-off-by: Jiuyang Liu >> Reviewed-by: Alexandre Ghiti >> Reviewed-by: Palmer Dabbelt > > IIRC, Palmer hasn't given this Reviewed-by tag. > >> --- > > Could you plz add version and changes? IIRC, this is the v3. > >> arch/riscv/include/asm/cacheflush.h | 6 ++++++ >> 1 file changed, 6 insertions(+) >> >> diff --git a/arch/riscv/include/asm/cacheflush.h b/arch/riscv/include/asm/cacheflush.h >> index 23ff70350992..3fd528badc35 100644 >> --- a/arch/riscv/include/asm/cacheflush.h >> +++ b/arch/riscv/include/asm/cacheflush.h >> @@ -30,6 +30,12 @@ static inline void flush_dcache_page(struct page *page) >> #define flush_icache_user_page(vma, pg, addr, len) \ >> flush_icache_mm(vma->vm_mm, 0) >> >> +/* >> + * flush_cache_vmap is invoked after map_kernel_range() has installed the page >> + * table entries, which modifies PTE, SFENCE.VMA should be inserted. > > Just my humble opinion, flush_cache_vmap() may not be necessary. vmalloc_fault > can take care of this, and finally sfence.vma is inserted in related path. > I believe Palmer and Jisheng are right, my initial proposal to implement flush_cache_vmap is wrong. But then, Jiuyang should not have noticed any problem here, so what's wrong? @Jiuyang: Does implementing flush_cache_vmap fix your issue? And regarding flush_cache_vunmap, from Jisheng call stack, it seems also not necessary. @Jiuyang: Can you tell us more about what you noticed? > Regards > >> + */ >> +#define flush_cache_vmap(start, end) flush_tlb_all() >> + >> #ifndef CONFIG_SMP >> >> #define flush_icache_all() local_flush_icache_all() >> -- >> 2.31.1 > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv >