Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2353056ybl; Thu, 15 Aug 2019 10:25:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqwHt7hIVeLFIrxvs6L83BN9s9mjF1iRKvEf6GrFNFessSoD4kTk2S3K1zkGzbqNX59YVOyM X-Received: by 2002:a65:5082:: with SMTP id r2mr4289079pgp.170.1565889941608; Thu, 15 Aug 2019 10:25:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565889941; cv=none; d=google.com; s=arc-20160816; b=PTJCTpJIzB1mWPXelfTMSiNB97TYvNTXoRgAkPFlYMowv1gMeoqziRO5W2BFmJevgK 3gv+cRGWSHcVOw4QX8q/rICVNvdQv5jPwl1/QTobuzmkToYGzn2zephDnyppt6eq0Sq+ 3xssiMq3YRBoOJtBuZChe8OL+Bv2R6qRUpNNqq4rFwN18PkIaoIe0srIldPfC92uUy5V XWLMqU1XbXWidZv/5wsMVoXRqJfswXwfmwOvb1hX17jIWZZlUw/JUQH7AFIuYqa1rKF9 LLqIrsAqbRNa97fnrW9sUnyb7QNCO1uX7LXVeCGDvDGXSiIU0Cn9ZngZOqYBe1T2aSca LlqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to; bh=2aKvtWpAYD2GqPaRvOz2TafsfYg3rgHYQnJiw5x8ehk=; b=Zh5s3/f+qbqYJvY9jvDpuuTtFtqZQ26bAEif0tq8pG+dQEBphvkA0Rz1KKeWWOirVK GTo4fhtwSHSLXTPedyj6H6dfJY7fEzX7izSIIIVKeuvFwC2WY84iDlEy9r2CADoUlLw2 LjhKU+BR/S4M9SNcC6OSU7h4k4jm6GimajxswTN9zIRJsVGqpVwvDrWXUc9X0/Iix5Mt 7+UDmt/Pl6KlFCOVaEuZ0HRL/SD6DJKL2rrRqDOFcSwhWolrz4Fj1xh/mQEPkOBIeW7n fjYAf+MX40I8Y5Kr52CSMLTuBB/oJZUNivJ7S/n1gxy4khgzmNWPat7on0hfMSW2Zbgl eLjQ== 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 gn12si2264161plb.321.2019.08.15.10.25.23; Thu, 15 Aug 2019 10:25:41 -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 S1730869AbfHOQUo (ORCPT + 99 others); Thu, 15 Aug 2019 12:20:44 -0400 Received: from ale.deltatee.com ([207.54.116.67]:59628 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730857AbfHOQUo (ORCPT ); Thu, 15 Aug 2019 12:20:44 -0400 Received: from s0106ac1f6bb1ecac.cg.shawcable.net ([70.73.163.230] helo=[192.168.11.155]) by ale.deltatee.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1hyIUJ-0001Sz-T8; Thu, 15 Aug 2019 10:20:32 -0600 To: Greentime Hu 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 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> From: Logan Gunthorpe Message-ID: <315f8a06-72f8-9ee8-4a3c-aa9e66b472fd@deltatee.com> Date: Thu, 15 Aug 2019 10:20:28 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 70.73.163.230 X-SA-Exim-Rcpt-To: linux-mm@vger.kernel.org, hch@lst.de, michaeljclark@mac.com, linux-riscv@lists.infradead.org, olof@lixom.net, sbates@raithlin.com, linux-kernel@vger.kernel.org, palmer@sifive.com, andrew@sifive.com, aou@eecs.berkeley.edu, robh@kernel.org, paul.walmsley@sifive.com, green.hu@gmail.com, greentime.hu@sifive.com X-SA-Exim-Mail-From: logang@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-8.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, GREYLIST_ISWHITE autolearn=ham autolearn_force=no version=3.4.2 Subject: Re: [PATCH v4 2/2] RISC-V: Implement sparsemem X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? Logan