Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4792601imu; Tue, 8 Jan 2019 06:26:56 -0800 (PST) X-Google-Smtp-Source: ALg8bN5CIM/SdQmzQlna1oa8kRzMrAH72HhYW8F/Oq7n/77sTyr36fsFnxTx7uuQ1AnAQeGz9fUR X-Received: by 2002:a62:8985:: with SMTP id n5mr1960427pfk.255.1546957616153; Tue, 08 Jan 2019 06:26:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546957616; cv=none; d=google.com; s=arc-20160816; b=xci22NVKwoX0sh1arzWE7VSaL2vS0wsLDulHLsiUsETAEjbCYVpatcEnniq1HIU8pB Zu9fXPLy12/87Vk03Z/nn4+EoKSSFCx1Kn9qO8eSAMGJ9MPwYhxN5lsXALVilue10wY8 x1fja9u+mracCr4abFVt4/SuzIbUeWXgpFUCksRKa33Fxn9M1MEpm+GE3ARnZ3agDYzu Cu0ZTNlvhLmKEKzOvEYbhhOvEZh1wPr5WGHE7NgaruPZ4MV0UM8UaV+MrhVQD8FFQGQ0 d3QpMNNyAriJDgLLf+OwMenFVN72bT36tTnoUKTSd6WfxH2R50Or53KerZzuVcUMre2g LucA== 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=vcns4D4BnIJZdTpzrvImM37Mf2DH0gF/kD21bpcGD6E=; b=m1NO+gQnKh8zdOvnJzgHOPFFSEsIoqdr1QdTik4v9dOO1QA6g8vf3uUXiqgE+GEZK2 2975xu5BR8B8lbn++i0w3sZ1I05T+k1nCn0PA38pKKkOzbaAp7O9eLUhRzUn7RmfVP83 svEj0+RvG9udClcPknFPCxPDRgBHDzRyHpg5GbcXbfPxQ2NiiEaWKaAu6Pa34HhZG80G BsjqwD/Cyn1lyDLILNLPJ9erzkjeZClrN+q1YM9L/+H55wbrM2a82DHdEfpJPKMpUJGw hJyxuF8LYmObkeyxGoUrku6gKBJguI6Uc7ShAeyYzKe6wtj8Oy+eFt0HEwD0kgjepeFi CbZQ== 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 u9si64882506pge.48.2019.01.08.06.26.39; Tue, 08 Jan 2019 06:26:56 -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 S1728793AbfAHOYI (ORCPT + 99 others); Tue, 8 Jan 2019 09:24:08 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:60750 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727662AbfAHOYH (ORCPT ); Tue, 8 Jan 2019 09:24:07 -0500 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id x08EJgLn080107 for ; Tue, 8 Jan 2019 09:24:06 -0500 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0b-001b2d01.pphosted.com with ESMTP id 2pvtkw2hn7-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 08 Jan 2019 09:24:05 -0500 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 8 Jan 2019 14:24:03 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp04.uk.ibm.com (192.168.101.134) 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 14:24:00 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x08ENwhB32374968 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 8 Jan 2019 14:23:59 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D057B52051; Tue, 8 Jan 2019 14:23:58 +0000 (GMT) Received: from oc2783563651 (unknown [9.152.224.86]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 732A152050; Tue, 8 Jan 2019 14:23:58 +0000 (GMT) Date: Tue, 8 Jan 2019 15:23:57 +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: <20190108144135.3fe5c23b.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> <20190108143613.2ca1a9d3@oc2783563651> <20190108144135.3fe5c23b.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: 19010814-0016-0000-0000-00000241FEF0 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19010814-0017-0000-0000-0000329C12F9 Message-Id: <20190108152357.39fea477@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=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901080118 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 8 Jan 2019 14:41:35 +0100 Cornelia Huck wrote: > On Tue, 8 Jan 2019 14:36:13 +0100 > Halil Pasic wrote: > > > 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. > > Yes, unless the caller does not expect any more alerts after > unregistering (I guess that's what you're saying?) Just to make sure, the caller, which I guess would probably be some sort of a driver, does not process the alerts. It is kvm that does. But you are right, the properties of unregister need do be considered in the cleanup code (e.g. resets). Sure, we must avoid the process_gib_alert_list() (which is common, i.e. ain't tied to any VM) poking dead GISAs. Frankly, I've my hands full with the normal operation scenario, and I did not pay much attention to the cleanup yet. > > > > > Bottom line is, while it may be critical that the IAM changes implied > > by register take place immediately, unregister is a different story. > > It does feel a bit weird, though. But maybe I just have trouble > grasping the design :/ > You are on the only one. I have extreme difficulties following some of the discussion here -- despite of the fact that I have quite some confidence in my understanding of the GISA/GIB architecture. Regards, Halil