All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yanteng Si <si.yanteng@linux.dev>
To: Song Gao <gaosong@loongson.cn>,
	maobibo@loongson.cn, zhaotianrui@loongson.cn,
	chenhuacai@kernel.org, lixianglai@loongson.cn
Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] LoongArch: KVM: Use kvm_get_vcpu_by_id() instead of kvm_get_vcpu()
Date: Tue, 12 Aug 2025 10:06:17 +0800	[thread overview]
Message-ID: <ed67c8bd-9e79-47c7-9186-910b530a191c@linux.dev> (raw)
In-Reply-To: <20250811025544.458422-1-gaosong@loongson.cn>

在 8/11/25 10:55 AM, Song Gao 写道:
> Use kvm_get_vcpu() may can't get vcpu context, use kvm_get_vcpu_by_id()
> instead of kvm_get_vcpu().
Since using kvm_get_vcpu() may fail to retrieve the vcpu context,
kvm_get_vcpu_by_id() should be used instead.

Under this premise, and under the premise of making revisions
in accordance with Bibo's and Huacai's suggestions,pick up my tag in v2.

Reviewed-by: Yanteng Si <siyanteng@cqsoftware.com.cm>

Additionally, do we need a fixes tag?

Thanks,
Yanteng
> 
> Signed-off-by: Song Gao <gaosong@loongson.cn>
> ---
>   arch/loongarch/kvm/intc/eiointc.c | 5 ++++-
>   arch/loongarch/kvm/intc/ipi.c     | 2 +-
>   2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/loongarch/kvm/intc/eiointc.c b/arch/loongarch/kvm/intc/eiointc.c
> index a3a12af9ecbf..5180da91d2e6 100644
> --- a/arch/loongarch/kvm/intc/eiointc.c
> +++ b/arch/loongarch/kvm/intc/eiointc.c
> @@ -45,7 +45,10 @@ static void eiointc_update_irq(struct loongarch_eiointc *s, int irq, int level)
>   	}
>   
>   	cpu = s->sw_coremap[irq];
> -	vcpu = kvm_get_vcpu(s->kvm, cpu);
> +	vcpu = kvm_get_vcpu_by_id(s->kvm, cpu);
> +	if (unlikely(vcpu == NULL)) {
> +		return;
> +	}
>   	if (level) {
>   		/* if not enable return false */
>   		if (!test_bit(irq, (unsigned long *)s->enable.reg_u32))
> diff --git a/arch/loongarch/kvm/intc/ipi.c b/arch/loongarch/kvm/intc/ipi.c
> index e658d5b37c04..0348a83a7ed7 100644
> --- a/arch/loongarch/kvm/intc/ipi.c
> +++ b/arch/loongarch/kvm/intc/ipi.c
> @@ -298,7 +298,7 @@ static int kvm_ipi_regs_access(struct kvm_device *dev,
>   	cpu = (attr->attr >> 16) & 0x3ff;
>   	addr = attr->attr & 0xff;
>   
> -	vcpu = kvm_get_vcpu(dev->kvm, cpu);
> +	vcpu = kvm_get_vcpu_by_id(dev->kvm, cpu);
>   	if (unlikely(vcpu == NULL)) {
>   		kvm_err("%s: invalid target cpu: %d\n", __func__, cpu);
>   		return -EINVAL;


  parent reply	other threads:[~2025-08-12  2:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-11  2:55 [PATCH] LoongArch: KVM: Use kvm_get_vcpu_by_id() instead of kvm_get_vcpu() Song Gao
2025-08-11 10:52 ` Bibo Mao
2025-08-11 13:23   ` Huacai Chen
2025-08-12  1:48     ` Bibo Mao
2025-08-12  2:06 ` Yanteng Si [this message]
2025-08-13  2:33   ` gaosong

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=ed67c8bd-9e79-47c7-9186-910b530a191c@linux.dev \
    --to=si.yanteng@linux.dev \
    --cc=chenhuacai@kernel.org \
    --cc=gaosong@loongson.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lixianglai@loongson.cn \
    --cc=loongarch@lists.linux.dev \
    --cc=maobibo@loongson.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 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.