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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAhV-H729+VA4fAWX1SOhCAptSDSwLDAOp_RwB0hkDtvm0hMLg@mail.gmail.com>
Date: Fri, 18 Jul 2025 12:13:46 +0800
From: Huacai Chen <chenhuacai@...nel.org>
To: Yury Norov <yury.norov@...il.com>
Cc: Tianrui Zhao <zhaotianrui@...ngson.cn>, Bibo Mao <maobibo@...ngson.cn>, 
	WANG Xuerui <kernel@...0n.name>, kvm@...r.kernel.org, loongarch@...ts.linux.dev, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] LoongArch: KVM:: simplify kvm_deliver_intr()

Hi, Yury,

On Thu, Jul 17, 2025 at 12:59 AM Yury Norov <yury.norov@...il.com> wrote:
>
> From: "Yury Norov (NVIDIA)" <yury.norov@...il.com>
>
> The function opencodes for_each_set_bit() macro, which makes it bulky.
> Using the proper API makes all the housekeeping code going away.
>
> Signed-off-by: Yury Norov (NVIDIA) <yury.norov@...il.com>
> ---
>  arch/loongarch/kvm/interrupt.c | 25 ++++---------------------
>  1 file changed, 4 insertions(+), 21 deletions(-)
>
> diff --git a/arch/loongarch/kvm/interrupt.c b/arch/loongarch/kvm/interrupt.c
> index 4c3f22de4b40..8462083f0301 100644
> --- a/arch/loongarch/kvm/interrupt.c
> +++ b/arch/loongarch/kvm/interrupt.c
> @@ -83,28 +83,11 @@ void kvm_deliver_intr(struct kvm_vcpu *vcpu)
>         unsigned long *pending = &vcpu->arch.irq_pending;
>         unsigned long *pending_clr = &vcpu->arch.irq_clear;
>
> -       if (!(*pending) && !(*pending_clr))
> -               return;
Is it necessary to keep these two lines?

Huacai

> -
> -       if (*pending_clr) {
> -               priority = __ffs(*pending_clr);
> -               while (priority <= INT_IPI) {
> -                       kvm_irq_clear(vcpu, priority);
> -                       priority = find_next_bit(pending_clr,
> -                                       BITS_PER_BYTE * sizeof(*pending_clr),
> -                                       priority + 1);
> -               }
> -       }
> +       for_each_set_bit(priority, pending_clr, INT_IPI + 1)
> +               kvm_irq_clear(vcpu, priority);
>
> -       if (*pending) {
> -               priority = __ffs(*pending);
> -               while (priority <= INT_IPI) {
> -                       kvm_irq_deliver(vcpu, priority);
> -                       priority = find_next_bit(pending,
> -                                       BITS_PER_BYTE * sizeof(*pending),
> -                                       priority + 1);
> -               }
> -       }
> +       for_each_set_bit(priority, pending, INT_IPI + 1)
> +               kvm_irq_deliver(vcpu, priority);
>  }
>
>  int kvm_pending_timer(struct kvm_vcpu *vcpu)
> --
> 2.43.0
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ