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

Re: [PATCH] x86/shadow: Delete the none.c dummy file


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
  • Date: Mon, 9 Feb 2026 16:06:59 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.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=ZACJAMIXm9fqBihO1qHxx44lQPPNDIw2L15Y3Sh9xok=; b=A/RAdJH6ABD/adWj211XhNMMTiy6PwUwf0q4mW5iqVIsZsgklVhrSl9fhE6kmKYENxprWwRwie6OHPEVDiY1l87PHNjF8pheXY9AJxzxIMr861ON33dM1kSKf4b/IWq+cdqAJ3yPJ/JId7Cg127HsyEz5iMo6N5nAgwLmNjO77xn3W4vhEYDKqYk93DuN2yvnGS4fGBHdEj78/efG6U1MNLMezfwPqMd4E/v/YIoVZFZRM02mMMe+wXq+ZSrp0lkXyYVTPPUks3gSn6e8/LkQZDH/LZkCPeGDqr8cQgjcUF09MqvITujYEILIgCeUxIhu+RGO9DerMm4RhdxVCewKA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AvugacQntXAb/QpydDpSMzW98Zl8mbWqji0AymP64+8L7xQuCcPFk/pU3oEQcuUv5fFuMi3J9JoUX18bwzHs1Dvc4mclGSLVEckBi08GnpXdsAg+DraRztKwbvH7nJUusWZWxzCrrUcHwSmr0nVLeea1XBckYE85hxZuqzq6oekY1VwAGck7JMMzbQBtHr1vUFWAaq73W9pflL5ZdmaNJlFMp+lKD59mxNKT+3Dqo1bKA5c0HTxcU3u7ZdY0GDKT75pz4N/0kTW1oSXQu0ATDA/oDQI55yf2gODxSG38r5lAq9irs8w7tUyvA1TXYo+wi0nna0q8wMlVS1PzO1MEVQ==
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Tim Deegan <tim@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 09 Feb 2026 15:08:35 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon Feb 9, 2026 at 3:36 PM CET, Jan Beulich wrote:
> On 09.02.2026 11:41, Alejandro Vallejo wrote:
>> It only has 2 callers, both of which can be conditionally removed.
>> 
>> Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
>> ---
>> I'd be ok conditionalising the else branch on...
>> 
>>     IS_ENABLED(CONFIG_SHADOW_PAGING )|| IS_ENABLED(CONFIG_LOG_DIRTY)
>> 
>> logdirty patch: 
>> https://lore.kernel.org/xen-devel/20260209103118.5885-1-alejandro.garciavallejo@xxxxxxx
>> 
>> ... to avoid the danger of stale pointers, with required changes elsewhere so
>> none.c is only compiled out in that case.
>
> I'm not sure I understand this remark. Is this about something in the other
> patch (which I haven't looked at yet), or ...
>
>> --- a/xen/arch/x86/mm/paging.c
>> +++ b/xen/arch/x86/mm/paging.c
>> @@ -634,7 +634,7 @@ int paging_domain_init(struct domain *d)
>>       */
>>      if ( hap_enabled(d) )
>>          hap_domain_init(d);
>> -    else
>> +    else if ( IS_ENABLED(CONFIG_SHADOW_PAGING) )
>>          rc = shadow_domain_init(d);
>>  
>>      return rc;
>> @@ -645,7 +645,7 @@ void paging_vcpu_init(struct vcpu *v)
>>  {
>>      if ( hap_enabled(v->domain) )
>>          hap_vcpu_init(v);
>> -    else
>> +    else if ( IS_ENABLED(CONFIG_SHADOW_PAGING) )
>>          shadow_vcpu_init(v);
>>  }
>
> ... these two hunks? In this latter case, I don't think the bigger conditional
> would be correct.

It'd be about these hunks and the inclusion condition for shadow/. I suggest 
that
because...

>
>> --- a/xen/arch/x86/mm/shadow/none.c
>> +++ /dev/null
>> @@ -1,77 +0,0 @@
>> -#include <xen/mm.h>
>> -#include <asm/shadow.h>
>> -
>> -static int cf_check _toggle_log_dirty(struct domain *d)
>> -{
>> -    ASSERT(is_pv_domain(d));
>> -    return -EOPNOTSUPP;
>> -}
>> -
>> -static void cf_check _clean_dirty_bitmap(struct domain *d)
>> -{
>> -    ASSERT(is_pv_domain(d));
>> -}
>> -
>> -static void cf_check _update_paging_modes(struct vcpu *v)
>> -{
>> -    ASSERT_UNREACHABLE();
>> -}
>> -
>> -int shadow_domain_init(struct domain *d)
>> -{
>> -    /* For HVM set up pointers for safety, then fail. */
>> -    static const struct log_dirty_ops sh_none_ops = {
>> -        .enable  = _toggle_log_dirty,
>> -        .disable = _toggle_log_dirty,
>> -        .clean   = _clean_dirty_bitmap,
>> -    };
>> -
>> -    paging_log_dirty_init(d, &sh_none_ops);
>
> How do you avoid d->arch.paging.log_dirty.ops remaining NULL with this
> removed?

... as you point out, the ops don't get initialised. Adding the log-dirty
condition ensures there's no uninitialised ops (even when unreachable).

>
>> -    d->arch.paging.update_paging_modes = _update_paging_modes;
>
> Same question for this function pointer.
>
>> -    return is_hvm_domain(d) ? -EOPNOTSUPP : 0;
>> -}

Oh. This was a hard miss, true that.

>> -
>> -static int cf_check _page_fault(
>> -    struct vcpu *v, unsigned long va, struct cpu_user_regs *regs)
>> -{
>> -    ASSERT_UNREACHABLE();
>> -    return 0;
>> -}
>> -
>> -static bool cf_check _invlpg(struct vcpu *v, unsigned long linear)
>> -{
>> -    ASSERT_UNREACHABLE();
>> -    return true;
>> -}
>> -
>> -#ifdef CONFIG_HVM
>> -static unsigned long cf_check _gva_to_gfn(
>> -    struct vcpu *v, struct p2m_domain *p2m, unsigned long va, uint32_t 
>> *pfec)
>> -{
>> -    ASSERT_UNREACHABLE();
>> -    return gfn_x(INVALID_GFN);
>> -}
>> -#endif
>> -
>> -static pagetable_t cf_check _update_cr3(struct vcpu *v, bool noflush)
>> -{
>> -    ASSERT_UNREACHABLE();
>> -    return pagetable_null();
>> -}
>> -
>> -static const struct paging_mode sh_paging_none = {
>> -    .page_fault                    = _page_fault,
>> -    .invlpg                        = _invlpg,
>> -#ifdef CONFIG_HVM
>> -    .gva_to_gfn                    = _gva_to_gfn,
>> -#endif
>> -    .update_cr3                    = _update_cr3,
>> -};
>> -
>> -void shadow_vcpu_init(struct vcpu *v)
>> -{
>> -    ASSERT(is_pv_vcpu(v));
>> -    v->arch.paging.mode = &sh_paging_none;
>
> And the same question yet again for this pointer.
>
> Jan

However, on the whole. Under what circumstances are these handlers invoked?

They are only compiled in for !CONFIG_SHADOW. But these are only applied with
HAP disabled. Are they for PV or something?

Cheers,
Alejandro



 


Rackspace

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