Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp887758pxb; Wed, 27 Oct 2021 14:30:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzsnujPMs9Purbj1i3H2y2D/DghINv2qU5P0oMZNmoij9ofhGZh0C98h2BVQRHx+rNN2wbJ X-Received: by 2002:a50:da48:: with SMTP id a8mr536216edk.146.1635370221455; Wed, 27 Oct 2021 14:30:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635370221; cv=none; d=google.com; s=arc-20160816; b=MrpeX1OfYybB8zYGTTFrOJM2mpavTlnkCL7EVCZU0zoee5pJbGFnMjfxVHzLErfJus tsjVJy8FEftX5YCbeMdk56H7dmCFRaNqhHuoHWw3A+s/pk2A7At7qO28g+/fUAD7FtZy HXIYGd2T69oQUr/2m6hUNNJLOr8m3PK4AFJQEscfuYegomHsIGV0msxc1x6+gmMDVMTf P+y5R9A/sRfgM2pWGlbs5AuoTpRMX8hEaQYGBtnb4bsYAK/z1ctQjHbRSPHH7WPTVni5 dgVwdOG20VRUbMHqRmt3aQYQi4IrGmYaVZT/WawAle8Q5jXELG7ia1gsDoHjABOCO+sV pYyw== 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=5uRyMZIN45jCj2VKDrWR2a9G78BQWuHGJKl7OtHJZ6k=; b=GV8q1kOiS/e9qGIpqo1ZpjxXzvEFR25MkDey1xCqhMnuloslR+E44HKLwqNxk0PcAM yalK/Tg4nSz+6d23ymxTbZLhXxRHYl3jssHhlzMQaEEPcorMOFSgHSouaCzeT9u7y3bq vSXCzs5+3fYK8R0PiOmOvi1KN9feeJiLs6sPOX0Oz78xN+QmkQgGgVhPLIE/aq9/RxLS Z3LZCRSR4ygT3UjpsvFXeUpY/DnP3WE65Ww1MMDZYoVh/HON1KLn8BUIP1X/1wWfdskX tlXhVKKszZvgEwQX/PElsHSIy2lMMuCzL2EtOu+HZXqFQDqd4NAWj8Pe3Lv55dgyvgxo DMqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=e2dR+en+; 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 f6si1558843edd.160.2021.10.27.14.29.57; Wed, 27 Oct 2021 14:30:21 -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=e2dR+en+; 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 S242795AbhJ0Pi6 (ORCPT + 97 others); Wed, 27 Oct 2021 11:38:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:51278 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232502AbhJ0Pi5 (ORCPT ); Wed, 27 Oct 2021 11:38:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635348991; 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=5uRyMZIN45jCj2VKDrWR2a9G78BQWuHGJKl7OtHJZ6k=; b=e2dR+en+X1RDREBLLt64xZsmtbn2gJbApYWO5LX8Vut55CfpXVAk81mSZdLNxqHu/Ho85b ubVa4Dq6esUrtQxHn2He/jDyHvGeNyRITA+GUK+2vIMqB8clziqaw2gtKhvjWKphvPlBXg 387CZYQIr/IItEkZlX7eLGEgp9R0xts= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-65-pL3ztGaHN26W6JesGyRGpg-1; Wed, 27 Oct 2021 11:36:30 -0400 X-MC-Unique: pL3ztGaHN26W6JesGyRGpg-1 Received: by mail-ed1-f70.google.com with SMTP id v9-20020a50d849000000b003dcb31eabaaso2693982edj.13 for ; Wed, 27 Oct 2021 08:36:29 -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=5uRyMZIN45jCj2VKDrWR2a9G78BQWuHGJKl7OtHJZ6k=; b=dWz5Ty8MirmahhY5N/NSFeoSrsht3ixqkUUCP4BduHhhZA7GqoSP6LHZtsqhLmfhaI Ipo6XBlnZFlCBbdixOnk94UjVLYBev+wmkVSoY16gBKOs8ENAXzaDB5TvKV+RjLOFDWR Ez1sdcLRqhjmjQ3ofg+ObaTUPFd50B0wKVPKEj5WwkxM0Vmb38o5P6gMG9uMUjHAXQ/R jDf5mMCiG/x45PTn1JKuiAbgPstm3gVKpOIbLe9fuRtMQbcI4GHMOhbmCUlTBkA3ql11 k7s/Mhh9zQzIxf/GsBs7e0kG7oQiu7XLV1dv0yIOip5Vitf/0hemylGNi7agS53wlu9S 5+sg== X-Gm-Message-State: AOAM530BVyVpaEnr9FRQ35M1AulMeFakwyX4JVJq3QkOSxClh4QNEZQr G1VwugZG6FzqHzZlglyX8BctdZJbyS41rjB8PojbA7bAEcOotwhgnBaWWJK4cM6qmJfym+1Pwf6 zuydZFn3F2uA98v0n4NUoDbU9 X-Received: by 2002:a17:907:72d4:: with SMTP id du20mr27123521ejc.324.1635348988843; Wed, 27 Oct 2021 08:36:28 -0700 (PDT) X-Received: by 2002:a17:907:72d4:: with SMTP id du20mr27123484ejc.324.1635348988605; Wed, 27 Oct 2021 08:36:28 -0700 (PDT) Received: from ?IPV6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id dx2sm110885ejb.125.2021.10.27.08.36.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Oct 2021 08:36:26 -0700 (PDT) Message-ID: <185502d7-861e-fa5c-b225-419710fe77ed@redhat.com> Date: Wed, 27 Oct 2021 17:36:18 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 Subject: Re: [PATCH v2 35/43] KVM: SVM: Signal AVIC doorbell iff vCPU is in guest mode Content-Language: en-US To: Sean Christopherson Cc: Marc Zyngier , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , James Morse , Alexandru Elisei , Suzuki K Poulose , Atish Patra , David Hildenbrand , Cornelia Huck , Claudio Imbrenda , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, David Matlack , Oliver Upton , Jing Zhang References: <20211009021236.4122790-1-seanjc@google.com> <20211009021236.4122790-36-seanjc@google.com> <0333be2a-76d8-657a-6c82-3bb5c9ff2e3b@redhat.com> From: Paolo Bonzini In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27/10/21 17:06, Sean Christopherson wrote: >> Does this still need to check the "running" flag? That should be a strict >> superset of vcpu->mode == IN_GUEST_MODE. > > No. Signalling the doorbell when "running" is set but the vCPU is not in the > guest is just an expensive nop. So even if KVM were to rework its handling of > "running" to set the flag immediately before VMRUN and clear it immediately after, > keying off IN_GUEST_MODE and not "running" would not be wrong, just sub-optimal. > > I doubt KVM will ever make the "running" flag super precise, because keeping the > flag set when the vCPU is loaded avoids VM-Exits on other vCPUs due to undelivered > IPIs. Right, so should we drop the "if (running)" check in this patch, at the same time as it's adding the IN_GUEST_MODE check? Paolo