2023-05-06 09:36:33

by ye.xingchen

[permalink] [raw]
Subject: [PATCH] RISC-V: KVM: use bitmap_zero() API

From: Ye Xingchen <[email protected]>

bitmap_zero() is faster than bitmap_clear(), so use bitmap_zero()
instead of bitmap_clear().

Signed-off-by: Ye Xingchen <[email protected]>
---
arch/riscv/kvm/tlb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/kvm/tlb.c b/arch/riscv/kvm/tlb.c
index 0e5479600695..44bc324aeeb0 100644
--- a/arch/riscv/kvm/tlb.c
+++ b/arch/riscv/kvm/tlb.c
@@ -296,7 +296,7 @@ static void make_xfence_request(struct kvm *kvm,
unsigned int actual_req = req;
DECLARE_BITMAP(vcpu_mask, KVM_MAX_VCPUS);

- bitmap_clear(vcpu_mask, 0, KVM_MAX_VCPUS);
+ bitmap_zero(vcpu_mask, KVM_MAX_VCPUS);
kvm_for_each_vcpu(i, vcpu, kvm) {
if (hbase != -1UL) {
if (vcpu->vcpu_id < hbase)
--
2.25.1


2023-05-07 15:47:28

by Anup Patel

[permalink] [raw]
Subject: Re: [PATCH] RISC-V: KVM: use bitmap_zero() API

On Sat, May 6, 2023 at 2:40 PM <[email protected]> wrote:
>
> From: Ye Xingchen <[email protected]>
>
> bitmap_zero() is faster than bitmap_clear(), so use bitmap_zero()
> instead of bitmap_clear().
>
> Signed-off-by: Ye Xingchen <[email protected]>

Looks good to me.

Reviewed-by: Anup Patel <[email protected]>

Regards,
Anup

> ---
> arch/riscv/kvm/tlb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/riscv/kvm/tlb.c b/arch/riscv/kvm/tlb.c
> index 0e5479600695..44bc324aeeb0 100644
> --- a/arch/riscv/kvm/tlb.c
> +++ b/arch/riscv/kvm/tlb.c
> @@ -296,7 +296,7 @@ static void make_xfence_request(struct kvm *kvm,
> unsigned int actual_req = req;
> DECLARE_BITMAP(vcpu_mask, KVM_MAX_VCPUS);
>
> - bitmap_clear(vcpu_mask, 0, KVM_MAX_VCPUS);
> + bitmap_zero(vcpu_mask, KVM_MAX_VCPUS);
> kvm_for_each_vcpu(i, vcpu, kvm) {
> if (hbase != -1UL) {
> if (vcpu->vcpu_id < hbase)
> --
> 2.25.1

2023-06-06 03:46:36

by Anup Patel

[permalink] [raw]
Subject: Re: [PATCH] RISC-V: KVM: use bitmap_zero() API

On Sat, May 6, 2023 at 2:40 PM <[email protected]> wrote:
>
> From: Ye Xingchen <[email protected]>
>
> bitmap_zero() is faster than bitmap_clear(), so use bitmap_zero()
> instead of bitmap_clear().
>
> Signed-off-by: Ye Xingchen <[email protected]>

Queued this patch for 6.5

Thanks,
Anup

> ---
> arch/riscv/kvm/tlb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/riscv/kvm/tlb.c b/arch/riscv/kvm/tlb.c
> index 0e5479600695..44bc324aeeb0 100644
> --- a/arch/riscv/kvm/tlb.c
> +++ b/arch/riscv/kvm/tlb.c
> @@ -296,7 +296,7 @@ static void make_xfence_request(struct kvm *kvm,
> unsigned int actual_req = req;
> DECLARE_BITMAP(vcpu_mask, KVM_MAX_VCPUS);
>
> - bitmap_clear(vcpu_mask, 0, KVM_MAX_VCPUS);
> + bitmap_zero(vcpu_mask, KVM_MAX_VCPUS);
> kvm_for_each_vcpu(i, vcpu, kvm) {
> if (hbase != -1UL) {
> if (vcpu->vcpu_id < hbase)
> --
> 2.25.1