Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp106092iob; Mon, 2 May 2022 14:20:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGfTGhYuUhuBas3c0Uvimi3SLdgbux9cZYuYNxWPbVMvawgxMA8t/wFULMZux5Q7wUGo0O X-Received: by 2002:a17:90a:b106:b0:1d9:7cde:7914 with SMTP id z6-20020a17090ab10600b001d97cde7914mr1194930pjq.56.1651526433564; Mon, 02 May 2022 14:20:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651526433; cv=none; d=google.com; s=arc-20160816; b=sHXoyPl7ojN6nF8zt3tNML3Bw9OIKcE5rWCMJfjyXCy9GdxkORdR0WdMbBEJs55zXn T0s6q8H05VpTzovwI2jbK188xoTwHdEGLf/PexGY1ZYtMYe4/HRbNwuJGMSlVOMNSK2M 2MIJ9dQvSLHTPra8OiBPg6Jb4ag2EwkTsuM7pgb2W/kP/1sW1vtXVhNJ5hqQDy3Gac/6 UU3wPH3SzFIqAf/xLITLJziV+aoNIvKZi0H205Q5XIBj1U4rvIYqQOC8LxIx0SZ5+29i X3rAmuxK3JjS0vseE9QGWjQ6rD94sjc3LJF0mNEZKXul+uydHJV8F2Sp7n3Cx84iEWTj VfYw== 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:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=rsSALeBOA7ZWPCcmJgm1/wGrXg4q+JRs+W7rdBh5ql0=; b=efHhBXH5Ie+V8pSMgmdiqM7zB8EVG7EUI3dQPU4pSbfQKGeylUVGkpT8a+0yAWYbIp iR4tGFLDnusDVzSdIIsoyPJSgY3unf5Fh8HUD838EkxtkMb92nEVQkXqIluYg1qErrQv HN0Z+hlvRSqTHWjQKv0acHJ/1idmkj3BzizLCO1Ep4mXieeGgHDWYxaS1qpAThpiKEgD 3Jja1hF3Tv4x+ndUAqxyfx/kP0Q/3InprhHQ9uMvmGxfJMOT6/hqcVRsbLebGyrt/aTH hlnGdIEP2kz+pSTFo01k+Idy9uogNnOHF6jwVwyjaSGYNEeRO52EBD/SLTfwO47Dq5U/ 9vPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ddC85xIe; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x63-20020a638642000000b003ab6168869esi14731164pgd.696.2022.05.02.14.20.16; Mon, 02 May 2022 14:20:33 -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=@redhat.com header.s=mimecast20190719 header.b=ddC85xIe; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386269AbiEBQUN (ORCPT + 99 others); Mon, 2 May 2022 12:20:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1386250AbiEBQUH (ORCPT ); Mon, 2 May 2022 12:20:07 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6D6BAE0AD for ; Mon, 2 May 2022 09:16:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651508197; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rsSALeBOA7ZWPCcmJgm1/wGrXg4q+JRs+W7rdBh5ql0=; b=ddC85xIe6EyqknPGRq3GtNS4EXuI15HxsJdpEO0Tl5onc3PSWV58fjxh9JHjYSDOHF1hVw NxwOlAb+slnI8T04sYUzBU1TlxbmKXf/9ALAOD0aoaN4606cGwnZvz0q45bGsl0v4QyfKt EDH3AlW6m3HF3wuoQWaEowMNEoXCNJU= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-621-dH9-QEFyMpmXPjuTvrU91Q-1; Mon, 02 May 2022 12:16:36 -0400 X-MC-Unique: dH9-QEFyMpmXPjuTvrU91Q-1 Received: by mail-ej1-f70.google.com with SMTP id jg5-20020a170907970500b006f42a861bb9so1609980ejc.11 for ; Mon, 02 May 2022 09:16:36 -0700 (PDT) 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 :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=rsSALeBOA7ZWPCcmJgm1/wGrXg4q+JRs+W7rdBh5ql0=; b=dUnfqrJ45UFO21IdwvfnpuOoDOdi/N2JDdIUG7iqAxXSxrNV31DqcAA5jbVAA9Qu9D IKy/kPXYLIXBbll+QLQ7Na2pkNCOKBuvJCWmvgh3a1iUm8d94TBbQc5/7WN0vk9ZjvgI dGFBw9L9OF742fX+omtgWclFK7dLgHhn04Fd9LevPIGqHAEzgeAf+YOMXngKWJpfHz6I kYV2mKqCoB38SzT6GFlMMOKfYRv6JAs3zpLhMnNgBRguzPeirtGrMPhjn9hrsJwQxYPW m5F0ki7xYSe7S1OxVs1Ip1Rg4JhDWKhWoU2T2wyU6kTCKAmFrdB0ODLD8zWwvKwku0im vtaA== X-Gm-Message-State: AOAM530z+ygCG4xKdEtueQScRiFlxB3gGPHNT1pOKC8pdKJZfEYn1c0f 2xUVbFNts2mwei7gtcHF7mWCf5Z2NMEsUpVScZpjVrvqJ6vVwW1RtvqOsmVDd34hJkgk4sKITVN NeS0tO98dXPtWW+PeykNDBoU0 X-Received: by 2002:a17:907:7243:b0:6f4:1ce5:4ac4 with SMTP id ds3-20020a170907724300b006f41ce54ac4mr10031089ejc.198.1651508195310; Mon, 02 May 2022 09:16:35 -0700 (PDT) X-Received: by 2002:a17:907:7243:b0:6f4:1ce5:4ac4 with SMTP id ds3-20020a170907724300b006f41ce54ac4mr10031056ejc.198.1651508195058; Mon, 02 May 2022 09:16:35 -0700 (PDT) Received: from ?IPV6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.googlemail.com with ESMTPSA id j12-20020a50ed0c000000b0042617ba63d4sm6834162eds.94.2022.05.02.09.16.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 02 May 2022 09:16:34 -0700 (PDT) Message-ID: Date: Mon, 2 May 2022 18:16:13 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH v9 9/9] KVM: VMX: enable IPI virtualization Content-Language: en-US To: Zeng Guang , 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 Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Robert Hu , Gao Chao References: <20220419154510.11938-1-guang.zeng@intel.com> From: Paolo Bonzini 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=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,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 4/19/22 17:45, Zeng Guang wrote: > +static bool vmx_can_use_pi_wakeup(struct kvm_vcpu *vcpu) > +{ > + /* > + * If a blocked vCPU can be the target of posted interrupts, > + * switching notification vector is needed so that kernel can > + * be informed when an interrupt is posted and get the chance > + * to wake up the blocked vCPU. For now, using posted interrupt > + * for vCPU wakeup when IPI virtualization or VT-d PI can be > + * enabled. > + */ > + return vmx_can_use_ipiv(vcpu) || vmx_can_use_vtd_pi(vcpu->kvm); > +} Slightly more accurate name and comment: static bool vmx_needs_pi_wakeup(struct kvm_vcpu *vcpu) { /* * The default posted interrupt vector does nothing when * invoked outside guest mode. Return whether a blocked vCPU * can be the target of posted interrupts, as is the case when * using either IPI virtualization or VT-d PI, so that the * notification vector is switched to the one that calls * back to the pi_wakeup_handler() function. */ return vmx_can_use_ipiv(vcpu) || vmx_can_use_vtd_pi(vcpu->kvm); } Paolo