Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp359905ybl; Thu, 15 Aug 2019 19:08:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqzHhTmSth28fArHH+e/NtAQmjnBsjba936MqYdHj4Hn0Odx2D021G7HiwAERuG7pGiJts47 X-Received: by 2002:a65:5c02:: with SMTP id u2mr5794365pgr.367.1565921305962; Thu, 15 Aug 2019 19:08:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565921305; cv=none; d=google.com; s=arc-20160816; b=jKvFJG9+F3y8HPbrIRJWDdi3B/09WuEFJxgqLgj7Mi8Coo9mapkRnc3li9oSZVHC/r hj6Yc3l+v6POKTDOtIOa3in30iwBux/AO4lW4LQaHST6b7DITnYlBRgXn2jpJIKW6nVv PjOVBzgURQXavkXDcRf+ExZnWP5+LUw0tbsmkgWFNridy5gv1Zv4DIqz3T9iYV5J403P hcsrFO4hPTT7F5XIBkW77nscYumk9WVGmr2Z9aXMzvNprWsjRyDCIP54A8XpuNQoDGSU 6cw1RlKcKkKKEhf8WN0tbBtIyixRFeJebCM5aAo1HPkr6BzoVuYqQSKqdMIxBG26X8eI /okA== 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=4t96VrJO/aS/379GpZWL86SzmnziIJmi9L5o4u6HMF4=; b=VE5im/zd3UQ0MyLQqOcz8EhdhFZZqxY1+NE/4N8sweTbAduEtguIRW6G/bo50Wxk3E PKUD8fn+rcnDaF8657UTwKdkSFR/sg1GB91hhg8+M3q22qvQ2oIMHYt2W5GA6yXtkGeP PZl6JDlsPSdhpaZ2/bvS4Ax8XK/unUua/xuZNnXOJp+mX0hP2jiKMpC6SrxNgcW4auU+ nNiBjbevmc9gFMpkRs0GptEftbge2mrpBnAgzspdnsh50zG6wTOQD97OBGIDpDxTdeG/ cwTUD2AX1ckVPOf3WC9nS7lg/sXTGQY89LpBnNq4h1Rgb6oCAawgCoJaUugSAMISbCro gJRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=Vrg1MvRS; 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 v11si2983085plo.223.2019.08.15.19.08.10; Thu, 15 Aug 2019 19:08:25 -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=pass header.i=@sifive.com header.s=google header.b=Vrg1MvRS; 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 S1726404AbfHPCHU (ORCPT + 99 others); Thu, 15 Aug 2019 22:07:20 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:54365 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726329AbfHPCHT (ORCPT ); Thu, 15 Aug 2019 22:07:19 -0400 Received: by mail-wm1-f68.google.com with SMTP id p74so2799231wme.4 for ; Thu, 15 Aug 2019 19:07:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4t96VrJO/aS/379GpZWL86SzmnziIJmi9L5o4u6HMF4=; b=Vrg1MvRSi8MEcTXWax28fm0Y94Y7L5w+dEhHm7nUDN1z0jmBLy24d5m6CjB6CtBncW cwSehAxMSaXQkSvTDrT0bkZx8wgxMt450myd8vIxr61UpKOG7hJ78gwa36Qs8GCcxGn5 /Cm2jQFdyB3LcbgB8kSa/5IqQ3L8KM3Z23Wf1UCneAopPqfQ6YaXBiLK2h9kb2eEmal4 cA3i9k9b55mm6naet6z3jF7eiquU/CxjIcGGUMhyO4dHR6qDzP4egWjhYqlbfOpvT5QZ uBNQt0gRL27bLoYVNBFSiVCtMB8/v2XNg5+xD8ZUy9gYPozeLXlnUsComPwI+KJ2H6LD B0Eg== 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=4t96VrJO/aS/379GpZWL86SzmnziIJmi9L5o4u6HMF4=; b=RyKmJC/p4w/laBKqqrxrmIgoGw9Ebz59AGXEEFTmRCsdskgUeSyleGmiDZkKgUYU6n HEpRhnSTipqKFOYMBkcRNPHPH0/YpCzVE6zCpacklcyqyTrbzrApkdm8dvIN0Q0mhmnd ctisRAFAGJ/sJq421h3Xsteg0L5XwvAn+vBvw9NlrfjW/MMoxCIn0NARIAXxXjOEV3s+ y+9cq01ndxRLDqEAt6As8IDR1rDd43WYNdSL+P7ZJ3SJOLnkAlsBj4qb8a98sjGO9vOD 9dyDNK2EVe80GPD8aEaXD6N56roXRcPKP67Cp8Vx95vqVc0Of2bVl5JTkVKRuIk8Iax8 WIWA== X-Gm-Message-State: APjAAAVrLipF+vkoZQ/zh6Teu5cOL7EUFYtu4nGo6msJo7DtM+35dvon tcXkYbS/PDO1hq5/BWQPqNNbfS9DxweCKghkgdieDQ== X-Received: by 2002:a1c:2dcf:: with SMTP id t198mr4510657wmt.147.1565921237851; Thu, 15 Aug 2019 19:07:17 -0700 (PDT) MIME-Version: 1.0 References: <20190109203911.7887-1-logang@deltatee.com> <0926a261-520e-4c40-f926-ddd40bb8ce44@deltatee.com> <96156909-1453-d487-ff66-a041d67c74d6@deltatee.com> <5506c875-9387-acc9-a7fe-5b7c10036c40@deltatee.com> <8b7b6285-dd85-5895-8653-be1f6f08cca8@deltatee.com> <315f8a06-72f8-9ee8-4a3c-aa9e66b472fd@deltatee.com> In-Reply-To: <315f8a06-72f8-9ee8-4a3c-aa9e66b472fd@deltatee.com> From: Greentime Hu Date: Fri, 16 Aug 2019 10:07:05 +0800 Message-ID: Subject: Re: [PATCH v4 2/2] RISC-V: Implement sparsemem To: Logan Gunthorpe Cc: Greentime Hu , Paul Walmsley , Rob Herring , Albert Ou , Andrew Waterman , Palmer Dabbelt , Linux Kernel Mailing List , Stephen Bates , Olof Johansson , linux-riscv@lists.infradead.org, Michael Clark , Christoph Hellwig , linux-mm@vger.kernel.org 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 Fri, Aug 16, 2019 at 12:20 AM Logan Gunthorpe wrote: > > > > On 2019-08-15 3:31 a.m., Greentime Hu wrote: > > Hi Logan, > > > > On Thu, Aug 15, 2019 at 6:21 AM Logan Gunthorpe wrote: > >> > >> Hey, > >> > >> On 2019-08-14 7:35 a.m., Greentime Hu wrote: > >>> How about this fix? Not sure if it is good for everyone. > >> > >> I applied your fix to the patch and it seems ok. But it doesn't seem to > >> work on a recent version of the kernel. Have you got it working on v5.3? > >> It seems the following patch breaks things: > >> > >> 671f9a3e2e24 ("RISC-V: Setup initial page tables in two stages") > >> > >> I don't really have time right now to debug this any further. > >> > > > > I just tried v5.3-rc4 and it failed. I try to debug this case. > > I found it failed might be because of an unmapped virtual address is used > > in memblocks_present() -> memblock_alloc (). > > > > In this commit 671f9a3e2e24 ("RISC-V: Setup initial page tables in two > > stages"), it finishes all the VA/PA mapping after setup_vm_final() is > > called. > > So we have to call memblocks_present() and sparse_init() right after > > setup_vm_final(). > > > > Here is my patch and I tested with memory-with-hole. > > It can boot normally in Unleashed board after applying this patch. > > Great, thanks! I'll roll this into my patch and send v5 out when I have > a moment. Can I add your Signed-off-by for the bits you've contributed > to give you credit for your work? Sure. Please use my Signed-off-by: Greentime Hu