From patchwork Tue Feb 25 02:21:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 11402407 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 70CDB14E3 for ; Tue, 25 Feb 2020 02:20:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5931B21927 for ; Tue, 25 Feb 2020 02:20:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728754AbgBYCT6 (ORCPT ); Mon, 24 Feb 2020 21:19:58 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:44134 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726962AbgBYCT6 (ORCPT ); Mon, 24 Feb 2020 21:19:58 -0500 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id BAF3F1A1BAE69E311B6B; Tue, 25 Feb 2020 10:19:56 +0800 (CST) Received: from huawei.com (10.175.105.18) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.439.0; Tue, 25 Feb 2020 10:19:48 +0800 From: linmiaohe To: , , , , , , , , , , CC: , , , Subject: [PATCH] KVM: X86: avoid meaningless kvm_apicv_activated() check Date: Tue, 25 Feb 2020 10:21:19 +0800 Message-ID: <1582597279-32297-1-git-send-email-linmiaohe@huawei.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.175.105.18] X-CFilter-Loop: Reflected Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Miaohe Lin After test_and_set_bit() for kvm->arch.apicv_inhibit_reasons, we will always get false when calling kvm_apicv_activated() because it's sure apicv_inhibit_reasons do not equal to 0. Signed-off-by: Miaohe Lin --- arch/x86/kvm/x86.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index ddcc51b89e2c..fa62dcb0ed0c 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -8018,8 +8018,7 @@ void kvm_request_apicv_update(struct kvm *kvm, bool activate, ulong bit) !kvm_apicv_activated(kvm)) return; } else { - if (test_and_set_bit(bit, &kvm->arch.apicv_inhibit_reasons) || - kvm_apicv_activated(kvm)) + if (test_and_set_bit(bit, &kvm->arch.apicv_inhibit_reasons)) return; }