From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E745EC433FE for ; Sat, 25 Sep 2021 00:56:02 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 9F97361261 for ; Sat, 25 Sep 2021 00:56:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9F97361261 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 537A94B13D; Fri, 24 Sep 2021 20:56:02 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TXd7pA1wYYhY; Fri, 24 Sep 2021 20:56:01 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 2CE454B15E; Fri, 24 Sep 2021 20:56:01 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 75D2B4B154 for ; Fri, 24 Sep 2021 20:56:00 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id c+h-m5f9S6Pn for ; Fri, 24 Sep 2021 20:55:59 -0400 (EDT) Received: from mail-qt1-f201.google.com (mail-qt1-f201.google.com [209.85.160.201]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 632D04B0E2 for ; Fri, 24 Sep 2021 20:55:59 -0400 (EDT) Received: by mail-qt1-f201.google.com with SMTP id b20-20020ac87fd4000000b002a69ee90efbso42020873qtk.11 for ; Fri, 24 Sep 2021 17:55:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=AVRxITHRgpiea0PQRu71hObIdpCCXd1tddFTuoKEd5M=; b=AmZZR6+/WobaV3d/KTMW3XEm+/mJU1HTP/alrco2LxeX8sPbzL7l8R5VIEq9wXYyp7 P31gfDlcRexYcYK12mPrGpQSHiwq1+7jjMKOfcgumO3thuYh7379U579a8VXzaHynz/c Q3KQVXVmXyM9LNzIQGRL46YsUVsNUTTA436JsJh3i+G14dKyyalUZ6UHTH5GdEZXjP9r IiNGv+ok9CwUCbLkrQ6KhkOVblpqSFVi+lqel510DljUqO6ykZ33BWRlVYKAV98E9Pb3 w2kY0mdXtU63LGRjV1zY+2LpQRo0iJs3knGrr124qdmj7QQ2lJ+zuHgXzPFrmiw1XkSd zSxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=AVRxITHRgpiea0PQRu71hObIdpCCXd1tddFTuoKEd5M=; b=JvnGuYQtM+tcaH0FmFHY/DotK2jRwWXBQsExoRrMnYkfzFg4ECiNGIEbEFcPQqKhTG Q2PhXb2CMtMSHiDmnPCLUQD+7QcjVXIbebhxnb3y95l+mFhVKNaFG818vjEsLPBuikWB xBn9BNVMbyuM+pP1GHEKxu7jR3b6QJjKpfoTQfd6ixYBnNv+DeTkH8p6+IACSJfhrUpZ LNaKoF5AehFyS0hgKVFcV+zKbaCYd7NQuDN6EZImk0ICvrWOhKoAMXWusMNTznm0+GJR Ev9y/novcH4U1rQtZ0+DAhhO+Gu74sMq0zlQkoBtPCLQZ3vU23XY36aq3Vy4kefG/b1U ISBw== X-Gm-Message-State: AOAM531n2c2Q2w9WblEHQiP0wzD8aW8brDdBbi2oFZNMSwpx5ZwkSh8U QhsaELtF6bEuEcvq+gl/yvyiFhBNhXU= X-Google-Smtp-Source: ABdhPJxx8SkwYvYT9fuqd8J8/D25/GRV4ipTe+x7gxZbCgpsQNDucApI5+ArqZrudVFBp8cYqIvrEUF3+SY= X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:90:200:4c72:89be:dba3:2bcb]) (user=seanjc job=sendgmr) by 2002:a05:6214:4c9:: with SMTP id ck9mr13433509qvb.52.1632531359011; Fri, 24 Sep 2021 17:55:59 -0700 (PDT) Date: Fri, 24 Sep 2021 17:55:27 -0700 In-Reply-To: <20210925005528.1145584-1-seanjc@google.com> Message-Id: <20210925005528.1145584-14-seanjc@google.com> Mime-Version: 1.0 References: <20210925005528.1145584-1-seanjc@google.com> X-Mailer: git-send-email 2.33.0.685.g46640cef36-goog Subject: [PATCH 13/14] KVM: x86: Directly block (instead of "halting") UNINITIALIZED vCPUs From: Sean Christopherson To: Marc Zyngier , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Christian Borntraeger , Janosch Frank , Paolo Bonzini Cc: Wanpeng Li , kvm@vger.kernel.org, David Hildenbrand , Joerg Roedel , Cornelia Huck , linux-mips@vger.kernel.org, kvm-ppc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, David Matlack , Vitaly Kuznetsov , Claudio Imbrenda , kvmarm@lists.cs.columbia.edu, Jim Mattson X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Sean Christopherson List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu Go directly to kvm_vcpu_block() when handling the case where userspace attempts to run an UNINITIALIZED vCPU. The vCPU isn't halted and its time spent in limbo arguably should not be factored into halt-polling as the behavior of the VM at this point is not at all indicative of the behavior of the VM once it is up and running, i.e. executing HLT in idle tasks. Note, because this case is encountered only on the first run of an AP vCPU, vcpu->halt_poll_ns is guaranteed to be '0', and so KVM will not attempt halt-polling, i.e. this really only affects the post-block bookkeeping. Signed-off-by: Sean Christopherson --- arch/x86/kvm/x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 0d71c73a61bb..b444f9315766 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -10127,7 +10127,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) r = -EINTR; goto out; } - kvm_vcpu_halt(vcpu); + kvm_vcpu_block(vcpu); if (kvm_apic_accept_events(vcpu) < 0) { r = 0; goto out; -- 2.33.0.685.g46640cef36-goog _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6123C433F5 for ; Sat, 25 Sep 2021 00:57:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D010C61251 for ; Sat, 25 Sep 2021 00:57:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347836AbhIYA7E (ORCPT ); Fri, 24 Sep 2021 20:59:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346958AbhIYA6V (ORCPT ); Fri, 24 Sep 2021 20:58:21 -0400 Received: from mail-qv1-xf4a.google.com (mail-qv1-xf4a.google.com [IPv6:2607:f8b0:4864:20::f4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C49B5C0617BF for ; Fri, 24 Sep 2021 17:55:59 -0700 (PDT) Received: by mail-qv1-xf4a.google.com with SMTP id z8-20020a056214040800b00380dea65c01so43938400qvx.4 for ; Fri, 24 Sep 2021 17:55:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=AVRxITHRgpiea0PQRu71hObIdpCCXd1tddFTuoKEd5M=; b=AmZZR6+/WobaV3d/KTMW3XEm+/mJU1HTP/alrco2LxeX8sPbzL7l8R5VIEq9wXYyp7 P31gfDlcRexYcYK12mPrGpQSHiwq1+7jjMKOfcgumO3thuYh7379U579a8VXzaHynz/c Q3KQVXVmXyM9LNzIQGRL46YsUVsNUTTA436JsJh3i+G14dKyyalUZ6UHTH5GdEZXjP9r IiNGv+ok9CwUCbLkrQ6KhkOVblpqSFVi+lqel510DljUqO6ykZ33BWRlVYKAV98E9Pb3 w2kY0mdXtU63LGRjV1zY+2LpQRo0iJs3knGrr124qdmj7QQ2lJ+zuHgXzPFrmiw1XkSd zSxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=AVRxITHRgpiea0PQRu71hObIdpCCXd1tddFTuoKEd5M=; b=xIBwxgvnW4LUyj2CaQPI5GZROGRKL2/2ahRiEwLhWKc0hKJi98JIUuFbdOLpd9UK8c BLnCZbTdd2g3oxpIi8IxzhUhBSjCBuU1+FtSLqw7A5eAuFjTChKl+Od/DtWC3h8onskN n61miPtdI1pwmhUMKJvCik8gmHETx3fWpLj8i3TxjcNJwKl3aKn5kf4AcjjrwYJHRs/6 ZBI1OsJaVilBABycqyv5eRYIQ6lY8QOYBz/FYDnNWVD5o7Ev6bOr5v+3ngqjrZFbgJw9 iWwONKoIl+vyLPia9/Og2mRSoUsGFcbOMtoKjOi5LuX4Kg9kXXawT6jx74SvUmJ0bj5h ytUg== X-Gm-Message-State: AOAM533pbfZ5AzWUc/30yFygq5tHbLGNx8AuyB1qUJft6lTZfRV+2dUB nwHJObhQu8gQwThk+gVXMGHj/lfa15o= X-Google-Smtp-Source: ABdhPJxx8SkwYvYT9fuqd8J8/D25/GRV4ipTe+x7gxZbCgpsQNDucApI5+ArqZrudVFBp8cYqIvrEUF3+SY= X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:90:200:4c72:89be:dba3:2bcb]) (user=seanjc job=sendgmr) by 2002:a05:6214:4c9:: with SMTP id ck9mr13433509qvb.52.1632531359011; Fri, 24 Sep 2021 17:55:59 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 24 Sep 2021 17:55:27 -0700 In-Reply-To: <20210925005528.1145584-1-seanjc@google.com> Message-Id: <20210925005528.1145584-14-seanjc@google.com> Mime-Version: 1.0 References: <20210925005528.1145584-1-seanjc@google.com> X-Mailer: git-send-email 2.33.0.685.g46640cef36-goog Subject: [PATCH 13/14] KVM: x86: Directly block (instead of "halting") UNINITIALIZED vCPUs From: Sean Christopherson To: Marc Zyngier , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Christian Borntraeger , Janosch Frank , Paolo Bonzini Cc: James Morse , Alexandru Elisei , Suzuki K Poulose , David Hildenbrand , Cornelia Huck , Claudio Imbrenda , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, linux-kernel@vger.kernel.org, David Matlack , Jing Zhang Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Go directly to kvm_vcpu_block() when handling the case where userspace attempts to run an UNINITIALIZED vCPU. The vCPU isn't halted and its time spent in limbo arguably should not be factored into halt-polling as the behavior of the VM at this point is not at all indicative of the behavior of the VM once it is up and running, i.e. executing HLT in idle tasks. Note, because this case is encountered only on the first run of an AP vCPU, vcpu->halt_poll_ns is guaranteed to be '0', and so KVM will not attempt halt-polling, i.e. this really only affects the post-block bookkeeping. Signed-off-by: Sean Christopherson --- arch/x86/kvm/x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 0d71c73a61bb..b444f9315766 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -10127,7 +10127,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) r = -EINTR; goto out; } - kvm_vcpu_halt(vcpu); + kvm_vcpu_block(vcpu); if (kvm_apic_accept_events(vcpu) < 0) { r = 0; goto out; -- 2.33.0.685.g46640cef36-goog From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEA7CC433EF for ; Sat, 25 Sep 2021 01:04:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 727356105A for ; Sat, 25 Sep 2021 01:04:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 727356105A Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Reply-To:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:References :Mime-Version:Message-Id:In-Reply-To:Date:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rTpDbY2dzFSkL57TmgoFxDOrWMjwTiQ3nky/4vZud+E=; b=ovVWi24qW8prh/ 6k/u0ZI2//joPql4acBEdT8GY4Vu9w9vt7LRIBAscGzDwH8mlCerOZKcP33ohywpxz9qRRt3WerAB HIDkLPTOXMEBaeyMRhs1DaL/mBfxyBj7QJWStYbfcHdyv6R22P4qNlQGcNjBqCq6CAsSAiqRowDYX ArkCpwm3tm6y1chpaPxLmDi/i/5B8bzHLP8rbjyIxGjtqOoDOH+UMSXXQaF/MBuUrTViPCjriQFV3 NZJ9ek3ivLwAP3u7G6rHfxdwKWC65bCgJRxPPz5me8vhPx+8GUZ7UYV/kT5DzFapDhU6VUmt6V+Oz GpGSybPAcL33qGODKBZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mTw4i-00FsVJ-3e; Sat, 25 Sep 2021 01:01:56 +0000 Received: from mail-qv1-xf49.google.com ([2607:f8b0:4864:20::f49]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mTvyy-00Fq2K-Im for linux-arm-kernel@lists.infradead.org; Sat, 25 Sep 2021 00:56:01 +0000 Received: by mail-qv1-xf49.google.com with SMTP id l18-20020a056214039200b0037e4da8b408so43620988qvy.6 for ; Fri, 24 Sep 2021 17:55:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=AVRxITHRgpiea0PQRu71hObIdpCCXd1tddFTuoKEd5M=; b=AmZZR6+/WobaV3d/KTMW3XEm+/mJU1HTP/alrco2LxeX8sPbzL7l8R5VIEq9wXYyp7 P31gfDlcRexYcYK12mPrGpQSHiwq1+7jjMKOfcgumO3thuYh7379U579a8VXzaHynz/c Q3KQVXVmXyM9LNzIQGRL46YsUVsNUTTA436JsJh3i+G14dKyyalUZ6UHTH5GdEZXjP9r IiNGv+ok9CwUCbLkrQ6KhkOVblpqSFVi+lqel510DljUqO6ykZ33BWRlVYKAV98E9Pb3 w2kY0mdXtU63LGRjV1zY+2LpQRo0iJs3knGrr124qdmj7QQ2lJ+zuHgXzPFrmiw1XkSd zSxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=AVRxITHRgpiea0PQRu71hObIdpCCXd1tddFTuoKEd5M=; b=Dx0HbI4s/7LNslVaWHJjdvBPHr2xYCwnlJZdBpTWyW0yNDfTQYkTIceSxwaaInyGb5 yqZTuj3GRbPXWNLoydTodoug0Vv06qW4FJfWWl4zxEDHqZNdd3FRKLzJbo/Id2pKXcel dGv/0Zhlyr0TO1ygzZxdWMgC49kNcpUOB4cgRSYyrQP5xO25Q43kUX7d8zaJYCZCjHmG l/KS2xIPUpbHcCT2e5sUdfsADHdKJ49shsiv9lQ6X589NpEbCpmi1znbc+JF8k21NJo0 AHt+mgq+5rl+dhD0Td1XvIPCNH2Dfu4MmmHE9w2xWoduwAhcD1LbErIV1NfkVJRuI37S H85A== X-Gm-Message-State: AOAM5315RIpHNmQtVWdpkH5CwQrxG0b0QJM4SPdJy9cdr1tBakVcTAZd 02okTM/88Tziz85v8RjoYReAlJoeRQg= X-Google-Smtp-Source: ABdhPJxx8SkwYvYT9fuqd8J8/D25/GRV4ipTe+x7gxZbCgpsQNDucApI5+ArqZrudVFBp8cYqIvrEUF3+SY= X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:90:200:4c72:89be:dba3:2bcb]) (user=seanjc job=sendgmr) by 2002:a05:6214:4c9:: with SMTP id ck9mr13433509qvb.52.1632531359011; Fri, 24 Sep 2021 17:55:59 -0700 (PDT) Date: Fri, 24 Sep 2021 17:55:27 -0700 In-Reply-To: <20210925005528.1145584-1-seanjc@google.com> Message-Id: <20210925005528.1145584-14-seanjc@google.com> Mime-Version: 1.0 References: <20210925005528.1145584-1-seanjc@google.com> X-Mailer: git-send-email 2.33.0.685.g46640cef36-goog Subject: [PATCH 13/14] KVM: x86: Directly block (instead of "halting") UNINITIALIZED vCPUs From: Sean Christopherson To: Marc Zyngier , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Christian Borntraeger , Janosch Frank , Paolo Bonzini Cc: James Morse , Alexandru Elisei , Suzuki K Poulose , David Hildenbrand , Cornelia Huck , Claudio Imbrenda , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, linux-kernel@vger.kernel.org, David Matlack , Jing Zhang X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210924_175600_658476_9D3DCF81 X-CRM114-Status: GOOD ( 13.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Sean Christopherson Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Go directly to kvm_vcpu_block() when handling the case where userspace attempts to run an UNINITIALIZED vCPU. The vCPU isn't halted and its time spent in limbo arguably should not be factored into halt-polling as the behavior of the VM at this point is not at all indicative of the behavior of the VM once it is up and running, i.e. executing HLT in idle tasks. Note, because this case is encountered only on the first run of an AP vCPU, vcpu->halt_poll_ns is guaranteed to be '0', and so KVM will not attempt halt-polling, i.e. this really only affects the post-block bookkeeping. Signed-off-by: Sean Christopherson --- arch/x86/kvm/x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 0d71c73a61bb..b444f9315766 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -10127,7 +10127,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) r = -EINTR; goto out; } - kvm_vcpu_halt(vcpu); + kvm_vcpu_block(vcpu); if (kvm_apic_accept_events(vcpu) < 0) { r = 0; goto out; -- 2.33.0.685.g46640cef36-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sean Christopherson Date: Sat, 25 Sep 2021 00:55:27 +0000 Subject: [PATCH 13/14] KVM: x86: Directly block (instead of "halting") UNINITIALIZED vCPUs Message-Id: <20210925005528.1145584-14-seanjc@google.com> List-Id: References: <20210925005528.1145584-1-seanjc@google.com> In-Reply-To: <20210925005528.1145584-1-seanjc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Marc Zyngier , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Christian Borntraeger , Janosch Frank , Paolo Bonzini Cc: Wanpeng Li , kvm@vger.kernel.org, David Hildenbrand , Joerg Roedel , Cornelia Huck , linux-mips@vger.kernel.org, kvm-ppc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, David Matlack , Vitaly Kuznetsov , Claudio Imbrenda , kvmarm@lists.cs.columbia.edu, Jim Mattson Go directly to kvm_vcpu_block() when handling the case where userspace attempts to run an UNINITIALIZED vCPU. The vCPU isn't halted and its time spent in limbo arguably should not be factored into halt-polling as the behavior of the VM at this point is not at all indicative of the behavior of the VM once it is up and running, i.e. executing HLT in idle tasks. Note, because this case is encountered only on the first run of an AP vCPU, vcpu->halt_poll_ns is guaranteed to be '0', and so KVM will not attempt halt-polling, i.e. this really only affects the post-block bookkeeping. Signed-off-by: Sean Christopherson --- arch/x86/kvm/x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 0d71c73a61bb..b444f9315766 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -10127,7 +10127,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) r = -EINTR; goto out; } - kvm_vcpu_halt(vcpu); + kvm_vcpu_block(vcpu); if (kvm_apic_accept_events(vcpu) < 0) { r = 0; goto out; -- 2.33.0.685.g46640cef36-goog