From: Anup Patel <apatel@ventanamicro.com>
To: Atish Patra <atish.patra@linux.dev>
Cc: Palmer Dabbelt <palmer@dabbelt.com>,
Paul Walmsley <paul.walmsley@sifive.com>,
Alexandre Ghiti <alex@ghiti.fr>,
Andrew Jones <ajones@ventanamicro.com>,
Anup Patel <anup@brainfault.org>,
kvm@vger.kernel.org, kvm-riscv@lists.infradead.org,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
Anup Patel <apatel@ventanamicro.com>
Subject: [PATCH 0/2] Few timer and AIA fixes for KVM RISC-V
Date: Fri, 4 Jul 2025 21:08:36 +0530 [thread overview]
Message-ID: <20250704153838.6575-1-apatel@ventanamicro.com> (raw)
The RISC-V Privileged specificaiton says the following: "WFI is also
required to resume execution for locally enabled interrupts pending
at any privilege level, regardless of the global interrupt enable at
each privilege level."
Based on the above, if there is pending VS-timer interrupt when the
host (aka HS-mode) executes WFI then such a WFI will simply become NOP
and not do anything. This result in QEMU RISC-V consuming a lot of CPU
time on the x86 machine where it is running. The PATCH1 solves this
issue by adding appropriate cleanup in KVM RISC-V timer virtualization.
As a result PATCH1, race conditions in updating HGEI[E|P] CSRs when a
VCPU is moved from one host CPU to another are being observed on QEMU
so the PATCH2 tries to minimize the chances of these race conditions.
Anup Patel (2):
RISC-V: KVM: Disable vstimecmp before exiting to user-space
RISC-V: KVM: Move HGEI[E|P] CSR access to IMSIC virtualization
arch/riscv/include/asm/kvm_aia.h | 4 ++-
arch/riscv/kvm/aia.c | 51 +++++---------------------------
arch/riscv/kvm/aia_imsic.c | 45 ++++++++++++++++++++++++++++
arch/riscv/kvm/vcpu.c | 2 --
arch/riscv/kvm/vcpu_timer.c | 16 ++++++++++
5 files changed, 71 insertions(+), 47 deletions(-)
--
2.43.0
--
kvm-riscv mailing list
kvm-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kvm-riscv
WARNING: multiple messages have this Message-ID (diff)
From: Anup Patel <apatel@ventanamicro.com>
To: Atish Patra <atish.patra@linux.dev>
Cc: Palmer Dabbelt <palmer@dabbelt.com>,
Paul Walmsley <paul.walmsley@sifive.com>,
Alexandre Ghiti <alex@ghiti.fr>,
Andrew Jones <ajones@ventanamicro.com>,
Anup Patel <anup@brainfault.org>,
kvm@vger.kernel.org, kvm-riscv@lists.infradead.org,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
Anup Patel <apatel@ventanamicro.com>
Subject: [PATCH 0/2] Few timer and AIA fixes for KVM RISC-V
Date: Fri, 4 Jul 2025 21:08:36 +0530 [thread overview]
Message-ID: <20250704153838.6575-1-apatel@ventanamicro.com> (raw)
The RISC-V Privileged specificaiton says the following: "WFI is also
required to resume execution for locally enabled interrupts pending
at any privilege level, regardless of the global interrupt enable at
each privilege level."
Based on the above, if there is pending VS-timer interrupt when the
host (aka HS-mode) executes WFI then such a WFI will simply become NOP
and not do anything. This result in QEMU RISC-V consuming a lot of CPU
time on the x86 machine where it is running. The PATCH1 solves this
issue by adding appropriate cleanup in KVM RISC-V timer virtualization.
As a result PATCH1, race conditions in updating HGEI[E|P] CSRs when a
VCPU is moved from one host CPU to another are being observed on QEMU
so the PATCH2 tries to minimize the chances of these race conditions.
Anup Patel (2):
RISC-V: KVM: Disable vstimecmp before exiting to user-space
RISC-V: KVM: Move HGEI[E|P] CSR access to IMSIC virtualization
arch/riscv/include/asm/kvm_aia.h | 4 ++-
arch/riscv/kvm/aia.c | 51 +++++---------------------------
arch/riscv/kvm/aia_imsic.c | 45 ++++++++++++++++++++++++++++
arch/riscv/kvm/vcpu.c | 2 --
arch/riscv/kvm/vcpu_timer.c | 16 ++++++++++
5 files changed, 71 insertions(+), 47 deletions(-)
--
2.43.0
WARNING: multiple messages have this Message-ID (diff)
From: Anup Patel <apatel@ventanamicro.com>
To: Atish Patra <atish.patra@linux.dev>
Cc: Palmer Dabbelt <palmer@dabbelt.com>,
Paul Walmsley <paul.walmsley@sifive.com>,
Alexandre Ghiti <alex@ghiti.fr>,
Andrew Jones <ajones@ventanamicro.com>,
Anup Patel <anup@brainfault.org>,
kvm@vger.kernel.org, kvm-riscv@lists.infradead.org,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
Anup Patel <apatel@ventanamicro.com>
Subject: [PATCH 0/2] Few timer and AIA fixes for KVM RISC-V
Date: Fri, 4 Jul 2025 21:08:36 +0530 [thread overview]
Message-ID: <20250704153838.6575-1-apatel@ventanamicro.com> (raw)
The RISC-V Privileged specificaiton says the following: "WFI is also
required to resume execution for locally enabled interrupts pending
at any privilege level, regardless of the global interrupt enable at
each privilege level."
Based on the above, if there is pending VS-timer interrupt when the
host (aka HS-mode) executes WFI then such a WFI will simply become NOP
and not do anything. This result in QEMU RISC-V consuming a lot of CPU
time on the x86 machine where it is running. The PATCH1 solves this
issue by adding appropriate cleanup in KVM RISC-V timer virtualization.
As a result PATCH1, race conditions in updating HGEI[E|P] CSRs when a
VCPU is moved from one host CPU to another are being observed on QEMU
so the PATCH2 tries to minimize the chances of these race conditions.
Anup Patel (2):
RISC-V: KVM: Disable vstimecmp before exiting to user-space
RISC-V: KVM: Move HGEI[E|P] CSR access to IMSIC virtualization
arch/riscv/include/asm/kvm_aia.h | 4 ++-
arch/riscv/kvm/aia.c | 51 +++++---------------------------
arch/riscv/kvm/aia_imsic.c | 45 ++++++++++++++++++++++++++++
arch/riscv/kvm/vcpu.c | 2 --
arch/riscv/kvm/vcpu_timer.c | 16 ++++++++++
5 files changed, 71 insertions(+), 47 deletions(-)
--
2.43.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next reply other threads:[~2025-07-04 15:39 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-04 15:38 Anup Patel [this message]
2025-07-04 15:38 ` [PATCH 0/2] Few timer and AIA fixes for KVM RISC-V Anup Patel
2025-07-04 15:38 ` Anup Patel
2025-07-04 15:38 ` [PATCH 1/2] RISC-V: KVM: Disable vstimecmp before exiting to user-space Anup Patel
2025-07-04 15:38 ` Anup Patel
2025-07-04 15:38 ` Anup Patel
2025-07-04 19:46 ` Heinrich Schuchardt
2025-07-04 19:46 ` Heinrich Schuchardt
2025-07-04 19:46 ` Heinrich Schuchardt
2025-07-05 7:21 ` Atish Patra
2025-07-05 7:21 ` Atish Patra
2025-07-05 7:21 ` Atish Patra
2025-07-04 15:38 ` [PATCH 2/2] RISC-V: KVM: Move HGEI[E|P] CSR access to IMSIC virtualization Anup Patel
2025-07-04 15:38 ` Anup Patel
2025-07-04 15:38 ` Anup Patel
2025-07-05 7:42 ` Atish Patra
2025-07-05 7:42 ` Atish Patra
2025-07-05 7:42 ` Atish Patra
2025-07-07 3:52 ` Anup Patel
2025-07-07 3:52 ` Anup Patel
2025-07-07 3:52 ` Anup Patel
2025-07-05 7:43 ` [PATCH 0/2] Few timer and AIA fixes for KVM RISC-V Atish Patra
2025-07-05 7:43 ` Atish Patra
2025-07-05 7:43 ` Atish Patra
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=20250704153838.6575-1-apatel@ventanamicro.com \
--to=apatel@ventanamicro.com \
--cc=ajones@ventanamicro.com \
--cc=alex@ghiti.fr \
--cc=anup@brainfault.org \
--cc=atish.patra@linux.dev \
--cc=kvm-riscv@lists.infradead.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.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 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.