All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Alejandro Vallejo <alejandro.vallejo@cloud.com>
Cc: Xen-devel <xen-devel@lists.xenproject.org>,
	Jan Beulich <jbeulich@suse.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>
Subject: Re: [PATCH v2 2/8] xen/x86: Simplify header dependencies in x86/hvm
Date: Thu, 23 May 2024 16:37:26 +0200	[thread overview]
Message-ID: <Zk9Upg9y03IYZEXd@macbook> (raw)
In-Reply-To: <00ce7005d1d6db5c1ffc2d5023d34d4bd34ff841.1715102098.git.alejandro.vallejo@cloud.com>

On Wed, May 08, 2024 at 01:39:21PM +0100, Alejandro Vallejo wrote:
> Otherwise it's not possible to call functions described in hvm/vlapic.h from the
> inline functions of hvm/hvm.h.
> 
> This is because a static inline in vlapic.h depends on hvm.h, and pulls it
> transitively through vpt.h. The ultimate cause is having hvm.h included in any
> of the "v*.h" headers, so break the cycle moving the guilty inline into hvm.h.
> 
> No functional change.
> 
> Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>

Acked-by: Roger Pau Monné <roger.pau@citrix.com>

One cosmetic comment below.

> ---
> v2:
>   * New patch. Prereq to moving vlapic_cpu_policy_changed() onto hvm.h
> ---
>  xen/arch/x86/hvm/irq.c                | 6 +++---
>  xen/arch/x86/hvm/vlapic.c             | 4 ++--
>  xen/arch/x86/include/asm/hvm/hvm.h    | 6 ++++++
>  xen/arch/x86/include/asm/hvm/vlapic.h | 6 ------
>  xen/arch/x86/include/asm/hvm/vpt.h    | 1 -
>  5 files changed, 11 insertions(+), 12 deletions(-)
> 
> diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c
> index 4a9fe82cbd8d..4f5479b12c98 100644
> --- a/xen/arch/x86/hvm/irq.c
> +++ b/xen/arch/x86/hvm/irq.c
> @@ -512,13 +512,13 @@ struct hvm_intack hvm_vcpu_has_pending_irq(struct vcpu *v)
>      int vector;
>  
>      /*
> -     * Always call vlapic_sync_pir_to_irr so that PIR is synced into IRR when
> -     * using posted interrupts. Note this is also done by
> +     * Always call hvm_vlapic_sync_pir_to_irr so that PIR is synced into IRR
> +     * when using posted interrupts. Note this is also done by
>       * vlapic_has_pending_irq but depending on which interrupts are pending
>       * hvm_vcpu_has_pending_irq will return early without calling
>       * vlapic_has_pending_irq.
>       */
> -    vlapic_sync_pir_to_irr(v);
> +    hvm_vlapic_sync_pir_to_irr(v);
>  
>      if ( unlikely(v->arch.nmi_pending) )
>          return hvm_intack_nmi;
> diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
> index 61a96474006b..8a244100009c 100644
> --- a/xen/arch/x86/hvm/vlapic.c
> +++ b/xen/arch/x86/hvm/vlapic.c
> @@ -98,7 +98,7 @@ static void vlapic_clear_irr(int vector, struct vlapic *vlapic)
>  
>  static int vlapic_find_highest_irr(struct vlapic *vlapic)
>  {
> -    vlapic_sync_pir_to_irr(vlapic_vcpu(vlapic));
> +    hvm_vlapic_sync_pir_to_irr(vlapic_vcpu(vlapic));
>  
>      return vlapic_find_highest_vector(&vlapic->regs->data[APIC_IRR]);
>  }
> @@ -1516,7 +1516,7 @@ static int cf_check lapic_save_regs(struct vcpu *v, hvm_domain_context_t *h)
>      if ( !has_vlapic(v->domain) )
>          return 0;
>  
> -    vlapic_sync_pir_to_irr(v);
> +    hvm_vlapic_sync_pir_to_irr(v);
>  
>      return hvm_save_entry(LAPIC_REGS, v->vcpu_id, h, vcpu_vlapic(v)->regs);
>  }
> diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
> index e1f0585d75a9..84911f3ebcb4 100644
> --- a/xen/arch/x86/include/asm/hvm/hvm.h
> +++ b/xen/arch/x86/include/asm/hvm/hvm.h
> @@ -798,6 +798,12 @@ static inline void hvm_update_vlapic_mode(struct vcpu *v)
>          alternative_vcall(hvm_funcs.update_vlapic_mode, v);
>  }
>  
> +static inline void hvm_vlapic_sync_pir_to_irr(struct vcpu *v)
> +{
> +    if ( hvm_funcs.sync_pir_to_irr )
> +        alternative_vcall(hvm_funcs.sync_pir_to_irr, v);

Nit: for consistency the wrappers are usually named hvm_<hook_name>,
so in this case it would be hvm_sync_pir_to_irr(), or the hvm_funcs
field should be renamed to vlapic_sync_pir_to_irr.

Thanks, Roger.


  parent reply	other threads:[~2024-05-23 14:37 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-08 12:39 [PATCH v2 0/8] x86: Expose consistent topology to guests Alejandro Vallejo
2024-05-08 12:39 ` [PATCH v2 1/8] xen/x86: Add initial x2APIC ID to the per-vLAPIC save area Alejandro Vallejo
2024-05-23 14:32   ` Roger Pau Monné
2024-05-24 10:58     ` Alejandro Vallejo
2024-05-24 11:15       ` Roger Pau Monné
2024-05-08 12:39 ` [PATCH v2 2/8] xen/x86: Simplify header dependencies in x86/hvm Alejandro Vallejo
2024-05-22  9:33   ` Jan Beulich
2024-05-22 15:24     ` Alejandro Vallejo
2024-05-23 14:37   ` Roger Pau Monné [this message]
2024-05-23 14:40     ` Jan Beulich
2024-05-23 14:52       ` Roger Pau Monné
2024-05-08 12:39 ` [PATCH v2 3/8] x86/vlapic: Move lapic_load_hidden migration checks to the check hook Alejandro Vallejo
2024-05-23 14:50   ` Roger Pau Monné
2024-05-24 11:16     ` Alejandro Vallejo
2024-05-24 12:53       ` Roger Pau Monné
2024-05-23 18:58   ` Andrew Cooper
2024-05-24  7:22     ` Roger Pau Monné
2024-05-08 12:39 ` [PATCH v2 4/8] tools/hvmloader: Wake APs with hypercalls and not with INIT+SIPI+SIPI Alejandro Vallejo
2024-05-08 19:13   ` Andrew Cooper
2024-05-09 11:04     ` Alejandro Vallejo
2024-05-09 17:50   ` [PATCH 4.5/8] tools/hvmloader: Further simplify SMP setup Andrew Cooper
2024-05-13 17:19     ` Alejandro Vallejo
2024-05-23 15:04     ` Roger Pau Monné
2024-05-08 12:39 ` [PATCH v2 5/8] tools/hvmloader: Retrieve (x2)APIC IDs from the APs themselves Alejandro Vallejo
2024-05-23 16:13   ` Roger Pau Monné
2024-05-24 15:16     ` Alejandro Vallejo
2024-05-27  8:55       ` Roger Pau Monné
2024-05-24  7:21   ` Roger Pau Monné
2024-05-24 15:15     ` Alejandro Vallejo
2024-05-27  8:52       ` Roger Pau Monné
2024-05-28 12:35         ` Alejandro Vallejo
2024-05-08 12:39 ` [PATCH v2 6/8] xen/lib: Add topology generator for x86 Alejandro Vallejo
2024-05-23 16:50   ` Roger Pau Monné
2024-05-28 13:28     ` Alejandro Vallejo
2024-05-08 12:39 ` [PATCH v2 7/8] xen/x86: Derive topologically correct x2APIC IDs from the policy Alejandro Vallejo
2024-05-24  8:39   ` Roger Pau Monné
2024-05-24 17:03     ` Alejandro Vallejo
2024-05-27  8:06       ` Roger Pau Monné
2024-05-08 12:39 ` [PATCH v2 8/8] xen/x86: Synthesise domain topologies Alejandro Vallejo
2024-05-24  8:58   ` Roger Pau Monné
2024-05-24 17:16     ` Alejandro Vallejo
2024-05-27  8:20       ` Roger Pau Monné
2024-05-28 14:06         ` Alejandro Vallejo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zk9Upg9y03IYZEXd@macbook \
    --to=roger.pau@citrix.com \
    --cc=alejandro.vallejo@cloud.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.