Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4747794imu; Tue, 8 Jan 2019 05:44:26 -0800 (PST) X-Google-Smtp-Source: ALg8bN50yaPykxW4c8zEOwTxuO365loWicU+YdUtksjvbTxP6KvYMMs3o/rWKBc8LOQMMHkbtp84 X-Received: by 2002:a17:902:b112:: with SMTP id q18mr1815530plr.255.1546955066425; Tue, 08 Jan 2019 05:44:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546955066; cv=none; d=google.com; s=arc-20160816; b=HN7JItA6r9MsDtG3OI9zuHJwN7HDl0WDXhZDVYpIMRjeuFON4HUEFixZp5wGcNxnbE i7utw1OHmWyy56pJvw/0i/Jmxxgtlry9MEbLpancyBNdk+i0FIFxcXoZIj5yZJHqyQ48 fC8zC5AqTb3vT3usS/PZlm1CRgkUOVMFLs5+rdTA3GHb6WsXiMgnbQYMDSlS4iasHHZu 8VDwa0GqsoqYy6CSVq813M71BJyQ20lwGEPEavIqb0xbf3SF/s1VxTm07dbxb1TQp516 toSyV0PZ2og3GBQFqvQilzmVzbQHX9xS5N26rtKi6auKWyXAxUbh09XkVrqxDwVZJWzL mOZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=c+v5Pf1kuuRxCuiuvNfdbkSTnZa7W2oK1BixqOZuu1U=; b=JE2Jx3I9IaerC+HBWQiIExhupMDn5yNJlxQQq2ogsfxoln0GuLv6nC0yCHPvBTHv4/ RxWQ17X0KRHLchoQAzYfOGRdtMTA88ASu7APX561ZNMhENABabKZNHiwUdtOh9jCjInt Euu3xauTDE+3bMuV5/mMMAYc9awSIkRS1EZ5AixQsMH2VY3uhafZeXSSEn8rvVRH4kmZ 42d3/YaoP3yJawm/sCQ0UjiA4jUJPDrLFV6DpexlOHpiYcb6ZlhCC7m4uDJ8TlHznbeE +FXkBnoCBJCwi8fcSiLr0mxVti7nTi+cIE52d6hR6fDZfojrvif8WNIug362qi3cUq1u eTCA== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m7si12524745pfc.118.2019.01.08.05.44.10; Tue, 08 Jan 2019 05:44:26 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728185AbfAHNlp (ORCPT + 99 others); Tue, 8 Jan 2019 08:41:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49163 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727236AbfAHNlo (ORCPT ); Tue, 8 Jan 2019 08:41:44 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C7DB13E2D0; Tue, 8 Jan 2019 13:41:43 +0000 (UTC) Received: from gondolin (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id AD80F100164E; Tue, 8 Jan 2019 13:41:37 +0000 (UTC) Date: Tue, 8 Jan 2019 14:41:35 +0100 From: Cornelia Huck To: Halil Pasic 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 Message-ID: <20190108144135.3fe5c23b.cohuck@redhat.com> In-Reply-To: <20190108143613.2ca1a9d3@oc2783563651> 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> Organization: Red Hat GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 08 Jan 2019 13:41:44 +0000 (UTC) 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: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?) > > 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 :/