lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAhV-H5ey2g_dmSQsM+5WM+Kir-b6jqfatxnbgBRvjggZzuXtQ@mail.gmail.com>
Date: Mon, 26 Feb 2024 20:59:57 +0800
From: Huacai Chen <chenhuacai@...nel.org>
To: Bibo Mao <maobibo@...ngson.cn>
Cc: Tianrui Zhao <zhaotianrui@...ngson.cn>, kvm@...r.kernel.org, loongarch@...ts.linux.dev, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] LoongArch: KVM: Do not restart SW timer when it is expired

The code itself looks good to me, but could you please tell me what
does "LoongArch guest has separate hw timer" mean?

Huacai

On Tue, Jan 30, 2024 at 3:22 PM Bibo Mao <maobibo@...ngson.cn> wrote:
>
> LoongArch guest has separate hw timer, SW timer is to wake up
> blocked vcpu thread, rather than HW timer emulation. When blocking
> vcpu schedules out, SW timer is used to wakeup blocked vcpu thread
> and injects timer interrupt. It does not care about whether guest
> timer is in period mode or oneshot mode, and SW timer needs not be
> restarted since vcpu has been woken.
>
> This patch does not restart sw timer when it is expired.
>
> Signed-off-by: Bibo Mao <maobibo@...ngson.cn>
> ---
>  arch/loongarch/kvm/timer.c | 20 +-------------------
>  1 file changed, 1 insertion(+), 19 deletions(-)
>
> diff --git a/arch/loongarch/kvm/timer.c b/arch/loongarch/kvm/timer.c
> index a9125f0a12d1..d3282f01d4d9 100644
> --- a/arch/loongarch/kvm/timer.c
> +++ b/arch/loongarch/kvm/timer.c
> @@ -23,24 +23,6 @@ static inline u64 tick_to_ns(struct kvm_vcpu *vcpu, u64 tick)
>         return div_u64(tick * MNSEC_PER_SEC, vcpu->arch.timer_mhz);
>  }
>
> -/*
> - * Push timer forward on timeout.
> - * Handle an hrtimer event by push the hrtimer forward a period.
> - */
> -static enum hrtimer_restart kvm_count_timeout(struct kvm_vcpu *vcpu)
> -{
> -       unsigned long cfg, period;
> -
> -       /* Add periodic tick to current expire time */
> -       cfg = kvm_read_sw_gcsr(vcpu->arch.csr, LOONGARCH_CSR_TCFG);
> -       if (cfg & CSR_TCFG_PERIOD) {
> -               period = tick_to_ns(vcpu, cfg & CSR_TCFG_VAL);
> -               hrtimer_add_expires_ns(&vcpu->arch.swtimer, period);
> -               return HRTIMER_RESTART;
> -       } else
> -               return HRTIMER_NORESTART;
> -}
> -
>  /* Low level hrtimer wake routine */
>  enum hrtimer_restart kvm_swtimer_wakeup(struct hrtimer *timer)
>  {
> @@ -50,7 +32,7 @@ enum hrtimer_restart kvm_swtimer_wakeup(struct hrtimer *timer)
>         kvm_queue_irq(vcpu, INT_TI);
>         rcuwait_wake_up(&vcpu->wait);
>
> -       return kvm_count_timeout(vcpu);
> +       return HRTIMER_NORESTART;
>  }
>
>  /*
> --
> 2.39.3
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ