Received: by 2002:a19:f614:0:0:0:0:0 with SMTP id x20csp59104lfe; Fri, 15 Apr 2022 19:26:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRcTXwR7MPFmZ1fJNbihsseD57PVFlEdGhn7W03ije1tx1UltuZqCaGu3wcn2olc4WMTMq X-Received: by 2002:a63:ed45:0:b0:399:5116:312a with SMTP id m5-20020a63ed45000000b003995116312amr1351408pgk.611.1650075964226; Fri, 15 Apr 2022 19:26:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650075964; cv=none; d=google.com; s=arc-20160816; b=OTFLD5pJMiXfM+7lhMtPF998984O7FwAGMSvgtxqBkXU02nMHWf/o3L4CZl73gbOVs N8ain3MBHmfhhs60QQwDmi/kjc6tgWkhWROtgKtuP8rBmgxxmEJV+RbFDHVqkTwCC7nn oEyvhg4+1yUlbJQYiYErUw6BpYjFcrtJ2mwbmTWVcTAJ8VGdCa7Z2YjBTpq841sTqI4x XA+hV4WHOZMD73J1RLO6MPf7AIsx1TBsP/4ScmRFQt2zCcC/Sg1oXuZyqopp+Z3qv8AJ OwR8++3tZeqxT1lJ9+ZaMmKhruzo6vzvhGAEBfAs/RHCmRFksRrh9/PP8ZjkWWmfq7NH odNw== 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:sender:dkim-signature; bh=I+8+SXYywmABWGlIYadF/DTQr7dJU4Q1NjstdTanSr8=; b=cZQvmryFf45LAmyuYTzX1wN8q14yAW50Q9dzghsXlixEXIL6ba67xND3HPJTgssfFc kzzVQxRzuagyHy6pgQqRSOwqzlHVDBqxT54ZBQ1pMb1q4b2EQ6qLvMPFZYYZcq/+PU83 TNRVGyIWsnCmAFUrqnZ9CxPEnjaBNEqzGpeXfwxRW2HfojVS7wemDnpmZPMfIOZAZZqU MCY6CXXM+L8H+ZslXf452KR5Apa5Gv2QscBbczNoCgUzouLUK+UHhdHZ2MT+GX7pC3zl vKXz8coPsbGBxeb5jzcyCzcgIDHZnheMkKC9A9njzxXhcqQ065ObMkQJr4aREQ+SXh5Q YTdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Ya2WM2Tu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id v10-20020a63610a000000b003a3efba618asi806694pgb.361.2022.04.15.19.26.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 19:26:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Ya2WM2Tu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1921AEE4FA; Fri, 15 Apr 2022 18:38:13 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354379AbiDOOXH (ORCPT + 99 others); Fri, 15 Apr 2022 10:23:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354472AbiDOOW7 (ORCPT ); Fri, 15 Apr 2022 10:22:59 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C50C013D1A; Fri, 15 Apr 2022 07:20:29 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id r13so15610318ejd.5; Fri, 15 Apr 2022 07:20:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=I+8+SXYywmABWGlIYadF/DTQr7dJU4Q1NjstdTanSr8=; b=Ya2WM2Tui/Nk8NL4I4C3K8csbywtdvpKpoJn1+x/a7RjClRAWSYWrD/p9KbcJkip2R 8XYI6iSYMrxl3Lp/noQDvD5tLUs/4IwC+VhQrwLEpiwaxspgVDR7czzPDEw7GlRN3pgk nS9dx8JOxVU/+TjK4dLth83FhMB+Tf7g5L1uZYQToIgsSgwduzaha/VMexIy68t0alKH 794KpDTPNnG+YAb6mJ7fVzcawyeJHj1Bf9kU/ZWNpIq2LbeFfCThS/H3lezAbphFaVr3 8jtAlgifveS1RSzrQNJgiuwe2mMn3QTll1kUR5bJ4Zk/bFOmQEbJVhswDJbkL1+FdshH yFwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :subject:content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=I+8+SXYywmABWGlIYadF/DTQr7dJU4Q1NjstdTanSr8=; b=3dNPJ6TzcLbLZXHuBhXlacz4atB8oTlG/GFPtpeYzuoXntlNb3/EEgPBUYD58KyXS3 wBT1clQFplsgTOLUk55rWpq5zPH3IgK4Wq+KoZlHISaS3Np0sMpgHeE4Oo60B6KvZxNY Q7LaSalUtmVnc9DIMzurcy4D2Qru6Zk2x/To3RZw578r8f/mW+bCHSqmSvj1u2CWhO80 mRP4ndYfwxTC69oH+nlK/00TOaI7z+noRP6TbWVtYn8cnkDF+TIKOzPFtlbPTPi0iLQu VvWTlg0mk4AnH/jRXwyb7F34BtJ9Y8SBHBsddgMZAJIk6YFZq83NgTyM3AXpJGWPOBQO bthw== X-Gm-Message-State: AOAM531YmR/MfVDuLDr1pKJG2ep7ZK8qWYDs/2wRidMlZ6oECunDjJga Olac9C9JjyU98wvmBXmEWts= X-Received: by 2002:a17:906:4e48:b0:6e8:a246:9645 with SMTP id g8-20020a1709064e4800b006e8a2469645mr6482857ejw.642.1650032428351; Fri, 15 Apr 2022 07:20:28 -0700 (PDT) Received: from ?IPV6:2001:b07:add:ec09:c399:bc87:7b6c:fb2a? ([2001:b07:add:ec09:c399:bc87:7b6c:fb2a]) by smtp.googlemail.com with ESMTPSA id b12-20020a056402278c00b004195a50759fsm2912853ede.84.2022.04.15.07.20.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 Apr 2022 07:20:27 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <1bff7526-c532-3ca8-7d7a-c7face576a37@redhat.com> Date: Fri, 15 Apr 2022 16:20:09 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [RFC PATCH v5 075/104] KVM: x86: Check for pending APICv interrupt in kvm_vcpu_has_events() Content-Language: en-US To: Sean Christopherson , isaku.yamahata@intel.com Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, isaku.yamahata@gmail.com, Jim Mattson , erdemaktas@google.com, Connor Kuehl References: From: Paolo Bonzini In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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/8/22 18:24, Sean Christopherson wrote: >> Return true for kvm_vcpu_has_events() if the vCPU has a pending APICv >> interrupt to support TDX's usage of APICv. Unlike VMX, TDX doesn't have >> access to vmcs.GUEST_INTR_STATUS and so can't emulate posted interrupts, > Based on the discussion in the HLT patch, this is no longer true. > It's still true, it only has access to RVI > PPR (which is enough to check if the vCPU is runnable). > Rather than hook this path, I would rather we tag kvm_apic has having some of its > state protected. Then kvm_cpu_has_interrupt() can invoke the alternative, > protected-apic-only hook when appropriate, and kvm_apic_has_interrupt() can bail > immediately instead of doing useless processing of stale vAPIC state. Agreed, this is similar to my suggestion on the HLT patch: https://lkml.kernel.org/r/a7d28775-2dbe-7d97-7053-e182bd5be51c@redhat.com Paolo