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

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


  • To: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 14 Aug 2026 09:37: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: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: Fri, 14 Aug 2026 07:37:57 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 13.08.2026 19:03, Oleksii Kurochko wrote:
> On 8/13/26 4:54 PM, Jan Beulich wrote:
>> On 04.08.2026 17:47, Oleksii Kurochko wrote:
>>> @@ -1324,9 +1359,15 @@ int evtchn_reset(struct domain *d, bool resuming)
>>>           rc = -EAGAIN;
>>>       else if ( d->evtchn_fifo )
>>>       {
>>> -        /* Switching back to 2-level ABI. */
>>>           evtchn_fifo_destroy(d);
>>> -        evtchn_2l_init(d);
>>> +
>>> +        if ( IS_ENABLED(CONFIG_HAS_SHARED_INFO) )
>>> +            /* Switching back to 2-level ABI. */
>>> +            evtchn_2l_init(d);
>>> +        else if ( IS_ENABLED(CONFIG_EVTCHN_FIFO) )
>>> +            evtchn_fifo_init_ops(d);
>>> +        else
>>> +            evtchn_none_init(d);
>>
>> This being the same as ...
>>
>>> @@ -1625,7 +1666,13 @@ void evtchn_check_pollers(struct domain *d, unsigned 
>>> int port)
>>>   
>>>   int evtchn_init(struct domain *d, unsigned int max_port)
>>>   {
>>> -    evtchn_2l_init(d);
>>> +    if ( IS_ENABLED(CONFIG_HAS_SHARED_INFO) )
>>> +        evtchn_2l_init(d);
>>> +    else if ( IS_ENABLED(CONFIG_EVTCHN_FIFO) )
>>> +        evtchn_fifo_init_ops(d);
>>> +    else
>>> +        evtchn_none_init(d);
>>
>> ... this: Maybe have a small helper (evtchn_preinit()?), to reduce the
>> duplication? Would require comment updates then as well.
> 
> I think then it will be needed to fix a lot of comments. My suggestion 
> is the following:
> 
> diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
> index 0911808fe861..809638ce4bfd 100644
> --- a/xen/common/event_channel.c
> +++ b/xen/common/event_channel.c
> @@ -71,10 +71,23 @@ static void evtchn_none_init(struct domain *d)
>       d->evtchn_port_ops = &evtchn_port_ops_none;
>   }
>   #else
> -/* Declaration only; the calls below are DCE'd unless both configs are 
> off. */
> +/*
> + * Declaration only; the call in evtchn_preinit() is DCE'd unless both
> + * configs are off.
> + */
>   void evtchn_none_init(struct domain *d);
>   #endif /* !CONFIG_HAS_SHARED_INFO && !CONFIG_EVTCHN_FIFO */
> 
> +static void evtchn_preinit(struct domain *d)
> +{
> +    if ( IS_ENABLED(CONFIG_HAS_SHARED_INFO) )
> +        evtchn_2l_init(d);
> +    else if ( IS_ENABLED(CONFIG_EVTCHN_FIFO) )
> +        evtchn_fifo_init_ops(d);
> +    else
> +        evtchn_none_init(d);
> +}
> +
>   /*
>    * Lock an event channel exclusively. This is allowed only when the 
> channel is
>    * free or unbound either when taking or when releasing the lock, as any
> @@ -1359,15 +1372,9 @@ int evtchn_reset(struct domain *d, bool resuming)
>           rc = -EAGAIN;
>       else if ( d->evtchn_fifo )
>       {
> +        /* Switching back to the default ABI. */
>           evtchn_fifo_destroy(d);
> -
> -        if ( IS_ENABLED(CONFIG_HAS_SHARED_INFO) )
> -            /* Switching back to 2-level ABI. */
> -            evtchn_2l_init(d);
> -        else if ( IS_ENABLED(CONFIG_EVTCHN_FIFO) )
> -            evtchn_fifo_init_ops(d);
> -        else
> -            evtchn_none_init(d);
> +        evtchn_preinit(d);
>       }
> 
>       write_unlock(&d->event_lock);
> @@ -1666,12 +1673,7 @@ void evtchn_check_pollers(struct domain *d, 
> unsigned int port)
> 
>   int evtchn_init(struct domain *d, unsigned int max_port)
>   {
> -    if ( IS_ENABLED(CONFIG_HAS_SHARED_INFO) )
> -        evtchn_2l_init(d);
> -    else if ( IS_ENABLED(CONFIG_EVTCHN_FIFO) )
> -        evtchn_fifo_init_ops(d);
> -    else
> -        evtchn_none_init(d);
> +    evtchn_preinit(d);
> 
>       d->max_evtchn_port = min_t(unsigned int, max_port, INT_MAX);
> 
> diff --git a/xen/common/event_channel.h b/xen/common/event_channel.h
> index c8ee09807008..156514fefff6 100644
> --- a/xen/common/event_channel.h
> +++ b/xen/common/event_channel.h
> @@ -71,8 +71,8 @@ static inline void evtchn_fifo_destroy(struct domain *d)
>   #endif /* CONFIG_EVTCHN_FIFO */
> 
>   /*
> - * Declaration only when !CONFIG_EVTCHN_FIFO; the (dead) calls in
> - * evtchn_init() and evtchn_reset() are DCE'd in that case.
> + * Declaration only when !CONFIG_EVTCHN_FIFO; the (dead) call in
> + * evtchn_preinit() is DCE'd in that case.
>    */
>   void evtchn_fifo_init_ops(struct domain *d);
> 
> diff --git a/xen/common/event_fifo.c b/xen/common/event_fifo.c
> index 3b6e619c5278..f11c4c16efa3 100644
> --- a/xen/common/event_fifo.c
> +++ b/xen/common/event_fifo.c
> @@ -423,10 +423,9 @@ static const struct evtchn_port_ops 
> evtchn_port_ops_fifo =
>   };
> 
>   /*
> - * evtchn_fifo_init_ops()'s only call sites are in the
> - * IS_ENABLED(CONFIG_EVTCHN_FIFO) dead branches of evtchn_init() and
> - * evtchn_reset(), which are never reached on HAS_SHARED_INFO=y builds
> - * because of DCE.
> + * evtchn_fifo_init_ops()'s only call site is the
> + * IS_ENABLED(CONFIG_EVTCHN_FIFO) dead branch of evtchn_preinit(), which is
> + * never reached on HAS_SHARED_INFO=y builds because of DCE.
>    */
>   #ifndef CONFIG_HAS_SHARED_INFO
>   void evtchn_fifo_init_ops(struct domain *d)
> diff --git a/xen/include/xen/event.h b/xen/include/xen/event.h
> index 930190054cf0..595dedf0792c 100644
> --- a/xen/include/xen/event.h
> +++ b/xen/include/xen/event.h
> @@ -211,7 +211,7 @@ static bool evtchn_usable(const struct evtchn *evtchn)
> 
>   void evtchn_check_pollers(struct domain *d, unsigned int port);
> 
> -/* Close all event channels and reset to 2-level ABI. */
> +/* Close all event channels and reset to the default ABI. */
>   int evtchn_reset(struct domain *d, bool resuming);
> 
> Does it look good for you?

Yes, thanks.

Jan



 


Rackspace

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