public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@ventanamicro.com>
To: "xiangwencheng" <xiangwencheng@lanxincomputing.com>,
	"Andrew Jones" <ajones@ventanamicro.com>
Cc: <anup@brainfault.org>, <kvm-riscv@lists.infradead.org>,
	<kvm@vger.kernel.org>, <linux-riscv@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <atishp@atishpatra.org>,
	<paul.walmsley@sifive.com>, <palmer@dabbelt.com>,
	<aou@eecs.berkeley.edu>,
	"linux-riscv" <linux-riscv-bounces@lists.infradead.org>
Subject: Re: [PATCH] riscv: KVM: Remove unnecessary vcpu kick
Date: Thu, 20 Feb 2025 09:50:06 +0100	[thread overview]
Message-ID: <D7X576NHG512.2HBBO3JLIA1JH@ventanamicro.com> (raw)
In-Reply-To: <38cc241c40a8ef2775e304d366bcd07df733ecf0.818d94fe.c229.4f42.a074.e64851f0591b@feishu.cn>

2025-02-20T16:17:33+08:00, xiangwencheng <xiangwencheng@lanxincomputing.com>:
>> From: "Andrew Jones"<ajones@ventanamicro.com>
>> On Thu, Feb 20, 2025 at 03:12:58PM +0800, xiangwencheng wrote:
>> > In kvm_arch_vcpu_blocking it will enable guest external interrupt, which
>
>> > means wirting to VS_FILE will cause an interrupt. And the interrupt handler
>
>> > hgei_interrupt which is setted in aia_hgei_init will finally call kvm_vcpu_kick
>
>> > to wake up vCPU.

(Configure your mail client, so it doesn't add a newline between each
 quoted line when replying.)

>> > So I still think is not necessary to call another kvm_vcpu_kick after writing to
>> > VS_FILE.

So the kick wasn't there to mask some other bug, thanks.

>> Right, we don't need anything since hgei_interrupt() kicks for us, but if
>> we do
>> 
>> @@ -973,8 +973,8 @@ int kvm_riscv_vcpu_aia_imsic_inject(struct kvm_vcpu *vcpu,
>>         read_lock_irqsave(&imsic->vsfile_lock, flags);
>> 
>>         if (imsic->vsfile_cpu >= 0) {
>> +               kvm_vcpu_wake_up(vcpu);
>>                 writel(iid, imsic->vsfile_va + IMSIC_MMIO_SETIPNUM_LE);
>> -               kvm_vcpu_kick(vcpu);
>>         } else {
>>                 eix = &imsic->swfile->eix[iid / BITS_PER_TYPE(u64)];
>>                 set_bit(iid & (BITS_PER_TYPE(u64) - 1), eix->eip);
>> 
>> then we should be able to avoid taking a host interrupt.

The wakeup is asynchronous, and this would practically never avoid the
host interrupt, but we'd do extra pointless work...
I think it's much better just with the write.  (The wakeup would again
make KVM look like it has a bug elsewhere.)

  reply	other threads:[~2025-02-20  8:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-19  1:54 [PATCH] riscv: KVM: Remove unnecessary vcpu kick BillXiang
2025-02-19  8:36 ` Andrew Jones
2025-02-19  8:51 ` Radim Krčmář
2025-02-20  7:12   ` xiangwencheng
2025-02-20  8:01     ` Andrew Jones
2025-02-20  8:17       ` xiangwencheng
2025-02-20  8:50         ` Radim Krčmář [this message]
2025-02-20 12:14           ` Andrew Jones
  -- strict thread matches above, loose matches on Subject: below --
2025-02-18  8:00 项文成
2025-02-18 17:48 ` Andrew Jones

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=D7X576NHG512.2HBBO3JLIA1JH@ventanamicro.com \
    --to=rkrcmar@ventanamicro.com \
    --cc=ajones@ventanamicro.com \
    --cc=anup@brainfault.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=atishp@atishpatra.org \
    --cc=kvm-riscv@lists.infradead.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv-bounces@lists.infradead.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=xiangwencheng@lanxincomputing.com \
    /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