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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62FC2ECAAD3 for ; Wed, 31 Aug 2022 18:17:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232797AbiHaSRs (ORCPT ); Wed, 31 Aug 2022 14:17:48 -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 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