Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1662041pxu; Thu, 17 Dec 2020 15:47:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJwieKNh7CFVOcS57+isn1wfxFbCWFdJ99s2NssaIAd415e28QwUyTWw84mp021SQqBHKmQc X-Received: by 2002:a17:906:5952:: with SMTP id g18mr1403127ejr.506.1608248867212; Thu, 17 Dec 2020 15:47:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608248867; cv=none; d=google.com; s=arc-20160816; b=Dxj3N+4D8KAd8xv7y4W+fbbweQ0I61u1QLFxRsEywnIsXyZlTHQJ2q2dcTauPazA50 msBcNMylNbH+b4/Fk7fl0jEGtRe7kORRD/8rWe55JtCJgc1NGC1rSsKqHXfprUvplgBl wrNxKAqjRxj7fDRIc2A8/rKD4+yMFJq0wZjYhqdzb0QSNDCgS4F6MebBobJ/OlOfzOQa ysXJjByUMy6kTsIkkXRuxjp8i52ef5ap4EmgubtGBOI4ngtMUXNlwC4qBeyCr8f5qieU mmN4zjmMS3ki+s6+zC0+3A63crws9e7qAyt3Z60u1Fc8TyuBlGTy9fu/lPUKfYVHS4Vu tL6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=YEsoTw48HMH8u6aKM5ZpQGVmiSJ4UnL8pOP47zgvLqg=; b=fHpLqfXYx+NFfJL4xd6ae1Ylm8oqJmVsjxO/ltGi0ZGir8+cCQEGcqXetz7tAJVSro df6yV8i+O1/Mw70v3t8dxHJdA69X6JOf5KTNRQAv3W/57ACwwPt8EPWWwNX0Pe75uqsI mvySa+dNQj3n4pfRKz2Ued6/B5aHoy0sMe82DhZKAE5DbVj2HGeCk/h8Px3mFx+Hg9lc XOPISm2gNVBOsSlrfC1EamDDLaBD35QwsLoCzkut5k9heCt2b0rqEU0pL+S5Wp+bk+kI W8vILB0K39cQqQg44D8FHqMXkOszAWiZXIrlwSeo28XiCaEgijkhM0nA3Krm2/Mn3vH1 PA2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@atishpatra.org header.s=google header.b=AIS4fbcr; 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 a73si5486394edf.23.2020.12.17.15.47.24; Thu, 17 Dec 2020 15:47:47 -0800 (PST) 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=@atishpatra.org header.s=google header.b=AIS4fbcr; 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 S1732452AbgLQXpW (ORCPT + 99 others); Thu, 17 Dec 2020 18:45:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732406AbgLQXpT (ORCPT ); Thu, 17 Dec 2020 18:45:19 -0500 Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADBB5C0611CE for ; Thu, 17 Dec 2020 15:44:28 -0800 (PST) Received: by mail-io1-xd30.google.com with SMTP id n4so343892iow.12 for ; Thu, 17 Dec 2020 15:44:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=atishpatra.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YEsoTw48HMH8u6aKM5ZpQGVmiSJ4UnL8pOP47zgvLqg=; b=AIS4fbcrDeyed9MR+yN2RrrrnUxX9oiei4nj/N9mZ4k332HAQBBeKxZQ2t6Phuhqji JTUeuxE7UwMIi4tMkfeHX1gl8RBiuU4vYPe7Kgqd84BwrrX2J1IPSI7LKg0+cwmt7e6Q 0nmYSu2TD6tpiGu6AUoTRb9Xsyt8+XdYqe8XU= 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=YEsoTw48HMH8u6aKM5ZpQGVmiSJ4UnL8pOP47zgvLqg=; b=C6qItO+TWdQvvAemir1NDYUGts5D2avqttVRysDZXbtANEBWnSBOtd/LoyJXAmcoIN k7TE9fE5zNkNYqWm7Se+tzZmXtHCuhANNqebM4BCzwit9FWaKECFj19JOXZrjvYmF3TL hnVi5A0XQb/j8SKmyCc/OolkF55rdbpWNNi6wtXo86IDKFhMBb0NZAG/vRMCunoZjmkJ pvsUrJvqDRdJyuJrC0sacJxqrfTfG5gbUneWiBFODyaozDNtrNXT3EKii3N4oYUmh0bG LAq1tVGf5j73sdhrCSoLGn+kQvPKulZyruogFJuJeSpYrQ3adLf554dM/LXTAyYUM45v JzHg== X-Gm-Message-State: AOAM5330LOxXrmAjbzOsbXgNEYiT8MiP8Hc2dAeBeQ3SIMul18Ayg93L YTX9TfF+xnd8oGnvychNqiZqQs/R/N+j552XMSEF X-Received: by 2002:a6b:2c52:: with SMTP id s79mr1494649ios.53.1608248668030; Thu, 17 Dec 2020 15:44:28 -0800 (PST) MIME-Version: 1.0 References: <20201217074855.1948743-1-atish.patra@wdc.com> In-Reply-To: From: Atish Patra Date: Thu, 17 Dec 2020 15:44:17 -0800 Message-ID: Subject: Re: [PATCH] RISC-V: Fix usage of memblock_enforce_memory_limit To: Bin Meng Cc: Atish Patra , Albert Ou , Anup Patel , linux-kernel , Palmer Dabbelt , Paul Walmsley , Andrew Morton , linux-riscv , Mike Rapoport Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 17, 2020 at 12:53 AM Bin Meng wrote: > > Hi Atish, > > On Thu, Dec 17, 2020 at 4:43 PM Atish Patra wrote: > > > > On Thu, Dec 17, 2020 at 12:12 AM Bin Meng wrote: > > > > > > Hi Atish, > > > > > > On Thu, Dec 17, 2020 at 3:49 PM Atish Patra wrote: > > > > > > > > memblock_enforce_memory_limit accepts the maximum memory size not the last > > > > address. Fix the function invocation correctly. > > > > > > > > Fixes: 1bd14a66ee52 ("RISC-V: Remove any memblock representing unusable memory area") > > > > > > > > Signed-off-by: Atish Patra > > > > --- > > > > arch/riscv/mm/init.c | 2 +- > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > > Thank you for working on this. > > > > > > Tested with QEMU 5.2.0 on 32-bit 'virt' and 'sifive_u', with > > > fw_jump.bin used as the -bios. > > > > fw_dynamic should also work unless you are using more than 1G of memory. > > Linux kernel can only support 1G of memory for RV32. The current > > I have always been using -m 2G for testing both 32-bit and 64-bit. > 32-bit 'virt' with 2G memory boots the 32-bit kernel fine. > 2GB issue with fw_dynamic is fixed with this patch. https://www.mail-archive.com/qemu-devel@nongnu.org/msg768341.html > $ qemu-system-riscv32 -nographic -M virt -m 2G -smp 4 -kernel > arch/riscv/boot/Image -bios fw_jump.bin > > > Kconfig is bit misleading and > > I will send a patch to update the description. > > > > However, kernel should be able to ignore any memory beyond what it can > > address and continue. > > I will investigate more. > > > > > 32-bit 'virt' boots, but 32-bit 'sifive_u' still does not boot, which > > > should be another issue because reverting the original 1bd14a66ee52 it > > > still does not help 'sifive_u'. > > > > > > > Are you using more than 1G of memory ? Let me know if the kernel boots > > if you use 1G. > > Kernel does not boot with 1G memory on 32-bit 'sifive_u', either with > fw_jump.bin or fw_dynamic.bin. > > $ qemu-system-riscv32 -nographic -M sifive_u -m 1G -smp 5 -kernel > arch/riscv/boot/Image -bios fw_jump.bin > This happened because of the incorrect loading address. It is already fixed by Alistair. https://www.mail-archive.com/qemu-devel@nongnu.org/msg768279.html > > > > > Tested-by: Bin Meng > > > Thanks for testing it. > > > I believe the following tag should also be added and patch cc'ed to > > > stable-kernel: > > > > > > Reported-by: Bin Meng > > > Cc: # 5.10 > Sure. I will add that and resend it. > Regards, > Bin -- Regards, Atish