From: Christian Borntraeger Subject: Re: [PATCH v1 2/4] KVM: s390: use WARN_ON_ONCE only for checking Date: Thu, 31 Aug 2017 12:55:04 +0200 Message-ID: References: <20170830160603.5452-1-david@redhat.com> <20170830160603.5452-3-david@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Cornelia Huck To: David Hildenbrand , kvm@vger.kernel.org Return-path: Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:44435 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750772AbdHaKzK (ORCPT ); Thu, 31 Aug 2017 06:55:10 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v7VAsbcq003593 for ; Thu, 31 Aug 2017 06:55:10 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2cpa7d0jrj-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 31 Aug 2017 06:55:09 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 31 Aug 2017 11:55:07 +0100 In-Reply-To: <20170830160603.5452-3-david@redhat.com> Content-Language: en-US Sender: kvm-owner@vger.kernel.org List-ID: On 08/30/2017 06:06 PM, David Hildenbrand wrote: > Move the real logic that always has to be executed out of the > WARN_ON_ONCE. The WARN_ON_ONCE macro seems to be clever enough to not require this, but it is certainly cleaner. There is a similar construct for the pfault interrupts in kvm-s390.c which might also want to see such a cleanup. In the future we might want to modify the interrupt code to not make any allocation at all so that we cannot fail. But anyway, applied. > > Signed-off-by: David Hildenbrand > --- > arch/s390/kvm/interrupt.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c > index a619ddae610d..a832ad031cee 100644 > --- a/arch/s390/kvm/interrupt.c > +++ b/arch/s390/kvm/interrupt.c > @@ -2479,6 +2479,7 @@ void kvm_s390_reinject_machine_check(struct kvm_vcpu *vcpu, > struct kvm_s390_mchk_info *mchk; > union mci mci; > __u64 cr14 = 0; /* upper bits are not used */ > + int rc; > > mci.val = mcck_info->mcic; > if (mci.sr) > @@ -2496,12 +2497,13 @@ void kvm_s390_reinject_machine_check(struct kvm_vcpu *vcpu, > if (mci.ck) { > /* Inject the floating machine check */ > inti.type = KVM_S390_MCHK; > - WARN_ON_ONCE(__inject_vm(vcpu->kvm, &inti)); > + rc = __inject_vm(vcpu->kvm, &inti); > } else { > /* Inject the machine check to specified vcpu */ > irq.type = KVM_S390_MCHK; > - WARN_ON_ONCE(kvm_s390_inject_vcpu(vcpu, &irq)); > + rc = kvm_s390_inject_vcpu(vcpu, &irq); > } > + WARN_ON_ONCE(rc); > } > > int kvm_set_routing_entry(struct kvm *kvm, >