Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp814786rwe; Wed, 31 Aug 2022 11:28:38 -0700 (PDT) X-Google-Smtp-Source: AA6agR4iSONgOYdnPR05FYYMN+ueDR9Mg5ehbM9IZ1vdsIYGGS7NC+fmsunZP97nLDMgGy2Lu6sY X-Received: by 2002:a05:6402:1f8c:b0:43e:8fab:76c with SMTP id c12-20020a0564021f8c00b0043e8fab076cmr25370964edc.126.1661970517982; Wed, 31 Aug 2022 11:28:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661970517; cv=none; d=google.com; s=arc-20160816; b=TwI9cGIrIqr+exXunqOGEunGOPk30teLYeCLqXRhKMdvwkbfaTPXr9ESs5L4JzN6LH NFh8jWy8qjHn5DyiWZgVwXYV3ELq5tzrrI4aYpiWws+TC+FzAYb+pY+EKEbMjY2S+QFN weD8uJLnAAB/k18SZ4Cp65+vyYGR2UV/bGPtUpc20zWMl4SaLOxHfN4d/l4M8O/04T4r vyyerm1pSi90hNlFgdi+o3CclUxTTzPv+Wdga8yLlgliWXYklxqgtcsHP1M5SiYBeXi7 WDSXdrzeA6lD97abZKY3bYaHu0/O2ReV7WPCnLRzuItta2hHdBPXDV/Ph/6Hxb3U5w2f BEvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=uE4KJW14kc3gE1qAWoSUzP1OSr0PXZymBaEjR1U5HqE=; b=bfwYM1VlBc/RkJDzncHHSt1XZwYinmB903Oc9Os6J5dWzatAmEfo59Wo6O95/D6I9x r+HUVaEkJ4jlB2n+JMqSD/tYM72z5YxguuJ5oB6/E1JCJc+xGQQV0CBpC+5oT5UMGQLV ObaMjH6NEPO2opgColjDJjVW7Dm1zGyrO6BZ1mP/pIUMYoWGY2OZoh8k9IR+TNXuHRFL UZ8wStfmi2/QvIvVjGmDj39qPmTtLJr6QJ1xo/c8DBHvBBD0fqmSTSDjAgruYSrTFM5j IuI5gbEb7mdKp1ZhCvRhClXzQmqQ+uLzTL7itQDt3Ne6jjwSubr6Rkoo7d8K+jVUNBCo gtwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=X1A6iccc; 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 b14-20020a056402084e00b0043e74bbfab2si15011004edz.162.2022.08.31.11.28.12; Wed, 31 Aug 2022 11:28:37 -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=X1A6iccc; 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 S232706AbiHaSRr (ORCPT + 99 others); Wed, 31 Aug 2022 14:17:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232477AbiHaSRE (ORCPT ); Wed, 31 Aug 2022 14:17:04 -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 ESMTPS id 740AD9E2D6 for ; Wed, 31 Aug 2022 11:13:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661969584; 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=uE4KJW14kc3gE1qAWoSUzP1OSr0PXZymBaEjR1U5HqE=; b=X1A6icccDISJgOXovqiGdlOzQNrxzGOfZ+ObcWC4PF7YRGMw5I8NZNr989tWQ+fRyrMWQf LdeXFYDbeoAT1AhWohFeAnsNJq071r6p0q8pa8jzdmatDDxUhWyqwrMoeVV0hcMjP53OdR UxgXlBjIjH/kWjLuHauMbZM6FZgQazw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-493-VTVB-NxDP2irnQSeEC6Fww-1; Wed, 31 Aug 2022 14:12:59 -0400 X-MC-Unique: VTVB-NxDP2irnQSeEC6Fww-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6C6348037AA; Wed, 31 Aug 2022 18:12:59 +0000 (UTC) Received: from starship (unknown [10.40.194.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id CC7DAC15BB3; Wed, 31 Aug 2022 18:12:57 +0000 (UTC) Message-ID: Subject: Re: [PATCH 11/19] KVM: SVM: Add helper to perform final AVIC "kick" of single vCPU From: Maxim Levitsky To: Sean Christopherson Cc: Paolo Bonzini , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Suravee Suthikulpanit , Li RongQing Date: Wed, 31 Aug 2022 21:12:56 +0300 In-Reply-To: References: <20220831003506.4117148-1-seanjc@google.com> <20220831003506.4117148-12-seanjc@google.com> <9144c9921bd46ba7c2b2e9427d053b1fc5abccf7.camel@redhat.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_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 Wed, 2022-08-31 at 15:08 +0000, Sean Christopherson wrote: > On Wed, Aug 31, 2022, Maxim Levitsky wrote: > > On Wed, 2022-08-31 at 00:34 +0000, Sean Christopherson wrote: > > > @@ -455,13 +461,8 @@ static void avic_kick_target_vcpus(struct kvm *kvm, struct kvm_lapic *source, > > > */ > > > kvm_for_each_vcpu(i, vcpu, kvm) { > > > if (kvm_apic_match_dest(vcpu, source, icrl & APIC_SHORT_MASK, > > > - dest, icrl & APIC_DEST_MASK)) { > > > - vcpu->arch.apic->irr_pending = true; > > > - svm_complete_interrupt_delivery(vcpu, > > > - icrl & APIC_MODE_MASK, > > > - icrl & APIC_INT_LEVELTRIG, > > > - icrl & APIC_VECTOR_MASK); > > > - } > > > + dest, icrl & APIC_DEST_MASK)) > > > + avic_kick_vcpu(vcpu, icrl); > > > } > > > } > > > > > > > I don't know what I think about this, sometimes *minor* code duplication > > might actually be a good thing, as it is easier to read the code, but I don't > > have much against this as well. > > > > I am not sure if before or after this code is more readable. > > I don't have a strong opinion either. I think I prefer having the helper, but > have no objection to leaving things as is. Originally I was thinking there was > going to be a third call site, but that didn't happen. > Yep - when something is duplicated 3 times, it is really rare to not want to have a helper, Anyway I don't have a strong opinion about this either. I mostly was unsure about the fact that helper receives icrl and not icrh, kind of wierd, but anyway let it be. Best regards, Maxim Levitsky