Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp378784lqb; Fri, 24 May 2024 00:38:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUEu583G3/FdejC6iPrS+svckWjWN+UsYoHynGlOXfc1rUtwpmFYgX8JFsyYr2OKyKla/QRriU0B9zKC4wMPRj0fB/8UoDvBPzKDBtwrQ== X-Google-Smtp-Source: AGHT+IEfwwz2gpJTRGSrjAvIBupgjY1YjkSTUjku1l+HDdPmMVgZfVXAznJ0o67YhI7aPcYUw//m X-Received: by 2002:ac2:4c49:0:b0:51d:8842:f0b8 with SMTP id 2adb3069b0e04-5296529053bmr1579363e87.13.1716536336758; Fri, 24 May 2024 00:38:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716536336; cv=pass; d=google.com; s=arc-20160816; b=HPSob/MKCa+ZDvItvT0fud7IUMUwf+bw95JZ647MCtaP3DOtRCpd8HY2eInB0sPg5Y o3+SScHpNil293KlP08TLvKZE6lBOeFgOfN/bzUf/T6hTK5FzBEpfxJIhGko0H/Jx9zV HKGZ74KAkicdQ2uQ37LWlhOGt4UQqtqSOS6gK1LQvDyvr9jJ2haLtbEe4WL8EVLEoWx4 RNQY+hLHnrse8XhVPhTvjpuG/Mg3zY4kZvr/8+krL9vwVHdU2E59Z0uNgi9Kcdeyy9Bn 43y53vt7I7EKCP6Faw5eg+LKQ7bNrtn9r7AymL+WRZmiP/cTcEToH1up6+AynxygQGir l0pA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=v6ltv+NdJ3KXguaQrwAl92e99gZ3CC9+I66Y23RDIFU=; fh=qdV62HKG2O0E2jvRwrIfwpeQ+X1zBkVKEmCAXswaWZQ=; b=pQnUDG11XDxWWz/zRv4NFXwbOo1w3RT2aBZrBNUQ72BctnbhJ1ZfHGGke8TOmbQlvd mFY384ZQOQLY9UtgHnPlhY3+8wZzgMZLUE5ycAXNSgu3klJ4SmcQmGZegJbv5XXB5MV5 +3q5p1d+mSQ8yb4qU5Kswk0+kI+7wgJt2nJnQfA0c+Zk2uIdEfzR2SdH4BKALXbwboAI Fup7iMYvmBOyUiAppjIz32LrWr8lqns14krqAG4eaZmj+4dBIfSZEtgj5D7p9ovZ7+Qd PmywduR0YAw88m9npGdBuK5hO6KJu+hUSYW5XGAqKiIkY4wb/qN+NutqwIBEiUkdptKY vfwA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=loongson.cn); spf=pass (google.com: domain of linux-kernel+bounces-188405-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188405-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a626c918a9bsi50371066b.241.2024.05.24.00.38.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 00:38:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-188405-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=loongson.cn); spf=pass (google.com: domain of linux-kernel+bounces-188405-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188405-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 693331F21D99 for ; Fri, 24 May 2024 07:38:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0595D129E6E; Fri, 24 May 2024 07:38:27 +0000 (UTC) Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B5FF1272D6; Fri, 24 May 2024 07:38:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.242.206.163 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716536306; cv=none; b=OYQaGLdF9dGh2wNQ/bWWjv3USqytNKEt+H7g2bAvw6iqcKSPv46cKn0r2PFszuK19W8LoCDf/cr8g0C+sIzEU6WHin9uD09EdNriNlGrOVZOZAWyqpYomCcOqhbnv8/tJUelgZj0Hld52cAJJZGs7ybl6vACJyHUG+WFVW745dE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716536306; c=relaxed/simple; bh=iQvVWMmNWY2muA4rMvVgeuF8u4UtlmePBbkozhT5u/g=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=ENWCQwyjY0FfxYWEtOkXN2HBXJ0O2P5e534HTuYwi7zTB0jd6XwF1ZOhrS3c7Ee9dcZxfn+HziocIdAxhGOr1uf0vXdmfGLhu8jBVAyyZln9NHAFuD5+mlW3Dx88pjvTTNfwiP8aIQy2qa/PxWBhbKWxqdM76ocZ27Nqj7/25bw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.client-ip=114.242.206.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [10.2.5.213]) by gateway (Coremail) with SMTP id _____8BxmurlQ1Bm2EsDAA--.4122S3; Fri, 24 May 2024 15:38:13 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.213]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxZcXlQ1BmScUHAA--.10650S2; Fri, 24 May 2024 15:38:13 +0800 (CST) From: Bibo Mao To: Tianrui Zhao , Huacai Chen Cc: Juergen Gross , kvm@vger.kernel.org, loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, x86@kernel.org, virtualization@lists.linux.dev Subject: [PATCH v4 0/2] LoongArch: Add steal time support Date: Fri, 24 May 2024 15:38:10 +0800 Message-Id: <20240524073812.731032-1-maobibo@loongson.cn> X-Mailer: git-send-email 2.39.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:AQAAf8CxZcXlQ1BmScUHAA--.10650S2 X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== Para-virt feature steal time is added in both kvm and guest kernel side. It is silimar with other architectures, steal time structure comes from guest memory, also pseduo register is used to save/restore base address of steal time structure, so that when vm is migrated, kvm module on target machine knows the base address of steal time. --- v3 ... v4: 1. To resolve compile dependency problem, enable SCHED_INFO option section if KVM is enabled. 2. Put new added option PARAVIRT_TIME_ACCOUNTING in one submemu with PARAVIRT in file arch/loongarch/Kconfig. v2 ... v3: 1. Solve code confliction based on the kernel 6.9.0 2. Add kernel parameter no-steal-acc support on LoongArch with file Documentation/admin-guide/kernel-parameters.txt 3. Add strict checking with pv stealtimer gpa address in function kvm_save_notify() and kvm_loongarch_pvtime_set_attr() v1 ... v2: 1. Add PARAVIRT_TIME_ACCOUNTING kconfig option in file arch/loongarch/Kconfig 2. Function name change such as replace pv_register_steal_time with pv_enable_steal_time etc --- Bibo Mao (2): LoongArch: KVM: Add steal time support in kvm side LoongArch: Add steal time support in guest side .../admin-guide/kernel-parameters.txt | 2 +- arch/loongarch/Kconfig | 11 ++ arch/loongarch/include/asm/kvm_host.h | 7 + arch/loongarch/include/asm/kvm_para.h | 10 ++ arch/loongarch/include/asm/kvm_vcpu.h | 4 + arch/loongarch/include/asm/loongarch.h | 1 + arch/loongarch/include/asm/paravirt.h | 5 + arch/loongarch/include/uapi/asm/kvm.h | 4 + arch/loongarch/kernel/paravirt.c | 133 ++++++++++++++++++ arch/loongarch/kernel/time.c | 2 + arch/loongarch/kvm/Kconfig | 1 + arch/loongarch/kvm/exit.c | 38 ++++- arch/loongarch/kvm/vcpu.c | 124 ++++++++++++++++ 13 files changed, 339 insertions(+), 3 deletions(-) base-commit: 6e51b4b5bbc07e52b226017936874715629932d1 -- 2.39.3