All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Orzel, Michal" <michal.orzel@amd.com>
To: Luca Fancellu <Luca.Fancellu@arm.com>
Cc: Harry Ramsey <Harry.Ramsey@arm.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Julien Grall <julien@xen.org>,
	Bertrand Marquis <Bertrand.Marquis@arm.com>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
	Hari Limaye <Hari.Limaye@arm.com>
Subject: Re: [PATCH 4/6] arm/mpu: Introduce modify_after_init_mappings
Date: Tue, 16 Dec 2025 15:26:53 +0100	[thread overview]
Message-ID: <52071968-d222-4bfe-ac8e-4e8cb7f3bc1f@amd.com> (raw)
In-Reply-To: <1D457431-73BE-4FA6-A27C-7D130CB9EA53@arm.com>



On 16/12/2025 14:11, Luca Fancellu wrote:
> Hi Michael,
> 
>> On 16 Dec 2025, at 09:15, Orzel, Michal <Michal.Orzel@amd.com> wrote:
>>
>>
>>
>> On 28/11/2025 10:58, Harry Ramsey wrote:
>>> From: Luca Fancellu <luca.fancellu@arm.com>
>>>
>>> During `init_done`, Xen sets the permissions of all symbols marked with
>>> __ro_after_init to be read-only. Currently this is achieved by calling
>>> `modify_xen_mappings` and will shrink the RW mapping on one side and
>>> extend the RO mapping on the other.
>> Can you be more specific about the sides you mention? How did you deduce it?
>> I assume you are talking about MMU part.
> 
> You are right, this sentence is a bit misleading.
> So what was written here was meant to say that on MPU modify_xen_mappings
> should shrink the RW mapping region and extend the RO mapping region because
> as of now they are declared like this in xen.lds.S:
> 
> read only data:
> +------------------+
> | _srodata         |
> | _erodata         |
> +-------------------+
> 
> RW data:
> +---------------------------+
> | __ro_after_init_start |
> | __ro_after_init_end  |
> | __init_begin              |
> +---------------------------+
> 
> And in head.S we map like this:
> 
> /* Xen read-only data section. */
> ldr x1, =_srodata
> ldr x2, =_erodata
> prepare_xen_region x0, x1, x2, x3, x4, x5, attr_prbar=REGION_RO_PRBAR
> 
> /* Xen read-only after init and data section. (RW data) */
> ldr x1, =__ro_after_init_start
> ldr x2, =__init_begin
> prepare_xen_region x0, x1, x2, x3, x4, x5
> 
> Now, because (__ro_after_init_start, __ro_after_init_end) needs to become RO,
> it means that RO section will be extended to (_srodata, __ro_after_init_end) and
> RW section will be shrinked to (__ro_after_init_end, __init_begin):
> 
> read only data region:
> +--------------------------+
> | _srodata                  |
> | __ro_after_init_end |
> +--------------------------+
> 
> RW data region:
> +---------------------------+
> | __ro_after_init_end  |
> | __init_begin              |
> +---------------------------+
> 
> So what we’ve done is taking (__ro_after_init_start, __ro_after_init_end) from
> the RW region and attach it to the RO region.
> 
>>
>>>
>>> This does not work on MPU systems at present because part-region
>>> modification is not supported. Therefore introduce the function
>> What else is in that region?
>> Wouldn't it be better to have one region for this __ro_after_init so that we
>> don't need to shrink/extend the mappings? Is it done because of number of
>> regions limitation?
> 
> So if we do in this way we waste one region, because we will have 2 region declared
> RO that are also contiguous, so easily mergeable, like how we are doing above by
> Extending/shrinking.
Ok, that makes more sense. I thought the descrption in commit msg was somehow
about MMU. It's not ideal to depend on the regions layout but I guess it's ok
if we don't want to waste regions.

~Michal



  reply	other threads:[~2025-12-16 14:27 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-28  9:58 [PATCH 0/6] Fourth MPU series Harry Ramsey
2025-11-28  9:58 ` [PATCH 1/6] arm/mpu: Implement copy_from_paddr for MPU systems Harry Ramsey
2025-12-04 10:44   ` Orzel, Michal
2025-11-28  9:58 ` [PATCH 2/6] arm/mpu: Implement vmap functions for MPU Harry Ramsey
2025-12-08  9:53   ` Orzel, Michal
2025-12-08 10:20     ` Luca Fancellu
2025-12-08 11:10       ` Orzel, Michal
2025-12-08 11:01     ` Harry Ramsey
2025-11-28  9:58 ` [PATCH 3/6] arm/mpu: Implement free_init_memory for MPU systems Harry Ramsey
2025-12-11 14:05   ` Orzel, Michal
2025-11-28  9:58 ` [PATCH 4/6] arm/mpu: Introduce modify_after_init_mappings Harry Ramsey
2025-12-16  9:15   ` Orzel, Michal
2025-12-16 13:11     ` Luca Fancellu
2025-12-16 14:26       ` Orzel, Michal [this message]
2025-11-28  9:58 ` [PATCH 5/6] arm: Use secure hypervisor timer in MPU system Harry Ramsey
2025-12-15 13:44   ` Orzel, Michal
2025-11-28  9:58 ` [PATCH 6/6] arm/mpu: Map domain page in AArch64 MPU systems Harry Ramsey
2025-12-16  9:26   ` Orzel, Michal
2025-12-16  9:29     ` Luca Fancellu
2025-12-16  9:32       ` Orzel, Michal
2025-12-16  9:57         ` Luca Fancellu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52071968-d222-4bfe-ac8e-4e8cb7f3bc1f@amd.com \
    --to=michal.orzel@amd.com \
    --cc=Bertrand.Marquis@arm.com \
    --cc=Hari.Limaye@arm.com \
    --cc=Harry.Ramsey@arm.com \
    --cc=Luca.Fancellu@arm.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.