Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1136pxa; Mon, 3 Aug 2020 20:33:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxds0XhXP9d+GO9fnLbnpKptkIpL8c/d5JP2uvhFm60lXRIq6Ct4ggUsf28rUpd+MUyRmnR X-Received: by 2002:a17:906:2801:: with SMTP id r1mr301243ejc.17.1596511981200; Mon, 03 Aug 2020 20:33:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596511981; cv=none; d=google.com; s=arc-20160816; b=ao8DqYAofsy976PDB3/0vjNZCMyQPk3CSN2ZLD6SMpgFvh/wNobQDF2vqpZIwbbKPw fw38WryBipbh4RApzB8G4sl9GSfYDvChRZwwbk2QonPrGwXx6cQzpVrmSi2cRwi9WngQ 3HbAq95g8IGa1Gl0PnQjwCJrbeRna5jK3ORUDy8Do+QR2DIr8fa94+s/h2bHBG03Iz0K /gztRg4CbXsJbxvCQP52WRYsSJwLoHfnJNV7etuV0+KxE5IFLvmnVFAvBPhdowoWHIYs RpTjSYrA+AnYY0dhs6PiD3zidCIoMbSv71jjnzhyAfZIhZKyd3+Hh/rhdoiuY1AHRhvr l7eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=LmKKzdmsH+1VZAyS/bcCQ07sLy0DbSnTthJzq4HEE1c=; b=B233RG0J5XVfsUssUOELBrkArLS5unYK7X09vKvaz5k3JSnUGHlYvwOCqiafEQF2qD /3rwgIeiHoemks6RhvBLyiO4lk1kjZP/CdxhSQRO5uegjlVx5dFYCDq/NgVSFasD26lG rpLynnYnUjchXfrOMKH/DhrPbqFunZtang1xorEK5mBbd9ciIWD6lINX+SWAqDrp5/aK IPpIrdO3bqJ+hyONj11rDHwfve1b2w6qjkAUywUNPKMr4g7nS41CbL4+1QPQ1tLWCjd4 A8F3JR64OtDc5oqMaAlgyd/XD2sj0XRvaBoqjCku/xiehWwOCrTID7BqKof5RN794CSD QLww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=N2Lx7bIp; 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 h25si11972537eje.30.2020.08.03.20.32.34; Mon, 03 Aug 2020 20:33:01 -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; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=N2Lx7bIp; 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 S1729660AbgHDD3q (ORCPT + 99 others); Mon, 3 Aug 2020 23:29:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729642AbgHDD3q (ORCPT ); Mon, 3 Aug 2020 23:29:46 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED618C06174A for ; Mon, 3 Aug 2020 20:29:45 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id y3so35986465wrl.4 for ; Mon, 03 Aug 2020 20:29:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LmKKzdmsH+1VZAyS/bcCQ07sLy0DbSnTthJzq4HEE1c=; b=N2Lx7bIpVS3FuJKK0Z0ef/alEh+npxvLnHgcnIQmEEHSV+bOdivorBtrAUOaIjaQuM /eLnzoiN2RHn5o1vELmITihEHOO1s7vfh3oLze4o01+BvJh61NtK3lY3JGcrm11VHvA3 XWw5mSxLNCwU1VcD8M1Bx+/ZrsYDZFBVUeM/1pDg7SJ9T4sWiiy5WrOyAcymIlTB+GHE 5mcsx6xQqdsgGXxYVoIHdGjoPjIjjlKHmYw2RNFeIbGMXEncp3CtPnFNqwM4BeujMFkn 0BThrq0Ha2ymRqGfYsvbBo8ibUwzjiePhV6KYPqfqV+MXGsBlerMbU2HLYvKZwXW00Au OCbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LmKKzdmsH+1VZAyS/bcCQ07sLy0DbSnTthJzq4HEE1c=; b=tWxqLvp/7UCeAm7DVXd2w/xffhPHICyGQU0Bgwjd+NJywZQge5i3dKsUuXJNlC7FFV lY2CLJnfclPNoIHZNz2piAWJLXMpvdZf8IJ+PryOfc5ui7ZagxQVzpNrzo4+57pAj5Gi Tn8wkWGFpdjaeMxoErKQqJXocihG6SnkoJBHaQ9d4r1tEtCGkZ70mtmqzBgTF/mCFZQY R2/5NMZ9mHK+s7vwOcjSN8Nr5LcW5n2MoOc78fUgX1dw3oAmzTte48oMpyqKKGFcbUzI lu6xa+d5mOdctctkq319Aqg0OtWE3yclPuyF+r0prx3J6ZwNJsGBVSZiFb2iAP1mhLT2 /c6A== X-Gm-Message-State: AOAM530es/oJSjsnenVQSZufWoMs1X6O3s8+QXWYUyqMBeTY2CEzZW2o kA+ApaMJ3/fTADkImQ+z+P3jlfdAMQLZwxXLz5Hpm3Mi X-Received: by 2002:adf:fb87:: with SMTP id a7mr18913370wrr.390.1596511784511; Mon, 03 Aug 2020 20:29:44 -0700 (PDT) MIME-Version: 1.0 References: <20200804030205.91656-1-greentime.hu@sifive.com> In-Reply-To: <20200804030205.91656-1-greentime.hu@sifive.com> From: Anup Patel Date: Tue, 4 Aug 2020 08:59:32 +0530 Message-ID: Subject: Re: [PATCH] riscv: Add sfence.vma after page table changed To: Greentime Hu Cc: linux-riscv , "linux-kernel@vger.kernel.org List" , Albert Ou , Palmer Dabbelt , Paul Walmsley , syven.wang@sifive.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 4, 2020 at 8:32 AM Greentime Hu wrote: > > This patch addes local_flush_tlb_page(addr) to use sfence.vma after the s/addes/adds > page table changed. That address will be used immediately in > memset(nextp, 0, PAGE_SIZE) to cause this issue so we should add the > sfence.vma before we use it. Alternate version of this commit description can be: Invalidate local TLB after both set_pet() and clear_pte() because the address can be used immediately after page table change. > > Fixes: f2c17aabc917 ("RISC-V: Implement compile-time fixed mappings") > > Reported-by: Syven Wang > Signed-off-by: Syven Wang > Signed-off-by: Greentime Hu > --- > arch/riscv/mm/init.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c > index f4adb3684f3d..29b0f7108054 100644 > --- a/arch/riscv/mm/init.c > +++ b/arch/riscv/mm/init.c > @@ -202,12 +202,11 @@ void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot) > > ptep = &fixmap_pte[pte_index(addr)]; > > - if (pgprot_val(prot)) { > + if (pgprot_val(prot)) > set_pte(ptep, pfn_pte(phys >> PAGE_SHIFT, prot)); > - } else { > + else > pte_clear(&init_mm, addr, ptep); > - local_flush_tlb_page(addr); > - } > + local_flush_tlb_page(addr); > } > > static pte_t *__init get_pte_virt(phys_addr_t pa) > -- > 2.28.0 > Otherwise looks good to me. Reviewed-by: Anup Patel Regards, Anup