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

Re: [PATCH v2 05/12] x86/hvm: Remove duplicate calls caused by tracing


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 21 Sep 2021 14:18:56 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=BPsGZx1BZ9bZll4oOKgFeSjcCZ1FW9k+MZvkR+BufVA=; b=F575BJA5gLWHM87gJaB1141YsNAfXZonAewFzgCgmoBLtutCkP5ryn+EmNms2t9mfJst9ISPhxMjjt/9UbSCchSIsREo1QlUVUhRvs812uYPjNoLaAseBhtkz4pH7gyAxDJ14HnsSIi/HOqMtrr6NYFZovaQlw5XOQitRnSJg3kiv/VDyDXGCQstGKAAQAzbB2xqVLdaP0qn4XOuRaMVSd7ZQE+2mkmcVnNBKojCSY2Fb3M8h6qlESSK7QhEJH2sp04wT+DWNVLcliwfz0Eh9SXrIHnPJs0S8eZBnwBVe+R3R9ws/fjXdgflspOs8YevsgkvftJYLYXjhNHP2eH2Nw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QH1vvyo4fGgK1OkXnHuV6ioH8VkmpAQTMO0AQm2Qc15bxZJe28JUNddyc9jwGEBQkXVA/ijzjh6ZsLjZ6oaKKKCshUdsNuhrF6s/P1/6lIryPzgNLTqOFlfBB+fQn8ZMwLsglEGq7ap+HTQYHpKKtg/s+njeoEpKCTKwS/hRwNXRtb6KO/JPakNgNdRXAfyempzLKH5BWBCW6eIFgDU2Q/Zt3S/bKCn39KDhPozXwL2K8CJvlrOJin18r4jRJsgQt+EfQR8Fl9HytW/pDTZp3735i7CcrR77DZZkd3o1cSe5jx5XhF6d9OiaItCaNPMVFamM/6bwdlFXfksEwjh/ZA==
  • Authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 21 Sep 2021 12:19:08 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 20.09.2021 19:25, Andrew Cooper wrote:
> 1) vpic_ack_pending_irq() calls vlapic_accept_pic_intr() twice, once in the
>    TRACE_2D() instantiation and once "for real".  Make the call only once.
> 
> 2) vlapic_accept_pic_intr() similarly calls __vlapic_accept_pic_intr() twice,
>    although this is more complicated to disentangle.
> 
>    v cannot be NULL because it has already been dereferenced in the function,
>    causing the ternary expression to always call __vlapic_accept_pic_intr().
>    However, the return expression of the function takes care to skip the call
>    if this vCPU isn't the PIC target.  As __vlapic_accept_pic_intr() is far
>    from trivial, make the TRACE_2D() semantics match the return semantics by
>    only calling __vlapic_accept_pic_intr() when the vCPU is the PIC target.
> 
> 3) hpet_set_timer() duplicates calls to hpet_tick_to_ns().  Pull the logic out
>    which simplifies both the TRACE and create_periodic_time() calls.
> 
> 4) lapic_rearm() makes multiple calls to vlapic_lvtt_period().  Pull it out
>    into a local variable.
> 
> vlapic_accept_pic_intr() is called on every VMEntry, so this is a reduction in
> VMEntry complexity across the board.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

> --- a/xen/arch/x86/hvm/vpic.c
> +++ b/xen/arch/x86/hvm/vpic.c
> @@ -512,14 +512,15 @@ void vpic_irq_negative_edge(struct domain *d, int irq)
>  
>  int vpic_ack_pending_irq(struct vcpu *v)
>  {
> -    int irq;
> +    int irq, accept;

Strictly speaking "accept" wants to be bool, and ...

>      struct hvm_hw_vpic *vpic = &v->domain->arch.hvm.vpic[0];
>  
>      ASSERT(has_vpic(v->domain));
>  
> -    TRACE_2D(TRC_HVM_EMUL_PIC_PEND_IRQ_CALL, vlapic_accept_pic_intr(v),
> -             vpic->int_output);
> -    if ( !vlapic_accept_pic_intr(v) || !vpic->int_output )
> +    accept = vlapic_accept_pic_intr(v);

... vlapic_accept_pic_intr() would eventually also want to be
converted to return bool.

Jan




 


Rackspace

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