[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] make ioremap_wc() x86 only (for the time being)


  • To: Julien Grall <julien@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 2 Apr 2026 08:00:46 +0200
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=suse.com header.i="@suse.com" header.h="Content-Transfer-Encoding:In-Reply-To:Autocrypt:From:Content-Language:References:Cc:To:Subject:User-Agent:MIME-Version:Date:Message-ID"
  • Autocrypt: addr=jbeulich@xxxxxxxx; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>
  • Delivery-date: Thu, 02 Apr 2026 06:01:04 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 02.04.2026 05:31, Julien Grall wrote:
> Hi Oleksii,
> 
> On 30/03/2026 15:24, Oleksii Kurochko wrote:
>>
>>
>> On 3/30/26 4:22 PM, Oleksii Kurochko wrote:
>>>
>>>
>>> On 2/19/26 4:53 PM, Jan Beulich wrote:
>>>> Its use in domain building is questionable: Already at the point both 
>>>> uses
>>>> were introduced, ioremap_cache() existed. I can't see why kernel and
>>>> initrd would need mapping WC, when at the same time other similar 
>>>> mappings
>>>> (in common/device-tree/) are done WB.
>>>>
>>>> With those uses replaced, neither Arm nor RISC-V have a need for the
>>>> function anymore.
>>>>
>>>
>>> It is okay for RISC-V, but for Arm, IIRC, likely it was done because 
>>> guest might start with cache disabled and PAGE_HYPERVISOR_WC on Arm 
>>> uses "Normal Non-cacheable" what could lead to that guest won't see 
>>> some part of kernel and/or initrd as it could be in a cache and won't 
>>> be flushed to RAM.
>>>
>>> But probably I misremembered something and 
>>> clean_and_invalidate_dcache_va_range() or something similar should be 
>>> called before guest is laucned.
>>
>> okay, so for this case copy_to_guest_phys_flush_dcache() is called after 
>> initrd and kernel are loaded.
> 
> Looking at the code, we are using ioremap_wc() on the source side rather 
> than the destination. So the use of copy_to_guest_phys_flush_cache() 
> would not matter as this only applies to the destination.
> 
> Regarding the source side, the cache only guarantees coherency when either:
>    * the memory attributes are similar between the component that loaded 
> it (most likely the firmware) and Xen
>    * The component that loaded it issued a cache flush
> 
> I saw Jan mentioned that other part of the device-tree code are using 
> ioremap_cache(). They were adding afterwards and I can't remember why we 
> consisder it was ok.

This sounds like you think it isn't okay.

> For older mapping we would be switching from a 
> non-cacheable mapping (HYPERVISOR_WC) to a cacheable one (HYPERVISOR).

Whereas this sounds like you think switching everything to WB (or whatever
the correct term on Arm) would be okay. IOW - I'm confused, and hence I'm
...

> While I agree we should have some consistency in the mappings, I am a 
> bit unease to change the attributes without any written details on why 
> there will not be any impact.

... also unclear as to whether this actually is an objection to the Arm
part of the change (incl patch 1). Please clarify.

As to written details: Mappings of ordinary RAM shouldn't need any extra
documentation when done WB. Any non-standard mappings (like WC) should
instead have comments. The absence of such comments indicates to me that
at the time the "best thing thought to be available" was used, i.e. WC
preferred over UC (which plain ioremap() would have used). Additionally,
the use of ioremap_wc() from initrd_load() (not Arm-specific) pretty
clearly isn't appropriate for RISC-V, aiui.

That said, using ioremap*() for RAM feels bogus in the first place. At
the time vmap() didn't exist yet, so it may have been appropriate. If
there are reasons not to use it here, perhaps something like Linux'es
memremap() should long have been introduced?

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.