Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3940842pxv; Tue, 13 Jul 2021 07:22:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNJqnOCOvvjKqjVywSU0KDxOX3A4FvrHtvjHi8oj1fksdI7SaRCBZrEAIdNO3dmwgXs/QX X-Received: by 2002:a92:d302:: with SMTP id x2mr3088200ila.161.1626186121825; Tue, 13 Jul 2021 07:22:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626186121; cv=none; d=google.com; s=arc-20160816; b=Yu9Dgo6lxt6T97ZUZ/GUwkQDIChytWqM2OEI1PBIveLME1i1pGX7QR6iZtJGMqQgbL T34j4I5jOrELL0MjeIr3zvRZYaIjMWjNFY3ZaGS2w/2dEoNuUAG+lMGjHTF6bUX1RFy7 cf4O0kZV7kjnkWnQ+62c6hQljGYBTcJGUqMrCQorsxmTaM4zwMIsn0zVU+2KdBn9sDIW MMSKY7UDS+8cg3Mld4pUp0hoACRjOEzCmnlX90Z5rrYfOOkJllCf/4mXZDawkhTeYB4H fkO5uSS3TYMSn2ZgdxhlPgBntiRJ8x9susosoFWguGoUQZAcgU8dmSDUQqR/iW5Wf7W1 zMsw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ODCACKiN6QCkZhzWLLA0L2Mc6+FY+1Xm7YVdgewvnSs=; b=zuxICYnkaoaY9L4HuThxCFl7b6wVXNcDTgQSMRXa3UYsYuLBJF58nsVKChIRHXfFeK fYXmbWwW9K/LYmCi4KgfHJK7S+5/ulhbUvp1cqp86DFUee7nV93DgVl9miErjLhoGlPL 5cyN6o2PnIp0M/wywTrMYRbvhPIOZdFweAUc/OWmMOfqBHRswtraEFd86I46FGxe/OXU HhhuX3HC4XSGPQKJEVIfEPvqYKkvtiZ4h00ywk2yM9h8j3QXrkFUdyxat9qYTQHRRhGM o7koa/Go9le+bWHO4AF6ln6J+kkLUDn1hEZ+ORRnE6T7HZrYg+Z6/DCgUKLvyGgDscxU 30Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XAYwbcEM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a16si14130573ilb.149.2021.07.13.07.21.49; Tue, 13 Jul 2021 07:22:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XAYwbcEM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236886AbhGMOXl (ORCPT + 99 others); Tue, 13 Jul 2021 10:23:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:36754 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236883AbhGMOXl (ORCPT ); Tue, 13 Jul 2021 10:23:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626186051; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ODCACKiN6QCkZhzWLLA0L2Mc6+FY+1Xm7YVdgewvnSs=; b=XAYwbcEMEhWXXpoir+Dekj5UQgZXD16otORF5r0tmuRWRTnjo0EAbsa2Z9fYorlRaP4jDu J+EARY/hwBqPD9CN9GZNr4g80DTiE0boLrqksTfxK6W1lzLTAbKKRybFNCCfMuOtyU2oMb m0lqmep4u/HT9PE30RgBMS/J1ahqsTg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-196-JoIXVxNxP9G4MJgSDMC9aw-1; Tue, 13 Jul 2021 10:20:50 -0400 X-MC-Unique: JoIXVxNxP9G4MJgSDMC9aw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 87D93100CA88; Tue, 13 Jul 2021 14:20:48 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.192.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B30D5D6AB; Tue, 13 Jul 2021 14:20:44 +0000 (UTC) From: Maxim Levitsky To: kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org (open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)), Jim Mattson , Joerg Roedel , Borislav Petkov , Vitaly Kuznetsov , Wanpeng Li , Paolo Bonzini , Thomas Gleixner , "H. Peter Anvin" , Ingo Molnar , x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)), Sean Christopherson , Maxim Levitsky Subject: [PATCH v2 4/8] KVM: x86: APICv: drop immediate APICv disablement on current vCPU Date: Tue, 13 Jul 2021 17:20:19 +0300 Message-Id: <20210713142023.106183-5-mlevitsk@redhat.com> In-Reply-To: <20210713142023.106183-1-mlevitsk@redhat.com> References: <20210713142023.106183-1-mlevitsk@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Special case of disabling the APICv on the current vCPU right away in kvm_request_apicv_update doesn't bring much benefit vs raising KVM_REQ_APICV_UPDATE on it instead, since this request will be processed on the next entry to the guest. (the comment about having another #VMEXIT is wrong). It also hides various assumptions that APIVc enable state matches the APICv inhibit state, as this special case only makes those states match on the current vCPU. Previous patches fixed few such assumptions so now it should be safe to drop this special case. Signed-off-by: Maxim Levitsky --- arch/x86/kvm/x86.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 76dae88cf524..29b92f6cbad4 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -9204,7 +9204,6 @@ EXPORT_SYMBOL_GPL(kvm_vcpu_update_apicv); */ void kvm_request_apicv_update(struct kvm *kvm, bool activate, ulong bit) { - struct kvm_vcpu *except; unsigned long old, new, expected; if (!kvm_x86_ops.check_apicv_inhibit_reasons || @@ -9230,16 +9229,7 @@ void kvm_request_apicv_update(struct kvm *kvm, bool activate, ulong bit) if (kvm_x86_ops.pre_update_apicv_exec_ctrl) static_call(kvm_x86_pre_update_apicv_exec_ctrl)(kvm, activate); - /* - * Sending request to update APICV for all other vcpus, - * while update the calling vcpu immediately instead of - * waiting for another #VMEXIT to handle the request. - */ - except = kvm_get_running_vcpu(); - kvm_make_all_cpus_request_except(kvm, KVM_REQ_APICV_UPDATE, - except); - if (except) - kvm_vcpu_update_apicv(except); + kvm_make_all_cpus_request(kvm, KVM_REQ_APICV_UPDATE); } EXPORT_SYMBOL_GPL(kvm_request_apicv_update); -- 2.26.3