Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2719968iog; Mon, 20 Jun 2022 03:18:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uEhxx99FfjOC8XlYXdcOz8UWXrPYbdUWO3dgbPmfCP7Br/z1ZFq0GefWeAgm6osuKBLwlH X-Received: by 2002:a05:6402:e88:b0:434:d7de:8d0b with SMTP id h8-20020a0564020e8800b00434d7de8d0bmr28458444eda.149.1655720317629; Mon, 20 Jun 2022 03:18:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655720317; cv=none; d=google.com; s=arc-20160816; b=rGlet1EYj5uqLjQ9u9Sfe2RWC90uvTmr9iutVHsbn03cDFn1+SuCRu0DUYo56Ld2T+ iZmVnhzob4e/1q4pwOX8NE0WAVs7MIEWp5RC92UGhaES/JAXjHVDglRJ1hkkEPMCH+2i wrPbzqMnPerT5XqYRMahOiKDvl190vWZOrqccrlubhSgoUXUKk0rrmw5pZnLprX6LG6X qevAtQYkv/2p4HLBPkCgVsDoc+SHN+nZNj+rhMoJtgqT2sxJCXpqiLY+hVTcmMrOVubM NyqP24godVVp1jr+8S3sAF2VOLFul+VFOebUFvr3bDFvkv6nCw9ovz7QEuhawupSMAVt 4O6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=bukIkCz1BLVKZfua+9ATfKw2JsMlFEtEDfvvXjSwxLg=; b=NsM3q5rOVLJGB2TFxF0p7qOMkRZW86DaPOhSIG3iNJLsOi9klBsGnO5TqwOzK19hOM 1YfbXnKL9dQa8g8PEDHDELnOaYXySi79yUTfURCFg2XbJyx9U6h5jzszwDtqxAu6x+Xi u9RuG/LcNfbgX9gD2RE5t7WFw3HH7uPLerQakgGtP1LhmFqbHNUKDbEWSzlwK3UO5VrL kIuvhufp95dke0Ii9ROIIjq+zQfEVK41urIV3NyJA5Bciq1oks1ccXFJyJJNTpJK6Pr4 IHHk8WFe3HuyGYWF86E3t1ZL98zOjRoAs3rUKekfzdUVTMphy4h34P52lnV7Ekr3AG1j cHVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=uecC0bAK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp40-20020a1709073e2800b0071200c979b1si10476305ejc.644.2022.06.20.03.18.08; Mon, 20 Jun 2022 03:18:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=uecC0bAK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239740AbiFTKDd (ORCPT + 99 others); Mon, 20 Jun 2022 06:03:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240864AbiFTKCp (ORCPT ); Mon, 20 Jun 2022 06:02:45 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B237813F14 for ; Mon, 20 Jun 2022 03:02:42 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id k127so4566591pfd.10 for ; Mon, 20 Jun 2022 03:02:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:to:cc:references :from:in-reply-to:content-transfer-encoding; bh=bukIkCz1BLVKZfua+9ATfKw2JsMlFEtEDfvvXjSwxLg=; b=uecC0bAKuqHCbuB/PSdZ+I92Im8L03KxMgUeN7vuTNdV/cRAIs5OCSH1qrYF4nDtnS 1duhcw3G064kfxVLb0ZErph4kkFZjPBEyq53m+NI4eyuWjD2WyyffYdgmP9mQuDwAjdm JCge31UqzJILIaSyufD2e33+VYbOu43SeSAV22LMIV230OS2Cu9Gv+GA0NCa8nNQOAJH rhNpOiKFUaOdyRPKo7FDi9pRx9BHVhc20Bu2WAqWp/wmLUl2msEMOu3guEVnT4ENqUSh /LW0+ojrz+JIoEd/LDkjGkaGv9hECJOUoM++8Efk+AD9ztaZ5iqjX49OlMFziFVZWVuQ w7Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :to:cc:references:from:in-reply-to:content-transfer-encoding; bh=bukIkCz1BLVKZfua+9ATfKw2JsMlFEtEDfvvXjSwxLg=; b=gAjhbwX7y1Li0AXtFNpYbu9pqSw/mEsvi9/8h5Zl0twpyhEVPaplKB1lh6gBvs8Qtg fO6Ztryepqd20xaSp5Wx+NeJ/v9rQTX7YB4loC6XCPi8Z6JBxSU1l/LDt4XEiyNSr3pk zV9MCJEqD6++gpnXogdcQRh4JlJKOmiFfNNtVyok8Jg42xtQKTwRYsOWdv3GTZmFNezH OyJs2qOKSFYPkPuxaF1XBvO7geHcOmWDo9NK3GyrxFn4s1dYWLV8Suo43+2xlLzZ6r6f kYyTbJY99vRUcTPVgvjwUJ3VZynPqUFcnoavBYss/WKMqxRdLgPYKq9ScA+GwPhsQCEU 9XZQ== X-Gm-Message-State: AJIora9Sp7I4Bssg9wowCOFO1/xPcEEk8ENACYnaP+KDHELLbxGBxVOH YJ+XRniYsBZ0TOZw2cf4gYg6zQ== X-Received: by 2002:aa7:8e9e:0:b0:525:1d15:8fb8 with SMTP id a30-20020aa78e9e000000b005251d158fb8mr6784149pfr.35.1655719362190; Mon, 20 Jun 2022 03:02:42 -0700 (PDT) Received: from [10.94.57.128] ([139.177.225.228]) by smtp.gmail.com with ESMTPSA id q3-20020a170902edc300b0016370e1af6bsm8280491plk.128.2022.06.20.03.02.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Jun 2022 03:02:41 -0700 (PDT) Message-ID: Date: Mon, 20 Jun 2022 18:02:32 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [External] [PATCH v9 9/9] KVM: VMX: enable IPI virtualization To: Zeng Guang Cc: Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, Dave Hansen , Tony Luck , Kan Liang , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Kim Phillips , Jarkko Sakkinen , Jethro Beekman , Kai Huang , x86@kernel.org, linux-kernel@vger.kernel.org, Robert Hu , Gao Chao , zhouyibo@bytedance.com References: <20220419154510.11938-1-guang.zeng@intel.com> From: Shenming Lu In-Reply-To: <20220419154510.11938-1-guang.zeng@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/04/2022 23:45, Zeng Guang wrote: > From: Chao Gao > > With IPI virtualization enabled, the processor emulates writes to > APIC registers that would send IPIs. The processor sets the bit > corresponding to the vector in target vCPU's PIR and may send a > notification (IPI) specified by NDST and NV fields in target vCPU's > Posted-Interrupt Descriptor (PID). It is similar to what IOMMU > engine does when dealing with posted interrupt from devices. > ... > @@ -3872,6 +3875,8 @@ static void vmx_update_msr_bitmap_x2apic(struct kvm_vcpu *vcpu) > vmx_enable_intercept_for_msr(vcpu, X2APIC_MSR(APIC_TMCCT), MSR_TYPE_RW); > vmx_disable_intercept_for_msr(vcpu, X2APIC_MSR(APIC_EOI), MSR_TYPE_W); > vmx_disable_intercept_for_msr(vcpu, X2APIC_MSR(APIC_SELF_IPI), MSR_TYPE_W); > + if (enable_ipiv) > + vmx_disable_intercept_for_msr(vcpu, X2APIC_MSR(APIC_ICR), MSR_TYPE_RW); > } > } > > @@ -4195,14 +4200,19 @@ static void vmx_refresh_apicv_exec_ctrl(struct kvm_vcpu *vcpu) > > pin_controls_set(vmx, vmx_pin_based_exec_ctrl(vmx)); > > - if (kvm_vcpu_apicv_active(vcpu)) > + if (kvm_vcpu_apicv_active(vcpu)) { > secondary_exec_controls_setbit(vmx, > SECONDARY_EXEC_APIC_REGISTER_VIRT | > SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY); > - else > + if (enable_ipiv) > + tertiary_exec_controls_setbit(vmx, TERTIARY_EXEC_IPI_VIRT); > + } else { > secondary_exec_controls_clearbit(vmx, > SECONDARY_EXEC_APIC_REGISTER_VIRT | > SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY); > + if (enable_ipiv) > + tertiary_exec_controls_clearbit(vmx, TERTIARY_EXEC_IPI_VIRT); > + } > > vmx_update_msr_bitmap_x2apic(vcpu); > } Hi, just a small question here: It seems that we clear the TERTIARY_EXEC_IPI_VIRT bit before enabling interception for APIC_ICR when deactivating APICv on some reason. Is there any problem with this sequence? Thanks, shenming