From: gang.chen.5i5j@gmail.com (Chen Gang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] virt: kvm: arm: vgic: Process the failure case when kvm_register_device_ops() fails
Date: Sat, 15 Nov 2014 00:30:11 +0800 [thread overview]
Message-ID: <54662E13.2010507@gmail.com> (raw)
In-Reply-To: <546625F8.6060900@arm.com>
According to your taste, we need improve 2 contents below:
On 11/14/2014 11:55 PM, Marc Zyngier wrote:
>
> No. This is completely overdesigned, and fixes something that really
> cannot happen. What is wrong with:
>
> diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c
> index 3aaca49..b7dffa80 100644
> --- a/virt/kvm/arm/vgic.c
> +++ b/virt/kvm/arm/vgic.c
> @@ -2465,13 +2465,17 @@ int kvm_vgic_hyp_init(void)
> goto out_free_irq;
> }
>
> + ret = kvm_register_device_ops(&kvm_arm_vgic_v2_ops,
> + KVM_DEV_TYPE_ARM_VGIC_V2);
> + if (ret)
> + goto out_free_irq;
> +
Need call __unregister_cpu_notifier(), since __register_cpu_notifier()
is already successfully called.
Need print some information for failure via kvm_err().
Thanks.
> /* Callback into for arch code for setup */
> vgic_arch_setup(vgic);
>
> on_each_cpu(vgic_init_maintenance_interrupt, NULL, 1);
>
> - return kvm_register_device_ops(&kvm_arm_vgic_v2_ops,
> - KVM_DEV_TYPE_ARM_VGIC_V2);
> + return 0;
>
> out_free_irq:
> free_percpu_irq(vgic->maint_irq, kvm_get_running_vcpus());
>
> This achieves the exact same effect.
>
> Thanks,
>
> M.
>
--
Chen Gang
Open share and attitude like air water and life which God blessed
WARNING: multiple messages have this Message-ID (diff)
From: Chen Gang <gang.chen.5i5j@gmail.com>
To: Marc Zyngier <marc.zyngier@arm.com>
Cc: "christoffer.dall@linaro.org" <christoffer.dall@linaro.org>,
"gleb@kernel.org" <gleb@kernel.org>,
Paolo Bonzini <pbonzini@redhat.com>,
"linux@arm.linux.org.uk" <linux@arm.linux.org.uk>,
Catalin Marinas <Catalin.Marinas@arm.com>,
Will Deacon <Will.Deacon@arm.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] virt: kvm: arm: vgic: Process the failure case when kvm_register_device_ops() fails
Date: Sat, 15 Nov 2014 00:30:11 +0800 [thread overview]
Message-ID: <54662E13.2010507@gmail.com> (raw)
In-Reply-To: <546625F8.6060900@arm.com>
According to your taste, we need improve 2 contents below:
On 11/14/2014 11:55 PM, Marc Zyngier wrote:
>
> No. This is completely overdesigned, and fixes something that really
> cannot happen. What is wrong with:
>
> diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c
> index 3aaca49..b7dffa80 100644
> --- a/virt/kvm/arm/vgic.c
> +++ b/virt/kvm/arm/vgic.c
> @@ -2465,13 +2465,17 @@ int kvm_vgic_hyp_init(void)
> goto out_free_irq;
> }
>
> + ret = kvm_register_device_ops(&kvm_arm_vgic_v2_ops,
> + KVM_DEV_TYPE_ARM_VGIC_V2);
> + if (ret)
> + goto out_free_irq;
> +
Need call __unregister_cpu_notifier(), since __register_cpu_notifier()
is already successfully called.
Need print some information for failure via kvm_err().
Thanks.
> /* Callback into for arch code for setup */
> vgic_arch_setup(vgic);
>
> on_each_cpu(vgic_init_maintenance_interrupt, NULL, 1);
>
> - return kvm_register_device_ops(&kvm_arm_vgic_v2_ops,
> - KVM_DEV_TYPE_ARM_VGIC_V2);
> + return 0;
>
> out_free_irq:
> free_percpu_irq(vgic->maint_irq, kvm_get_running_vcpus());
>
> This achieves the exact same effect.
>
> Thanks,
>
> M.
>
--
Chen Gang
Open share and attitude like air water and life which God blessed
next prev parent reply other threads:[~2014-11-14 16:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-14 15:18 [PATCH v2] virt: kvm: arm: vgic: Process the failure case when kvm_register_device_ops() fails Chen Gang
2014-11-14 15:18 ` Chen Gang
2014-11-14 15:55 ` Marc Zyngier
2014-11-14 15:55 ` Marc Zyngier
2014-11-14 16:30 ` Chen Gang [this message]
2014-11-14 16:30 ` Chen Gang
2014-11-30 3:25 ` Chen Gang
2014-11-30 3:25 ` Chen Gang
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=54662E13.2010507@gmail.com \
--to=gang.chen.5i5j@gmail.com \
--cc=linux-arm-kernel@lists.infradead.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.