Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1999446yba; Mon, 15 Apr 2019 02:52:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqwyDYtbzEyU/rQjF/MS6n54Ul0R310m93HCm1h32mr82JpU7iVaAIrylSfHUuj0O8aTkBv+ X-Received: by 2002:a62:4595:: with SMTP id n21mr74001664pfi.79.1555321932282; Mon, 15 Apr 2019 02:52:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555321932; cv=none; d=google.com; s=arc-20160816; b=IC/boSLMHj5Fk+hadHxkIXXTKgIGoeBGNjkyoUkyZ5nP2B2u5hHo0j3fYofUk8w3dy Cmfvt2usaxLvgPihkr2GwkWAWDyjwmugeBYuPbG/Mh2qKm4Q06jD7qGL6XpnmwSJTm1a rfWRd7DApByJh70XTpKcnzxT0Kq1Jyg404rnHx0dZzdWak3B3m5WCAfHvZE3cT7o8SGM ImdT26AUhBMD48XeIjWI/h9X07qnxBjWbCrq/mMC2L8A4Z/eukcyQVWJcckUbL8gERA+ do2DB7WPFjHnciMvi6mKICiEvt6hlDmxur0B6XEUvcksf2RbxA8dFwltFRX7sTruDTuL IE7A== 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=weMMPhuLAkzY7FGz244/eeW8qB5WCzG5Oh1dRyfyCGs=; b=t3voCIqHrppbUJNgYSyWwU1Tmo53FVn6s+sARwxmesaZQJyRKba4MOPLsKuYV1nR3m x3130+1UvEh8E0imSOKm/GxO5d1K7zHXn7aFDsjfyMbzmP+uQZo0nFIiIGfW7iXCOkkg hEbH/bYik23wHtd29qMVXBn0fOB5YbBA9DiZ9sJ7g7OFCsYdIMvsJgDbRc3tc2GiINuN FMG3CRmYuCHTCLqa41i2rN6Xg9HyAWMkZxtGJ9XCS7+PCmMp0OIsQODE9foFoFdJ4P8a 1B9gbwqXhzWAC6x19bQiM0IH07dvoS7RCLOt3qtzQHutdfKscfIph72vMxcCvkZDWURv nyDg== 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 z64si45121991pgd.106.2019.04.15.02.51.56; Mon, 15 Apr 2019 02:52:12 -0700 (PDT) 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 S1727090AbfDOJuo (ORCPT + 99 others); Mon, 15 Apr 2019 05:50:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51160 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726313AbfDOJuo (ORCPT ); Mon, 15 Apr 2019 05:50:44 -0400 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 7270A30917F0; Mon, 15 Apr 2019 09:50:43 +0000 (UTC) Received: from gondolin (unknown [10.40.205.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3AEC9108F82F; Mon, 15 Apr 2019 09:50:34 +0000 (UTC) Date: Mon, 15 Apr 2019 11:50:30 +0200 From: Cornelia Huck To: Tony Krowiak Cc: Harald Freudenberger , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Reinhard Buendgen , borntraeger@de.ibm.com, frankja@linux.ibm.com, david@redhat.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, pmorel@linux.ibm.com, pasic@linux.ibm.com, alex.williamson@redhat.com, kwankhede@nvidia.com Subject: Re: [PATCH 1/7] s390: zcrypt: driver callback to indicate resource in use Message-ID: <20190415115030.1df61182.cohuck@redhat.com> In-Reply-To: <89f09e58-eab6-94d4-c5aa-937162d60744@linux.ibm.com> References: <1555016604-2008-1-git-send-email-akrowiak@linux.ibm.com> <1555016604-2008-2-git-send-email-akrowiak@linux.ibm.com> <223c82c7-6a75-7209-3652-c2341c83878f@linux.ibm.com> <20190412114313.0156c01b.cohuck@redhat.com> <89f09e58-eab6-94d4-c5aa-937162d60744@linux.ibm.com> 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.41]); Mon, 15 Apr 2019 09:50:43 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 12 Apr 2019 15:38:21 -0400 Tony Krowiak wrote: > On 4/12/19 5:43 AM, Cornelia Huck wrote: > > On Fri, 12 Apr 2019 08:54:54 +0200 > > Harald Freudenberger wrote: > > > >> On 11.04.19 23:03, Tony Krowiak wrote: > >>> Introduces a new driver callback to prevent a root user from unbinding > >>> an AP queue from its device driver if the queue is in use. This prevents > >>> a root user from inadvertently taking a queue away from a guest and > >>> giving it to the host, or vice versa. The callback will be invoked > >>> whenever a change to the AP bus's apmask or aqmask sysfs interfaces may > >>> result in one or more AP queues being removed from its driver. If the > >>> callback responds in the affirmative for any driver queried, the change > >>> to the apmask or aqmask will be rejected with a device in use error. > >>> > >>> For this patch, only non-default drivers will be queried. Currently, > >>> there is only one non-default driver, the vfio_ap device driver. The > >>> vfio_ap device driver manages AP queues passed through to one or more > >>> guests and we don't want to unexpectedly take AP resources away from > >>> guests which are most likely independently administered. > >>> > >>> Signed-off-by: Tony Krowiak > >> > >> Hello Tony > >> > >> you are going out with your patches but ... what is the result of the discussions > >> we had in the past ? Do we have a common understanding that we want to have > >> it this way ? A driver which is able to claim resources and the bus code > >> has lower precedence ? > > This is what Reinhard suggested and what we agreed to as a team quite > some time ago. I submitted three versions of this patch to our > internal mailing list, all of which you reviewed, so I'm not sure > why you are surprised by this now. > > > > > I don't know about previous discussions, but I'm curious how you > > arrived at this design. A driver being able to override the bus code > > seems odd. Restricting this to 'non-default' drivers looks even more > > odd. > > > > What is this trying to solve? Traditionally, root has been able to > > shoot any appendages of their choice. I would rather expect that in a > > supported setup you'd have some management software keeping track of > > device usage and making sure that only unused queues can be unbound. Do > > we need to export more information to user space so that management > > software can make better choices? > > Is there a reason other than tradition to prevent root from accidentally > shooting himself in the foot or any other appendage? At present, > sysfs is the only supported setup, so IMHO it makes sense to prevent as > much accidentally caused damage as possible in the kernel. I don't think anybody wants an interface where it is easy for root to accidentally cause damage... but from the patch description, it sounds like you're creating an interface which makes it easy for a badly-acting driver to hog resources without any way for root to remove them forcefully. Therefore, again my question: What is this trying to solve? I see a management layer as a better place to make sure that queues are not accidentally yanked from guests that are using them. Does more information about queue usage need to be made available to userspace for this to be feasible? Is anything else missing? > > > > >> > >>> --- > >>> drivers/s390/crypto/ap_bus.c | 138 +++++++++++++++++++++++++++++++++++++++++-- > >>> drivers/s390/crypto/ap_bus.h | 3 + > >>> 2 files changed, 135 insertions(+), 6 deletions(-) > > >