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 B7346C433F5 for ; Sun, 31 Oct 2021 22:26:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 939A860EE9 for ; Sun, 31 Oct 2021 22:26:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230316AbhJaW2Y (ORCPT ); Sun, 31 Oct 2021 18:28:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24897 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230025AbhJaW2X (ORCPT ); Sun, 31 Oct 2021 18:28:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635719150; 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=SbOGjXYHIaVWWvxDmyY/7NrfjCgFCeLG7KQq/v0+M1g=; b=LFX9W4Orb+uJ6iG3CoroROdTkqnHSqiIs7Z3bXZNjXabTY6WrT3eKlaT+CGEORIB5c6t0A 5/otLuEz+DzX1BFuRQNrTbgu4ANQYHyvusWUzhEHmmDcMpyvoh7xvZR8GuVa6EnE0ilQQp sn7ZeS92W0j2QQDrl7HurhgwyGOIFDI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-559-CLsFAk3fN5iz-7DE45UL9g-1; Sun, 31 Oct 2021 18:25:47 -0400 X-MC-Unique: CLsFAk3fN5iz-7DE45UL9g-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 058441006AA2; Sun, 31 Oct 2021 22:25:44 +0000 (UTC) Received: from starship (unknown [10.40.194.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id E30CC5DD68; Sun, 31 Oct 2021 22:25:26 +0000 (UTC) Message-ID: <0e6e3ed2831a01f5dad9f51b83f3bd1a3c318847.camel@redhat.com> Subject: Re: [PATCH v2 41/43] KVM: VMX: Pass desired vector instead of bool for triggering posted IRQ From: Maxim Levitsky To: Sean Christopherson , Marc Zyngier , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Paolo Bonzini 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 Date: Mon, 01 Nov 2021 00:25:25 +0200 In-Reply-To: <20211009021236.4122790-42-seanjc@google.com> References: <20211009021236.4122790-1-seanjc@google.com> <20211009021236.4122790-42-seanjc@google.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.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2021-10-08 at 19:12 -0700, Sean Christopherson wrote: > Refactor the posted interrupt helper to take the desired notification > vector instead of a bool so that the callers are self-documenting. > > No functional change intended. > > Signed-off-by: Sean Christopherson > --- > arch/x86/kvm/vmx/vmx.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index 78c8bc7f1b3b..f505fee3cf5c 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -3928,11 +3928,9 @@ static void vmx_msr_filter_changed(struct kvm_vcpu *vcpu) > } > > static inline bool kvm_vcpu_trigger_posted_interrupt(struct kvm_vcpu *vcpu, > - bool nested) > + int pi_vec) > { > #ifdef CONFIG_SMP > - int pi_vec = nested ? POSTED_INTR_NESTED_VECTOR : POSTED_INTR_VECTOR; > - > if (vcpu->mode == IN_GUEST_MODE) { > /* > * The vector of interrupt to be delivered to vcpu had > @@ -3986,7 +3984,7 @@ static int vmx_deliver_nested_posted_interrupt(struct kvm_vcpu *vcpu, > */ > kvm_make_request(KVM_REQ_EVENT, vcpu); > /* the PIR and ON have been set by L1. */ > - if (!kvm_vcpu_trigger_posted_interrupt(vcpu, true)) > + if (!kvm_vcpu_trigger_posted_interrupt(vcpu, POSTED_INTR_NESTED_VECTOR)) > kvm_vcpu_wake_up(vcpu); > return 0; > } > @@ -4024,7 +4022,7 @@ static int vmx_deliver_posted_interrupt(struct kvm_vcpu *vcpu, int vector) > * guaranteed to see PID.ON=1 and sync the PIR to IRR if triggering a > * posted interrupt "fails" because vcpu->mode != IN_GUEST_MODE. > */ > - if (!kvm_vcpu_trigger_posted_interrupt(vcpu, false)) > + if (!kvm_vcpu_trigger_posted_interrupt(vcpu, POSTED_INTR_VECTOR)) > kvm_vcpu_wake_up(vcpu); > > return 0; I both like and don't like this patch. It is indeed a bit more more self documented, but then it allows caller to pass anything other than POSTED_INTR_NESTED_VECTOR/POSTED_INTR_VECTOR which would fail. Maybe addd an assert? I won't do bikesheddding about this though, so Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky 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 3B3A3C433F5 for ; Sun, 31 Oct 2021 22:26:12 +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 F2B66600EF for ; Sun, 31 Oct 2021 22:26:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F2B66600EF 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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Date:Cc:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8qT17KjEpYpbYROdAuDaS8CV8ErrbwUCaYGHZb6WY0o=; b=fqm+Lzy/OxHncu nJmHNIxVGMMWfiVQfVq+m4DQ29bI5Z/nhrQT8jU7uZSS6wjGpuhdRWGSaSt8qa4TEbXWe6jNs/o5R Z2hdWHt616/spp23HkohNS7KaLpeoZzAuh7aoGQwLw91exeOI8cX4w4hghtdy93v/cy4AKJoPGKO+ D0vyU/lFLzADS3fw+Fzl0k7HDUI9b5vs26IBpWjr8NmS9LQw34LdTLh4pYMX1Nxnzyi2K8NbwQUts fsfYK19u9smRd6JUxOiWoazpCr7n2BXWR0Bty4s8E7yycLxkZgYTjmmC2D4uBXmXzQGCLXL8NfszM hw4mBq7GUAbwwES/oZaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mhJHB-00EoXL-NW; Sun, 31 Oct 2021 22:26:05 +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 1mhJGx-00EoUo-PE for linux-riscv@lists.infradead.org; Sun, 31 Oct 2021 22:25:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635719150; 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=SbOGjXYHIaVWWvxDmyY/7NrfjCgFCeLG7KQq/v0+M1g=; b=LFX9W4Orb+uJ6iG3CoroROdTkqnHSqiIs7Z3bXZNjXabTY6WrT3eKlaT+CGEORIB5c6t0A 5/otLuEz+DzX1BFuRQNrTbgu4ANQYHyvusWUzhEHmmDcMpyvoh7xvZR8GuVa6EnE0ilQQp sn7ZeS92W0j2QQDrl7HurhgwyGOIFDI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-559-CLsFAk3fN5iz-7DE45UL9g-1; Sun, 31 Oct 2021 18:25:47 -0400 X-MC-Unique: CLsFAk3fN5iz-7DE45UL9g-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 058441006AA2; Sun, 31 Oct 2021 22:25:44 +0000 (UTC) Received: from starship (unknown [10.40.194.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id E30CC5DD68; Sun, 31 Oct 2021 22:25:26 +0000 (UTC) Message-ID: <0e6e3ed2831a01f5dad9f51b83f3bd1a3c318847.camel@redhat.com> Subject: Re: [PATCH v2 41/43] KVM: VMX: Pass desired vector instead of bool for triggering posted IRQ From: Maxim Levitsky To: Sean Christopherson , Marc Zyngier , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Paolo Bonzini 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 Date: Mon, 01 Nov 2021 00:25:25 +0200 In-Reply-To: <20211009021236.4122790-42-seanjc@google.com> References: <20211009021236.4122790-1-seanjc@google.com> <20211009021236.4122790-42-seanjc@google.com> User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211031_152551_998930_04D55CB8 X-CRM114-Status: GOOD ( 22.47 ) 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Fri, 2021-10-08 at 19:12 -0700, Sean Christopherson wrote: > Refactor the posted interrupt helper to take the desired notification > vector instead of a bool so that the callers are self-documenting. > > No functional change intended. > > Signed-off-by: Sean Christopherson > --- > arch/x86/kvm/vmx/vmx.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index 78c8bc7f1b3b..f505fee3cf5c 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -3928,11 +3928,9 @@ static void vmx_msr_filter_changed(struct kvm_vcpu *vcpu) > } > > static inline bool kvm_vcpu_trigger_posted_interrupt(struct kvm_vcpu *vcpu, > - bool nested) > + int pi_vec) > { > #ifdef CONFIG_SMP > - int pi_vec = nested ? POSTED_INTR_NESTED_VECTOR : POSTED_INTR_VECTOR; > - > if (vcpu->mode == IN_GUEST_MODE) { > /* > * The vector of interrupt to be delivered to vcpu had > @@ -3986,7 +3984,7 @@ static int vmx_deliver_nested_posted_interrupt(struct kvm_vcpu *vcpu, > */ > kvm_make_request(KVM_REQ_EVENT, vcpu); > /* the PIR and ON have been set by L1. */ > - if (!kvm_vcpu_trigger_posted_interrupt(vcpu, true)) > + if (!kvm_vcpu_trigger_posted_interrupt(vcpu, POSTED_INTR_NESTED_VECTOR)) > kvm_vcpu_wake_up(vcpu); > return 0; > } > @@ -4024,7 +4022,7 @@ static int vmx_deliver_posted_interrupt(struct kvm_vcpu *vcpu, int vector) > * guaranteed to see PID.ON=1 and sync the PIR to IRR if triggering a > * posted interrupt "fails" because vcpu->mode != IN_GUEST_MODE. > */ > - if (!kvm_vcpu_trigger_posted_interrupt(vcpu, false)) > + if (!kvm_vcpu_trigger_posted_interrupt(vcpu, POSTED_INTR_VECTOR)) > kvm_vcpu_wake_up(vcpu); > > return 0; I both like and don't like this patch. It is indeed a bit more more self documented, but then it allows caller to pass anything other than POSTED_INTR_NESTED_VECTOR/POSTED_INTR_VECTOR which would fail. Maybe addd an assert? I won't do bikesheddding about this though, so Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky _______________________________________________ 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 E665DC433F5 for ; Sun, 31 Oct 2021 22:27:19 +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 9B63760EE3 for ; Sun, 31 Oct 2021 22:27:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9B63760EE3 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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Date:Cc:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RcUUMYDSWHTekToDKqybjRcnkSKkG/HuqRiyb6lbeIU=; b=UtIydCwXEDprd6 tVh+2UC+NwxbIAJ76+dqXt2JVCjGtIAnEA0Tx7j6WXSZsrOuXDpXZjA4Mi/MYgN/aTN2eY+jRT8Yw WBxRqaQhMtAXmKqpQDpZXg+dynAQw6/CR/YNcmgUSj6w5i7OW/qXSy4OtP63AJQpzRe10qwG40HrA NEaZcH+kVqEG9PRU5P8Sd+aQBIS59b0mulWM1ZqYrF5jHvMxoOjTvgcEPGHgbiUzmNFrS2D4lsTr4 Qrn97FsxglXEldfzpKRL6hX4NhctwCxlfv9mhQJO/30XMr9S/bpAbDUsA392Av+nfKEsQXAnM5woq tYvXE5YjQDl5Fa9kOgBA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mhJH2-00EoVq-30; Sun, 31 Oct 2021 22:25:56 +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 1mhJGx-00EoUn-PE for linux-arm-kernel@lists.infradead.org; Sun, 31 Oct 2021 22:25:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635719150; 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=SbOGjXYHIaVWWvxDmyY/7NrfjCgFCeLG7KQq/v0+M1g=; b=LFX9W4Orb+uJ6iG3CoroROdTkqnHSqiIs7Z3bXZNjXabTY6WrT3eKlaT+CGEORIB5c6t0A 5/otLuEz+DzX1BFuRQNrTbgu4ANQYHyvusWUzhEHmmDcMpyvoh7xvZR8GuVa6EnE0ilQQp sn7ZeS92W0j2QQDrl7HurhgwyGOIFDI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-559-CLsFAk3fN5iz-7DE45UL9g-1; Sun, 31 Oct 2021 18:25:47 -0400 X-MC-Unique: CLsFAk3fN5iz-7DE45UL9g-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 058441006AA2; Sun, 31 Oct 2021 22:25:44 +0000 (UTC) Received: from starship (unknown [10.40.194.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id E30CC5DD68; Sun, 31 Oct 2021 22:25:26 +0000 (UTC) Message-ID: <0e6e3ed2831a01f5dad9f51b83f3bd1a3c318847.camel@redhat.com> Subject: Re: [PATCH v2 41/43] KVM: VMX: Pass desired vector instead of bool for triggering posted IRQ From: Maxim Levitsky To: Sean Christopherson , Marc Zyngier , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Paolo Bonzini 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 Date: Mon, 01 Nov 2021 00:25:25 +0200 In-Reply-To: <20211009021236.4122790-42-seanjc@google.com> References: <20211009021236.4122790-1-seanjc@google.com> <20211009021236.4122790-42-seanjc@google.com> User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211031_152551_998721_E1C3D722 X-CRM114-Status: GOOD ( 23.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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, 2021-10-08 at 19:12 -0700, Sean Christopherson wrote: > Refactor the posted interrupt helper to take the desired notification > vector instead of a bool so that the callers are self-documenting. > > No functional change intended. > > Signed-off-by: Sean Christopherson > --- > arch/x86/kvm/vmx/vmx.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index 78c8bc7f1b3b..f505fee3cf5c 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -3928,11 +3928,9 @@ static void vmx_msr_filter_changed(struct kvm_vcpu *vcpu) > } > > static inline bool kvm_vcpu_trigger_posted_interrupt(struct kvm_vcpu *vcpu, > - bool nested) > + int pi_vec) > { > #ifdef CONFIG_SMP > - int pi_vec = nested ? POSTED_INTR_NESTED_VECTOR : POSTED_INTR_VECTOR; > - > if (vcpu->mode == IN_GUEST_MODE) { > /* > * The vector of interrupt to be delivered to vcpu had > @@ -3986,7 +3984,7 @@ static int vmx_deliver_nested_posted_interrupt(struct kvm_vcpu *vcpu, > */ > kvm_make_request(KVM_REQ_EVENT, vcpu); > /* the PIR and ON have been set by L1. */ > - if (!kvm_vcpu_trigger_posted_interrupt(vcpu, true)) > + if (!kvm_vcpu_trigger_posted_interrupt(vcpu, POSTED_INTR_NESTED_VECTOR)) > kvm_vcpu_wake_up(vcpu); > return 0; > } > @@ -4024,7 +4022,7 @@ static int vmx_deliver_posted_interrupt(struct kvm_vcpu *vcpu, int vector) > * guaranteed to see PID.ON=1 and sync the PIR to IRR if triggering a > * posted interrupt "fails" because vcpu->mode != IN_GUEST_MODE. > */ > - if (!kvm_vcpu_trigger_posted_interrupt(vcpu, false)) > + if (!kvm_vcpu_trigger_posted_interrupt(vcpu, POSTED_INTR_VECTOR)) > kvm_vcpu_wake_up(vcpu); > > return 0; I both like and don't like this patch. It is indeed a bit more more self documented, but then it allows caller to pass anything other than POSTED_INTR_NESTED_VECTOR/POSTED_INTR_VECTOR which would fail. Maybe addd an assert? I won't do bikesheddding about this though, so Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky _______________________________________________ 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 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 AB261C433F5 for ; Mon, 1 Nov 2021 21:40:21 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 56C1E60FE8 for ; Mon, 1 Nov 2021 21:40:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 56C1E60FE8 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 08E594B1CF; Mon, 1 Nov 2021 17:40:21 -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 1CwbZoZ3dPJW; Mon, 1 Nov 2021 17:40:19 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 1B9524B25E; Mon, 1 Nov 2021 17:40:14 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 3173F4B091 for ; Sun, 31 Oct 2021 18:25:56 -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 qrBIW-OEe5h4 for ; Sun, 31 Oct 2021 18:25:55 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 334594A500 for ; Sun, 31 Oct 2021 18:25:55 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635719155; 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=SbOGjXYHIaVWWvxDmyY/7NrfjCgFCeLG7KQq/v0+M1g=; b=VPs4TtwdgED3bDNeq6J0073c2e8NFSvZ0pgJ9UXwfRdVy6KPQ0xN/lUXGZ2xe8r+7ZbweO 0WYrrCrT5BOy79PNnmQbcWclIU4XqRjW2aOq2GizVuY1Br6J8Arv+y2Gm9CHJZSDxTW9JH pw1xxw0bgUTn4jLtNJDv4y+nVpT5jRE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-559-CLsFAk3fN5iz-7DE45UL9g-1; Sun, 31 Oct 2021 18:25:47 -0400 X-MC-Unique: CLsFAk3fN5iz-7DE45UL9g-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 058441006AA2; Sun, 31 Oct 2021 22:25:44 +0000 (UTC) Received: from starship (unknown [10.40.194.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id E30CC5DD68; Sun, 31 Oct 2021 22:25:26 +0000 (UTC) Message-ID: <0e6e3ed2831a01f5dad9f51b83f3bd1a3c318847.camel@redhat.com> Subject: Re: [PATCH v2 41/43] KVM: VMX: Pass desired vector instead of bool for triggering posted IRQ From: Maxim Levitsky To: Sean Christopherson , Marc Zyngier , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Paolo Bonzini Date: Mon, 01 Nov 2021 00:25:25 +0200 In-Reply-To: <20211009021236.4122790-42-seanjc@google.com> References: <20211009021236.4122790-1-seanjc@google.com> <20211009021236.4122790-42-seanjc@google.com> User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mailman-Approved-At: Mon, 01 Nov 2021 17:40:12 -0400 Cc: Wanpeng Li , kvm@vger.kernel.org, David Hildenbrand , linux-kernel@vger.kernel.org, Atish Patra , linux-riscv@lists.infradead.org, Claudio Imbrenda , kvmarm@lists.cs.columbia.edu, Joerg Roedel , kvm-ppc@vger.kernel.org, David Matlack , linux-arm-kernel@lists.infradead.org, Jim Mattson , Cornelia Huck , linux-mips@vger.kernel.org, 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Fri, 2021-10-08 at 19:12 -0700, Sean Christopherson wrote: > Refactor the posted interrupt helper to take the desired notification > vector instead of a bool so that the callers are self-documenting. > > No functional change intended. > > Signed-off-by: Sean Christopherson > --- > arch/x86/kvm/vmx/vmx.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index 78c8bc7f1b3b..f505fee3cf5c 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -3928,11 +3928,9 @@ static void vmx_msr_filter_changed(struct kvm_vcpu *vcpu) > } > > static inline bool kvm_vcpu_trigger_posted_interrupt(struct kvm_vcpu *vcpu, > - bool nested) > + int pi_vec) > { > #ifdef CONFIG_SMP > - int pi_vec = nested ? POSTED_INTR_NESTED_VECTOR : POSTED_INTR_VECTOR; > - > if (vcpu->mode == IN_GUEST_MODE) { > /* > * The vector of interrupt to be delivered to vcpu had > @@ -3986,7 +3984,7 @@ static int vmx_deliver_nested_posted_interrupt(struct kvm_vcpu *vcpu, > */ > kvm_make_request(KVM_REQ_EVENT, vcpu); > /* the PIR and ON have been set by L1. */ > - if (!kvm_vcpu_trigger_posted_interrupt(vcpu, true)) > + if (!kvm_vcpu_trigger_posted_interrupt(vcpu, POSTED_INTR_NESTED_VECTOR)) > kvm_vcpu_wake_up(vcpu); > return 0; > } > @@ -4024,7 +4022,7 @@ static int vmx_deliver_posted_interrupt(struct kvm_vcpu *vcpu, int vector) > * guaranteed to see PID.ON=1 and sync the PIR to IRR if triggering a > * posted interrupt "fails" because vcpu->mode != IN_GUEST_MODE. > */ > - if (!kvm_vcpu_trigger_posted_interrupt(vcpu, false)) > + if (!kvm_vcpu_trigger_posted_interrupt(vcpu, POSTED_INTR_VECTOR)) > kvm_vcpu_wake_up(vcpu); > > return 0; I both like and don't like this patch. It is indeed a bit more more self documented, but then it allows caller to pass anything other than POSTED_INTR_NESTED_VECTOR/POSTED_INTR_VECTOR which would fail. Maybe addd an assert? I won't do bikesheddding about this though, so Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky _______________________________________________ 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 From: Maxim Levitsky Date: Sun, 31 Oct 2021 22:25:25 +0000 Subject: Re: [PATCH v2 41/43] KVM: VMX: Pass desired vector instead of bool for triggering posted IRQ Message-Id: <0e6e3ed2831a01f5dad9f51b83f3bd1a3c318847.camel@redhat.com> List-Id: References: <20211009021236.4122790-1-seanjc@google.com> <20211009021236.4122790-42-seanjc@google.com> In-Reply-To: <20211009021236.4122790-42-seanjc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Sean Christopherson , Marc Zyngier , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Paolo Bonzini 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 On Fri, 2021-10-08 at 19:12 -0700, Sean Christopherson wrote: > Refactor the posted interrupt helper to take the desired notification > vector instead of a bool so that the callers are self-documenting. > > No functional change intended. > > Signed-off-by: Sean Christopherson > --- > arch/x86/kvm/vmx/vmx.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index 78c8bc7f1b3b..f505fee3cf5c 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -3928,11 +3928,9 @@ static void vmx_msr_filter_changed(struct kvm_vcpu *vcpu) > } > > static inline bool kvm_vcpu_trigger_posted_interrupt(struct kvm_vcpu *vcpu, > - bool nested) > + int pi_vec) > { > #ifdef CONFIG_SMP > - int pi_vec = nested ? POSTED_INTR_NESTED_VECTOR : POSTED_INTR_VECTOR; > - > if (vcpu->mode = IN_GUEST_MODE) { > /* > * The vector of interrupt to be delivered to vcpu had > @@ -3986,7 +3984,7 @@ static int vmx_deliver_nested_posted_interrupt(struct kvm_vcpu *vcpu, > */ > kvm_make_request(KVM_REQ_EVENT, vcpu); > /* the PIR and ON have been set by L1. */ > - if (!kvm_vcpu_trigger_posted_interrupt(vcpu, true)) > + if (!kvm_vcpu_trigger_posted_interrupt(vcpu, POSTED_INTR_NESTED_VECTOR)) > kvm_vcpu_wake_up(vcpu); > return 0; > } > @@ -4024,7 +4022,7 @@ static int vmx_deliver_posted_interrupt(struct kvm_vcpu *vcpu, int vector) > * guaranteed to see PID.ON=1 and sync the PIR to IRR if triggering a > * posted interrupt "fails" because vcpu->mode != IN_GUEST_MODE. > */ > - if (!kvm_vcpu_trigger_posted_interrupt(vcpu, false)) > + if (!kvm_vcpu_trigger_posted_interrupt(vcpu, POSTED_INTR_VECTOR)) > kvm_vcpu_wake_up(vcpu); > > return 0; I both like and don't like this patch. It is indeed a bit more more self documented, but then it allows caller to pass anything other than POSTED_INTR_NESTED_VECTOR/POSTED_INTR_VECTOR which would fail. Maybe addd an assert? I won't do bikesheddding about this though, so Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky