Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp9820350ybl; Thu, 26 Dec 2019 06:00:05 -0800 (PST) X-Google-Smtp-Source: APXvYqwq9db25MaC1EjczfZJJ/UQwbvQOLGM7ZJCsIJSRHMpYx3SIe8UlTxnkEgrAJfCPlch6cb0 X-Received: by 2002:a05:6830:3048:: with SMTP id p8mr27955642otr.312.1577368805040; Thu, 26 Dec 2019 06:00:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577368805; cv=none; d=google.com; s=arc-20160816; b=bIZa6Rgx0/EyfJ7Jfiip1TGwRQZHuovwQQbEELOAu8/qgaTcXEymWJ7Q6kSkGE/m3C Bjv6xCWYBQvoOMlvKDgwXodGJE2BhmnlZV35uCKos/pEbxcc+ai8eb9wRmuoB9o4FRce sNEoNqIWpnSS6STIy9sHbWMyRKIj69l/2LDGUh2o0HPzPix6ZrKAYlJ+lYGCoEXvNCoO bHwJYOC9RWxRl6mdiH+nQnGqL2xDwReccDkx4BzhWnSLb3ZBbcLFjn7rrbq6zQD+KTJ4 zyY+uT0FXvDPrPVFQDy8Cux9+13gA0ZJxPqdA58f9cIusLq0nWT6VqqwiR9Xob//4RFJ 31qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=34e66bQr739uHchaYd1BDA9QgMMmJjlw6nVELBqrovM=; b=ePy5Cg0BbLmFA8z+fbjL6dbnKTKMMHaFn/Q5CxCSysW8y8LO/ZFiwDXdgDBfOBi0zj Od7IavHXSjRTaElRFD3TvvK7X+A2bsZfnkfn6EvuvfzKLOq+q+POeQ4xRP+Z4ppX88Sg nyQ4vtglYhiDpbM0tNdcTq+2/WBPTFbsXxsAEG9yYosR7uNcAzWFONEMaYqT0JAbF17y O74RnLt9Z5PZ+NMi5ODyAa8oTNj0fnV6rwAGNjZjiuizhEL5kGq5ya3u4gkVxI5s2AlD qsUG7nKOBObvMAIFYDJOtiRKYuHDtsxLZqAfhhOoANU38nnuw8IQZCqKSYRTI8BF7mpQ FGZQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j13si15715162otq.146.2019.12.26.05.59.51; Thu, 26 Dec 2019 06:00:05 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726534AbfLZN7B (ORCPT + 99 others); Thu, 26 Dec 2019 08:59:01 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:41178 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725954AbfLZN7A (ORCPT ); Thu, 26 Dec 2019 08:59:00 -0500 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 17720E927BC04C10696D; Thu, 26 Dec 2019 21:58:57 +0800 (CST) Received: from DESKTOP-1NISPDV.china.huawei.com (10.173.221.248) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.439.0; Thu, 26 Dec 2019 21:58:51 +0800 From: Zengruan Ye To: , , , , , CC: , , , , , , , , , , Subject: [PATCH v2 0/6] KVM: arm64: VCPU preempted check support Date: Thu, 26 Dec 2019 21:58:27 +0800 Message-ID: <20191226135833.1052-1-yezengruan@huawei.com> X-Mailer: git-send-email 2.23.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.173.221.248] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch set aims to support the vcpu_is_preempted() functionality under KVM/arm64, which allowing the guest to obtain the VCPU is currently running or not. This will enhance lock performance on overcommitted hosts (more runnable VCPUs than physical CPUs in the system) as doing busy waits for preempted VCPUs will hurt system performance far worse than early yielding. We have observed some performace improvements in uninx benchmark tests. unix benchmark result: host: kernel 5.5.0-rc1, HiSilicon Kunpeng920, 8 CPUs guest: kernel 5.5.0-rc1, 16 VCPUs test-case | after-patch | before-patch ----------------------------------------+-------------------+------------------ Dhrystone 2 using register variables | 334600751.0 lps | 335319028.3 lps Double-Precision Whetstone | 32856.1 MWIPS | 32849.6 MWIPS Execl Throughput | 3662.1 lps | 2718.0 lps File Copy 1024 bufsize 2000 maxblocks | 432906.4 KBps | 158011.8 KBps File Copy 256 bufsize 500 maxblocks | 116023.0 KBps | 37664.0 KBps File Copy 4096 bufsize 8000 maxblocks | 1432769.8 KBps | 441108.8 KBps Pipe Throughput | 6405029.6 lps | 6021457.6 lps Pipe-based Context Switching | 185872.7 lps | 184255.3 lps Process Creation | 4025.7 lps | 3706.6 lps Shell Scripts (1 concurrent) | 6745.6 lpm | 6436.1 lpm Shell Scripts (8 concurrent) | 998.7 lpm | 931.1 lpm System Call Overhead | 3913363.1 lps | 3883287.8 lps ----------------------------------------+-------------------+------------------ System Benchmarks Index Score | 1835.1 | 1327.6 Changes from v1: https://lore.kernel.org/lkml/20191217135549.3240-1-yezengruan@huawei.com/ * Guest kernel no longer allocates the PV lock structure, instead it is allocated by user space to avoid lifetime issues about kexec. * Provide VCPU attributes for PV lock. * Update SMC number of PV lock features. * Report some basic validation when PV lock init. * Document preempted field. * Bunch of typo fixes. Zengruan Ye (6): KVM: arm64: Document PV-lock interface KVM: arm64: Add SMCCC paravirtualised lock calls KVM: arm64: Support pvlock preempted via shared structure KVM: arm64: Provide VCPU attributes for PV lock KVM: arm64: Add interface to support VCPU preempted check KVM: arm64: Support the VCPU preemption check Documentation/virt/kvm/arm/pvlock.rst | 63 ++++++++++++ Documentation/virt/kvm/devices/vcpu.txt | 14 +++ arch/arm/include/asm/kvm_host.h | 18 ++++ arch/arm64/include/asm/kvm_host.h | 28 ++++++ arch/arm64/include/asm/paravirt.h | 15 +++ arch/arm64/include/asm/pvlock-abi.h | 16 ++++ arch/arm64/include/asm/spinlock.h | 7 ++ arch/arm64/include/uapi/asm/kvm.h | 2 + arch/arm64/kernel/Makefile | 2 +- arch/arm64/kernel/paravirt-spinlocks.c | 13 +++ arch/arm64/kernel/paravirt.c | 121 +++++++++++++++++++++++- arch/arm64/kernel/setup.c | 2 + arch/arm64/kvm/Makefile | 1 + arch/arm64/kvm/guest.c | 9 ++ include/linux/arm-smccc.h | 14 +++ include/linux/cpuhotplug.h | 1 + include/uapi/linux/kvm.h | 2 + virt/kvm/arm/arm.c | 8 ++ virt/kvm/arm/hypercalls.c | 8 ++ virt/kvm/arm/pvlock.c | 103 ++++++++++++++++++++ 20 files changed, 445 insertions(+), 2 deletions(-) create mode 100644 Documentation/virt/kvm/arm/pvlock.rst create mode 100644 arch/arm64/include/asm/pvlock-abi.h create mode 100644 arch/arm64/kernel/paravirt-spinlocks.c create mode 100644 virt/kvm/arm/pvlock.c -- 2.19.1