mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yi Wang <up2wing@gmail.com>
To: Dongli Zhang <dongli.zhang@oracle.com>
Cc: x86@kernel.org, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org,  foxywang@tencent.com,
	seanjc@google.com, pbonzini@redhat.com,  mingo@redhat.com,
	tglx@linutronix.de, dave.hansen@linux.intel.com,  hpa@zytor.com,
	bp@alien8.de, wanpengli@tencent.com, oliver.upton@linux.dev,
	 anup@brainfault.org, frankja@linux.ibm.com,
	imbrenda@linux.ibm.com,  maz@kernel.org, atishp@atishpatra.org,
	borntraeger@linux.ibm.com
Subject: Re: [v3 0/3] KVM: irqchip: synchronize srcu only if needed
Date: Fri, 9 Feb 2024 18:17:56 +0800	[thread overview]
Message-ID: <CAN35MuSanFT1JxM16usksSDjrLLsAAWs-kosJEd20sKckvwJfg@mail.gmail.com> (raw)
In-Reply-To: <02fe988e-2b42-9610-6ab5-bd17b0d9fb80@oracle.com>

Hi Dongli,

Thanks for the reply and Happy Spring Festival to all :)

On Fri, Feb 9, 2024 at 5:00 PM Dongli Zhang <dongli.zhang@oracle.com> wrote:
>
> Hi Yi,
>
> On 1/24/24 03:34, Yi Wang wrote:
> > From: Yi Wang <foxywang@tencent.com>
> >
> > We found that it may cost more than 20 milliseconds very accidentally
> > to enable cap of KVM_CAP_SPLIT_IRQCHIP on a host which has many vms
> > already.
>
> Would you mind explaining the reason that the *number of VMs* matters, as
> KVM_CAP_SPLIT_IRQCHIP is a per-VM cap?
>
> Or it meant it is more likely to have some VM workload impacted by the
> synchronize_srcu_expedited() as in prior discussion?
>
> https://lore.kernel.org/kvm/CAN35MuSkQf0XmBZ5ZXGhcpUCGD-kKoyTv9G7ya4QVD1xiqOxLg@mail.gmail.com/
>

The actual reason is might_sleep() and the kworker in
synchronize_srcu_expedited(),
which may cause some delay when there are pretty many threads in the host, so
"number of VMs" is just one of  the situations which can trigger the issue :)

> Thank you very much!
>
> Dongli Zhang
>
> >
> > The reason is that when vmm(qemu/CloudHypervisor) invokes
> > KVM_CAP_SPLIT_IRQCHIP kvm will call synchronize_srcu_expedited() and
> > might_sleep and kworker of srcu may cost some delay during this period.
> > One way makes sence is setup empty irq routing when creating vm and
> > so that x86/s390 don't need to setup empty/dummy irq routing.
> >
> > Note: I have no s390 machine so the s390 patch has not been tested.
> >
> > Changelog:
> > ----------
> > v3:
> >   - squash setup empty routing function and use of that into one commit
> >   - drop the comment in s390 part
> >
> > v2:
> >   - setup empty irq routing in kvm_create_vm
> >   - don't setup irq routing in x86 KVM_CAP_SPLIT_IRQCHIP
> >   - don't setup irq routing in s390 KVM_CREATE_IRQCHIP
> >
> > v1: https://urldefense.com/v3/__https://lore.kernel.org/kvm/20240112091128.3868059-1-foxywang@tencent.com/__;!!ACWV5N9M2RV99hQ!LjwKfBaGVl3u1l9YQSskg_1RU6278h2-fYnYLsoihF9i43aq73eIDqolGzOmeRvO8UlPreQHLqXEL1bAuw$
> >
> > Yi Wang (3):
> >   KVM: setup empty irq routing when create vm
> >   KVM: x86: don't setup empty irq routing when KVM_CAP_SPLIT_IRQCHIP
> >   KVM: s390: don't setup dummy routing when KVM_CREATE_IRQCHIP
> >
> >  arch/s390/kvm/kvm-s390.c |  9 +--------
> >  arch/x86/kvm/irq.h       |  1 -
> >  arch/x86/kvm/irq_comm.c  |  5 -----
> >  arch/x86/kvm/x86.c       |  3 ---
> >  include/linux/kvm_host.h |  1 +
> >  virt/kvm/irqchip.c       | 19 +++++++++++++++++++
> >  virt/kvm/kvm_main.c      |  4 ++++
> >  7 files changed, 25 insertions(+), 17 deletions(-)
> >



-- 
---
Best wishes
Yi Wang

      reply	other threads:[~2024-02-09 10:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-24 11:34 Yi Wang
2024-01-24 11:34 ` [v3 1/3] KVM: setup empty irq routing when create vm Yi Wang
2024-01-24 11:34 ` [v3 2/3] KVM: x86: don't setup empty irq routing when KVM_CAP_SPLIT_IRQCHIP Yi Wang
2024-01-24 11:34 ` [v3 3/3] KVM: s390: don't setup dummy routing when KVM_CREATE_IRQCHIP Yi Wang
2024-02-08  9:06 ` [v3 0/3] KVM: irqchip: synchronize srcu only if needed Yi Wang
2024-02-09  9:00 ` Dongli Zhang
2024-02-09 10:17   ` Yi Wang [this message]

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=CAN35MuSanFT1JxM16usksSDjrLLsAAWs-kosJEd20sKckvwJfg@mail.gmail.com \
    --to=up2wing@gmail.com \
    --cc=anup@brainfault.org \
    --cc=atishp@atishpatra.org \
    --cc=borntraeger@linux.ibm.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=dongli.zhang@oracle.com \
    --cc=foxywang@tencent.com \
    --cc=frankja@linux.ibm.com \
    --cc=hpa@zytor.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=mingo@redhat.com \
    --cc=oliver.upton@linux.dev \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --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

all inboxes | Powered by JetHome®