mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: Peng Hao <peng.hao2@zte.com.cn>, Christoffer Dall <cdall@kernel.org>
Cc: linux-kernel@vger.kernel.org, kvmarm@lists.cs.columbia.edu,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2] KVM: arm/arm64 : add lpi info in vgic-debug
Date: Fri, 23 Mar 2018 15:27:09 +0000	[thread overview]
Message-ID: <a1148944-ef9c-7ef5-640b-2f20ce0efffd@arm.com> (raw)
In-Reply-To: <1521846074-66914-1-git-send-email-peng.hao2@zte.com.cn>

On 23/03/18 23:01, Peng Hao wrote:
> Add lpi debug info to vgic-stat.
> the printed info like this:
>     SPI  287      0 000001        0        0   0 160      -1
>     LPI 8192      2 000100        0        0   0 160      -1
> 
> Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
> ---
>  virt/kvm/arm/vgic/vgic-debug.c | 56 ++++++++++++++++++++++++++++++++++++++----
>  1 file changed, 51 insertions(+), 5 deletions(-)
> 
> diff --git a/virt/kvm/arm/vgic/vgic-debug.c b/virt/kvm/arm/vgic/vgic-debug.c
> index 10b3817..cb85550 100644
> --- a/virt/kvm/arm/vgic/vgic-debug.c
> +++ b/virt/kvm/arm/vgic/vgic-debug.c
> @@ -36,9 +36,12 @@
>  struct vgic_state_iter {
>  	int nr_cpus;
>  	int nr_spis;
> +	int nr_lpis;
>  	int dist_id;
>  	int vcpu_id;
>  	int intid;
> +	int lpi_print_count;
> +	struct vgic_irq **lpi_irqs;
>  };
>  
>  static void iter_next(struct vgic_state_iter *iter)
> @@ -52,6 +55,35 @@ static void iter_next(struct vgic_state_iter *iter)
>  	if (iter->intid == VGIC_NR_PRIVATE_IRQS &&
>  	    ++iter->vcpu_id < iter->nr_cpus)
>  		iter->intid = 0;
> +
> +	if (iter->intid >= VGIC_NR_PRIVATE_IRQS + iter->nr_spis) {
> +		if (iter->lpi_print_count < iter->nr_lpis)
> +			iter->intid = iter->lpi_irqs[iter->lpi_print_count]->intid;
> +		iter->lpi_print_count++;
> +	}
> +}
> +
> +static void vgic_debug_get_lpis(struct kvm *kvm, struct vgic_state_iter *iter)
> +{
> +	struct vgic_dist *dist = &kvm->arch.vgic;
> +	int i = 0;
> +	struct vgic_irq *irq = NULL, **lpi_irqs;
> +
> +	iter->nr_lpis = dist->lpi_list_count;
> +	lpi_irqs = kmalloc_array(iter->nr_lpis, sizeof(irq), GFP_KERNEL);
> +	if (!lpi_irqs) {
> +		iter->nr_lpis = 0;
> +		return;
> +	}
> +	spin_lock(&dist->lpi_list_lock);
> +	list_for_each_entry(irq, &dist->lpi_list_head, lpi_list) {
> +		vgic_get_irq_kref(irq);
> +		if (i < iter->nr_lpis)
> +			lpi_irqs[i++] = irq;
> +	}
> +	iter->nr_lpis = i;
> +	spin_unlock(&dist->lpi_list_lock);
> +	iter->lpi_irqs = lpi_irqs;

I've already explained why I didn't like this construct.

I still don't like it.

	M.
-- 
Jazz is not dead. It just smells funny...

  reply	other threads:[~2018-03-23 15:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-23 23:01 Peng Hao
2018-03-23 15:27 ` Marc Zyngier [this message]
2018-03-24 10:28 ` kbuild test robot

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=a1148944-ef9c-7ef5-640b-2f20ce0efffd@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=cdall@kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peng.hao2@zte.com.cn \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®