From patchwork Wed Jul 31 11:27:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Wanpeng Li X-Patchwork-Id: 11067527 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F174A13A0 for ; Wed, 31 Jul 2019 11:27:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFA2A205FC for ; Wed, 31 Jul 2019 11:27:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D309128908; Wed, 31 Jul 2019 11:27:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F9B1205FC for ; Wed, 31 Jul 2019 11:27:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727848AbfGaL1Y (ORCPT ); Wed, 31 Jul 2019 07:27:24 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:42696 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725793AbfGaL1X (ORCPT ); Wed, 31 Jul 2019 07:27:23 -0400 Received: by mail-pl1-f193.google.com with SMTP id ay6so30399978plb.9; Wed, 31 Jul 2019 04:27:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Jyl7Q+fNfa4JowIqcItEgbQqxdMDKkuTAtedoCYt2UY=; b=rR8nivXt3VGb0fDD2orZENlGfFMWpJdAptZe46xvNyKt1xFErw1szWcxJ5+3aqK4e0 FbinTes/wrEWvPX+g8ruWPjaFdy7hJVis8gDjaktFCvKPS+cnLdyUjBKWhBgf6TWv5yb fYprXUDjTROH2nXfaPvqXGX3y1nSZj3EP9U7LxQLsKcAs6/XnSJh1n1qxlBr4H/ag72f wmMG/bxWT5qb1P2gpjJFqxojI7LjW1GVjrfx+q/lz1CA9JWwLZySeCmEb5NDuKZ5xdL+ oEE+KhfmBHswKTfz3M6PmnBaj8ZJ/2KOmDwpgjTY+olfhFVXSOleIa998TGVl2FZkdwG Xr+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Jyl7Q+fNfa4JowIqcItEgbQqxdMDKkuTAtedoCYt2UY=; b=Y2kO5SA1lP7LcKoCvwLHC6q3Glo9+6xe09mGPebq9cguoVVFujB+8bmQMU8+oHRrpR xqPapRGxbW0iCexdR8Efj5kvJQd7H9fZAPBoaseD1Vwp5X/9KY9bS8E80hxC270gnQJP eKLP6exJpzrw2rXGkYQljhY7/mJToZTbyibhITviFhN4LoGk9J1AB58cQ6KUckxJX6r3 U7SdhycvjNeCxDP8BSsnfc7VkM3ccRD2hpPjMo9Y80dU51/E2XUYQRq68RoOYw5Gjkdt S8Vm5Fhod3C8yR51AHIGP37LZ1bapQ6VytwvLCcwynKA7ACVaLmtXVKOLTfnMEFXm3Ak Pmyg== X-Gm-Message-State: APjAAAUoYKqdkNCv1n3yVndtz4fckvEOx4qFyM0isWtlWBn/5ThtNo0B AzRgCEDpM+7x+LeIBbGOwbfFJV22AVU= X-Google-Smtp-Source: APXvYqwYkfllzMYOfWgLQxB4pcShgB0fDQyELULrcRsAQRTCKlJ0kbPsYGxBPYDbNJ5BjxSACyTiwA== X-Received: by 2002:a17:902:f216:: with SMTP id gn22mr117209690plb.118.1564572442981; Wed, 31 Jul 2019 04:27:22 -0700 (PDT) Received: from localhost.localdomain ([203.205.141.123]) by smtp.googlemail.com with ESMTPSA id e3sm1211441pgm.64.2019.07.31.04.27.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 31 Jul 2019 04:27:22 -0700 (PDT) From: Wanpeng Li X-Google-Original-From: Wanpeng Li To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Paolo Bonzini , =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= Subject: [PATCH 1/3] KVM: Don't need to wakeup vCPU twice afer timer fire Date: Wed, 31 Jul 2019 19:27:16 +0800 Message-Id: <1564572438-15518-1-git-send-email-wanpengli@tencent.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wanpeng Li kvm_set_pending_timer() will take care to wake up the sleeping vCPU which has pending timer, don't need to check this in apic_timer_expired() again. Cc: Paolo Bonzini Cc: Radim Krčmář Signed-off-by: Wanpeng Li --- arch/x86/kvm/lapic.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 0aa1586..685d17c 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -1548,7 +1548,6 @@ static void kvm_apic_inject_pending_timer_irqs(struct kvm_lapic *apic) static void apic_timer_expired(struct kvm_lapic *apic) { struct kvm_vcpu *vcpu = apic->vcpu; - struct swait_queue_head *q = &vcpu->wq; struct kvm_timer *ktimer = &apic->lapic_timer; if (atomic_read(&apic->lapic_timer.pending)) @@ -1566,13 +1565,6 @@ static void apic_timer_expired(struct kvm_lapic *apic) atomic_inc(&apic->lapic_timer.pending); kvm_set_pending_timer(vcpu); - - /* - * For x86, the atomic_inc() is serialized, thus - * using swait_active() is safe. - */ - if (swait_active(q)) - swake_up_one(q); } static void start_sw_tscdeadline(struct kvm_lapic *apic) From patchwork Wed Jul 31 11:27:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Wanpeng Li X-Patchwork-Id: 11067529 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5278F13AC for ; Wed, 31 Jul 2019 11:27:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F40D205FC for ; Wed, 31 Jul 2019 11:27:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33761288F4; Wed, 31 Jul 2019 11:27:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73C83288EF for ; Wed, 31 Jul 2019 11:27:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387393AbfGaL12 (ORCPT ); Wed, 31 Jul 2019 07:27:28 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:36688 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725793AbfGaL1Z (ORCPT ); Wed, 31 Jul 2019 07:27:25 -0400 Received: by mail-pl1-f196.google.com with SMTP id k8so30376917plt.3; Wed, 31 Jul 2019 04:27:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VHS57PmtuwPLtfBLBbltEv6DFT+0iXK6WiNzQSWrzrE=; b=dSzE4VGKLVc5cptEp5NMZBvonc0E/Mbzeb3v3kZ2sxvS3MocB+Ey4AdqyrtDCd6y9v DCf8ngnHUtuo4l20ghiUhdYu6+Q/lyQ8YQWECVv7FndGXX5UKvoZVCitKN+DrOyJQWm7 hgoAjRHZSDUtBTLnwIHv1IYkMXQylL7hCoaD0lRfZK7+eMPyoHp8kmoPJqKu0aVLbkCs /NrFg0TZLA5QR8NH12QCUVHuPdD+N3VDuDmGkAuwmA1WXBFBY/tacPzvhs0eoT2+l4I8 1YsCb9omqhQgf5Hp95OJNL2jHAtRHp6lVTj/EndYIFZ8Fle7RoKtMaVvt1Ky2kxVKzAS +eug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VHS57PmtuwPLtfBLBbltEv6DFT+0iXK6WiNzQSWrzrE=; b=iEWWK25ljgyrrUkgef5PlzvgB8xX+Mur5wrq0dpoHxWY9Xtd0n0ZqqnAFzPvWVES71 ByYxRhfRftT0ZjM76RSneEfPVGPk3rMczt2cABuB6lYYO/EgsFhjK0viv1scMmmRdnBX Nb1BDZ1KiNuzTvu3F1+dQOp6BcoTW7W7r5lFfQS0D2bOdR+vvYnXHfs9/H8LGwb86x6/ DUT+zHU5dthM2nGCdXaoRi343MRywIIhD/nMBq1y2ZQ9aBZGY8egv2EqpHtvx8XAoFnZ fzKZVlokyGP5p0pjBN8F6QGnUc7ribH/2JaYCgTzXHBRgcRCCOVFkWVD/KKwFHNbOACM r3vw== X-Gm-Message-State: APjAAAVp6rN/3ATY58vUtSMnQww+pBNVqXhbNU9iaV6P4N/WbUly5rtQ dZI5VTkisq+du019wif7fFgBhMj2Y8Y= X-Google-Smtp-Source: APXvYqy2Umcofp2a7ba/gLc41pb58cmWuK120xoCrZgYeHsxJpEp44GERukISjQ4a835VZZtogc5YQ== X-Received: by 2002:a17:902:ba8b:: with SMTP id k11mr119794439pls.107.1564572444762; Wed, 31 Jul 2019 04:27:24 -0700 (PDT) Received: from localhost.localdomain ([203.205.141.123]) by smtp.googlemail.com with ESMTPSA id e3sm1211441pgm.64.2019.07.31.04.27.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 31 Jul 2019 04:27:24 -0700 (PDT) From: Wanpeng Li X-Google-Original-From: Wanpeng Li To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Paolo Bonzini , =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= Subject: [PATCH 2/3] KVM: Check preempted_in_kernel for involuntary preemption Date: Wed, 31 Jul 2019 19:27:17 +0800 Message-Id: <1564572438-15518-2-git-send-email-wanpengli@tencent.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1564572438-15518-1-git-send-email-wanpengli@tencent.com> References: <1564572438-15518-1-git-send-email-wanpengli@tencent.com> MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wanpeng Li preempted_in_kernel is updated in preempt_notifier when involuntary preemption ocurrs, it can be stale when the voluntarily preempted vCPUs are taken into account by kvm_vcpu_on_spin() loop. This patch lets it just check preempted_in_kernel for involuntary preemption. Cc: Paolo Bonzini Cc: Radim Krčmář Signed-off-by: Wanpeng Li --- virt/kvm/kvm_main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 887f3b0..ed061d8 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -2508,7 +2508,8 @@ void kvm_vcpu_on_spin(struct kvm_vcpu *me, bool yield_to_kernel_mode) continue; if (swait_active(&vcpu->wq) && !kvm_arch_vcpu_runnable(vcpu)) continue; - if (yield_to_kernel_mode && !kvm_arch_vcpu_in_kernel(vcpu)) + if (READ_ONCE(vcpu->preempted) && yield_to_kernel_mode && + !kvm_arch_vcpu_in_kernel(vcpu)) continue; if (!kvm_vcpu_eligible_for_directed_yield(vcpu)) continue; @@ -4205,7 +4206,7 @@ static void kvm_sched_in(struct preempt_notifier *pn, int cpu) { struct kvm_vcpu *vcpu = preempt_notifier_to_vcpu(pn); - vcpu->preempted = false; + WRITE_ONCE(vcpu->preempted, false); WRITE_ONCE(vcpu->ready, false); kvm_arch_sched_in(vcpu, cpu); @@ -4219,7 +4220,7 @@ static void kvm_sched_out(struct preempt_notifier *pn, struct kvm_vcpu *vcpu = preempt_notifier_to_vcpu(pn); if (current->state == TASK_RUNNING) { - vcpu->preempted = true; + WRITE_ONCE(vcpu->preempted, true); WRITE_ONCE(vcpu->ready, true); } kvm_arch_vcpu_put(vcpu); From patchwork Wed Jul 31 11:27:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Wanpeng Li X-Patchwork-Id: 11067531 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 468CB13AC for ; Wed, 31 Jul 2019 11:27:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 375DB288A0 for ; Wed, 31 Jul 2019 11:27:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C31B288F4; Wed, 31 Jul 2019 11:27:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5317F288A0 for ; Wed, 31 Jul 2019 11:27:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728189AbfGaL12 (ORCPT ); Wed, 31 Jul 2019 07:27:28 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:45725 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728123AbfGaL11 (ORCPT ); Wed, 31 Jul 2019 07:27:27 -0400 Received: by mail-pg1-f195.google.com with SMTP id o13so31819936pgp.12; Wed, 31 Jul 2019 04:27:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vQV5WkYi1RCaWV1rfzrmNeSid8EG2ORcB51l+rIc8nE=; b=YAQafS7T3YJom2VXMOvDWitBFs54x+WqCi/+XukFa7EOfEC/iuP5xGekW2D1YbYRc1 1NcoIrd3zS4DPSHoYMzURGkQRdc6/i2zS3DuskzXg0alJOBimbt8/nVs4IAm3TqXAnmO 1kfGJ+wCyQPXeA+X8F9qq8Nsc0+lSkuVlBU/ME5xGKRHTXRNlDkrVstOPBo/psYk3POi clKIoAWQFRqABDp7axVMg2G25NZS7YXBMVMJF5yXPyyql2L1Cj5vkBHPq+krSvznMVuA rojQ7PaezEKTurEfI7x2ItVHYTCAtDrgi49rbwEuTSKOay6K6lKkJUgRHAjQvDHOIFi3 bhdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vQV5WkYi1RCaWV1rfzrmNeSid8EG2ORcB51l+rIc8nE=; b=C8ptdu2BRhlVPxqL7VecpzNjWx7SVc+2oyDURrLX5Kv9iNYi47M67Goug9z9e2WNFk M5FmzuBt1txxNkcNKFDMsePTgt2lmuC6kve5j4Hvl6HaF9b3z2IeZlTIKKNo6p1IpH/h poBmR9ReSuLybsY0Vked3mgwvPUU6tlKk8h/WITdUpc+xbndVePdmJdLbPJOXmqjJlE9 55aPJREMu9Z2DSnBPWQofJwqvDKfgtvWvlNxW2Jqa5OJ92JgrUgQxNcc+1Ckyj3DFQSt 1qe+5Ly6hSjQHiGOhCOenF1SsEW7CE20gST4F62tnwSgE6jbOFsD3elTAfCt4xcea8eU 9Geg== X-Gm-Message-State: APjAAAUAPI7OOf9Ad06MMTfq+RXLPxes8+3P5OPmpLAYKAVJ1WUPlIda HDqeVVcl1476o8T7AHIw+DRPboIvZmU= X-Google-Smtp-Source: APXvYqyZyRrubMwWdKsJ5FhRtpzBvWs+SH6iatiD5Xa+UFGCV6WUXQmwGPq/GZVrzH6Cd6jqgVNNXQ== X-Received: by 2002:a63:f750:: with SMTP id f16mr84157002pgk.317.1564572446710; Wed, 31 Jul 2019 04:27:26 -0700 (PDT) Received: from localhost.localdomain ([203.205.141.123]) by smtp.googlemail.com with ESMTPSA id e3sm1211441pgm.64.2019.07.31.04.27.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 31 Jul 2019 04:27:26 -0700 (PDT) From: Wanpeng Li X-Google-Original-From: Wanpeng Li To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Paolo Bonzini , =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= , stable@vger.kernel.org Subject: [PATCH 3/3] KVM: Fix leak vCPU's VMCS value into other pCPU Date: Wed, 31 Jul 2019 19:27:18 +0800 Message-Id: <1564572438-15518-3-git-send-email-wanpengli@tencent.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1564572438-15518-1-git-send-email-wanpengli@tencent.com> References: <1564572438-15518-1-git-send-email-wanpengli@tencent.com> MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wanpeng Li After commit d73eb57b80b (KVM: Boost vCPUs that are delivering interrupts), a five years ago bug is exposed. Running ebizzy benchmark in three 80 vCPUs VMs on one 80 pCPUs Skylake server, a lot of rcu_sched stall warning splatting in the VMs after stress testing: INFO: rcu_sched detected stalls on CPUs/tasks: { 4 41 57 62 77} (detected by 15, t=60004 jiffies, g=899, c=898, q=15073) Call Trace: flush_tlb_mm_range+0x68/0x140 tlb_flush_mmu.part.75+0x37/0xe0 tlb_finish_mmu+0x55/0x60 zap_page_range+0x142/0x190 SyS_madvise+0x3cd/0x9c0 system_call_fastpath+0x1c/0x21 swait_active() sustains to be true before finish_swait() is called in kvm_vcpu_block(), voluntarily preempted vCPUs are taken into account by kvm_vcpu_on_spin() loop greatly increases the probability condition kvm_arch_vcpu_runnable(vcpu) is checked and can be true, when APICv is enabled the yield-candidate vCPU's VMCS RVI field leaks(by vmx_sync_pir_to_irr()) into spinning-on-a-taken-lock vCPU's current VMCS. This patch fixes it by reverting the kvm_arch_vcpu_runnable() condition in kvm_vcpu_on_spin() loop. Cc: Paolo Bonzini Cc: Radim Krčmář Fixes: 98f4a1467 (KVM: add kvm_arch_vcpu_runnable() test to kvm_vcpu_on_spin() loop) Cc: stable@vger.kernel.org Signed-off-by: Wanpeng Li --- virt/kvm/kvm_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index ed061d8..12f2c91 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -2506,7 +2506,7 @@ void kvm_vcpu_on_spin(struct kvm_vcpu *me, bool yield_to_kernel_mode) continue; if (vcpu == me) continue; - if (swait_active(&vcpu->wq) && !kvm_arch_vcpu_runnable(vcpu)) + if (swait_active(&vcpu->wq)) continue; if (READ_ONCE(vcpu->preempted) && yield_to_kernel_mode && !kvm_arch_vcpu_in_kernel(vcpu))