Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5251305pxv; Wed, 28 Jul 2021 06:44:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUl6ruW3nukKQuVq83BV4YC4EGv8KpEIO3A7C/zysS/ZcpGUp4QUzg1MTRJicAgfg8z6bw X-Received: by 2002:a05:6e02:1a67:: with SMTP id w7mr20310806ilv.175.1627479847957; Wed, 28 Jul 2021 06:44:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627479847; cv=none; d=google.com; s=arc-20160816; b=FXYENdG4BEgmq7XuJ+gpJi9/a8YjB6Zu2cMo+if8k2IENNRfsd/NX8974vIV8WnpXe Bf2GT7Me54IWQ1yK/gSd+XMKLchO/u62Fmz8eG010neA4NE+Xs7sThZnHphPU5OCUXh1 reKbLFLOlpbheLNZK37Mhk/sAWwrvBbtDb/hSuCvLipWEehOWzhELZF9ifE6stwIc3iX YoBN1YDqaTeYu+sTuqF91rXKG6YhsPlMpoNslweROqsfHxCEH2WAjZX49LnGw/autMGT +zCe41P+l3+3vDCSBtFjiiKlayAQNtMYRR1fptlQhRyeUEx7ZECT7Q7TmFYJB9jxcBzO Lp9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=H2yNMS1D+GRLF/AUuNQuhT8RlaBua7StLFaTOY1jVsw=; b=P3H0vDBxrfItvHmqrDk23MjVTxZgGcKruH1OWB4CbRO8EJBGgelfnxH0IgA+JFvtsN 0FWlE1rMGANxmvxwi3uyAj6xJL93vDfCJLM8ItoenitqSfNwwBF4HE5ENP1tsL1Pf6Wx 617VKL8CeZ3qXAB6fnkd2RH6Z8NuJBDXZunjpmvYTUvumqfQE9KBaCgWee4AQ+yL4+5K xdW86Y+kl+G7N+WDl1CezuBZGvunofcAlEQKvhd9vx96m8bMKNb+aCmvjKlJAB39hxcQ WcePGjmclfmDmDTByCMZglT+FmMNRKFSAGRes7NYe9y5mwFacT/IKcSlcD15yo9SyYw1 bCag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=p+vPhRbG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v18si6554848ilo.15.2021.07.28.06.43.56; Wed, 28 Jul 2021 06:44:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=p+vPhRbG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236292AbhG1NnP (ORCPT + 99 others); Wed, 28 Jul 2021 09:43:15 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:43760 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235314AbhG1NnO (ORCPT ); Wed, 28 Jul 2021 09:43:14 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16SDXoqn128509; Wed, 28 Jul 2021 09:43:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=H2yNMS1D+GRLF/AUuNQuhT8RlaBua7StLFaTOY1jVsw=; b=p+vPhRbGAyw6CowI36EGGNWrOAnEPUzVFwbA8fLRYgvDDYf1V2LZbaG14MhsWzN36Qky wF/kvQ90O/AxLCpsRdjsPfQTnXg1XemupLtnGe16AZq78KpNqNuxtmFdGnhEqaRJCfVl W9hGNpTmiyQuGz3nn8KGAlOTFt6+eeoGxbER8ughJnb51e/a1XuQU58zNaj4M8dkDo76 xanmMkdDbAeEMi8sJmZAVyXotZX08lQeXeQb6lPi+FwtD8ZqFb/31xtJU5NH9iePui63 GeDrCLZkX2Yiodhn/R55MuM/oZpTSfoCB/EZucJlBQTksdnIFFhX57IOdjoPHm4w2sus Yg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3a377bb2cs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Jul 2021 09:43:09 -0400 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 16SDXqoU128660; Wed, 28 Jul 2021 09:43:08 -0400 Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0a-001b2d01.pphosted.com with ESMTP id 3a377bb2c7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Jul 2021 09:43:08 -0400 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 16SDSTfc008025; Wed, 28 Jul 2021 13:43:07 GMT Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by ppma04dal.us.ibm.com with ESMTP id 3a235pc4ky-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Jul 2021 13:43:07 +0000 Received: from b03ledav003.gho.boulder.ibm.com (b03ledav003.gho.boulder.ibm.com [9.17.130.234]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 16SDh6F833095976 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Jul 2021 13:43:06 GMT Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 135BA6A054; Wed, 28 Jul 2021 13:43:06 +0000 (GMT) Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5A4696A058; Wed, 28 Jul 2021 13:43:04 +0000 (GMT) Received: from cpe-172-100-181-211.stny.res.rr.com (unknown [9.77.143.250]) by b03ledav003.gho.boulder.ibm.com (Postfix) with ESMTP; Wed, 28 Jul 2021 13:43:04 +0000 (GMT) Subject: Re: [PATCH 2/2] s390/vfio-ap: replace open coded locks for VFIO_GROUP_NOTIFY_SET_KVM notification To: Halil Pasic , Jason Gunthorpe Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, borntraeger@de.ibm.com, cohuck@redhat.com, pasic@linux.vnet.ibm.com, jjherne@linux.ibm.com, alex.williamson@redhat.com, kwankhede@nvidia.com, david@redhat.com, pbonzini@redhat.com, David Hildenbrand , frankja@linux.ibm.com, imbrenda@linux.ibm.com References: <20210719193503.793910-1-akrowiak@linux.ibm.com> <20210719193503.793910-3-akrowiak@linux.ibm.com> <20210721164550.5402fe1c.pasic@linux.ibm.com> <20210723162625.59cead27.pasic@linux.ibm.com> <5380652f-e68f-bbd0-10c0-c7d541065843@linux.ibm.com> <20210726223628.4d7759bf.pasic@linux.ibm.com> <20210726220317.GA1721383@nvidia.com> <20210727004329.3bcc7d4f.pasic@linux.ibm.com> From: Tony Krowiak Message-ID: Date: Wed, 28 Jul 2021 09:43:03 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210727004329.3bcc7d4f.pasic@linux.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-GUID: J4CNyl775TrIyC91pzqarvdtJXqcGreK X-Proofpoint-ORIG-GUID: MfBEXE31ktBTrbZRs-sEW6NsopN7z9lB X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-07-28_08:2021-07-27,2021-07-28 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 clxscore=1015 adultscore=0 impostorscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2107280076 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/26/21 6:43 PM, Halil Pasic wrote: > On Mon, 26 Jul 2021 19:03:17 -0300 > Jason Gunthorpe wrote: > >>> You may end up with open and close running interleaved. What I' >>> trying to say is, to my best knowledge, normally there is no >>> you have to close it before you open it again rule for files. >> This is an existing bug in this driver, I've fixed in the reflck series. >> >> open_device/close_device will not run concurrently, or out of order, >> afer it is fixed. > Well if that is the case then provided your fix precedes this patch: > > Acked-by: Halil Pasic > > I'm not entirely happy with this. I did not thoroughly investigate the > implications of reversing the locking order of the vfio-ap lock (driver > global) and the kvm lock (guest specific). I will trust Tony and hope > our KVM maintainers will scream if this is bad from interference and > delay perspective. This solution was suggested by Jason G and it does in fact resolve the lockdep splat encountered when starting an SE guest with access to crypto resources. There is a chance that the KVM lock can get held while waiting for the lock on the matrix_dev->mutex, but this does not seem like a grave concern to me. That would only happen during VFIO_GROUP_NOTIFY_SET_KVM notification - either when the guest is being started or terminated, or when the mdev fd is opened or closed. According to Jason, once he integrates his reflck series, the open/close will happen only once. I've copied the KVM maintainers on this response, so hopefully one of them will provide some input. > > Regards, > Halil