Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4744141imu; Tue, 8 Jan 2019 05:40:13 -0800 (PST) X-Google-Smtp-Source: ALg8bN4bSA1L/Nw8aoy76xOaN2ARsZF4k6dQYdWLEKZqi29dvgOcMqToTdAfSeL1LlBXk0CSNkQf X-Received: by 2002:a63:d005:: with SMTP id z5mr1592144pgf.64.1546954812955; Tue, 08 Jan 2019 05:40:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546954812; cv=none; d=google.com; s=arc-20160816; b=ejB8bpS776kYTaxGulFwAtheU0nB9csJUdOIdhLBw15TrDEO+b9wNBgyuRue83XakS 4WkVgrnxETcAPSBjm36814d+b/WV75M0CWsVAw7rIcd/r1T/7PJ/k7+mvWORxxitzEZX aUqw8wyzRPboegbDAcG8U+94vKMtu4nXNyErRPFm7F8E0TNkX6U0rTuI+LFSMTPUZg0o WnC1GcpskXC6L5y5HwUYWl2KPZTQ06MRUk6m7+8MXVhAsjXiEXZ1NIlPx7uopnx5LK7v VWp109FrQr4KQ/Zwd9VcMa2w/s+TWkOHJX7C2vgYGzBY1EHzCOl28pGVlcRrtOyrvDAp GKmQ== 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=ZxC3ldKimjnCMqxu2Nij2GUUi2rMFrNXVLryTWYAUOc=; b=Z6VUfMBdxfmnZYbPhx9TGTWvEl+mFFOkMwvYra9lywB48kdwSChdkeonCdillsgd4b dOfwdyujA8oGy7EYKDBqirc+RyNWK8+zi5k9wlucRCWvs3aCSGDswpQOASJgLIK8xzqL J4/LMrV7QOE/7Rza5LEmdDqgbkUrBMfBqA954deTU0dTS8bd/vOFZF3CkMZg5jxshrbT xOtWXVb0hWgEaohz5kyij4hII4s9/Ee63vzDcya74cx1ULYsCOZ+U5o7F+XeVx7+ERpi f6TDFBtLSjemT9u+uGRP5mYk+0rmaQIt1zd9XYdADBLhjqG51KQiPZqDPxFzn3gEM5fm Ob3Q== 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 z6si62795160pln.66.2019.01.08.05.39.57; Tue, 08 Jan 2019 05:40:12 -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 S1728632AbfAHNg0 (ORCPT + 99 others); Tue, 8 Jan 2019 08:36:26 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:59072 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727941AbfAHNgZ (ORCPT ); Tue, 8 Jan 2019 08:36:25 -0500 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id x08DYSG8013525 for ; Tue, 8 Jan 2019 08:36:23 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2pvthbr78y-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 08 Jan 2019 08:36:22 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 8 Jan 2019 13:36:20 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 8 Jan 2019 13:36:17 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x08DaFNJ32768008 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 8 Jan 2019 13:36:15 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 656D14C058; Tue, 8 Jan 2019 13:36:15 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0AFFF4C050; Tue, 8 Jan 2019 13:36:15 +0000 (GMT) Received: from oc2783563651 (unknown [9.152.224.86]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 8 Jan 2019 13:36:14 +0000 (GMT) Date: Tue, 8 Jan 2019 14:36:13 +0100 From: Halil Pasic To: Cornelia Huck Cc: Michael Mueller , Pierre Morel , KVM Mailing List , Linux-S390 Mailing List , linux-kernel@vger.kernel.org, Martin Schwidefsky , Heiko Carstens , Christian Borntraeger , Janosch Frank , David Hildenbrand Subject: Re: [PATCH v5 10/15] KVM: s390: add functions to (un)register GISC with GISA In-Reply-To: <20190108113444.56e76f13.cohuck@redhat.com> References: <20181219191756.57973-1-mimu@linux.ibm.com> <20181219191756.57973-11-mimu@linux.ibm.com> <20190104141836.0ca98a77.cohuck@redhat.com> <20190108113444.56e76f13.cohuck@redhat.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=US-ASCII Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 19010813-0028-0000-0000-00000335F4D6 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19010813-0029-0000-0000-000023F30226 Message-Id: <20190108143613.2ca1a9d3@oc2783563651> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-01-08_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=650 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901080112 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 8 Jan 2019 11:34:44 +0100 Cornelia Huck wrote: > > >> > > >>> + spin_unlock(&kvm->arch.iam_ref_lock); > > >>> + > > >>> + return gib->nisc; > > >>> +} > > >>> +EXPORT_SYMBOL_GPL(kvm_s390_gisc_register); > > >>> + > > >>> +int kvm_s390_gisc_unregister(struct kvm *kvm, u32 gisc) > > >>> +{ > > >>> + int rc = 0; > > >>> + > > >>> + if (!kvm->arch.gib_in_use) > > >>> + return -ENODEV; > > >>> + if (gisc > MAX_ISC) > > >>> + return -ERANGE; > > >>> + > > >>> + spin_lock(&kvm->arch.iam_ref_lock); > > >>> + if (kvm->arch.iam_ref_count[gisc] == 0) { > > >>> + rc = -EINVAL; > > >>> + goto out; > > >>> + } > > >>> + kvm->arch.iam_ref_count[gisc]--; > > >>> + if (kvm->arch.iam_ref_count[gisc] == 0) { > > >>> + kvm->arch.iam &= ~(0x80 >> gisc); > > >>> + set_iam(kvm->arch.gisa, kvm->arch.iam); > > > > > > Any chance of this function failing here? If yes, would there be any > > > implications? > > > > It is the same here. > > I'm not sure that I follow: This is the reverse operation > (unregistering the gisc). Can we rely on get_ipm() to do any fixup > later? Is that a problem for the caller? IMHO gib alerts are all about not loosing initiative. I.e. avoiding substantially delayed delivery of interrupts due to vCPUs in wait state. Thus we must avoid letting go before setting up stuff (gisa.iam under consideration of gisa ipm, gisa.next_alert, and gib.alert_list_origin) so that we can react on the next interrupt (if necessary). On the other hand, getting more gisa alerts than necessary is not fatal -- better avoided if not too much hassle of course. Bottom line is, while it may be critical that the IAM changes implied by register take place immediately, unregister is a different story. Regards, Halil > > Apologies if I sound confused (well, that's because I probably am); > this is hard to review without access to the hardware specification.