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

Re: [PATCH v6 01/23] xen: introduce CONFIG_HAS_SHARED_INFO for archs without a shared page


  • To: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 28 Jul 2026 17:40:28 +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:Content-Type: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: Romain Caritey <Romain.Caritey@xxxxxxxxxxxxx>, Baptiste Le Duc <baptiste.le-duc@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 28 Jul 2026 15:40:35 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 28.07.2026 17:29, Oleksii Kurochko wrote:
> On 7/21/26 4:50 PM, Jan Beulich wrote:
>> On 20.07.2026 17:59, Oleksii Kurochko wrote:
>>> --- a/xen/common/domctl.c
>>> +++ b/xen/common/domctl.c
>>> @@ -102,9 +102,14 @@ void getdomaininfo(struct domain *d, struct 
>>> xen_domctl_getdomaininfo *info)
>>>   #ifdef CONFIG_MEM_PAGING
>>>       info->paged_pages       = atomic_read(&d->paged_pages);
>>>   #endif
>>> -    info->shared_info_frame =
>>> -        gfn_x(mfn_to_gfn(d, _mfn(virt_to_mfn(d->shared_info))));
>>> -    BUG_ON(SHARED_M2P(info->shared_info_frame));
>>> +    if ( IS_ENABLED(CONFIG_HAS_SHARED_INFO) )
>>> +    {
>>> +        info->shared_info_frame =
>>> +            gfn_x(mfn_to_gfn(d, _mfn(virt_to_mfn(d->shared_info))));
>>> +        BUG_ON(SHARED_M2P(info->shared_info_frame));
>>> +    }
>>> +    else
>>> +        info->shared_info_frame = gfn_x(INVALID_GFN);
>>
>> There's one issue left here: INVALID_GFN is a Xen internal concept. It could
>> change value if we saw a need. Therefore you cannot use that value here, to
>> supply it as hypercall output. It needs to be ~0, and imo the public header
>> also wants amending to indicate the special meaning of this value.
> 
> I think I get your point. I will use ~0 here.
> 
> I don't see INVALID_GFN in public headers. If it exists then it isn't 
> clear why it shouldn't be used here.
> 
> Don't we want to add something like:
> 
> /* Domain has no shared_info page? */
> #define XEN_INVALID_SHARED_INFO_FRAME (~0ULL)
>      uint64_aligned_t shared_info_frame; /* GMFN of shared_info struct */
> 
> in public/domctl.h.

In principle we could consider doing such, but if we did it needs to be
technically accurate. It may not, as your code fragment does, assume
that unsigned long long and uint64_aligned_t (and for just the purpose
here also uint64_t) are the same thing. Yet at the same time I think we
have successfully avoided use of the fixed-width integer constants
macros in the public headers, first and foremost because plain C89
doesn't offer them.

Hence overall I think introducing such a constant is going too far;
merely stating verbally that the field being set to all-ones has this
particular meaning should be enough.

>> And there's one further aspect to consider: Do we really want to retain the
>> shared_info struct domain field when !HAS_SHARED_INFO? 
> 
> I think we could consider that.
> 
>> Making it conditional
>> would require some adjustment here, but might be tidier overall. In
>> particular doing so would eliminate the risk of new uses of the field
>> appearing, with people not noticing that they'd break RISC-V.
> 
> Would you be okay with the following change:
> 
> +#ifdef CONFIG_HAS_SHARED_INFO
> +    info->shared_info_frame =
> +        gfn_x(mfn_to_gfn(d, _mfn(virt_to_mfn(d->shared_info))));
> +    BUG_ON(SHARED_M2P(info->shared_info_frame));
> +#else
> +    info->shared_info_frame = ~0;
> +#endif

It's not pretty, but acceptable imo.

Jan



 


Rackspace

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