kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Haiwei Li <lihaiwei.kernel@gmail.com>
Cc: wanpengli@tencent.com, x86@kernel.org, kvm@vger.kernel.org
Subject: Re: Some warnings occur in hyperv.c.
Date: Thu, 12 Mar 2020 11:47:00 +0100	[thread overview]
Message-ID: <87o8t1rgt7.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <CAB5KdOaiqS_nXq8_HfMH1PmjThFzmYNBcBrMnC3Utkw6-OPUfQ@mail.gmail.com>

Haiwei Li <lihaiwei.kernel@gmail.com> writes:

> Hi, When i build kvm, some warnings occur. Just like:
>
> /home/kernel/data/linux/arch/x86/kvm//hyperv.c: In function ‘kvm_hv_flush_tlb’:
> /home/kernel/data/linux/arch/x86/kvm//hyperv.c:1436:1: warning: the
> frame size of 1064 bytes is larger than 1024 bytes
> [-Wframe-larger-than=]
>  }
>  ^
> /home/kernel/data/linux/arch/x86/kvm//hyperv.c: In function ‘kvm_hv_send_ipi’:
> /home/kernel/data/linux/arch/x86/kvm//hyperv.c:1529:1: warning: the
> frame size of 1112 bytes is larger than 1024 bytes
> [-Wframe-larger-than=]
>  }
>  ^
>
> Then i get the two functions in hyperv.c. Like:
>
> static u64 kvm_hv_send_ipi(struct kvm_vcpu *current_vcpu, u64 ingpa, u64 outgpa,
>                            bool ex, bool fast)
> {
>         struct kvm *kvm = current_vcpu->kvm;
>         struct hv_send_ipi_ex send_ipi_ex;
>         struct hv_send_ipi send_ipi;
>         u64 vp_bitmap[KVM_HV_MAX_SPARSE_VCPU_SET_BITS];
>         DECLARE_BITMAP(vcpu_bitmap, KVM_MAX_VCPUS);
>         unsigned long *vcpu_mask;
>         unsigned long valid_bank_mask;
>         u64 sparse_banks[64];
>         int sparse_banks_len;
>         u32 vector;
>         bool all_cpus;
>
> static u64 kvm_hv_flush_tlb(struct kvm_vcpu *current_vcpu, u64 ingpa,
>                             u16 rep_cnt, bool ex)
> {
>         struct kvm *kvm = current_vcpu->kvm;
>         struct kvm_vcpu_hv *hv_vcpu = &current_vcpu->arch.hyperv;
>         struct hv_tlb_flush_ex flush_ex;
>         struct hv_tlb_flush flush;
>         u64 vp_bitmap[KVM_HV_MAX_SPARSE_VCPU_SET_BITS];
>         DECLARE_BITMAP(vcpu_bitmap, KVM_MAX_VCPUS);
>         unsigned long *vcpu_mask;
>         u64 valid_bank_mask;
>         u64 sparse_banks[64];
>         int sparse_banks_len;
>         bool all_cpus;
>
> The definition of sparse_banks for X86_64 is 512 B.  So i tried to
> refactor it by
> defining it for both tlb and ipi. But no preempt disable in the flow.
> How can i do?

I don't think preemption is a problem here if you define a per-vCPU
buffer: we can never switch to serving some new request for the same
vCPU before finishing the previous one so this is naturally serialized.

To not waste memory I'd suggest you allocate this buffer dinamically
upon first usage. We can also have a union for struct
hv_tlb_flush*/struct hv_send_ipi* as these also can't be used
simultaneously.

-- 
Vitaly


  reply	other threads:[~2020-03-12 10:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-12 10:20 Some warnings occur in hyperv.c Haiwei Li
2020-03-12 10:47 ` Vitaly Kuznetsov [this message]
2020-03-18  0:59   ` Haiwei Li
2020-03-18  9:54     ` Vitaly Kuznetsov

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=87o8t1rgt7.fsf@vitty.brq.redhat.com \
    --to=vkuznets@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=lihaiwei.kernel@gmail.com \
    --cc=wanpengli@tencent.com \
    --cc=x86@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).