Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp249346pxb; Mon, 25 Oct 2021 07:36:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwT2GBaN+WAUyF68JuRra636gvx3L3b90Nl0uaEWMi92sCPRI7XsGBtRjTxtxzDvBzzrXFc X-Received: by 2002:a63:295:: with SMTP id 143mr14121284pgc.334.1635172565224; Mon, 25 Oct 2021 07:36:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635172565; cv=none; d=google.com; s=arc-20160816; b=luho4nvUATkJxY7EUKgH67ZqzgNW7FTjKwhx5ROURUMUSiuJ3dCqGmcezabOiGMpjK EBuBgOoTKOow9T1YzC9nKZ5Ipg3p4HnZTDDD+rRJtIppsx2FXhdtrEpTkrMGOpu5hWqN C3gUKV1K4sVWc6vrNhoMz0xx8HviAOot5QNZk1hGBb/sRMcCoBG1r0dzP8CPBAo+Wu9g tknyirvyvBfLEya+aQ/VSH4gxZ5oneOhF0PABM3hjtx1aGysCrFsLXGQchAiDfvpE8y5 ORzS6ExanLpN0uOa/IcGUxf6fEUAV6gf2IdSXN+5jVrzY3zviqv/t4KXMNUMQstdqEqg Gc1Q== 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=0JDFR/w0BO+fJnaqyJz0KqLIzoSXAKAPvBzPCJS8rh0=; b=YYMSKO2reJ9k28TcnXAvQNQh8GmylxB6a7LoJ9r6evuWtZChzULpKoDWCV9slxnDlQ +90ViuG1UI0xF55ZvQlK68kPoq3g4PPFehcls2HaCQ2dzmOxY4XDwkzvOuL35QAsPWAW ahWtqOQcpeMR1xrKR28aycfPn1hDb0VbzKL4oeSCJh64N6yFxt/qtemVJ+vmvhim9yo7 VYZ4g6xXHeMY1Nevt28XXh21cTWMez7qQoPYuMpM/Ky27Dg5hfS8CPok22YeEQn0/QOw bf+sFKF3Y1W8Bt8luCDU47Cax3up3+R2r7WKdl/tRzReJS/0zYORmguvdIFPHkHdeF6f gb5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hbCJMtC+; 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 ls13si28093171pjb.109.2021.10.25.07.35.50; Mon, 25 Oct 2021 07:36:05 -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=hbCJMtC+; 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 S233567AbhJYO2t (ORCPT + 99 others); Mon, 25 Oct 2021 10:28:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:45156 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233556AbhJYO2q (ORCPT ); Mon, 25 Oct 2021 10:28:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635171983; 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=0JDFR/w0BO+fJnaqyJz0KqLIzoSXAKAPvBzPCJS8rh0=; b=hbCJMtC+feXdD4DZpsFhxR0KHosx1zwzyF8Tv1JUfLQGhFPT6Sz9jaYEhXZ8ctLiBr5K/+ 1Af4KNf2fipA4V/TwlqSvOhuL0s5hBfhvsM7MGI8li9fR49uEYSSeK/5IpxDydkWDJz9qy I/Q+pHO5qIr6muF9tbKPliOWf9AUoz0= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-350-SUmqaruQPcSzG9aO_dBgNw-1; Mon, 25 Oct 2021 10:26:22 -0400 X-MC-Unique: SUmqaruQPcSzG9aO_dBgNw-1 Received: by mail-ed1-f69.google.com with SMTP id t18-20020a056402021200b003db9e6b0e57so816589edv.10 for ; Mon, 25 Oct 2021 07:26:21 -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=0JDFR/w0BO+fJnaqyJz0KqLIzoSXAKAPvBzPCJS8rh0=; b=kCK9h39KytANM2V9BkNcNJz0mWxH8TVcP3hvfXnQYWkWpGXakdjlpr/X9BAogIm9Fs 4d/honaF/GUdPvwjAjrYpUu0se7Nf26MobdyNurnQYT84IbrBMOpKNsf1/SqaK2o4xUv b3FtjGeuuJC2HV72xeKsOTfUV+Ea1UxWQVukoPYVkFREZScYGfHwB3Lx5y7B14yTzbkG eFvsWD8/yRtyyYrq1BegWRpqeUyfUcjIlK8yTHOrdlJN5e27OwNppn8kETncOSmKmcTe V0e9UXQLwigvm/JL4AlbpQMmYgwmmfUbUdtLvidQ1EIoeAnEHNv45YCGLKHV3SzrBUmG lsxA== X-Gm-Message-State: AOAM532N72cm/N+hn2+jhSWs+Uv9TuOrvXrbzlAJkyz88crmhl0UEw1M 4eXpFkQ7AALH1fTonI3NJqT9yl6gDhO9dCimUgm0HskLTHXz4HQBpelibjFxEpDJ4R4csc5QXgK YO1GKklEJGmfpyDqb+Sm3p8g1 X-Received: by 2002:a50:d78c:: with SMTP id w12mr26913803edi.147.1635171980781; Mon, 25 Oct 2021 07:26:20 -0700 (PDT) X-Received: by 2002:a50:d78c:: with SMTP id w12mr26913764edi.147.1635171980582; Mon, 25 Oct 2021 07:26:20 -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 hs28sm1430847ejc.111.2021.10.25.07.26.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Oct 2021 07:26:19 -0700 (PDT) Message-ID: <0333be2a-76d8-657a-6c82-3bb5c9ff2e3b@redhat.com> Date: Mon, 25 Oct 2021 16:26:17 +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 , Marc Zyngier , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank Cc: 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> From: Paolo Bonzini In-Reply-To: <20211009021236.4122790-36-seanjc@google.com> 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 09/10/21 04:12, Sean Christopherson wrote: > + */ > + if (vcpu->mode == IN_GUEST_MODE) { > int cpu = READ_ONCE(vcpu->cpu); > > /* > @@ -687,8 +692,13 @@ int svm_deliver_avic_intr(struct kvm_vcpu *vcpu, int vec) > if (cpu != get_cpu()) > wrmsrl(SVM_AVIC_DOORBELL, kvm_cpu_get_apicid(cpu)); > put_cpu(); > - } else > + } else { > + /* > + * Wake the vCPU if it was blocking. KVM will then detect the > + * pending IRQ when checking if the vCPU has a wake event. > + */ > kvm_vcpu_wake_up(vcpu); > + } > Does this still need to check the "running" flag? That should be a strict superset of vcpu->mode == IN_GUEST_MODE. Paolo