From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89CBDC433F5 for ; Wed, 27 Oct 2021 16:14:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 70AC260FBF for ; Wed, 27 Oct 2021 16:14:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235723AbhJ0QRQ (ORCPT ); Wed, 27 Oct 2021 12:17:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24371 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229480AbhJ0QRP (ORCPT ); Wed, 27 Oct 2021 12:17:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635351289; 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=YJ1AvjILyDHE6A0xH65m+vjqkknvkqBvDuAHk95niU8=; b=NNZezK5I92wtIcPstDA/xymm972gQZ9WtIC5LNxfA9/cKxuo+jbIJpAKxG+WhoLmdVV01i NfPQgaZ9mJOfSB0HBcNLWZgEKlOhbZu9FMixihVNRp0ciu5gnbRZwRTQfUaUFD0slfDuBp DgWNhhGjuOT8NzyXPJVCkv+W8CekUrs= 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-415-B302cc1FNk-CVBhEuZppYA-1; Wed, 27 Oct 2021 12:14:48 -0400 X-MC-Unique: B302cc1FNk-CVBhEuZppYA-1 Received: by mail-ed1-f69.google.com with SMTP id t1-20020a056402524100b003dd9a419eb5so2827623edd.4 for ; Wed, 27 Oct 2021 09:14:48 -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=YJ1AvjILyDHE6A0xH65m+vjqkknvkqBvDuAHk95niU8=; b=UKtHBy8HvwRGirPeFHgWJG7HEucI/0j5mXKAwLVVEQOpDrWoYzrqD6RQ82JwGK4uNX d3z5BYq6jaFoFCKuuYxQY4fYl5uY690hxAKu/hZ2gzWZFcqecbB4e7MFwcBU8RtvErZp upgzvBlE45bKSYcsuvyOGsBQE+ESbppcBDI3GTIrrzF7m4kgRVzPLgQxjHIQudmsR8RM MRMxr2xlRNdEYOu3zTuSKjVGDCKY2ubklOh3rOpOThllGD+vBCallIlHEuMXgo5dSsL8 G3hspbBohulxVaGO+PWZMIbMHh7OJEQunz/xMEKbZJWjmurJmVdQaQdd6L9cbj0EkQoK qDwg== X-Gm-Message-State: AOAM530N6FRE0maZjntNeLIaQvJ99KFb+qCEAIut+lK/01WuDjxzpuS2 vhpzCbJtgPhYlxlzM4QykthLU+dyM4pZXSXhQJaPIgbqpQuA4q3Nw5/s8KPQR4XpXHiWswQbsZp Pj2SZtRkT2pHYjy16/a/5W73i X-Received: by 2002:a17:907:16a7:: with SMTP id hc39mr22891310ejc.214.1635351287165; Wed, 27 Oct 2021 09:14:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzO/QgQ5GMyh0vFS/oBYQIX6qwD3vL9k6RGrSUIXFucShmCvNWLSsmfmRBNY3o+Ac+4bg3ipQ== X-Received: by 2002:a17:907:16a7:: with SMTP id hc39mr22891269ejc.214.1635351286915; Wed, 27 Oct 2021 09:14:46 -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 sb30sm195562ejc.45.2021.10.27.09.14.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Oct 2021 09:14:46 -0700 (PDT) Message-ID: Date: Wed, 27 Oct 2021 18:14:44 +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> <185502d7-861e-fa5c-b225-419710fe77ed@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 18:08, Sean Christopherson wrote: >> 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? > LOL, I think we have a Three^WTwo Stooges routine going on. This patch does > remove avic_vcpu_is_running() and replaces it with the vcpu->mode check. Or am > I completely misunderstanding what your referring to? > > - if (avic_vcpu_is_running(vcpu)) { > + /* > + * Signal the doorbell to tell hardware to inject the IRQ if the vCPU > + * is in the guest. If the vCPU is not in the guest, hardware will > + * automatically process AVIC interrupts at VMRUN. > + */ > + if (vcpu->mode == IN_GUEST_MODE) { > int cpu = READ_ONCE(vcpu->cpu); Nevermind, I confused svm_deliver_avic_intr with avic_kick_target_vcpus, which anyway you are handling in patch 36. Paolo From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 634A9C433F5 for ; Wed, 27 Oct 2021 16:14:55 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id D5CDA60F38 for ; Wed, 27 Oct 2021 16:14:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D5CDA60F38 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 5DA6E4B14C; Wed, 27 Oct 2021 12:14:54 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@redhat.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XrEI7LmY4oaq; Wed, 27 Oct 2021 12:14:52 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id AC0204B11E; Wed, 27 Oct 2021 12:14:52 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id CADA34B11E for ; Wed, 27 Oct 2021 12:14:50 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uYdXRaL8kNvq for ; Wed, 27 Oct 2021 12:14:49 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 9DC044B106 for ; Wed, 27 Oct 2021 12:14:49 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635351289; 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=YJ1AvjILyDHE6A0xH65m+vjqkknvkqBvDuAHk95niU8=; b=NNZezK5I92wtIcPstDA/xymm972gQZ9WtIC5LNxfA9/cKxuo+jbIJpAKxG+WhoLmdVV01i NfPQgaZ9mJOfSB0HBcNLWZgEKlOhbZu9FMixihVNRp0ciu5gnbRZwRTQfUaUFD0slfDuBp DgWNhhGjuOT8NzyXPJVCkv+W8CekUrs= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-164-Ij5myqF5N8GpHIAlrkhmmQ-1; Wed, 27 Oct 2021 12:14:48 -0400 X-MC-Unique: Ij5myqF5N8GpHIAlrkhmmQ-1 Received: by mail-ed1-f71.google.com with SMTP id z1-20020a05640235c100b003dcf0fbfbd8so2826361edc.6 for ; Wed, 27 Oct 2021 09:14:48 -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=YJ1AvjILyDHE6A0xH65m+vjqkknvkqBvDuAHk95niU8=; b=cMsHBMQZbk1piKg0p0W4Di5Bjav872LwQvSZpDM5o4JqSEMTZIPUi0qLRC09wnctpR 1nSq7G6PXRkeq+i2PtMkKnLMSudpwDn3qswDOjR0C9cpa0OEIBjFNWCaM/PMvWAqw/Sj 37VMAAFUHnyPlCvu6XDUB6vJwgoh6AZMLoBycViyFjY6tpbIZXsAJ590b3ANHMkAExaZ 65+zU3IDKIQw2OWsEoVeNKMG20X0pYGz9MWOtIOSw58UeQMUkD/UL7bN40XapXp1D49H Q+j4rloWTrwOg7WWiTkHP+oHyDdgFsWvHBOxnI7lWn/46kAvQJlsBFXWM6Ed4t+kGEZD 5PfA== X-Gm-Message-State: AOAM531+y5nsMlMD9+gOZmmMSmUn7fzyIOVZXbDJxsBn9oS3REy7yJDu 2QwBeSWIy7n+tc9I+dSoBgx7LPM0NstrwAert0dPDiTa89jdVBW7gPAdeuI96Ax0KhZjsmTkNyG 7rkdEj601wjOdQKhHBQporwre X-Received: by 2002:a17:907:16a7:: with SMTP id hc39mr22891307ejc.214.1635351287160; Wed, 27 Oct 2021 09:14:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzO/QgQ5GMyh0vFS/oBYQIX6qwD3vL9k6RGrSUIXFucShmCvNWLSsmfmRBNY3o+Ac+4bg3ipQ== X-Received: by 2002:a17:907:16a7:: with SMTP id hc39mr22891269ejc.214.1635351286915; Wed, 27 Oct 2021 09:14:46 -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 sb30sm195562ejc.45.2021.10.27.09.14.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Oct 2021 09:14:46 -0700 (PDT) Message-ID: Date: Wed, 27 Oct 2021 18:14:44 +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 To: Sean Christopherson References: <20211009021236.4122790-1-seanjc@google.com> <20211009021236.4122790-36-seanjc@google.com> <0333be2a-76d8-657a-6c82-3bb5c9ff2e3b@redhat.com> <185502d7-861e-fa5c-b225-419710fe77ed@redhat.com> From: Paolo Bonzini In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Cc: Cornelia Huck , Wanpeng Li , kvm@vger.kernel.org, David Hildenbrand , linux-kernel@vger.kernel.org, Paul Mackerras , Atish Patra , linux-riscv@lists.infradead.org, Claudio Imbrenda , kvmarm@lists.cs.columbia.edu, Janosch Frank , Marc Zyngier , Joerg Roedel , Huacai Chen , Christian Borntraeger , Aleksandar Markovic , Albert Ou , kvm-ppc@vger.kernel.org, Paul Walmsley , David Matlack , linux-arm-kernel@lists.infradead.org, Jim Mattson , Anup Patel , linux-mips@vger.kernel.org, Palmer Dabbelt , kvm-riscv@lists.infradead.org, Vitaly Kuznetsov X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On 27/10/21 18:08, Sean Christopherson wrote: >> 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? > LOL, I think we have a Three^WTwo Stooges routine going on. This patch does > remove avic_vcpu_is_running() and replaces it with the vcpu->mode check. Or am > I completely misunderstanding what your referring to? > > - if (avic_vcpu_is_running(vcpu)) { > + /* > + * Signal the doorbell to tell hardware to inject the IRQ if the vCPU > + * is in the guest. If the vCPU is not in the guest, hardware will > + * automatically process AVIC interrupts at VMRUN. > + */ > + if (vcpu->mode == IN_GUEST_MODE) { > int cpu = READ_ONCE(vcpu->cpu); Nevermind, I confused svm_deliver_avic_intr with avic_kick_target_vcpus, which anyway you are handling in patch 36. Paolo _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8F83C433EF for ; Wed, 27 Oct 2021 16:15:17 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7268B60F38 for ; Wed, 27 Oct 2021 16:15:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7268B60F38 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BdKRAIdKUusgOfxVC8J3U36Q9uiOf+2kCfGUlL50aRI=; b=Cyh6YxURr/qRe1 HHY41hEwUKZYQ6nzYMAwvhjVm4cwUq/ltBUWIeYCIYl5uisJKmmqjCY9BXhs3675SEXUJEThtPP0C LDwHEOKR+O6eto9Q1Vvy+ix/UqRQBvSwltF3n12Vqpcti5TFMdiXCxvvdRYQ86pWGHKI0X+9yecJ9 Rv6IcJicp0K5VaLTmZXOcowKkybEFi1iikpw5oBydEw3ibxtURPlLeu8AtYVtGO5nJOxuqhBhqxit aZbUTmldrBGvEWz4rKtv66WUjdYpxIlYPDIRZkzeFA65B2RyJ2XvO6fSSsQDtt6CuVJBbOlEFU0De DBRWzqw7is5oRvl223iw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfla2-005Qu6-AI; Wed, 27 Oct 2021 16:15:10 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mflZk-005Qpf-GO for linux-riscv@lists.infradead.org; Wed, 27 Oct 2021 16:14:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635351289; 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=YJ1AvjILyDHE6A0xH65m+vjqkknvkqBvDuAHk95niU8=; b=NNZezK5I92wtIcPstDA/xymm972gQZ9WtIC5LNxfA9/cKxuo+jbIJpAKxG+WhoLmdVV01i NfPQgaZ9mJOfSB0HBcNLWZgEKlOhbZu9FMixihVNRp0ciu5gnbRZwRTQfUaUFD0slfDuBp DgWNhhGjuOT8NzyXPJVCkv+W8CekUrs= 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-190-ihc-uhQ5MrSNMVyASV3syw-1; Wed, 27 Oct 2021 12:14:48 -0400 X-MC-Unique: ihc-uhQ5MrSNMVyASV3syw-1 Received: by mail-ed1-f69.google.com with SMTP id c25-20020a056402143900b003dc19782ea8so2849450edx.3 for ; Wed, 27 Oct 2021 09:14:48 -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=YJ1AvjILyDHE6A0xH65m+vjqkknvkqBvDuAHk95niU8=; b=PFhMn1tZ2ULsPo1A8Qd2N2oriX+Kwb4OpWSzsKOeGMEgVM+z13fCJ6xHO/e/XYnV83 EQUHs+4STyhJnXVxvSG9osF6F+IeA5d3/sXVGRcf+BlT7UidVXR22IWmZdTdBc80tux4 uvidxzDO5AEKEFOni3IuZSAmy1/KzDdQd9cvben/JC1QoLUVOLIk8fq13WrILnO9XdlX NPf5rRzGIXw2emgskZrKPKeHYzXxA78bjgOGWU70mN8dnfzMQsuxDi4G4NAXOQoah3qH idToI6G+CkjZU6khsorKgjkq6jBmITTJcFRtqCbMI9LU5hVeghYwX8WMWimIQU/agYnw kWNw== X-Gm-Message-State: AOAM530voUM9F2RfF8X79tTPo5DMWx9lFXDZlOL+PwhuPYDZ0FyEvLel VcONlerwGgMGgrYiOePWp5sngb4ip8oHuRV/wt0pegwWqSihF8JbOlHAflNCdLOQsTF+xfFzfw+ V17HH9Y+irs2Lgfc6GQag0RTkQmg6 X-Received: by 2002:a17:907:16a7:: with SMTP id hc39mr22891329ejc.214.1635351287181; Wed, 27 Oct 2021 09:14:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzO/QgQ5GMyh0vFS/oBYQIX6qwD3vL9k6RGrSUIXFucShmCvNWLSsmfmRBNY3o+Ac+4bg3ipQ== X-Received: by 2002:a17:907:16a7:: with SMTP id hc39mr22891269ejc.214.1635351286915; Wed, 27 Oct 2021 09:14:46 -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 sb30sm195562ejc.45.2021.10.27.09.14.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Oct 2021 09:14:46 -0700 (PDT) Message-ID: Date: Wed, 27 Oct 2021 18:14:44 +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 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> <185502d7-861e-fa5c-b225-419710fe77ed@redhat.com> From: Paolo Bonzini In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211027_091452_682512_1980F298 X-CRM114-Status: GOOD ( 12.86 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On 27/10/21 18:08, Sean Christopherson wrote: >> 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? > LOL, I think we have a Three^WTwo Stooges routine going on. This patch does > remove avic_vcpu_is_running() and replaces it with the vcpu->mode check. Or am > I completely misunderstanding what your referring to? > > - if (avic_vcpu_is_running(vcpu)) { > + /* > + * Signal the doorbell to tell hardware to inject the IRQ if the vCPU > + * is in the guest. If the vCPU is not in the guest, hardware will > + * automatically process AVIC interrupts at VMRUN. > + */ > + if (vcpu->mode == IN_GUEST_MODE) { > int cpu = READ_ONCE(vcpu->cpu); Nevermind, I confused svm_deliver_avic_intr with avic_kick_target_vcpus, which anyway you are handling in patch 36. Paolo _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9AC89C433FE for ; Wed, 27 Oct 2021 16:16:28 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 67A7A60F38 for ; Wed, 27 Oct 2021 16:16:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 67A7A60F38 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UB8+W/qKk8bPu5ZFK4EIn9SL1wJiSewHnLW0HIWpkRw=; b=ZjCsEHeP8phjX9 iuxHG//re6ZG17/QagAc2zfvR5Mh52K3TDOPPxH8fuGaDrkd1f9/Wuwiqb/1rSJ4X4gGhzFi9Xhwd Y4f75vnsCLu/DkSWx+K/dVHtm2JvljB36G6zphO9DMQYQKQym9/vGE/Shq5U2rccDqhktjHxld0B/ c2D3XskerqRiLwHv5aUIFHRx7Yfe9uaoAVDpTOl358hyYpM/gzUFW+B0yeT2Qpjb8diezvUOkcKYI wdZUWw2MiiST4SwkpHvn6MgeZ7ofxZSG9+1k6IfJ3PROzVjLRto17/Pdv5SjlNiM5QwwoYjDhD/IS Uv4s2Ew5t46f9iyDlo9Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mflZq-005Qro-UC; Wed, 27 Oct 2021 16:14:59 +0000 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mflZk-005Qpb-1h for linux-arm-kernel@lists.infradead.org; Wed, 27 Oct 2021 16:14:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635351289; 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=YJ1AvjILyDHE6A0xH65m+vjqkknvkqBvDuAHk95niU8=; b=NNZezK5I92wtIcPstDA/xymm972gQZ9WtIC5LNxfA9/cKxuo+jbIJpAKxG+WhoLmdVV01i NfPQgaZ9mJOfSB0HBcNLWZgEKlOhbZu9FMixihVNRp0ciu5gnbRZwRTQfUaUFD0slfDuBp DgWNhhGjuOT8NzyXPJVCkv+W8CekUrs= 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-415-kyOLEfzfNOame18Fkn33Vw-1; Wed, 27 Oct 2021 12:14:48 -0400 X-MC-Unique: kyOLEfzfNOame18Fkn33Vw-1 Received: by mail-ed1-f70.google.com with SMTP id s12-20020a50dacc000000b003dbf7a78e88so2839762edj.2 for ; Wed, 27 Oct 2021 09:14:48 -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=YJ1AvjILyDHE6A0xH65m+vjqkknvkqBvDuAHk95niU8=; b=fLtarpg9iBvSmowEDXNR1q0uaA4e1k7iwZh9RUMAGKmXOxyeX0nepx4aiQ3Ywh75tI qgnHasHTzfiJcobVBcIQ4wZOcuBFqIDVoBz1bSEnXlXUhKPFR9yWYObA2mh41wjwuH/J +PRwbbikXclopIwn8Qwn8k0io363SoKsvtAGRFjGqL9nB/qkbONgQquDJmBda7z4E4iE OE8nhhw7+Z5o3USPOq7f7f2DNrfd14vfd7cpBkS/+fZwDJmBI8D2HUHvnEiNFLVBmWP4 zenE/+hBge5kmE4za+sFzJdQ/yVhGL/ah9yYClb97/RQxlSID9xxSJahCGMaKGzjbKYk CeCA== X-Gm-Message-State: AOAM5316Cmk1aIEQ5YIFVfHNSjvwWVlvyprFD/QN4CSFwOkrqzCU5Ruz hlw3jZJ2XKAmCH/7c/H+iMIWojkjtCY/VeUaIdMIpr7xuoOw5vkyvS6j86NCjw1Gj+h/GpkFDNZ 9QfYVHRy3aCfMsb3BpWcZP2RiPk6evy9QY5c= X-Received: by 2002:a17:907:16a7:: with SMTP id hc39mr22891331ejc.214.1635351287184; Wed, 27 Oct 2021 09:14:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzO/QgQ5GMyh0vFS/oBYQIX6qwD3vL9k6RGrSUIXFucShmCvNWLSsmfmRBNY3o+Ac+4bg3ipQ== X-Received: by 2002:a17:907:16a7:: with SMTP id hc39mr22891269ejc.214.1635351286915; Wed, 27 Oct 2021 09:14:46 -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 sb30sm195562ejc.45.2021.10.27.09.14.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Oct 2021 09:14:46 -0700 (PDT) Message-ID: Date: Wed, 27 Oct 2021 18:14:44 +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 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> <185502d7-861e-fa5c-b225-419710fe77ed@redhat.com> From: Paolo Bonzini In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211027_091452_211043_5F2FF6BD X-CRM114-Status: GOOD ( 14.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 27/10/21 18:08, Sean Christopherson wrote: >> 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? > LOL, I think we have a Three^WTwo Stooges routine going on. This patch does > remove avic_vcpu_is_running() and replaces it with the vcpu->mode check. Or am > I completely misunderstanding what your referring to? > > - if (avic_vcpu_is_running(vcpu)) { > + /* > + * Signal the doorbell to tell hardware to inject the IRQ if the vCPU > + * is in the guest. If the vCPU is not in the guest, hardware will > + * automatically process AVIC interrupts at VMRUN. > + */ > + if (vcpu->mode == IN_GUEST_MODE) { > int cpu = READ_ONCE(vcpu->cpu); Nevermind, I confused svm_deliver_avic_intr with avic_kick_target_vcpus, which anyway you are handling in patch 36. Paolo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Date: Wed, 27 Oct 2021 16:14:44 +0000 Subject: Re: [PATCH v2 35/43] KVM: SVM: Signal AVIC doorbell iff vCPU is in guest mode Message-Id: List-Id: References: <20211009021236.4122790-1-seanjc@google.com> <20211009021236.4122790-36-seanjc@google.com> <0333be2a-76d8-657a-6c82-3bb5c9ff2e3b@redhat.com> <185502d7-861e-fa5c-b225-419710fe77ed@redhat.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 On 27/10/21 18:08, Sean Christopherson wrote: >> 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? > LOL, I think we have a Three^WTwo Stooges routine going on. This patch does > remove avic_vcpu_is_running() and replaces it with the vcpu->mode check. Or am > I completely misunderstanding what your referring to? > > - if (avic_vcpu_is_running(vcpu)) { > + /* > + * Signal the doorbell to tell hardware to inject the IRQ if the vCPU > + * is in the guest. If the vCPU is not in the guest, hardware will > + * automatically process AVIC interrupts at VMRUN. > + */ > + if (vcpu->mode = IN_GUEST_MODE) { > int cpu = READ_ONCE(vcpu->cpu); Nevermind, I confused svm_deliver_avic_intr with avic_kick_target_vcpus, which anyway you are handling in patch 36. Paolo