From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A6DBC433B4 for ; Fri, 9 Apr 2021 12:07:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DAB3361042 for ; Fri, 9 Apr 2021 12:07:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DAB3361042 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 62B8E6B006E; Fri, 9 Apr 2021 08:07:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5DB516B0070; Fri, 9 Apr 2021 08:07:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 47C106B0074; Fri, 9 Apr 2021 08:07:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0009.hostedemail.com [216.40.44.9]) by kanga.kvack.org (Postfix) with ESMTP id 2F7996B006E for ; Fri, 9 Apr 2021 08:07:33 -0400 (EDT) Received: from smtpin40.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id D7CD7A8C4 for ; Fri, 9 Apr 2021 12:07:32 +0000 (UTC) X-FDA: 78012703944.40.8DC51D8 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf28.hostedemail.com (Postfix) with ESMTP id 0169D2000263 for ; Fri, 9 Apr 2021 12:07:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617970051; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cPZ0Ie5xguOPpDLkGIOIn4xg63tOXcjWUdAtpJa2pV4=; b=UNpOKj/G7KAXPeGzotxcWODpud4BPr5jyjcZRbDpY2MQM1Y9/+g+VkY/+yL8HR3iEoaVUV uW4HaAh8CoLj0FCZFuhNCqph0TqEh/pcifi1X6vVyRT8x1SXfDfTWzAeiGPsQKfmxy0gs+ 0O7NWYkcgENBy7NongghIEh2DvQm5+w= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-47-m71PPXm6OwGvDs3bRsxdqA-1; Fri, 09 Apr 2021 08:07:29 -0400 X-MC-Unique: m71PPXm6OwGvDs3bRsxdqA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E92AA801971; Fri, 9 Apr 2021 12:07:27 +0000 (UTC) Received: from [10.36.115.11] (ovpn-115-11.ams2.redhat.com [10.36.115.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 75E3460916; Fri, 9 Apr 2021 12:07:25 +0000 (UTC) To: Alex Ghiti , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org Cc: Vitaly Wool , Mike Rapoport References: <20210409065115.11054-1-alex@ghiti.fr> <3500f3cb-b660-5bbc-ae8d-0c9770e4a573@ghiti.fr> From: David Hildenbrand Organization: Red Hat GmbH Subject: Re: [PATCH v7] RISC-V: enable XIP Message-ID: Date: Fri, 9 Apr 2021 14:07:24 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Rspamd-Queue-Id: 0169D2000263 X-Stat-Signature: aa7j8yrp3dczjondfddcnu3atzor4soh X-Rspamd-Server: rspam02 Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf28; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=216.205.24.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1617970052-241558 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 09.04.21 13:39, Alex Ghiti wrote: > Hi David, >=20 > Le 4/9/21 =C3=A0 4:23 AM, David Hildenbrand a =C3=A9crit=C2=A0: >> On 09.04.21 09:14, Alex Ghiti wrote: >>> Le 4/9/21 =C3=A0 2:51 AM, Alexandre Ghiti a =C3=A9crit=C2=A0: >>>> From: Vitaly Wool >>>> >>>> Introduce XIP (eXecute In Place) support for RISC-V platforms. >>>> It allows code to be executed directly from non-volatile storage >>>> directly addressable by the CPU, such as QSPI NOR flash which can >>>> be found on many RISC-V platforms. This makes way for significant >>>> optimization of RAM footprint. The XIP kernel is not compressed >>>> since it has to run directly from flash, so it will occupy more >>>> space on the non-volatile storage. The physical flash address used >>>> to link the kernel object files and for storing it has to be known >>>> at compile time and is represented by a Kconfig option. >>>> >>>> XIP on RISC-V will for the time being only work on MMU-enabled >>>> kernels. >>>> >>> I added linux-mm and linux-arch to get feedbacks because I noticed th= at >>> DEBUG_VM_PGTABLE fails for SPARSEMEM (it works for FLATMEM but I thin= k >>> it does not do what is expected): the fact that we don't have any str= uct >>> page to back the text and rodata in flash is the problem but to which >>> extent ? >> >> Just wondering, why can't we create a memmap for that memory -- or is = it >> even desireable to not do that explicity? There might be some nasty si= de >> effects when not having a memmap for text and rodata. >=20 >=20 > Do you have examples of such effects ? Any feature that will not work > without that ? >=20 At least if it's not part of /proc/iomem in any way (maybe "System RAM"=20 is not what we want without a memmap, TBD), kexec-tools won't be able to=20 handle it properly e.g., for kdump. But not sure if that is really=20 relevant in your setup. Regarding other features, anything that does a pfn_valid(),=20 pfn_to_page() or pfn_to_online_page() would behave differently now --=20 assuming the kernel doesn't fall into a section with other System RAM=20 (whereby we would still allocate the memmap for the whole section). I guess you might stumble over some surprises in some code paths, but=20 nothing really comes to mind. Not sure if your zeropage is part of the=20 kernel image on RISC-V (I remember that we sometimes need a memmap=20 there, but I might be wrong)? I assume you still somehow create the direct mapping for the kernel,=20 right? So it's really some memory region with a direct mapping but=20 without a memmap (and right now, without a resource), correct? [...] >> >> Also, will that memory properly be exposed in the resource tree as >> System RAM (e.g., /proc/iomem) ? Otherwise some things (/proc/kcore) >> won't work as expected - the kernel won't be included in a dump. >=20 >=20 > I have just checked and it does not appear in /proc/iomem. >=20 > Ok your conclusion would be to have struct page, I'm going to implement > this version then using memblock as you described. Let's first evaluate what the harm could be. You could (and should?)=20 create the kernel resource manually - IIRC, that's independent of the=20 memmap/memblock thing. @Mike, what's your take on not having a memmap for kernel text and ro dat= a? --=20 Thanks, David / dhildenb