Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp739344imu; Wed, 9 Jan 2019 05:41:23 -0800 (PST) X-Google-Smtp-Source: ALg8bN4bQQL6D5FfaXnsk4bcujFnvoYSYGPKhBvWe2uJdnHteQhfBrEWH5QA2wbyBfRpo3weF3DH X-Received: by 2002:a63:d949:: with SMTP id e9mr5486047pgj.24.1547041283209; Wed, 09 Jan 2019 05:41:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547041283; cv=none; d=google.com; s=arc-20160816; b=y/cGUWEpvy9Nqv6Er6wvk5nlZC4iXrLJOKhdbe1kH28N9WCTcUIY9agcodBlq9PGoz g+QyUTTBUYrDwQNUuHldoV4qWHDZZeJiPDaxXgyPtxdEQ10l8mM2fwqTmzoMzI1wnt7t r/6NL4sXv8AbGIaJkZdltmJzL6dOnLsQooNIUQv1ssE03+exwbrBerY2D4iTJ2VP5D1n zFlqrL1e4T4wvA0wxX1PpVgJvFzGyLU11yO+kPHc85NIJAyHiq6VX4IUwqedCLqlN6fo CSxNCAY/ug1ndg1sWMcJEvGaHAFSaVOPo1znuIcE1mFt7zF5FS7tnpRHPvjqHlfLX8QQ CZ9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:organization:references:in-reply-to:subject:cc:to:from :date; bh=RckyrV1wO1PwTr2nltItMopDftQOfllHXqAE1VpnXos=; b=qlsy9nYw4YrOkXF0AemDezr+cXD7AMf01mfXv/unwMVKvOBxR272Yq50+tTPssoq21 bkoFjcWuEma36Zlknz7zhzXUUVRJY8/8a4+vuT28KEs4rI5kyZhR3oUl1/FCfjtesb6K GXKqwuE+/UOglJAWTW3PuW5rH8UNnrYNzJ4Hq9M8gEzWNQUZgmOh4OYuarWZz9M3Zwmq il1WSSCgD32bnyRSvLX0qHByYPXGjdp3G/VZTPBoB25EqxMse+CwU2XVrd48c9yXArkq Ko5JHg0Bfhg8J3If0kJd2EN/xhZ2RO7GcJKpuBSevl8pQ80wvGwGUtJArmx17O3COQZD 6Dxg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r207si16554243pfc.179.2019.01.09.05.41.07; Wed, 09 Jan 2019 05:41:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730889AbfAINKZ convert rfc822-to-8bit (ORCPT + 99 others); Wed, 9 Jan 2019 08:10:25 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:35810 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730249AbfAINKZ (ORCPT ); Wed, 9 Jan 2019 08:10:25 -0500 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id x09D0D8E133274 for ; Wed, 9 Jan 2019 08:10:24 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2pwg0svmyk-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 Jan 2019 08:10:24 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 9 Jan 2019 13:10:21 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 9 Jan 2019 13:10:19 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x09DAHZ41901006 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 9 Jan 2019 13:10:17 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8AAD4AE04D; Wed, 9 Jan 2019 13:10:17 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3CA73AE051; Wed, 9 Jan 2019 13:10:17 +0000 (GMT) Received: from oc2783563651 (unknown [9.152.98.225]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 9 Jan 2019 13:10:17 +0000 (GMT) Date: Wed, 9 Jan 2019 14:10:15 +0100 From: Halil Pasic To: Pierre Morel Cc: mimu@linux.ibm.com, KVM Mailing List , Linux-S390 Mailing List , linux-kernel@vger.kernel.org, Martin Schwidefsky , Heiko Carstens , Christian Borntraeger , Janosch Frank , David Hildenbrand , Cornelia Huck Subject: Re: [PATCH v5 13/15] KVM: s390: add function process_gib_alert_list() In-Reply-To: <01566362-d452-c04b-0509-cdcc758bc1e1@linux.ibm.com> References: <20181219191756.57973-1-mimu@linux.ibm.com> <20181219191756.57973-14-mimu@linux.ibm.com> <20190108135919.18048dd4@oc2783563651> <7e4a5077-00f0-3a0f-e21a-5bbc2fa14b70@linux.ibm.com> <01566362-d452-c04b-0509-cdcc758bc1e1@linux.ibm.com> Organization: IBM X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.31; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-TM-AS-GCONF: 00 x-cbid: 19010913-0020-0000-0000-0000030387FF X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19010913-0021-0000-0000-000021549DBD Message-Id: <20190109141015.3023fb55@oc2783563651> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-01-09_07:,, 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=1015 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-1901090110 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 9 Jan 2019 13:14:17 +0100 Pierre Morel wrote: > On 08/01/2019 16:21, Michael Mueller wrote: > > > > > > On 08.01.19 13:59, Halil Pasic wrote: > >> On Wed, 19 Dec 2018 20:17:54 +0100 > >> Michael Mueller wrote: > >> > >>> This function processes the Gib Alert List (GAL). It is required > >>> to run when either a gib alert interruption has been received or > >>> a gisa that is in the alert list is cleared or dropped. > >>> > >>> The GAL is build up by millicode, when the respective ISC bit is > >>> set in the Interruption Alert Mask (IAM) and an interruption of > >>> that class is observed. > >>> > >>> Signed-off-by: Michael Mueller > >>> --- > >>>   arch/s390/kvm/interrupt.c | 140 > >>> ++++++++++++++++++++++++++++++++++++++++++++++ > >>>   1 file changed, 140 insertions(+) > >>> > >>> diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c > >>> index 48a93f5e5333..03e7ba4f215a 100644 > >>> --- a/arch/s390/kvm/interrupt.c > >>> +++ b/arch/s390/kvm/interrupt.c > >>> @@ -2941,6 +2941,146 @@ int kvm_s390_get_irq_state(struct kvm_vcpu > >>> *vcpu, __u8 __user *buf, int len) > >>>       return n; > >>>   } > >>> +static int __try_airqs_kick(struct kvm *kvm, u8 ipm) > >>> +{ > >>> +    struct kvm_s390_float_interrupt *fi = &kvm->arch.float_int; > >>> +    struct kvm_vcpu *vcpu = NULL, *kick_vcpu[MAX_ISC + 1]; > >>> +    int online_vcpus = atomic_read(&kvm->online_vcpus); > >>> +    u8 ioint_mask, isc_mask, kick_mask = 0x00; > >>> +    int vcpu_id, kicked = 0; > >>> + > >>> +    /* Loop over vcpus in WAIT state. */ > >>> +    for (vcpu_id = find_first_bit(fi->idle_mask, online_vcpus); > >>> +         /* Until all pending ISCs have a vcpu open for airqs. */ > >>> +         (~kick_mask & ipm) && vcpu_id < online_vcpus; > >>> +         vcpu_id = find_next_bit(fi->idle_mask, online_vcpus, > >>> vcpu_id)) { > >>> +        vcpu = kvm_get_vcpu(kvm, vcpu_id); > >>> +        if (psw_ioint_disabled(vcpu)) > >>> +            continue; > >>> +        ioint_mask = (u8)(vcpu->arch.sie_block->gcr[6] >> 24); > >>> +        for (isc_mask = 0x80; isc_mask; isc_mask >>= 1) { > >>> +            /* ISC pending in IPM ? */ > >>> +            if (!(ipm & isc_mask)) > >>> +                continue; > >>> +            /* vcpu for this ISC already found ? */ > >>> +            if (kick_mask & isc_mask) > >>> +                continue; > >>> +            /* vcpu open for airq of this ISC ? */ > >>> +            if (!(ioint_mask & isc_mask)) > >>> +                continue; > >>> +            /* use this vcpu (for all ISCs in ioint_mask) */ > >>> +            kick_mask |= ioint_mask; > >>> +            kick_vcpu[kicked++] = vcpu; > >> > >> Assuming that the vcpu can/will take all ISCs it's currently open for > >> does not seem right. We kind of rely on this assumption here, or? > > why does it not seem right? > When an interrupt is delivered a psw-swap takes place. The new-psw may fence IO interrupts. Thus for example if we have the vcpu open for all ISCs and 0, 1 and 2 pending, we may end up only delivering 0, if the psw-swap corresponding to delivering 0 closes the vcpu for IO interrupts. After guest has control, we don't have control over the rest of the story. > > > > My latest version of this routine already follows a different strategy. > > It looks for a horizontal distribution of pending ISCs among idle vcpus. > > > > May be you should separate the GAL IRQ handling and the algorithm of the > vCPU to kick in different patches to ease the review. > > No strong opinion here. I found it convenient to have the most of the logic in one patch/email. Regards, Halil