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

Re: [PATCH 2/2] x86: Remove stubs from asm/pv/domain.h


  • To: Grygorii Strashko <grygorii_strashko@xxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
  • Date: Wed, 12 Nov 2025 18:21:36 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=epam.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fO3LhbHyUb4uHq0X7a53YLERszG34i+96s5FCgZT1W0=; b=j8KAQzC2thti2YDsQ0wQQL/7JZ46kddqQQ0xXSLpoQDDWY9FQnOOS3otlLgzPCGjnpyBRkQWtaDgxXOg3pkOMRHqFVAjUg654JrmhTAu5n12fdJ0LCOj3g76sAnab5vrkgygCIzZScYbLbdXY80LGNBk55P8Avxl4anurSUhITfXqHrIIm3aglRoTTJqZ9wv9JSt3hq8s4nEZ8wk4q+E7IDWv5CXEtUBg8M3AAuZoSJSZDUQ4eYxIj1usT739M+q9JeXRA4ih9OXL8zXf/qs828Yv9FQQOrZ6v3avQonzEGWiyfKUC2f5XwDuknuT95eLQz/9yjXwxUCj9XYh127rQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gAuG92hq6frk7OxhbTPubusFHD4FOSGj5C4Lys8TLNBiSnprlJQAxKc/dyn80pchbhEirX4hTA+kYytwvFMNKQDCEzWXRFlT0m5Gb1FjZs4mRJVpPviGocBSR3ZiyWYeLsI1+j/Hy94LWzYS/jBH39sr3cPRtbUwOiCkZnQfJlwssSqQhaGzWtY9vDvzXcmYxN1CaY9o72BH9+gz3sxnUScQ93V/6jFDp+283+FJHvmjNrkJURwO2AzSLrl4MK2+BGGI0YLAkZn7TBzNERbIgepTbUw6FdPjetTUTVOaYTovLbl2Sm6aUF/HrYDanB95v2T+E88kMltSoKNgXezZzQ==
  • Cc: Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Jason Andryuk <Jason.Andryuk@xxxxxxx>
  • Delivery-date: Wed, 12 Nov 2025 17:21:54 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed Nov 12, 2025 at 4:56 PM CET, Grygorii Strashko wrote:
>
>
> On 12.11.25 17:22, Alejandro Vallejo wrote:
>> They are unnecessary. The only two cases with link-time failures are
>> fallback else branches that can just as well be adjusted with explicit
>> IS_ENABLED(CONFIG_PV). HVM has no equivalent stubs and there's no reason
>> to keep the asymmetry.
>> 
>> No functional change.
>> 
>> Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
>> ---
>> I'd rather remove the "rc = -EOPNOTSUPP" branch altogether, or replace
>> it with ASSERT_UNREACHABLE(), but I kept it here to preserve prior behaviour.
>> 
>> Thoughts?
>> 
>> ---
>>   xen/arch/x86/domain.c                | 10 ++++++----
>>   xen/arch/x86/include/asm/pv/domain.h | 25 -------------------------
>>   2 files changed, 6 insertions(+), 29 deletions(-)
>> 
>> diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
>> index 19fd86ce88..0977d9323d 100644
>> --- a/xen/arch/x86/domain.c
>> +++ b/xen/arch/x86/domain.c
>> @@ -571,15 +571,17 @@ int arch_vcpu_create(struct vcpu *v)
>>   
>>       if ( is_hvm_domain(d) )
>>           rc = hvm_vcpu_initialise(v);
>> -    else if ( !is_idle_domain(d) )
>> -        rc = pv_vcpu_initialise(v);
>> -    else
>> +    else if ( is_idle_domain(d) )
>>       {
>
> The is_idle_domain() wants to go first here, i think.
> [1] https://patchwork.kernel.org/comment/26646246/

I'm not sure I follow. I inverted the condition in order for the PV case to
become the fallback "else" and be thus eliminable through DCE.

>
>>           /* Idle domain */
>>           v->arch.cr3 = __pa(idle_pg_table);
>>           rc = 0;
>>           v->arch.msrs = ZERO_BLOCK_PTR; /* Catch stray misuses */
>>       }
>> +    else if ( IS_ENABLED(CONFIG_PV) )
>> +        rc = pv_vcpu_initialise(v);
>> +    else
>> +        rc = -EOPNOTSUPP;
>>   
>>       if ( rc )
>>           goto fail;
>
> Actually, if you are here and have time and inspiration :)

I may find at least one of those two :)

> - if ( is_idle_domain(d) ) staff can be consolidated at the
>    beginning of arch_vcpu_create() which will make it much more readable and 
> simple.

Good point

Though it's subtle because the idle domain has wacky matching semantics
and there's many exit paths. Let me see if I can make a clearer version
with that sort of consolidation that is not a functional change.

> - mapcache_vcpu_init() is PV only (->pv_vcpu_initialise()?)

This I shouldn't do. It's PV-only only temporarily. The directmap removal series
(in-flight for a while now, but ought to make it upstream sooner or later) makes
it also usable for HVM when the directmap is sparsely populated. I'd rather not
generate more churn than I have to for that series.

Cheers,
Alejandro



 


Rackspace

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