loongarch.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Bibo Mao <maobibo@loongson.cn>
To: Zeng Chi <zeng_chi911@163.com>,
	zhaotianrui@loongson.cn, chenhuacai@kernel.org,
	kernel@xen0n.name
Cc: kvm@vger.kernel.org, loongarch@lists.linux.dev,
	linux-kernel@vger.kernel.org, zengchi@kylinos.cn
Subject: Re: [PATCH] LoongArch: KVM: Add missing slots_lock for EIOINTC virtual extension device registration
Date: Mon, 18 May 2026 17:56:27 +0800	[thread overview]
Message-ID: <af3e9ecc-cb30-6d7d-5f2d-19ddf42755a0@loongson.cn> (raw)
In-Reply-To: <20260518094521.138692-1-zeng_chi911@163.com>



On 2026/5/18 下午5:45, Zeng Chi wrote:
> From: Zeng Chi <zengchi@kylinos.cn>
> 
> The second kvm_io_bus_register_dev() call for device_vext was missing
> kvm->slots_lock protection. Add it to match the first registration.
> 
> Signed-off-by: Zeng Chi <zengchi@kylinos.cn>
> ---
>   arch/loongarch/kvm/intc/eiointc.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/arch/loongarch/kvm/intc/eiointc.c b/arch/loongarch/kvm/intc/eiointc.c
> index 2ab7fafa86d5..ce64ffb706df 100644
> --- a/arch/loongarch/kvm/intc/eiointc.c
> +++ b/arch/loongarch/kvm/intc/eiointc.c
> @@ -645,8 +645,10 @@ static int kvm_eiointc_create(struct kvm_device *dev, u32 type)
>   
>   	device = &s->device_vext;
>   	kvm_iodevice_init(device, &kvm_eiointc_virt_ops);
> +	mutex_lock(&kvm->slots_lock);
>   	ret = kvm_io_bus_register_dev(kvm, KVM_IOCSR_BUS,
>   			EIOINTC_VIRT_BASE, EIOINTC_VIRT_SIZE, device);
> +	mutex_unlock(&kvm->slots_lock);
>   	if (ret < 0) {
>   		kvm_io_bus_unregister_dev(kvm, KVM_IOCSR_BUS, &s->device);
>   		kfree(s);
> 
Hi ZengChi,

Good catch.

There should be the similar lock protection with function call 
kvm_io_bus_unregister_dev() in files pch_pic.c/ipi.c/eiointc.c

Would you like add these together?

Regards
Bibo Mao


  reply	other threads:[~2026-05-18  9:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-18  9:45 [PATCH] LoongArch: KVM: Add missing slots_lock for EIOINTC virtual extension device registration Zeng Chi
2026-05-18  9:56 ` Bibo Mao [this message]
2026-05-25  9:26 ` [PATCH v2 net] LoongArch: KVM: Add missing slots_lock for IO bus device register/unregister Zeng Chi
2026-05-25  9:50   ` Bibo Mao
2026-05-25  9:58     ` Huacai Chen
2026-05-26  1:25       ` Bibo Mao
2026-06-05  8:31   ` [PTACH v3] " Zeng Chi
2026-06-05 14:02     ` Huacai Chen

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=af3e9ecc-cb30-6d7d-5f2d-19ddf42755a0@loongson.cn \
    --to=maobibo@loongson.cn \
    --cc=chenhuacai@kernel.org \
    --cc=kernel@xen0n.name \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=zeng_chi911@163.com \
    --cc=zengchi@kylinos.cn \
    --cc=zhaotianrui@loongson.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).