Message ID | 20231110090529.56950-1-maobibo@loongson.cn |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp1288806vqs; Fri, 10 Nov 2023 10:04:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IH31BgkpRSnpkfyj24KnAO3pXlYzXUScweHz/9FHV6ciTGQ5jKqw8OksJLXaznQNQzRMatp X-Received: by 2002:a05:6300:8084:b0:15e:a653:fed5 with SMTP id ap4-20020a056300808400b0015ea653fed5mr9827375pzc.16.1699639470321; Fri, 10 Nov 2023 10:04:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699639470; cv=none; d=google.com; s=arc-20160816; b=nk7ipLThNu2IMDfp9MQWmxOpFnkaoQG1T36UcHdf3XNC3Ae597XDhpryBwFOGmJgL8 M5rCuTlu1lzYxWMgvpNRBAxCrYAmpwRhGokxBj2DmUmTKk75EoOhtRSruzFsVIBSNSpo fttYTersWrGeyenblqK/mQcWCmF7eiwBpRWjVm54hsIFt8iYV97tG5D+t4kLktrrsfuU Al+qzu2OT2mlvAvvAsrIALj5ONrn/OoGNiu9SqtbeD14sW+Q4p+qWDekOx102JQsyBCk kAsguPlFUDujwZWLXb5txprF53xt3o0uG4cTHwMPQGTfHbDSd/qEglOB0Q/BzqTwsYiX XwkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=c5zImAs9P9AjDI0/YDeJQ4LTyqMIs4zvBW2y7BVaqzc=; fh=JOrDXAv7dX9lqUsWenmIinruxsV5NNS7FV+l4Q4onAY=; b=ECf2YXkQWRQbmHNAYuInj27AEyM0v4sQW3vshAGvLNeMR7kMBQjnFK2QMN0fp9HuGH DeUVQCi19Kkb3LIf/8SQ2lsfNSzthAWfGU+6huH02A+RsZbx9WcelSTiHAoPB4y+2sWr 9Lk/U9hhSXQ/17/jJ5erZsT1wDQEJxX+XZOHhJcLg1C12NgPlPvFUjCjSDFW9edSB6rI HO4zlI27lg9IEi+/fudj9TQZJx88I5OuUrzXJ8wy8nJAYVFPNFC479Q/s2QR+WYJY1A6 17p7xxc85b8arvvFvU3J3ATfZZi9g3x6SVrh8+CcMCYhHulNcWoaj3ua6/J/X84hWieG GaJA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id v9-20020a63f849000000b0056959099f46si10390813pgj.856.2023.11.10.10.04.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Nov 2023 10:04:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 66C89832CE7A; Fri, 10 Nov 2023 10:04:01 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235259AbjKJSAW (ORCPT <rfc822;lhua1029@gmail.com> + 30 others); Fri, 10 Nov 2023 13:00:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229982AbjKJR72 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 10 Nov 2023 12:59:28 -0500 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3A9ACD080; Fri, 10 Nov 2023 01:07:58 -0800 (PST) Received: from loongson.cn (unknown [10.2.5.213]) by gateway (Coremail) with SMTP id _____8AxEvDq8k1lS7I4AA--.45479S3; Fri, 10 Nov 2023 17:07:55 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.213]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxkN3q8k1l6vU9AA--.7142S2; Fri, 10 Nov 2023 17:07:54 +0800 (CST) From: Bibo Mao <maobibo@loongson.cn> To: Tianrui Zhao <zhaotianrui@loongson.cn>, Huacai Chen <chenhuacai@kernel.org> Cc: WANG Xuerui <kernel@xen0n.name>, kvm@vger.kernel.org, loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v3 0/3] LoongArch: KVM: Remove SW timer switch when vcpu is halt polling Date: Fri, 10 Nov 2023 17:05:26 +0800 Message-Id: <20231110090529.56950-1-maobibo@loongson.cn> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8DxkN3q8k1l6vU9AA--.7142S2 X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBj93XoW7AF4rZryDJry3Gw48Kw4xKrX_yoW8Jw47pF ZxCFnxXr40krWYg3W7ta1DWFn7WrW8KFy7JrnIkF1rCr17Aw1FqFW8Kr95XFy3Ja93AryI vryrt3W5ua4UA3cCm3ZEXasCq-sJn29KB7ZKAUJUUUU5529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUk2b4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1a6r1DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx 1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1q6rW5McIj6I8E87Iv 67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2 Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s02 6x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0x vE2Ix0cI8IcVAFwI0_Gr0_Xr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE 42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6x kF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUoxR6UUUUU X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Fri, 10 Nov 2023 10:04:01 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782200249894347628 X-GMAIL-MSGID: 1782201157046360401 |
Series |
LoongArch: KVM: Remove SW timer switch when vcpu is halt polling
|
|
Message
maobibo
Nov. 10, 2023, 9:05 a.m. UTC
This patches removes SW timer switch during vcpu block stage. VM uses HW timer rather than SW PV timer on LoongArch system, it can check pending HW timer interrupt status directly, rather than switch to SW timer and check injected SW timer interrupt. When SW timer is not used in vcpu halt-polling mode, the relative SW timer handling before entering guest can be removed also. Timer emulation is simpler than before, SW timer emuation is only used in vcpu thread context switch. --- Changes in v3: Add kvm_arch_vcpu_runnable checking before kvm_vcpu_halt. Changes in v2: Add halt polling support for idle instruction emulation, using api kvm_vcpu_halt rather than kvm_vcpu_block in function kvm_emu_idle. --- Bibo Mao (3): LoongArch: KVM: Remove SW timer switch when vcpu is halt polling LoongArch: KVM: Allow to access HW timer CSR registers always LoongArch: KVM: Remove kvm_acquire_timer before entering guest arch/loongarch/include/asm/kvm_vcpu.h | 1 - arch/loongarch/kvm/exit.c | 13 ++------ arch/loongarch/kvm/main.c | 1 - arch/loongarch/kvm/timer.c | 47 +++++++-------------------- arch/loongarch/kvm/vcpu.c | 38 +++++----------------- 5 files changed, 22 insertions(+), 78 deletions(-) base-commit: 305230142ae0637213bf6e04f6d9f10bbcb74af8
Comments
Hi, Bibo, Does this series have some relationship with the commit "LoongArch:LSVZ: set timer offset at first time once" in our internal repo? Huacai On Fri, Nov 10, 2023 at 5:07 PM Bibo Mao <maobibo@loongson.cn> wrote: > > This patches removes SW timer switch during vcpu block stage. VM uses HW > timer rather than SW PV timer on LoongArch system, it can check pending > HW timer interrupt status directly, rather than switch to SW timer and > check injected SW timer interrupt. > > When SW timer is not used in vcpu halt-polling mode, the relative > SW timer handling before entering guest can be removed also. Timer > emulation is simpler than before, SW timer emuation is only used in vcpu > thread context switch. > > --- > > Changes in v3: > Add kvm_arch_vcpu_runnable checking before kvm_vcpu_halt. > > Changes in v2: > Add halt polling support for idle instruction emulation, using api > kvm_vcpu_halt rather than kvm_vcpu_block in function kvm_emu_idle. > > --- > > Bibo Mao (3): > LoongArch: KVM: Remove SW timer switch when vcpu is halt polling > LoongArch: KVM: Allow to access HW timer CSR registers always > LoongArch: KVM: Remove kvm_acquire_timer before entering guest > > arch/loongarch/include/asm/kvm_vcpu.h | 1 - > arch/loongarch/kvm/exit.c | 13 ++------ > arch/loongarch/kvm/main.c | 1 - > arch/loongarch/kvm/timer.c | 47 +++++++-------------------- > arch/loongarch/kvm/vcpu.c | 38 +++++----------------- > 5 files changed, 22 insertions(+), 78 deletions(-) > > > base-commit: 305230142ae0637213bf6e04f6d9f10bbcb74af8 > -- > 2.39.3 >
On 2023/11/13 下午10:36, Huacai Chen wrote: > Hi, Bibo, > > Does this series have some relationship with the commit > "LoongArch:LSVZ: set timer offset at first time once" in our internal > repo? No, it is not relative with internal repo. This patch is only optimization for timer save and restore. The internal repo is to set timestamp offset for VM. I will post another patch for timestamp offset setting. Regards Bibo, > > Huacai > > On Fri, Nov 10, 2023 at 5:07 PM Bibo Mao <maobibo@loongson.cn> wrote: >> >> This patches removes SW timer switch during vcpu block stage. VM uses HW >> timer rather than SW PV timer on LoongArch system, it can check pending >> HW timer interrupt status directly, rather than switch to SW timer and >> check injected SW timer interrupt. >> >> When SW timer is not used in vcpu halt-polling mode, the relative >> SW timer handling before entering guest can be removed also. Timer >> emulation is simpler than before, SW timer emuation is only used in vcpu >> thread context switch. >> >> --- >> >> Changes in v3: >> Add kvm_arch_vcpu_runnable checking before kvm_vcpu_halt. >> >> Changes in v2: >> Add halt polling support for idle instruction emulation, using api >> kvm_vcpu_halt rather than kvm_vcpu_block in function kvm_emu_idle. >> >> --- >> >> Bibo Mao (3): >> LoongArch: KVM: Remove SW timer switch when vcpu is halt polling >> LoongArch: KVM: Allow to access HW timer CSR registers always >> LoongArch: KVM: Remove kvm_acquire_timer before entering guest >> >> arch/loongarch/include/asm/kvm_vcpu.h | 1 - >> arch/loongarch/kvm/exit.c | 13 ++------ >> arch/loongarch/kvm/main.c | 1 - >> arch/loongarch/kvm/timer.c | 47 +++++++-------------------- >> arch/loongarch/kvm/vcpu.c | 38 +++++----------------- >> 5 files changed, 22 insertions(+), 78 deletions(-) >> >> >> base-commit: 305230142ae0637213bf6e04f6d9f10bbcb74af8 >> -- >> 2.39.3 >>