From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D351CC4332B for ; Thu, 19 Mar 2020 15:21:51 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 58A102072D for ; Thu, 19 Mar 2020 15:21:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="JPA1J07I" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 58A102072D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id D938E4B087; Thu, 19 Mar 2020 11:21:50 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@kernel.org Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VZVdmOgk-k5g; Thu, 19 Mar 2020 11:21:48 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 4A6264B086; Thu, 19 Mar 2020 11:21:48 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id EFC6B4B082 for ; Thu, 19 Mar 2020 11:21:46 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BXb0Njo3sMwV for ; Thu, 19 Mar 2020 11:21:45 -0400 (EDT) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id BBF6E4A4BE for ; Thu, 19 Mar 2020 11:21:45 -0400 (EDT) Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A324B20658; Thu, 19 Mar 2020 15:21:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584631304; bh=F6q5btvbklLUG07V2Lwbtfvpc+8jDG0/MxA3HQ9VDtM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=JPA1J07If5eZNL6QR32IQDwuMxW4CIFSKTHedniqtt3qhjXMQhUB0dICE2zwCdK9P nGKPdsozIqPbRjniOwNbVCEGMzJgiYD4vsaMD870QC6D5Dy5d4Zif2wVhbSZOrHljp Z+KtwSGLZYHEmw+7UEHx938eVIzH5NvTBxnGMKsg= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jEwzO-00E0De-PQ; Thu, 19 Mar 2020 15:21:42 +0000 MIME-Version: 1.0 Date: Thu, 19 Mar 2020 15:21:42 +0000 From: Marc Zyngier To: Auger Eric Subject: Re: [PATCH v5 23/23] KVM: arm64: GICv4.1: Expose HW-based SGIs in debugfs In-Reply-To: <4cb4c3d4-7b02-bb77-cd7a-c185346b6a2f@redhat.com> References: <20200304203330.4967-1-maz@kernel.org> <20200304203330.4967-24-maz@kernel.org> <4cb4c3d4-7b02-bb77-cd7a-c185346b6a2f@redhat.com> Message-ID: <45c282bddd43420024633943c1befac3@kernel.org> X-Sender: maz@kernel.org User-Agent: Roundcube Webmail/1.3.10 X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: eric.auger@redhat.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, lorenzo.pieralisi@arm.com, jason@lakedaemon.net, rrichter@marvell.com, tglx@linutronix.de, yuzenghui@huawei.com, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Cc: Lorenzo Pieralisi , Jason Cooper , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Robert Richter , Thomas Gleixner , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu Hi Eric, On 2020-03-19 15:05, Auger Eric wrote: > Hi Marc, > > On 3/4/20 9:33 PM, Marc Zyngier wrote: >> The vgic-state debugfs file could do with showing the pending state >> of the HW-backed SGIs. Plug it into the low-level code. >> >> Signed-off-by: Marc Zyngier >> --- >> virt/kvm/arm/vgic/vgic-debug.c | 14 +++++++++++++- >> 1 file changed, 13 insertions(+), 1 deletion(-) >> >> diff --git a/virt/kvm/arm/vgic/vgic-debug.c >> b/virt/kvm/arm/vgic/vgic-debug.c >> index cc12fe9b2df3..b13a9e3f99dd 100644 >> --- a/virt/kvm/arm/vgic/vgic-debug.c >> +++ b/virt/kvm/arm/vgic/vgic-debug.c >> @@ -178,6 +178,8 @@ static void print_irq_state(struct seq_file *s, >> struct vgic_irq *irq, >> struct kvm_vcpu *vcpu) >> { >> char *type; >> + bool pending; > nit: can be directly initialized to irq->pending_latch >> + >> if (irq->intid < VGIC_NR_SGIS) >> type = "SGI"; >> else if (irq->intid < VGIC_NR_PRIVATE_IRQS) >> @@ -190,6 +192,16 @@ static void print_irq_state(struct seq_file *s, >> struct vgic_irq *irq, >> if (irq->intid ==0 || irq->intid == VGIC_NR_PRIVATE_IRQS) >> print_header(s, irq, vcpu); >> >> + pending = irq->pending_latch; >> + if (irq->hw && vgic_irq_is_sgi(irq->intid)) { >> + int err; >> + >> + err = irq_get_irqchip_state(irq->host_irq, >> + IRQCHIP_STATE_PENDING, >> + &pending); >> + WARN_ON_ONCE(err); >> + } >> + >> seq_printf(s, " %s %4d " >> " %2d " >> "%d%d%d%d%d%d%d " >> @@ -201,7 +213,7 @@ static void print_irq_state(struct seq_file *s, >> struct vgic_irq *irq, >> "\n", >> type, irq->intid, >> (irq->target_vcpu) ? irq->target_vcpu->vcpu_id : -1, >> - irq->pending_latch, >> + pending, >> irq->line_level, >> irq->active, >> irq->enabled, >> > The patch looks good to me but I am now lost about how we retrieve the > pending stat of other hw mapped interrupts. Looks we use > irq->pending_latch always. Is that correct? Correct. GICv4.0 doesn't give us an architectural way to look at the vLPI pending state (there isn't even a guarantee about when the GIC will stop writing to memory, if it ever does). With GICv4.1, you can introspect the HW state for SGIs. You can also look at the vLPI state by peeking at the virtual pending table, but you'd need to unmap the VPE first, which I obviously don't want to do for this debug interface, specially as it can be used whilst the guest is up and running. In the future, we'll have to implement that in order to support guest save/restore from a GICv4.1 system. I haven't given much thought to it though. > For the patch: > Reviewed-by: Eric Auger Thanks, M. -- Jazz is not dead. It just smells funny... _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DF35C4332E for ; Thu, 19 Mar 2020 15:21:50 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 14B0F2072D for ; Thu, 19 Mar 2020 15:21:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="XNrjKntE"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="JPA1J07I" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 14B0F2072D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:To:From: Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=sEVh+6ts02xV4zCQ9wCVJGGta5C9uNgpn072qAOgksQ=; b=XNrjKntEWGHSYwW3t7Q6wxpvp /Z59k5fgEcXttQ8KYCeF1MHQQTFOE/0lffHLuvLIVRmvaH/Rba9zf4lOkJYZRZUR7yZ4F7+IHSTWE KmT+pqfRdl4lwpQFmxsxaDhhjycNFvQmNRwAZxYZCLMEwsZ1AH1HPzXcpQuwKufSO5KNp315rfy3S NwMr5gsMk4yfQmMi815Ul1eyKPQnxy3eJRY1sa+jOyBYdV42PPjnzGk8GbK7s7xKpo/CRt7TIfBGi GabZpBKoKiHT/JMjyzfUSOSd0EB/f1UdBiuq+bS/tzVraa81r/io9hfebCOO1TAQqC3vj7udsRIsk rOEYx9Hxw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jEwzV-0000Ej-M2; Thu, 19 Mar 2020 15:21:49 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jEwzR-0000EK-N1 for linux-arm-kernel@lists.infradead.org; Thu, 19 Mar 2020 15:21:47 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A324B20658; Thu, 19 Mar 2020 15:21:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584631304; bh=F6q5btvbklLUG07V2Lwbtfvpc+8jDG0/MxA3HQ9VDtM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=JPA1J07If5eZNL6QR32IQDwuMxW4CIFSKTHedniqtt3qhjXMQhUB0dICE2zwCdK9P nGKPdsozIqPbRjniOwNbVCEGMzJgiYD4vsaMD870QC6D5Dy5d4Zif2wVhbSZOrHljp Z+KtwSGLZYHEmw+7UEHx938eVIzH5NvTBxnGMKsg= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jEwzO-00E0De-PQ; Thu, 19 Mar 2020 15:21:42 +0000 MIME-Version: 1.0 Date: Thu, 19 Mar 2020 15:21:42 +0000 From: Marc Zyngier To: Auger Eric Subject: Re: [PATCH v5 23/23] KVM: arm64: GICv4.1: Expose HW-based SGIs in debugfs In-Reply-To: <4cb4c3d4-7b02-bb77-cd7a-c185346b6a2f@redhat.com> References: <20200304203330.4967-1-maz@kernel.org> <20200304203330.4967-24-maz@kernel.org> <4cb4c3d4-7b02-bb77-cd7a-c185346b6a2f@redhat.com> Message-ID: <45c282bddd43420024633943c1befac3@kernel.org> X-Sender: maz@kernel.org User-Agent: Roundcube Webmail/1.3.10 X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: eric.auger@redhat.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, lorenzo.pieralisi@arm.com, jason@lakedaemon.net, rrichter@marvell.com, tglx@linutronix.de, yuzenghui@huawei.com, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200319_082145_796626_260AB428 X-CRM114-Status: GOOD ( 18.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lorenzo Pieralisi , Jason Cooper , kvm@vger.kernel.org, Suzuki K Poulose , linux-kernel@vger.kernel.org, Robert Richter , James Morse , Julien Thierry , Zenghui Yu , Thomas Gleixner , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Eric, On 2020-03-19 15:05, Auger Eric wrote: > Hi Marc, > > On 3/4/20 9:33 PM, Marc Zyngier wrote: >> The vgic-state debugfs file could do with showing the pending state >> of the HW-backed SGIs. Plug it into the low-level code. >> >> Signed-off-by: Marc Zyngier >> --- >> virt/kvm/arm/vgic/vgic-debug.c | 14 +++++++++++++- >> 1 file changed, 13 insertions(+), 1 deletion(-) >> >> diff --git a/virt/kvm/arm/vgic/vgic-debug.c >> b/virt/kvm/arm/vgic/vgic-debug.c >> index cc12fe9b2df3..b13a9e3f99dd 100644 >> --- a/virt/kvm/arm/vgic/vgic-debug.c >> +++ b/virt/kvm/arm/vgic/vgic-debug.c >> @@ -178,6 +178,8 @@ static void print_irq_state(struct seq_file *s, >> struct vgic_irq *irq, >> struct kvm_vcpu *vcpu) >> { >> char *type; >> + bool pending; > nit: can be directly initialized to irq->pending_latch >> + >> if (irq->intid < VGIC_NR_SGIS) >> type = "SGI"; >> else if (irq->intid < VGIC_NR_PRIVATE_IRQS) >> @@ -190,6 +192,16 @@ static void print_irq_state(struct seq_file *s, >> struct vgic_irq *irq, >> if (irq->intid ==0 || irq->intid == VGIC_NR_PRIVATE_IRQS) >> print_header(s, irq, vcpu); >> >> + pending = irq->pending_latch; >> + if (irq->hw && vgic_irq_is_sgi(irq->intid)) { >> + int err; >> + >> + err = irq_get_irqchip_state(irq->host_irq, >> + IRQCHIP_STATE_PENDING, >> + &pending); >> + WARN_ON_ONCE(err); >> + } >> + >> seq_printf(s, " %s %4d " >> " %2d " >> "%d%d%d%d%d%d%d " >> @@ -201,7 +213,7 @@ static void print_irq_state(struct seq_file *s, >> struct vgic_irq *irq, >> "\n", >> type, irq->intid, >> (irq->target_vcpu) ? irq->target_vcpu->vcpu_id : -1, >> - irq->pending_latch, >> + pending, >> irq->line_level, >> irq->active, >> irq->enabled, >> > The patch looks good to me but I am now lost about how we retrieve the > pending stat of other hw mapped interrupts. Looks we use > irq->pending_latch always. Is that correct? Correct. GICv4.0 doesn't give us an architectural way to look at the vLPI pending state (there isn't even a guarantee about when the GIC will stop writing to memory, if it ever does). With GICv4.1, you can introspect the HW state for SGIs. You can also look at the vLPI state by peeking at the virtual pending table, but you'd need to unmap the VPE first, which I obviously don't want to do for this debug interface, specially as it can be used whilst the guest is up and running. In the future, we'll have to implement that in order to support guest save/restore from a GICv4.1 system. I haven't given much thought to it though. > For the patch: > Reviewed-by: Eric Auger Thanks, M. -- Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27906C43332 for ; Thu, 19 Mar 2020 15:21:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F39992072D for ; Thu, 19 Mar 2020 15:21:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584631309; bh=F6q5btvbklLUG07V2Lwbtfvpc+8jDG0/MxA3HQ9VDtM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=Qd8CT8sSs6h3WPT/y+Jxo6n/SEmqWpmu3K0fPW9hWX6CDPlUz8RGN3epKhIwsBT8g NQXlwqnI/lM2PoyGwZ7yE/ZVbE9QJ5jd1ukNhwec0taXVm3l8RtlstIwhGEKOwZgws 6fof8VoZsfaFcSW3MJV8eCwwlcs3mP3hFiu3VOeI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727781AbgCSPVq (ORCPT ); Thu, 19 Mar 2020 11:21:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:46800 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727540AbgCSPVp (ORCPT ); Thu, 19 Mar 2020 11:21:45 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A324B20658; Thu, 19 Mar 2020 15:21:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584631304; bh=F6q5btvbklLUG07V2Lwbtfvpc+8jDG0/MxA3HQ9VDtM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=JPA1J07If5eZNL6QR32IQDwuMxW4CIFSKTHedniqtt3qhjXMQhUB0dICE2zwCdK9P nGKPdsozIqPbRjniOwNbVCEGMzJgiYD4vsaMD870QC6D5Dy5d4Zif2wVhbSZOrHljp Z+KtwSGLZYHEmw+7UEHx938eVIzH5NvTBxnGMKsg= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jEwzO-00E0De-PQ; Thu, 19 Mar 2020 15:21:42 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 19 Mar 2020 15:21:42 +0000 From: Marc Zyngier To: Auger Eric Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Lorenzo Pieralisi , Jason Cooper , Robert Richter , Thomas Gleixner , Zenghui Yu , James Morse , Julien Thierry , Suzuki K Poulose Subject: Re: [PATCH v5 23/23] KVM: arm64: GICv4.1: Expose HW-based SGIs in debugfs In-Reply-To: <4cb4c3d4-7b02-bb77-cd7a-c185346b6a2f@redhat.com> References: <20200304203330.4967-1-maz@kernel.org> <20200304203330.4967-24-maz@kernel.org> <4cb4c3d4-7b02-bb77-cd7a-c185346b6a2f@redhat.com> Message-ID: <45c282bddd43420024633943c1befac3@kernel.org> X-Sender: maz@kernel.org User-Agent: Roundcube Webmail/1.3.10 X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: eric.auger@redhat.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, lorenzo.pieralisi@arm.com, jason@lakedaemon.net, rrichter@marvell.com, tglx@linutronix.de, yuzenghui@huawei.com, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Hi Eric, On 2020-03-19 15:05, Auger Eric wrote: > Hi Marc, > > On 3/4/20 9:33 PM, Marc Zyngier wrote: >> The vgic-state debugfs file could do with showing the pending state >> of the HW-backed SGIs. Plug it into the low-level code. >> >> Signed-off-by: Marc Zyngier >> --- >> virt/kvm/arm/vgic/vgic-debug.c | 14 +++++++++++++- >> 1 file changed, 13 insertions(+), 1 deletion(-) >> >> diff --git a/virt/kvm/arm/vgic/vgic-debug.c >> b/virt/kvm/arm/vgic/vgic-debug.c >> index cc12fe9b2df3..b13a9e3f99dd 100644 >> --- a/virt/kvm/arm/vgic/vgic-debug.c >> +++ b/virt/kvm/arm/vgic/vgic-debug.c >> @@ -178,6 +178,8 @@ static void print_irq_state(struct seq_file *s, >> struct vgic_irq *irq, >> struct kvm_vcpu *vcpu) >> { >> char *type; >> + bool pending; > nit: can be directly initialized to irq->pending_latch >> + >> if (irq->intid < VGIC_NR_SGIS) >> type = "SGI"; >> else if (irq->intid < VGIC_NR_PRIVATE_IRQS) >> @@ -190,6 +192,16 @@ static void print_irq_state(struct seq_file *s, >> struct vgic_irq *irq, >> if (irq->intid ==0 || irq->intid == VGIC_NR_PRIVATE_IRQS) >> print_header(s, irq, vcpu); >> >> + pending = irq->pending_latch; >> + if (irq->hw && vgic_irq_is_sgi(irq->intid)) { >> + int err; >> + >> + err = irq_get_irqchip_state(irq->host_irq, >> + IRQCHIP_STATE_PENDING, >> + &pending); >> + WARN_ON_ONCE(err); >> + } >> + >> seq_printf(s, " %s %4d " >> " %2d " >> "%d%d%d%d%d%d%d " >> @@ -201,7 +213,7 @@ static void print_irq_state(struct seq_file *s, >> struct vgic_irq *irq, >> "\n", >> type, irq->intid, >> (irq->target_vcpu) ? irq->target_vcpu->vcpu_id : -1, >> - irq->pending_latch, >> + pending, >> irq->line_level, >> irq->active, >> irq->enabled, >> > The patch looks good to me but I am now lost about how we retrieve the > pending stat of other hw mapped interrupts. Looks we use > irq->pending_latch always. Is that correct? Correct. GICv4.0 doesn't give us an architectural way to look at the vLPI pending state (there isn't even a guarantee about when the GIC will stop writing to memory, if it ever does). With GICv4.1, you can introspect the HW state for SGIs. You can also look at the vLPI state by peeking at the virtual pending table, but you'd need to unmap the VPE first, which I obviously don't want to do for this debug interface, specially as it can be used whilst the guest is up and running. In the future, we'll have to implement that in order to support guest save/restore from a GICv4.1 system. I haven't given much thought to it though. > For the patch: > Reviewed-by: Eric Auger Thanks, M. -- Jazz is not dead. It just smells funny...