Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2798494ybi; Sun, 9 Jun 2019 21:32:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqwyuhFXCog3AxW2BVZX88CVF7XOYgW1WilacY+8tOQY6tdRRBs38EDhxNEBwx4t/6W/+dsT X-Received: by 2002:a63:d006:: with SMTP id z6mr2340737pgf.364.1560141128465; Sun, 09 Jun 2019 21:32:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560141128; cv=none; d=google.com; s=arc-20160816; b=iGtLjdd+2aXPDOIA9BNKR5dCzanmcWMlNOVtOymRcAD92hT8qmeGL1prxnIY1PsS3/ t3yIJGRagSIE192n30GBd2igeNFw2l1h0O0919YJiQQpiAYCHvEJlDCG9v2h6AnxOJTi meQfee3PyyK1NMXQLIA6jzrScuYYn9vVnEYiV3qM6/AoXNmpyP01LE36v2w12u9hsfrF ZMnCliz+Ih1tPRVfclPeAq335r6j9oP/DUUAs2oKN92DLW3XEdDd45BHAZ/FdGjQjxh7 YXVlQpF5cYXJUQw/H+0vI1HAfXW8nP4omZxIxvJ5pionycXW3Kyo9+VmAy4dRcEkYyTB S2+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=zqVRtfIXSfL2glUOZ/rPqcfEx5EYpKNLA4Zoyt8Pnhg=; b=Yq66R/ZDL5rBzvK2zyur5ybV/7dT02F5oq4y08k8p0crZmVoUzwTy+NwDno0kIsGdA BSnYrzLiaxX/xBS59rWAitYOgmZruBjavOpVeHe9R0i4s3GQWvqGq1/kkufyAPGGyZ05 nP6+R6RzbWiUjl+PCtisxt9IPF7Xt4mtPGWHXHMimmw+CuNph4TXx4swDsgXtLSX4I1V Ap5+wzq/UKlA4TnsfqMTmCBNwdA9pHzhbXzcKqzCtdXNXzeaikx/x7g9KJk6PG0TdgQo G11Acm0CZrSI0LSAVERAphpfj590SAe/9o3WfJ52QDjg+UX+OlUiGO0VwEqlXfEeSEHk 8Xfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ue19iE+N; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c8si8703273pjr.17.2019.06.09.21.31.52; Sun, 09 Jun 2019 21:32:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ue19iE+N; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728258AbfFJEbs (ORCPT + 99 others); Mon, 10 Jun 2019 00:31:48 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:32826 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728092AbfFJEbs (ORCPT ); Mon, 10 Jun 2019 00:31:48 -0400 Received: by mail-ot1-f65.google.com with SMTP id p4so3882794oti.0; Sun, 09 Jun 2019 21:31:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zqVRtfIXSfL2glUOZ/rPqcfEx5EYpKNLA4Zoyt8Pnhg=; b=ue19iE+NTrIsYbDZPeAukExr8wKcPe3hVLkZ8so/3GUG6HTktivL9uGMTedOf1PCI0 fvcY9kOdGV6WXSPD+IAqLBo2582Zue8weJb5nZLIbJOkfvTsQSQ2pNXOiTMhstQorQhJ uKdrZRKAUtHShrEd4QqNOfs0dZ6yYZFh4kRZeKmw2bd518fzFUBrSXwODkyMo0KDcSm0 kqm5CuQA2zKTcKhqsPZd2oihR2U7gvIpVoLDfwZftgPym/QUKBZWxtsuQ7Y4zoMvScWD +acz2Crjwitx205NOxJEQajagGT0hpESOAamcm2YwSqJyiNBW5iZ2NWbHEeh+HDV7Eg7 jMig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zqVRtfIXSfL2glUOZ/rPqcfEx5EYpKNLA4Zoyt8Pnhg=; b=AZwDpDdiTkaqUDFBXEpIzoMtBbhQNJeAz3zYxQEpCnexnMhDOyhoirMQGpzMZQlQkd 7vfncgvOZ9hLzcBDn3Dt202ZggB8LrlPQ6QjhjSBmyRbBPzo5Y2f8Sq3LSYEb37ycxYY RX8DlRmo7PJ0zLltYWt0MSBi5HJdTd9GJ1ovbmc94lL+2UcHry4OnOA+gj39Yl5GcQsC A2lbuOL0/bRnm6V3Vmc8tKkoNLsmdp0epXSXIIW7EvIz5gE/urcKeETsk2Tv0uKXL2tV +JjduViIyXaJnzqYEEepcaWGyG9TjuQeZVfmCqjC38G/MRi+xeaYYpVVi/AY0+lKdmzN bpDw== X-Gm-Message-State: APjAAAX8wwdYfTchQEfAjBwazL0OnQ0vSF1Us+UTWE1Pr/EslvhMI18z 4utZ/2zYbgGHqN/iVlZl2qlNgEkj9cgYGgrrEAFG66P0 X-Received: by 2002:a9d:6312:: with SMTP id q18mr27167731otk.45.1560141107273; Sun, 09 Jun 2019 21:31:47 -0700 (PDT) MIME-Version: 1.0 References: <1559799086-13912-1-git-send-email-wanpengli@tencent.com> In-Reply-To: <1559799086-13912-1-git-send-email-wanpengli@tencent.com> From: Wanpeng Li Date: Mon, 10 Jun 2019 12:32:33 +0800 Message-ID: Subject: Re: [PATCH v2 0/3] KVM: LAPIC: Implement Exitless Timer To: LKML , kvm Cc: Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 6 Jun 2019 at 13:31, Wanpeng Li wrote: > > Dedicated instances are currently disturbed by unnecessary jitter due > to the emulated lapic timers fire on the same pCPUs which vCPUs resident. > There is no hardware virtual timer on Intel for guest like ARM. Both > programming timer in guest and the emulated timer fires incur vmexits. > This patchset tries to avoid vmexit which is incurred by the emulated > timer fires in dedicated instance scenario. > > When nohz_full is enabled in dedicated instances scenario, the unpinned > timer will be moved to the nearest busy housekeepers after commit 444969223c8 > ("sched/nohz: Fix affine unpinned timers mess"). However, KVM always makes > lapic timer pinned to the pCPU which vCPU residents, the reason is explained > by commit 61abdbe0 (kvm: x86: make lapic hrtimer pinned). Actually, these > emulated timers can be offload to the housekeeping cpus since APICv > is really common in recent years. The guest timer interrupt is injected by > posted-interrupt which is delivered by housekeeping cpu once the emulated > timer fires. > > The host admin should fine tuned, e.g. dedicated instances scenario w/ > nohz_full cover the pCPUs which vCPUs resident, several pCPUs surplus > for housekeeping, disable mwait/hlt/pause vmexits to occupy the pCPUs, > fortunately preemption timer is disabled after mwait is exposed to > guest which makes emulated timer offload can be possible. > 3%~5% redis performance benefit can be observed on Skylake server. w/o patchset: VM-EXIT Samples Samples% Time% Min Time Max Time Avg time EXTERNAL_INTERRUPT 42916 49.43% 39.30% 0.47us 106.09us 0.71us ( +- 1.09% ) w/ patchset: VM-EXIT Samples Samples% Time% Min Time Max Time Avg time EXTERNAL_INTERRUPT 6871 9.29% 2.96% 0.44us 57.88us 0.72us ( +- 4.02% ) Regards, Wanpeng Li