From patchwork Mon Nov 19 17:25:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Mueller X-Patchwork-Id: 10688967 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9AD4B14DB for ; Mon, 19 Nov 2018 17:25:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7AD9429699 for ; Mon, 19 Nov 2018 17:25:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E3BD296D0; Mon, 19 Nov 2018 17:25:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F33A729699 for ; Mon, 19 Nov 2018 17:25:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404391AbeKTDuU (ORCPT ); Mon, 19 Nov 2018 22:50:20 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:49624 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404157AbeKTDuT (ORCPT ); Mon, 19 Nov 2018 22:50:19 -0500 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wAJHPORD048338 for ; Mon, 19 Nov 2018 12:25:55 -0500 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2nuyj9628y-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 19 Nov 2018 12:25:54 -0500 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 19 Nov 2018 17:25:51 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 19 Nov 2018 17:25:50 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wAJHPmKa61014096 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 19 Nov 2018 17:25:48 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C35BF4C04A; Mon, 19 Nov 2018 17:25:48 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 564374C046; Mon, 19 Nov 2018 17:25:48 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 19 Nov 2018 17:25:48 +0000 (GMT) From: Michael Mueller To: kvm@vger.kernel.org, linux-s390@vger.kernel.org Cc: Martin Schwidefsky , Heiko Carstens , Christian Borntraeger , Janosch Frank , David Hildenbrand , Cornelia Huck , Michael Mueller , Halil Pasic , Pierre Morel Subject: [PATCH v2 01/12] KVM: s390: leave AIs in IPM of GISA during vcpu_pre_run() Date: Mon, 19 Nov 2018 18:25:25 +0100 X-Mailer: git-send-email 2.16.4 In-Reply-To: <20181119172536.52649-1-mimu@linux.ibm.com> References: <20181119172536.52649-1-mimu@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18111917-0012-0000-0000-000002CCD820 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18111917-0013-0000-0000-00002101FD3D Message-Id: <20181119172536.52649-2-mimu@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-11-19_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811190159 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Do not call __deliver_io() for adapter interruptions already pending in the IPM. That is a double effort. They will be processed as soon the vcpu control is given to SIE. Signed-off-by: Michael Mueller --- arch/s390/kvm/interrupt.c | 54 ++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c index fcb55b02990e..1f4c0c7286f7 100644 --- a/arch/s390/kvm/interrupt.c +++ b/arch/s390/kvm/interrupt.c @@ -271,14 +271,9 @@ static unsigned long disable_iscs(struct kvm_vcpu *vcpu, return active_mask; } -static unsigned long deliverable_irqs(struct kvm_vcpu *vcpu) +static unsigned long __deliverable_irqs(struct kvm_vcpu *vcpu, + unsigned long active_mask) { - unsigned long active_mask; - - active_mask = pending_irqs(vcpu); - if (!active_mask) - return 0; - if (psw_extint_disabled(vcpu)) active_mask &= ~IRQ_PEND_EXT_MASK; if (psw_ioint_disabled(vcpu)) @@ -315,6 +310,28 @@ static unsigned long deliverable_irqs(struct kvm_vcpu *vcpu) return active_mask; } +static unsigned long deliverable_irqs_no_gisa(struct kvm_vcpu *vcpu) +{ + unsigned long active_mask; + + active_mask = pending_irqs_no_gisa(vcpu); + if (!active_mask) + return 0; + + return __deliverable_irqs(vcpu, active_mask); +} + +static unsigned long deliverable_irqs(struct kvm_vcpu *vcpu) +{ + unsigned long active_mask; + + active_mask = pending_irqs(vcpu); + if (!active_mask) + return 0; + + return __deliverable_irqs(vcpu, active_mask); +} + static void __set_cpu_idle(struct kvm_vcpu *vcpu) { kvm_s390_set_cpuflags(vcpu, CPUSTAT_WAIT); @@ -957,7 +974,6 @@ static int __must_check __deliver_io(struct kvm_vcpu *vcpu, struct list_head *isc_list; struct kvm_s390_float_interrupt *fi; struct kvm_s390_interrupt_info *inti = NULL; - struct kvm_s390_io_info io; u32 isc; int rc = 0; @@ -995,28 +1011,8 @@ static int __must_check __deliver_io(struct kvm_vcpu *vcpu, if (inti) { rc = __do_deliver_io(vcpu, &(inti->io)); kfree(inti); - goto out; } - if (vcpu->kvm->arch.gisa && - kvm_s390_gisa_tac_ipm_gisc(vcpu->kvm->arch.gisa, isc)) { - /* - * in case an adapter interrupt was not delivered - * in SIE context KVM will handle the delivery - */ - VCPU_EVENT(vcpu, 4, "%s isc %u", "deliver: I/O (AI/gisa)", isc); - memset(&io, 0, sizeof(io)); - io.io_int_word = isc_to_int_word(isc); - vcpu->stat.deliver_io++; - trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, - KVM_S390_INT_IO(1, 0, 0, 0), - ((__u32)io.subchannel_id << 16) | - io.subchannel_nr, - ((__u64)io.io_int_parm << 32) | - io.io_int_word); - rc = __do_deliver_io(vcpu, &io); - } -out: return rc; } @@ -1205,7 +1201,7 @@ int __must_check kvm_s390_deliver_pending_interrupts(struct kvm_vcpu *vcpu) if (cpu_timer_irq_pending(vcpu)) set_bit(IRQ_PEND_EXT_CPU_TIMER, &li->pending_irqs); - while ((irqs = deliverable_irqs(vcpu)) && !rc) { + while ((irqs = deliverable_irqs_no_gisa(vcpu)) && !rc) { /* bits are in the reverse order of interrupt priority */ irq_type = find_last_bit(&irqs, IRQ_PEND_COUNT); switch (irq_type) {